Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/reasoners/satml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module type SAT_ML = sig

val assume_th_elt : t -> Expr.th_elt -> Explanation.t -> unit
val decision_level : t -> int
val assertion_level : t -> int
val cancel_until : t -> int -> unit

val exists_in_lazy_cnf : t -> FF.t -> bool
Expand Down Expand Up @@ -583,6 +584,7 @@ module Make (Th : Theory.S) : SAT_ML with type th = Th.t = struct
end

let decision_level env = Vec.size env.trail_lim
let[@inline always] assertion_level env = Vec.size env.increm_guards

let nb_choices env = env.nchoices
let nb_assigns env = Vec.size env.trail - nb_choices env
Expand Down
9 changes: 9 additions & 0 deletions src/lib/reasoners/satml.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ module type SAT_ML = sig

val assume_th_elt : t -> Expr.th_elt -> Explanation.t -> unit
val decision_level : t -> int

val assertion_level : t -> int
(** Returns the number of active assertion levels, that is the number of
levels introduced with [push] that have not yet been popped. *)

val cancel_until : t -> int -> unit

val exists_in_lazy_cnf : t -> Flat_Formula.t -> bool
Expand All @@ -90,7 +95,11 @@ module type SAT_ML = sig
val conflict_analyze_and_fix : t -> conflict_origin -> unit

val push : t -> Satml_types.Atom.atom -> unit
(** [push env g] adds a new assertion level. The formula [g] is used in
[Satml_frontend] to guard all formulas asserted at this level. *)

val pop : t -> unit
(** [pop env] pops the latest assertion level. *)

val optimize : t -> Objective.Function.t -> unit
(** [optimize env fn] adds the objection [fn] to the environment
Expand Down
4 changes: 2 additions & 2 deletions src/lib/reasoners/satml_frontend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,7 @@ module Make (Th : Theory.S) : Sat_solver_sig.S = struct
{gf with E.ff = E.mk_imp current_guard gf.E.ff}

let unsat env gf =
assert (SAT.decision_level env.satml <= SAT.assertion_level env.satml);
checks_implemented_features ();
let gf = add_guard env gf in
Debug.unsat gf;
Expand All @@ -1337,7 +1338,6 @@ module Make (Th : Theory.S) : Sat_solver_sig.S = struct
Inst.add_terms env.inst
(E.max_ground_terms_rec_of_form gf.E.ff) gf;
try
assert (SAT.decision_level env.satml == 0);
let _updated = assume_aux ~dec_lvl:0 env [gf] in
let max_t = max_term_depth_in_sat env in
env.inst <- Inst.register_max_term_depth env.inst max_t;
Expand All @@ -1357,7 +1357,7 @@ module Make (Th : Theory.S) : Sat_solver_sig.S = struct

let assume env gf _dep =
(* dep currently not used. No unsat-cores in satML yet *)
assert (SAT.decision_level env.satml == 0);
assert (SAT.decision_level env.satml <= SAT.assertion_level env.satml);
try ignore (assume_aux ~dec_lvl:0 env [add_guard env gf])
with | IUnsat (_env, dep) -> raise (Unsat dep)
| Util.Timeout ->
Expand Down