3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-25 12:35:59 +00:00

bailout for saturation lemmas

This commit is contained in:
Jakob Rath 2022-07-01 11:51:52 +02:00
parent c78007fd1a
commit d473c23e5b
5 changed files with 89 additions and 24 deletions

View file

@ -98,6 +98,12 @@ namespace polysat {
std::ostream& display(std::ostream& out) const override { return out << m_name; }
};
enum class conflict_kind_t {
ok,
bailout_gave_up,
bailout_lemma,
};
/** Conflict state, represented as core (~negation of clause). */
class conflict {
solver& s;
@ -106,13 +112,19 @@ namespace polysat {
uint_set m_vars; // variable assignments used as premises
uint_set m_bail_vars;
friend class inference_logger;
scoped_ptr<inference_logger> m_logger;
// If this is not null_var, the conflict was due to empty viable set for this variable.
// Can be treated like "v = x" for any value x.
pvar m_conflict_var = null_var;
/** Whether we are in a bailout state.
* We enter a bailout state when we give up on proper conflict resolution,
* or want to learn a lemma without fine-grained backtracking.
*/
conflict_kind_t m_kind = conflict_kind_t::ok;
friend class inference_logger;
scoped_ptr<inference_logger> m_logger;
bool_vector m_bvar2mark; // mark of Boolean variables
void set_mark(signed_constraint c);
@ -120,9 +132,6 @@ namespace polysat {
void minimize_vars(signed_constraint c);
/** Whether we are in a bailout state. We enter a bailout state when we give up on proper conflict resolution. */
bool m_bailout = false;
constraint_manager& cm() const;
scoped_ptr_vector<explainer> ex_engines;
scoped_ptr_vector<variable_elimination_engine> ve_engines;
@ -143,9 +152,10 @@ namespace polysat {
pvar conflict_var() const { return m_conflict_var; }
bool is_bailout() const { return m_bailout; }
void set_bailout();
bool is_bailout() const { return m_kind != conflict_kind_t::ok; }
bool is_bailout_lemma() const { return m_kind == conflict_kind_t::bailout_lemma; }
void set_bailout_gave_up();
void set_bailout_lemma();
bool empty() const;
void reset();