3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-04-14 22:03:28 -07:00
parent 034132d245
commit 9a2b7677bf
3 changed files with 20 additions and 9 deletions

View file

@ -240,9 +240,8 @@ namespace dd {
break;
case pdd_subst_val_op:
while (!is_val(q) && !is_val(p)) {
if (level(p) == level(q)) break;
if (level(p) < level(q)) q = lo(q);
else p = lo(p);
else break;
}
if (is_val(p) || is_val(q)) return p;
break;
@ -388,12 +387,19 @@ namespace dd {
case pdd_subst_val_op:
SASSERT(!is_val(p));
SASSERT(!is_val(q));
SASSERT(level_p == level_q);
SASSERT(level_p >= level_q);
push(apply_rec(lo(p), q, pdd_subst_val_op)); // lo := subst(lo(p), s)
push(apply_rec(hi(p), q, pdd_subst_val_op)); // hi := subst(hi(p), s)
push(apply_rec(lo(q), read(1), pdd_mul_op)); // hi := hi*s[var(p)]
r = apply_rec(read(1), read(3), pdd_add_op); // r := hi + lo := subst(lo(p),s) + s[var(p)]*subst(hi(p),s)
npop = 3;
if (level_p > level_q) {
r = make_node(level_p, read(2), read(1));
npop = 2;
}
else {
push(apply_rec(lo(q), read(1), pdd_mul_op)); // hi := hi*s[var(p)]
r = apply_rec(read(1), read(3), pdd_add_op); // r := hi + lo := subst(lo(p),s) + s[var(p)]*subst(hi(p),s)
npop = 3;
}
break;
default:
r = null_pdd;

View file

@ -220,9 +220,9 @@ namespace polysat {
return false;
}
// one variable remains unassigned.
// at most one variable remains unassigned.
auto other_var = vars[1 - idx];
SASSERT(!is_assigned(other_var));
// SASSERT(!is_assigned(other_var));
// Detect and apply unit propagation.
@ -364,12 +364,14 @@ namespace polysat {
void solver::set_conflict(constraint& c) {
SASSERT(m_conflict.empty());
TRACE("polysat", tout << "conflict " << c << "\n";);
m_conflict.push_back(&c);
}
void solver::set_conflict(pvar v) {
SASSERT(m_conflict.empty());
m_conflict.append(m_cjust[v]);
TRACE("polysat", tout << "conflict "; for (auto* c : m_conflict) tout << *c << "\n";);
if (m_cjust[v].empty())
m_conflict.push_back(nullptr);
}

View file

@ -36,7 +36,10 @@ namespace polysat {
s.add_eq(a + 1);
s.check();
}
// TBD: we get the wrong result / conflicts.
// it claims that v1 + 2*v0 + 1 with v0 replaced by 0 is 1.
// it should be v1 + 1
static void test_l2() {
scoped_solver s;
auto a = s.var(s.add_var(2));