mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
add facility to check for missing propagations
This commit is contained in:
parent
cafe3acff1
commit
bdac86501d
5 changed files with 109 additions and 11 deletions
|
@ -206,14 +206,62 @@ struct solver::imp {
|
|||
}
|
||||
}
|
||||
|
||||
if (r == l_true)
|
||||
return r;
|
||||
|
||||
IF_VERBOSE(0, verbose_stream() << "check-nra " << r << "\n";
|
||||
m_nlsat->display(verbose_stream());
|
||||
for (auto const& [v, w] : m_lp2nl) {
|
||||
auto& ls = m_nla_core.lra;
|
||||
if (ls.column_has_lower_bound(v))
|
||||
verbose_stream() << w << " >= " << ls.get_lower_bound(v) << "\n";
|
||||
verbose_stream() << "x" << w << " >= " << ls.get_lower_bound(v) << "\n";
|
||||
if (ls.column_has_upper_bound(v))
|
||||
verbose_stream() << w << " <= " << ls.get_upper_bound(v) << "\n";
|
||||
verbose_stream() << "x" << w << " <= " << ls.get_upper_bound(v) << "\n";
|
||||
});
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
lbool check_tight(dd::pdd const& eq) {
|
||||
m_zero = nullptr;
|
||||
m_nlsat = alloc(nlsat::solver, m_limit, m_params, false);
|
||||
m_zero = alloc(scoped_anum, am());
|
||||
m_lp2nl.reset();
|
||||
m_term_set.reset();
|
||||
add_eq(eq);
|
||||
for (auto const& [v, w] : m_lp2nl) {
|
||||
auto& ls = m_nla_core.lra;
|
||||
if (ls.column_has_lower_bound(v))
|
||||
add_strict_lb(ls.get_lower_bound(v), w);
|
||||
if (ls.column_has_upper_bound(v))
|
||||
add_strict_ub(ls.get_upper_bound(v), w);
|
||||
}
|
||||
|
||||
lbool r = l_undef;
|
||||
try {
|
||||
r = m_nlsat->check();
|
||||
}
|
||||
catch (z3_exception&) {
|
||||
if (m_limit.is_canceled()) {
|
||||
r = l_undef;
|
||||
}
|
||||
else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
if (r == l_true)
|
||||
return r;
|
||||
|
||||
IF_VERBOSE(0, verbose_stream() << "check-nra tight " << r << "\n";
|
||||
m_nlsat->display(verbose_stream());
|
||||
for (auto const& [v, w] : m_lp2nl) {
|
||||
auto& ls = m_nla_core.lra;
|
||||
if (ls.column_has_lower_bound(v))
|
||||
verbose_stream() << "x" << w << " >= " << ls.get_lower_bound(v) << "\n";
|
||||
if (ls.column_has_upper_bound(v))
|
||||
verbose_stream() << "x" << w << " <= " << ls.get_upper_bound(v) << "\n";
|
||||
});
|
||||
|
||||
|
||||
|
@ -235,6 +283,13 @@ struct solver::imp {
|
|||
m_nlsat->mk_clause(1, &lit, nullptr);
|
||||
}
|
||||
|
||||
void add_strict_lb(lp::impq const& b, unsigned w) {
|
||||
add_bound(b.x, w, false, nlsat::atom::kind::GT);
|
||||
}
|
||||
void add_strict_ub(lp::impq const& b, unsigned w) {
|
||||
add_bound(b.x, w, false, nlsat::atom::kind::LT);
|
||||
}
|
||||
|
||||
void add_lb(lp::impq const& b, unsigned w) {
|
||||
add_bound(b.x, w, b.y <= 0, b.y > 0 ? nlsat::atom::kind::GT : nlsat::atom::kind::LT);
|
||||
}
|
||||
|
@ -269,7 +324,8 @@ struct solver::imp {
|
|||
m_lp2nl.insert(v, w);
|
||||
}
|
||||
polynomial::polynomial_ref vp(pm.mk_polynomial(w, 1), pm);
|
||||
return pm.add(lo, pm.mul(vp, hi));
|
||||
polynomial::polynomial_ref mp(pm.mul(vp, hi), pm);
|
||||
return pm.add(lo, mp);
|
||||
}
|
||||
|
||||
bool is_int(lp::var_index v) {
|
||||
|
@ -361,6 +417,10 @@ lbool solver::check(vector<dd::pdd> const& eqs) {
|
|||
return m_imp->check(eqs);
|
||||
}
|
||||
|
||||
lbool solver::check_tight(dd::pdd const& eq) {
|
||||
return m_imp->check_tight(eq);
|
||||
}
|
||||
|
||||
bool solver::need_check() {
|
||||
return m_imp->need_check();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue