- if b1 then
- let b2,rl2,rr2 = eval (f2,sets) in
- if b2 then (true,rl1||rl2,rr1||rr2) else (false,false,false)
- else (false,false,false)
- )
- in
- eval (f,sets)
-
-
- module MemoFormlist = Memoizer.Make(
- Hashtbl.Make(struct
- type t = Formlist.t*(StateSet.t*StateSet.t)
- let equal (f1,(s1,t1)) (f2,(s2,t2)) =
- Formlist.equal f1 f2 && StateSet.equal s1 s2 && StateSet.equal t1 t2
- let hash (f,(s,t)) =
- HASHINT3(Formlist.uid f ,StateSet.uid s,StateSet.uid t)
- end))
-
- let eval_formlist ?(memo=true) s1 s2 fl =
- let sets = (s1,s2) in
- let eval = MemoFormlist.make_rec (
- fun eval (fl,_) ->
- if Formlist.is_empty fl
- then StateSet.empty,false,false,false,false
- else
- let f,fll = Formlist.uncons fl in
- let q,mark,f,_ = Transition.node f in
- let b,b1,b2 = eval_form_bool f s1 s2 in
- let s,b',b1',b2',amark = eval (fll,sets) in
- if b then (StateSet.add q s, b, b1'||b1,b2'||b2,mark||amark)
- else s,b',b1',b2',amark )
- in eval (fl,sets)
-
+ if b1 then
+ let b2,rl2,rr2 = eval (f2,sets) in
+ if b2 then (true,rl1||rl2,rr1||rr2) else (false,false,false)
+ else (false,false,false)
+ )
+
+let eval_form_bool f s1 s2 = eval_form_bool (f,(s1,s2))
+
+
+module MemoFormlist = Memoizer.Make(
+ Hashtbl.Make(struct
+ type t = Formlist.t*(StateSet.t*StateSet.t)
+ let equal (f1,(s1,t1)) (f2,(s2,t2)) =
+ Formlist.equal f1 f2 && StateSet.equal s1 s2 && StateSet.equal t1 t2
+ let hash (f,(s,t)) =
+ HASHINT3(Formlist.uid f ,StateSet.uid s,StateSet.uid t)
+ end))
+
+
+
+ let eval_formlist = MemoFormlist.make_rec (
+ fun eval (fl,((s1,s2)as sets)) ->
+ match Formlist.node fl with
+ | Formlist.Nil -> StateSet.empty,false,false,false,false
+ | Formlist.Cons(f,fll) ->
+ let q,mark,f,_ = Transition.node f in
+ let b,b1,b2 = eval_form_bool f s1 s2 in
+ let s,b',b1',b2',amark = eval (fll,sets) in
+ if b then (StateSet.add q s, b, b1'||b1,b2'||b2,mark||amark)
+ else s,b',b1',b2',amark )
+
+ let eval_formlist ?(memo=true) s1 s2 fl =
+ eval_formlist (fl,(s1,s2))
+