1 (* optimizes triples that have complementary environments and the same
4 let double_negate trips =
7 (function (s,_,wit) -> function (s',_,wit') -> compare (s,wit) (s',wit'))
9 let rec classify = function
11 | ((s,th,wit) as x)::rest ->
12 (match classify rest with
14 | (((s',th',wit')::_) as x1)::rest ->
15 if (s,wit) = (s',wit')
18 | _ -> failwith "not possible") in
22 (((s,_,wit)::_) as all) ->
23 ((s,wit),List.map (function (_,th,_) -> th) all)
24 | _ -> failwith "not possible")
33 if memBy eq_sub (negate_sub sub1) subs
35 else if memBy eq_sub sub1 subs
37 else (sub1::subs)::rest)
47 match conj_subst [sub1] subs with
49 | Some th -> th::rest)
57 ((s,wit),[th]) -> (s,th,wit)::rest
60 [] -> failwith "not possible"
62 let (cnf : substitution list) =
64 (List.map (function x -> [x]) th) ths in
66 [] -> (s,[],wit)::rest
71 (List.map (function x -> [x]) th)
73 (List.map (function th -> (s,th,wit)) res) @ rest)