3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 19:35:50 +00:00

Polysat: fixes in solver, forbidden intervals for eq_constraint (#5240)

* Rename to neg_cond

* Add some logging utilities

* Implement case of forbidden interval covering the whole domain

* Implement diseq_narrow

* Do not activate constraint if we are in a conflict state

* comments

* Assert that lemma isn't undefined

* Update revert_decision to work in the case where narrowing causes propagation

* Fix case of non-disjunctive lemma from forbidden intervals

* Conflict should not leak outside user scope

* Add guard to decide(), some notes

* Add test case

* Add constraints to watchlist of unassigned variable during propagation

* Move common propagation functionality into base class

* Combine eq/diseq narrow

* Compute forbidden interval for equality constraints by considering them as p <=u 0 (or p >u 0 for disequalities)
This commit is contained in:
Jakob Rath 2021-05-03 18:30:17 +02:00 committed by GitHub
parent 04876ba8b7
commit f7e476a4a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 350 additions and 130 deletions

View file

@ -48,7 +48,8 @@ namespace polysat {
bool is_sle() const { return m_kind == ckind_t::sle_t; }
ckind_t kind() const { return m_kind; }
virtual std::ostream& display(std::ostream& out) const = 0;
virtual bool propagate(solver& s, pvar v) = 0;
bool propagate(solver& s, pvar v);
virtual void propagate_core(solver& s, pvar v, pvar other_v);
virtual constraint* resolve(solver& s, pvar v) = 0;
virtual bool is_always_false() = 0;
virtual bool is_currently_false(solver& s) = 0;
@ -66,6 +67,8 @@ namespace polysat {
bool is_positive() const { return m_status == l_true; }
bool is_negative() const { return m_status == l_false; }
bool is_undef() const { return m_status == l_undef; }
/** Precondition: all variables other than v are assigned. */
virtual bool forbidden_interval(solver& s, pvar v, eval_interval& i, constraint*& neg_condition) { return false; }
};
@ -75,6 +78,10 @@ namespace polysat {
scoped_ptr_vector<constraint> m_literals;
public:
clause() {}
clause(scoped_ptr<constraint>&& c) {
SASSERT(c);
m_literals.push_back(c.detach());
}
clause(scoped_ptr_vector<constraint>&& literals): m_literals(std::move(literals)) {
SASSERT(std::all_of(m_literals.begin(), m_literals.end(), [](constraint* c) { return c != nullptr; }));
SASSERT(empty() || std::all_of(m_literals.begin(), m_literals.end(), [this](constraint* c) { return c->level() == level(); }));