3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 20:38:43 +00:00
This commit is contained in:
Nikolaj Bjorner 2023-10-25 16:38:18 -07:00
parent 20c54048f7
commit 4434cee5df
2 changed files with 80 additions and 81 deletions

View file

@ -18,6 +18,7 @@ namespace nra {
typedef nla::mon_eq mon_eq;
typedef nla::variable_map_type variable_map_type;
struct solver::imp {
lp::lar_solver& lra;
reslimit& m_limit;
@ -146,11 +147,12 @@ struct solver::imp {
throw;
}
}
#if 0
TRACE("nra",
m_nlsat->display(tout << r << "\n");
display(tout);
for (auto [j, x] : m_lp2nl) tout << "j" << j << " := x" << x << "\n";
);
for (auto [j, x] : m_lp2nl) tout << "j" << j << " := x" << x << "\n";);
#endif
switch (r) {
case l_true:
m_nla_core.set_use_nra_model(true);
@ -355,7 +357,7 @@ struct solver::imp {
for (lp::constraint_index ci : lra.constraints().indices())
if (!check_constraint(ci))
return l_undef;
for (auto const& m : m_nla_core.emons()) {
for (auto const& m : m_nla_core.emons())
if (!check_monic(m))
return l_undef;
break;
@ -376,7 +378,6 @@ struct solver::imp {
case l_undef:
break;
}
return r;
}
@ -422,7 +423,6 @@ struct solver::imp {
verbose_stream() << "x" << w << " <= " << lra.get_upper_bound(v) << "\n";
});
return r;
}
@ -439,13 +439,12 @@ struct solver::imp {
normeq *= lc;
polynomial::manager& pm = m_nlsat->pm();
polynomial::polynomial_ref p(pdd2polynomial(normeq), pm);
bool is_even[1] = { false };
polynomial::polynomial* ps[1] = { p };
bool is_even[1] = {false};
polynomial::polynomial* ps[1] = {p};
nlsat::literal lit = m_nlsat->mk_ineq_literal(nlsat::atom::kind::EQ, 1, ps, is_even);
m_nlsat->mk_clause(1, &lit, a);
}
void add_lb(lp::impq const& b, unsigned w, nlsat::assumption a = nullptr) {
polynomial::manager& pm = m_nlsat->pm();
polynomial::polynomial_ref p(pm.mk_polynomial(w), pm);
@ -473,8 +472,8 @@ struct solver::imp {
polynomial::manager& pm = m_nlsat->pm();
polynomial::polynomial_ref p2(pm.mk_const(bound), pm);
polynomial::polynomial_ref p(pm.sub(p1, p2), pm);
polynomial::polynomial* ps[1] = { p };
bool is_even[1] = { false };
polynomial::polynomial* ps[1] = {p};
bool is_even[1] = {false};
nlsat::literal lit = m_nlsat->mk_ineq_literal(k, 1, ps, is_even);
if (neg)
lit.neg();
@ -503,6 +502,8 @@ struct solver::imp {
return pm.add(lo, mp);
}
bool is_int(lp::var_index v) {
return lra.var_is_int(v);
}
@ -539,8 +540,8 @@ struct solver::imp {
coeffs.push_back(-den);
polynomial::manager& pm = m_nlsat->pm();
polynomial::polynomial_ref p(pm.mk_linear(coeffs.size(), coeffs.data(), vars.data(), rational(0)), pm);
polynomial::polynomial* ps[1] = { p };
bool is_even[1] = { false };
polynomial::polynomial* ps[1] = {p};
bool is_even[1] = {false};
nlsat::literal lit = m_nlsat->mk_ineq_literal(nlsat::atom::kind::EQ, 1, ps, is_even);
m_nlsat->mk_clause(1, &lit, nullptr);
}

View file

@ -19,8 +19,6 @@ namespace lp {
namespace nra {
class solver {
struct imp;
imp* m_imp;