3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-20 03:12:03 +00:00

Expand always-false check

This commit is contained in:
Jakob Rath 2022-09-28 10:57:40 +02:00
parent 27b31c88d2
commit e08e124790
3 changed files with 11 additions and 5 deletions

View file

@ -196,6 +196,7 @@ namespace polysat {
break; break;
case l_undef: case l_undef:
if (c.is_always_false()) { if (c.is_always_false()) {
LOG("Always false: " << c);
// asserted an always-false constraint // asserted an always-false constraint
set_conflict_at_base_level(); set_conflict_at_base_level();
return; return;

View file

@ -134,17 +134,22 @@ namespace polysat {
s.m_viable.intersect(p, q, sc); s.m_viable.intersect(p, q, sc);
} }
bool ule_constraint::is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs) const { bool ule_constraint::is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs) {
// TODO: other conditions (e.g. when forbidden interval would be full)
if (is_positive) { if (is_positive) {
// lhs <= rhs
if (rhs.is_zero()) if (rhs.is_zero())
return lhs.is_never_zero(); return lhs.is_never_zero(); // p <= 0 implies p == 0
return lhs.is_val() && rhs.is_val() && lhs.val() > rhs.val(); return lhs.is_val() && rhs.is_val() && lhs.val() > rhs.val();
} }
else { else {
// lhs > rhs
if (lhs.is_zero()) if (lhs.is_zero())
return true; // 0 > ... is always false return true; // 0 > ... is always false
return (lhs.is_val() && rhs.is_val() && lhs.val() <= rhs.val()) || (lhs == rhs); if (lhs == rhs)
return true; // p > p
if (lhs.is_one() && rhs.is_never_zero())
return true; // 1 > p implies p == 0
return lhs.is_val() && rhs.is_val() && lhs.val() <= rhs.val();
} }
} }

View file

@ -34,7 +34,7 @@ namespace polysat {
pdd const& rhs() const { return m_rhs; } pdd const& rhs() const { return m_rhs; }
std::ostream& display(std::ostream& out, lbool status) const override; std::ostream& display(std::ostream& out, lbool status) const override;
std::ostream& display(std::ostream& out) const override; std::ostream& display(std::ostream& out) const override;
bool is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs) const; static bool is_always_false(bool is_positive, pdd const& lhs, pdd const& rhs);
bool is_always_false(bool is_positive) const override; bool is_always_false(bool is_positive) const override;
bool is_currently_false(solver& s, bool is_positive) const override; bool is_currently_false(solver& s, bool is_positive) const override;
bool is_currently_true(solver& s, bool is_positive) const override; bool is_currently_true(solver& s, bool is_positive) const override;