mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 17:45:32 +00:00
Update eval_invariant
This commit is contained in:
parent
2285ed90fb
commit
0433f81f78
1 changed files with 13 additions and 10 deletions
|
@ -1663,20 +1663,23 @@ namespace polysat {
|
|||
bool solver::eval_invariant() const {
|
||||
if (is_conflict())
|
||||
return true;
|
||||
bool ok = true;
|
||||
for (sat::bool_var v = m_bvars.size(); v-- > 0; ) {
|
||||
sat::literal lit(v);
|
||||
auto c = lit2cnstr(lit);
|
||||
if (!all_of(c->vars(), [this](auto w) { return is_assigned(w); }))
|
||||
sat::literal const lit(v);
|
||||
signed_constraint const c = lit2cnstr(lit);
|
||||
if (!all_of(c->vars(), [this](pvar w) { return is_assigned(w); }))
|
||||
continue;
|
||||
ok &= (m_bvars.value(lit) != l_true) || !c.is_currently_false(*this);
|
||||
ok &= (m_bvars.value(lit) != l_false) || !c.is_currently_true(*this);
|
||||
if (!ok) {
|
||||
LOG("assignment invariant is broken " << v << "\n" << *this);
|
||||
break;
|
||||
lbool const bvalue = m_bvars.value(lit);
|
||||
lbool const pvalue = c.eval(*this);
|
||||
if (bvalue != l_undef && pvalue != l_undef && bvalue != pvalue) {
|
||||
verbose_stream() << "missed bool/eval conflict: " << lit_pp(*this, lit) << "\n";
|
||||
return false;
|
||||
}
|
||||
if (bvalue == l_undef && pvalue != l_undef) {
|
||||
verbose_stream() << "missed evaluation: " << lit_pp(*this, lit) << "\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Check that each variable is either assigned or queued for decisions */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue