mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-11 13:38:43 -05:00
add eval_level in the API of the SAT solver
This commit is contained in:
parent
a21807c624
commit
facfe336a1
5 changed files with 24 additions and 2 deletions
|
|
@ -146,6 +146,7 @@ module Make(Log : Log_intf.S) = struct
|
||||||
with SatSolver.Unsat -> ()
|
with SatSolver.Unsat -> ()
|
||||||
|
|
||||||
let eval = SatSolver.eval
|
let eval = SatSolver.eval
|
||||||
|
let eval_level = SatSolver.eval_level
|
||||||
|
|
||||||
let get_proof () =
|
let get_proof () =
|
||||||
(* SatSolver.Proof.learn (SatSolver.history ()); *)
|
(* SatSolver.Proof.learn (SatSolver.history ()); *)
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,12 @@ module Make(Log: Log_intf.S) : sig
|
||||||
val eval : atom -> bool
|
val eval : atom -> bool
|
||||||
(** Return the current assignement of the literals. *)
|
(** Return the current assignement of the literals. *)
|
||||||
|
|
||||||
|
val eval_level : atom -> bool * int
|
||||||
|
(** Return the current assignement of the literals, as well as its
|
||||||
|
decision level. If the level is 0, then it is necessary for
|
||||||
|
the atom to have this value; otherwise it is due to choices
|
||||||
|
that can potentially be backtracked. *)
|
||||||
|
|
||||||
val assume : ?tag:int -> atom list list -> unit
|
val assume : ?tag:int -> atom list list -> unit
|
||||||
(** Add a list of clauses to the set of assumptions. *)
|
(** Add a list of clauses to the set of assumptions. *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -941,11 +941,14 @@ module Make
|
||||||
let cnf = List.rev_map (List.rev_map atom) cnf in
|
let cnf = List.rev_map (List.rev_map atom) cnf in
|
||||||
init_solver ?tag cnf
|
init_solver ?tag cnf
|
||||||
|
|
||||||
let eval lit =
|
let eval_level lit =
|
||||||
let var, negated = make_boolean_var lit in
|
let var, negated = make_boolean_var lit in
|
||||||
assert (var.pa.is_true || var.na.is_true);
|
assert (var.pa.is_true || var.na.is_true);
|
||||||
let truth = var.pa.is_true in
|
let truth = var.pa.is_true in
|
||||||
if negated then not truth else truth
|
let value = if negated then not truth else truth in
|
||||||
|
value, var.level
|
||||||
|
|
||||||
|
let eval lit = fst (eval_level lit)
|
||||||
|
|
||||||
let hyps () = env.clauses_hyps
|
let hyps () = env.clauses_hyps
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@ module Make
|
||||||
(** Returns the valuation of a formula in the current state
|
(** Returns the valuation of a formula in the current state
|
||||||
of the sat solver. *)
|
of the sat solver. *)
|
||||||
|
|
||||||
|
val eval_level : St.formula -> bool * int
|
||||||
|
(** Return the current assignement of the literals, as well as its
|
||||||
|
decision level. If the level is 0, then it is necessary for
|
||||||
|
the atom to have this value; otherwise it is due to choices
|
||||||
|
that can potentially be backtracked. *)
|
||||||
|
|
||||||
val hyps : unit -> St.clause Vec.t
|
val hyps : unit -> St.clause Vec.t
|
||||||
(** Returns the vector of assumptions used by the solver. May be slightly different
|
(** Returns the vector of assumptions used by the solver. May be slightly different
|
||||||
from the clauses assumed because of top-level simplification of clauses. *)
|
from the clauses assumed because of top-level simplification of clauses. *)
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,12 @@ module Make (L : Log_intf.S)(F : Formula_intf.S)
|
||||||
(** Returns the valuation of a formula in the current state
|
(** Returns the valuation of a formula in the current state
|
||||||
of the sat solver. *)
|
of the sat solver. *)
|
||||||
|
|
||||||
|
val eval_level : F.t -> bool * int
|
||||||
|
(** Return the current assignement of the literals, as well as its
|
||||||
|
decision level. If the level is 0, then it is necessary for
|
||||||
|
the atom to have this value; otherwise it is due to choices
|
||||||
|
that can potentially be backtracked. *)
|
||||||
|
|
||||||
val hyps : unit -> St.clause Vec.t
|
val hyps : unit -> St.clause Vec.t
|
||||||
(** Returns the vector of assumptions used by the solver. May be slightly different
|
(** Returns the vector of assumptions used by the solver. May be slightly different
|
||||||
from the clauses assumed because of top-level simplification of clauses. *)
|
from the clauses assumed because of top-level simplification of clauses. *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue