api: sat_state takes formulas, not atoms

This commit is contained in:
Simon Cruanes 2019-01-28 19:00:10 -06:00 committed by Guillaume Bury
parent a58c940c6d
commit 1736b4a99e
3 changed files with 10 additions and 10 deletions

View file

@ -1990,7 +1990,7 @@ module Make(Plugin : PLUGIN)
(* Result type *)
type res =
| Sat of (term,atom,value) Solver_intf.sat_state
| Sat of (term,Formula.t,value) Solver_intf.sat_state
| Unsat of (atom,clause,Proof.t) Solver_intf.unsat_state
let pp_all st lvl status =
@ -2004,19 +2004,19 @@ module Make(Plugin : PLUGIN)
(Vec.pp ~sep:"" Clause.debug) (history st)
)
let mk_sat (st:t) : _ Solver_intf.sat_state =
let mk_sat (st:t) : (Term.t, Formula.t, _) Solver_intf.sat_state =
pp_all st 99 "SAT";
let t = trail st in
let iter f f' =
let iter_trail f f' =
Vec.iter (function
| Atom a -> f a
| Atom a -> f (Atom.formula a)
| Lit l -> f' l.term)
t
in
let[@inline] eval f = eval st (mk_atom st f) in
let[@inline] eval_level f = eval_level st (mk_atom st f) in
{ Solver_intf.
eval = eval st;
eval_level = eval_level st;
iter_trail = iter;
eval; eval_level; iter_trail;
model = (fun () -> model st);
}
@ -2061,7 +2061,7 @@ module Make(Plugin : PLUGIN)
let c = Clause.make c Hyp in
add_clause_ st c
let solve (st:t) ?(assumptions=[]) () =
let solve (st:t) ?(assumptions=[]) () : res =
cancel_until st 0;
Vec.clear st.assumptions;
List.iter (Vec.push st.assumptions) assumptions;

View file

@ -414,7 +414,7 @@ module type S = sig
(** Result type for the solver *)
type res =
| Sat of (term,atom,Value.t) sat_state (** Returned when the solver reaches SAT, with a model *)
| Sat of (term,formula,Value.t) sat_state (** Returned when the solver reaches SAT, with a model *)
| Unsat of (atom,clause,Proof.t) unsat_state (** Returned when the solver reaches UNSAT, with a proof *)
exception UndecidedLit

View file

@ -29,7 +29,7 @@ module Process = struct
let check_clause c =
let l = List.map (function a ->
Log.debugf 99
(fun k -> k "Checking value of %a" S.Atom.pp a);
(fun k -> k "Checking value of %a" S.Formula.pp a);
sat.Msat.eval a) c in
List.exists (fun x -> x) l
in