3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-02 01:13:18 +00:00

work on niil_solver::check()

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2018-08-13 11:55:30 +08:00
parent 07c9e22303
commit a86601f7d2
2 changed files with 28 additions and 13 deletions

View file

@ -274,9 +274,11 @@ class theory_lra::imp {
lbool check(lp::explanation_t& ex) { lbool check(lp::explanation_t& ex) {
if (m_use_niil) { if (m_use_niil) {
if (m_niil != nullptr) if (m_niil != nullptr) {
std::cout << "check niil\n";
return (*m_niil)->check(ex); return (*m_niil)->check(ex);
} }
}
else { else {
if (m_nra != nullptr) if (m_nra != nullptr)
return (*m_nra)->check(ex); return (*m_nra)->check(ex);
@ -2047,16 +2049,7 @@ public:
return lia_check; return lia_check;
} }
lbool check_nra() { lbool check_aftermath_nra(lbool r) {
m_use_nra_model = false;
if (m.canceled()) {
TRACE("arith", tout << "canceled\n";);
return l_undef;
}
if (!m_nra) return l_true;
if (!m_switcher.need_check()) return l_true;
m_a1 = nullptr; m_a2 = nullptr;
lbool r = m_switcher.check(m_explanation);
m_a1 = alloc(scoped_anum, m_nra->am()); m_a1 = alloc(scoped_anum, m_nra->am());
m_a2 = alloc(scoped_anum, m_nra->am()); m_a2 = alloc(scoped_anum, m_nra->am());
switch (r) { switch (r) {
@ -2077,6 +2070,23 @@ public:
return r; return r;
} }
lbool check_aftermath_niil(lbool r) {
return r;
}
lbool check_nra() {
m_use_nra_model = false;
if (m.canceled()) {
TRACE("arith", tout << "canceled\n";);
return l_undef;
}
if (!m_nra && !m_niil) return l_true;
if (!m_switcher.need_check()) return l_true;
m_a1 = nullptr; m_a2 = nullptr;
lbool r = m_switcher.check(m_explanation);
return m_nra? check_aftermath_nra(r) : check_aftermath_niil(r);
}
/** /**
\brief We must redefine this method, because theory of arithmetic contains \brief We must redefine this method, because theory of arithmetic contains
underspecified operators such as division by 0. underspecified operators such as division by 0.

View file

@ -48,6 +48,12 @@ struct solver::imp {
m_monomials.shrink(m_monomials_lim[m_monomials_lim.size() - n]); m_monomials.shrink(m_monomials_lim[m_monomials_lim.size() - n]);
m_monomials_lim.shrink(m_monomials_lim.size() - n); m_monomials_lim.shrink(m_monomials_lim.size() - n);
} }
lbool check(lp::explanation_t& ex) {
lp_assert(m_solver.get_status() == lp::lp_status::OPTIMAL);
return l_undef;
}
}; };
void solver::add_monomial(lp::var_index v, unsigned sz, lp::var_index const* vs) { void solver::add_monomial(lp::var_index v, unsigned sz, lp::var_index const* vs) {
std::cout << "called add_monomial\n"; std::cout << "called add_monomial\n";
@ -56,8 +62,7 @@ void solver::add_monomial(lp::var_index v, unsigned sz, lp::var_index const* vs)
bool solver::need_check() { return true; } bool solver::need_check() { return true; }
lbool solver::check(lp::explanation_t& ex) { lbool solver::check(lp::explanation_t& ex) {
lp_assert(false); return m_imp->check(ex);
return l_undef;
} }