From 33677b9803a21e2a24da47c68589f8299bb019b0 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Fri, 10 Apr 2020 11:56:35 -0700 Subject: [PATCH] fix #3898 Signed-off-by: Nikolaj Bjorner --- src/smt/theory_lra.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/smt/theory_lra.cpp b/src/smt/theory_lra.cpp index 99f6d17c8..8a3078ba5 100644 --- a/src/smt/theory_lra.cpp +++ b/src/smt/theory_lra.cpp @@ -898,10 +898,10 @@ class theory_lra::imp { } void del_bounds(unsigned old_size) { - for (unsigned i = m_bounds_trail.size(); i > old_size; ) { - --i; + for (unsigned i = m_bounds_trail.size(); i-- > old_size; ) { unsigned v = m_bounds_trail[i]; lp_api::bound* b = m_bounds[v].back(); + m_bool_var2bound.erase(v); // del_use_lists(b); dealloc(b); m_bounds[v].pop_back(); @@ -1062,7 +1062,15 @@ public: else if (a.is_ge(atom, n1, n2) && is_numeral(n2, r) && is_app(n1)) { v = internalize_def(to_app(n1)); k = lp_api::lower_t; - } + } + if (a.is_le(atom, n1, n2) && is_numeral(n1, r) && is_app(n2)) { + v = internalize_def(to_app(n2)); + k = lp_api::lower_t; + } + else if (a.is_ge(atom, n1, n2) && is_numeral(n1, r) && is_app(n2)) { + v = internalize_def(to_app(n2)); + k = lp_api::upper_t; + } else if (a.is_is_int(atom)) { internalize_is_int(atom); return true; @@ -2284,11 +2292,12 @@ public: if (!can_propagate()) { return; } - while (m_asserted_qhead < m_asserted_atoms.size() && !ctx().inconsistent()) { + while (m_asserted_qhead < m_asserted_atoms.size() && !ctx().inconsistent() && m.inc()) { bool_var bv = m_asserted_atoms[m_asserted_qhead].m_bv; bool is_true = m_asserted_atoms[m_asserted_qhead].m_is_true; m_to_check.push_back(bv); lp_api::bound* b = nullptr; + TRACE("arith", tout << "propagate: " << bv << "\n";); if (m_bool_var2bound.find(bv, b)) { assert_bound(bv, is_true, *b); ++m_asserted_qhead; @@ -3791,7 +3800,7 @@ public: m_bounds[v].push_back(a); m_bounds_trail.push_back(v); m_bool_var2bound.insert(bv, a); - TRACE("arith", tout << mk_pp(b, m) << "\n";); + TRACE("arith", tout << "internalized " << bv << ": " << mk_pp(b, m) << "\n";); } if (is_strict) { b = m.mk_not(b);