3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-22 00:07:36 +00:00

Fix crash exposed in QF_UFNIA

This commit is contained in:
Nikolaj Bjorner 2025-01-24 15:31:10 -08:00
parent 9e8dd68ee6
commit f6e7dcff47
4 changed files with 37 additions and 31 deletions

View file

@ -127,10 +127,30 @@ namespace sls {
tout << "\n";);
for (auto v : ctx.unsat_vars())
a.add_lookahead(v);
add_lookahead(v);
}
template<typename num_t>
void arith_clausal<num_t>::add_lookahead(sat::bool_var bv) {
auto* ineq = a.get_ineq(bv);
if (!ineq)
return;
num_t na, nb;
for (auto const& [x, nl] : ineq->m_nonlinear) {
if (a.is_fixed(x))
continue;
if (a.is_add(x) || a.is_mul(x) || a.is_op(x))
;
else if (a.is_linear(x, nl, nb))
a.find_linear_moves(*ineq, x, nb);
else if (a.is_quadratic(x, nl, na, nb))
a.find_quadratic_moves(*ineq, x, na, nb, ineq->m_args_value);
else
;
}
}
/**
* \brief walk over literals that are false in some clause.
* Try to determine if flipping them to true improves the overall score.
@ -162,7 +182,7 @@ namespace sls {
--sz;
a.m_bool_var_atoms.swap_elems(idx, sz);
if (occurs_negative(bv))
a.add_lookahead(bv);
add_lookahead(bv);
else
++i;
}
@ -171,7 +191,7 @@ namespace sls {
for (unsigned i = 0; i < sz; ++i) {
bv = a.m_bool_var_atoms[i];
if (occurs_negative(bv))
a.add_lookahead(bv);
add_lookahead(bv);
}
}
}