feat: pass a sign along with the formula in acts_add_decision_lit

This commit is contained in:
Simon Cruanes 2020-11-14 18:58:40 -05:00
parent 4097ed9dc2
commit 764695bb65
3 changed files with 8 additions and 7 deletions

View file

@ -1700,8 +1700,9 @@ module Make(Plugin : PLUGIN)
Log.debugf info (fun k->k "(@[sat.th.add-clause@ %a@])" Clause.debug c); Log.debugf info (fun k->k "(@[sat.th.add-clause@ %a@])" Clause.debug c);
Vec.push st.clauses_to_add c Vec.push st.clauses_to_add c
let acts_add_decision_lit (st:t) (f:formula) : unit = let acts_add_decision_lit (st:t) (f:formula) (sign:bool) : unit =
let a = create_atom st f in let a = create_atom st f in
let a = if sign then a else Atom.neg a in
if not (Atom.has_value a) then ( if not (Atom.has_value a) then (
Log.debugf 10 (fun k->k "(@[sat.th.add-decision-lit@ %a@])" Atom.debug a); Log.debugf 10 (fun k->k "(@[sat.th.add-decision-lit@ %a@])" Atom.debug a);
st.next_decisions <- a :: st.next_decisions st.next_decisions <- a :: st.next_decisions

View file

@ -48,7 +48,7 @@ type ('term, 'formula, 'value, 'proof) acts = ('term, 'formula, 'value, 'proof)
acts_add_clause : ?keep:bool -> 'formula list -> 'proof -> unit; acts_add_clause : ?keep:bool -> 'formula list -> 'proof -> unit;
acts_raise_conflict: 'b. 'formula list -> 'proof -> 'b; acts_raise_conflict: 'b. 'formula list -> 'proof -> 'b;
acts_propagate : 'formula -> ('term, 'formula, 'proof) reason -> unit; acts_propagate : 'formula -> ('term, 'formula, 'proof) reason -> unit;
acts_add_decision_lit: 'formula -> unit; acts_add_decision_lit: 'formula -> bool -> unit;
} }
type negated = Solver_intf.negated = Negated | Same_sign type negated = Solver_intf.negated = Negated | Same_sign

View file

@ -120,7 +120,7 @@ type ('term, 'formula, 'value, 'proof) acts = {
(** Add a clause to the solver. (** Add a clause to the solver.
@param keep if true, the clause will be kept by the solver. @param keep if true, the clause will be kept by the solver.
Otherwise the solver is allowed to GC the clause and propose this Otherwise the solver is allowed to GC the clause and propose this
partial model again. partial model again.
*) *)
acts_raise_conflict: 'b. 'formula list -> 'proof -> 'b; acts_raise_conflict: 'b. 'formula list -> 'proof -> 'b;
@ -132,10 +132,10 @@ type ('term, 'formula, 'value, 'proof) acts = {
(** Propagate a formula, i.e. the theory can evaluate the formula to be true (** Propagate a formula, i.e. the theory can evaluate the formula to be true
(see the definition of {!type:eval_res} *) (see the definition of {!type:eval_res} *)
acts_add_decision_lit: 'formula -> unit; acts_add_decision_lit: 'formula -> bool -> unit;
(** Ask the SAT solver to decide on the given formula before it can (** Ask the SAT solver to decide on the given formula with given sign
answer [SAT]. The order of decisions is still unspecified. before it can answer [SAT]. The order of decisions is still unspecified.
Useful for theory combination. *) Useful for theory combination. This will be undone on backtracking. *)
} }
(** The type for a slice of assertions to assume/propagate in the theory. *) (** The type for a slice of assertions to assume/propagate in the theory. *)