mirror of
https://github.com/Z3Prover/z3
synced 2025-06-23 06:13:40 +00:00
two bugs: check for always false, adjust start of list was incorrect during re-insert
This commit is contained in:
parent
1a36b74143
commit
32edbfa28e
4 changed files with 13 additions and 13 deletions
|
@ -165,10 +165,9 @@ namespace polysat {
|
||||||
auto c2 = s.ule(a, b);
|
auto c2 = s.ule(a, b);
|
||||||
if (!c.is_positive())
|
if (!c.is_positive())
|
||||||
c2 = ~c2;
|
c2 = ~c2;
|
||||||
LOG("try-reduce is false " << c2.is_currently_false(s));
|
|
||||||
if (!c2.is_currently_false(s))
|
if (!c2.is_currently_false(s))
|
||||||
continue;
|
continue;
|
||||||
if (c2.bvalue(s) == l_false)
|
if (c2.is_always_false() || c2.bvalue(s) == l_false)
|
||||||
return false;
|
return false;
|
||||||
if (!c2->has_bvar() || l_undef == c2.bvalue(s)) {
|
if (!c2->has_bvar() || l_undef == c2.bvalue(s)) {
|
||||||
vector<signed_constraint> premises;
|
vector<signed_constraint> premises;
|
||||||
|
|
|
@ -73,11 +73,9 @@ namespace polysat {
|
||||||
// a*v <= 0, a odd
|
// a*v <= 0, a odd
|
||||||
if (match_zero(c, a1, b1, e1, a2, b2, e2, fi))
|
if (match_zero(c, a1, b1, e1, a2, b2, e2, fi))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// a*v + b > 0, a odd
|
// a*v + b > 0, a odd
|
||||||
if (match_non_zero_linear(c, a1, b1, e1, a2, b2, e2, fi))
|
if (match_non_zero_linear(c, a1, b1, e1, a2, b2, e2, fi))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (match_linear1(c, a1, b1, e1, a2, b2, e2, fi))
|
if (match_linear1(c, a1, b1, e1, a2, b2, e2, fi))
|
||||||
return true;
|
return true;
|
||||||
if (match_linear2(c, a1, b1, e1, a2, b2, e2, fi))
|
if (match_linear2(c, a1, b1, e1, a2, b2, e2, fi))
|
||||||
|
@ -349,7 +347,7 @@ namespace polysat {
|
||||||
signed_constraint const& c,
|
signed_constraint const& c,
|
||||||
rational const & a1, pdd const& b1, pdd const& e1,
|
rational const & a1, pdd const& b1, pdd const& e1,
|
||||||
fi_record& fi) {
|
fi_record& fi) {
|
||||||
if (a1.is_odd() && b1.is_zero() && !c.is_positive()) {
|
if (a1.is_odd() && b1.is_zero() && c.is_negative()) {
|
||||||
auto& m = e1.manager();
|
auto& m = e1.manager();
|
||||||
rational lo_val(0);
|
rational lo_val(0);
|
||||||
auto lo = m.zero();
|
auto lo = m.zero();
|
||||||
|
@ -361,7 +359,7 @@ namespace polysat {
|
||||||
fi.side_cond.push_back(s.eq(b1, e1));
|
fi.side_cond.push_back(s.eq(b1, e1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (a1.is_odd() && b1.is_val() && !c.is_positive()) {
|
if (a1.is_odd() && b1.is_val() && c.is_negative()) {
|
||||||
auto& m = e1.manager();
|
auto& m = e1.manager();
|
||||||
rational const& mod_value = m.two_to_N();
|
rational const& mod_value = m.two_to_N();
|
||||||
rational a1_inv;
|
rational a1_inv;
|
||||||
|
@ -389,7 +387,7 @@ namespace polysat {
|
||||||
signed_constraint const& c,
|
signed_constraint const& c,
|
||||||
rational const & a2, pdd const& b2, pdd const& e2,
|
rational const & a2, pdd const& b2, pdd const& e2,
|
||||||
fi_record& fi) {
|
fi_record& fi) {
|
||||||
if (a2.is_one() && b2.is_val() && !c.is_positive()) {
|
if (a2.is_one() && b2.is_val() && c.is_negative()) {
|
||||||
auto& m = e2.manager();
|
auto& m = e2.manager();
|
||||||
rational const& mod_value = m.two_to_N();
|
rational const& mod_value = m.two_to_N();
|
||||||
rational lo_val(mod(-b2.val() - 1, mod_value));
|
rational lo_val(mod(-b2.val() - 1, mod_value));
|
||||||
|
|
|
@ -46,9 +46,11 @@ namespace polysat {
|
||||||
|
|
||||||
void viable::pop_viable() {
|
void viable::pop_viable() {
|
||||||
auto& [v, k, e] = m_trail.back();
|
auto& [v, k, e] = m_trail.back();
|
||||||
|
SASSERT(well_formed(m_units[v]));
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case entry_kind::unit_e:
|
case entry_kind::unit_e:
|
||||||
e->remove_from(m_units[v], e);
|
e->remove_from(m_units[v], e);
|
||||||
|
SASSERT(well_formed(m_units[v]));
|
||||||
break;
|
break;
|
||||||
case entry_kind::equal_e:
|
case entry_kind::equal_e:
|
||||||
e->remove_from(m_equal_lin[v], e);
|
e->remove_from(m_equal_lin[v], e);
|
||||||
|
@ -67,13 +69,15 @@ namespace polysat {
|
||||||
SASSERT(e->prev() != e || e->next() == e);
|
SASSERT(e->prev() != e || e->next() == e);
|
||||||
SASSERT(k == entry_kind::unit_e);
|
SASSERT(k == entry_kind::unit_e);
|
||||||
(void)k;
|
(void)k;
|
||||||
|
SASSERT(well_formed(m_units[v]));
|
||||||
if (e->prev() != e) {
|
if (e->prev() != e) {
|
||||||
e->prev()->insert_after(e);
|
e->prev()->insert_after(e);
|
||||||
if (e->interval.lo_val() < e->next()->interval.lo_val())
|
if (e->interval.lo_val() < m_units[v]->interval.lo_val())
|
||||||
m_units[v] = e;
|
m_units[v] = e;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_units[v] = e;
|
m_units[v] = e;
|
||||||
|
SASSERT(well_formed(m_units[v]));
|
||||||
m_trail.pop_back();
|
m_trail.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +106,7 @@ namespace polysat {
|
||||||
}
|
}
|
||||||
|
|
||||||
void viable::insert(entry* e, pvar v, ptr_vector<entry>& entries, entry_kind k) {
|
void viable::insert(entry* e, pvar v, ptr_vector<entry>& entries, entry_kind k) {
|
||||||
|
SASSERT(well_formed(m_units[v]));
|
||||||
m_trail.push_back({ v, k, e });
|
m_trail.push_back({ v, k, e });
|
||||||
s.m_trail.push_back(trail_instr_t::viable_add_i);
|
s.m_trail.push_back(trail_instr_t::viable_add_i);
|
||||||
e->init(e);
|
e->init(e);
|
||||||
|
@ -109,6 +114,7 @@ namespace polysat {
|
||||||
entries[v] = e;
|
entries[v] = e;
|
||||||
else
|
else
|
||||||
e->insert_after(entries[v]);
|
e->insert_after(entries[v]);
|
||||||
|
SASSERT(well_formed(m_units[v]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool viable::intersect(pvar v, entry* ne) {
|
bool viable::intersect(pvar v, entry* ne) {
|
||||||
|
@ -441,6 +447,7 @@ namespace polysat {
|
||||||
return refine_viable(v, val);
|
return refine_viable(v, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rational viable::min_viable(pvar v) {
|
rational viable::min_viable(pvar v) {
|
||||||
refined:
|
refined:
|
||||||
rational lo(0);
|
rational lo(0);
|
||||||
|
|
|
@ -1375,10 +1375,6 @@ namespace polysat {
|
||||||
void tst_polysat() {
|
void tst_polysat() {
|
||||||
using namespace polysat;
|
using namespace polysat;
|
||||||
|
|
||||||
test_polysat::test_ineq1();
|
|
||||||
test_polysat::test_ineq2();
|
|
||||||
test_polysat::test_monot();
|
|
||||||
return;
|
|
||||||
|
|
||||||
test_polysat::test_fi_zero();
|
test_polysat::test_fi_zero();
|
||||||
test_polysat::test_fi_nonzero();
|
test_polysat::test_fi_nonzero();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue