th_bool: fix polarity issues

This commit is contained in:
Simon Cruanes 2018-02-19 21:27:15 -06:00
parent 2be10fb907
commit 20a85a1f35

View file

@ -139,7 +139,7 @@ module TC = struct
| Builtin {view=B_not b; _} -> b, false | Builtin {view=B_not b; _} -> b, false
| _ -> self, true | _ -> self, true
let subst _ _ = assert false (* no congruence *) let subst _ _ = None (* no congruence *)
let explain _eq _ _ = assert false (* no congruence *) let explain _eq _ _ = assert false (* no congruence *)
@ -274,7 +274,7 @@ let tseitin (self:t) (lit:Lit.t) (b:term builtin) : unit =
| B_or subs -> | B_or subs ->
if Lit.sign lit then ( if Lit.sign lit then (
(* propagate [lit => _i subs_i] *) (* propagate [lit => _i subs_i] *)
let c = lit :: List.map (Lit.atom ~sign:true) subs in let c = Lit.neg lit :: List.map (Lit.atom ~sign:true) subs in
self.acts.Theory.add_local_axiom (IArray.of_list c) self.acts.Theory.add_local_axiom (IArray.of_list c)
) else ( ) else (
(* propagate [¬lit => ¬subs_i] *) (* propagate [¬lit => ¬subs_i] *)
@ -288,7 +288,7 @@ let tseitin (self:t) (lit:Lit.t) (b:term builtin) : unit =
| B_imply (guard,concl) -> | B_imply (guard,concl) ->
if Lit.sign lit then ( if Lit.sign lit then (
(* propagate [lit => _i ¬guard_i concl] *) (* propagate [lit => _i ¬guard_i concl] *)
let c = lit :: Lit.atom concl :: List.map (Lit.atom ~sign:false) guard in let c = Lit.atom concl :: Lit.neg lit :: List.map (Lit.atom ~sign:false) guard in
self.acts.Theory.add_local_axiom (IArray.of_list c) self.acts.Theory.add_local_axiom (IArray.of_list c)
) else ( ) else (
let expl = Bag.return (Explanation.lit lit) in let expl = Bag.return (Explanation.lit lit) in
@ -303,14 +303,12 @@ let tseitin (self:t) (lit:Lit.t) (b:term builtin) : unit =
) )
let on_assert (self:t) (lit:Lit.t) = let on_assert (self:t) (lit:Lit.t) =
Log.debugf 5 (fun k->k "(@[th_bool.on_assert@ %a@])" Lit.pp lit);
match Lit.view lit with match Lit.view lit with
| Lit.Lit_atom { Term.term_cell=Term.Custom{view=Builtin {view=b};_}; _ } -> | Lit.Lit_atom { Term.term_cell=Term.Custom{view=Builtin {view=b};_}; _ } ->
tseitin self lit b tseitin self lit b
| _ -> () | _ -> ()
let final_check _ _ : unit = let final_check _ _ : unit = ()
Log.debug 5 "(th_bool.final_check)"
let th = let th =
let make tst acts = let make tst acts =