Skip to content

Commit

Permalink
change to expr_ref to allow trying simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Nov 8, 2023
1 parent bd4d580 commit 0556059
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/smt/theory_lra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,13 +1730,13 @@ class theory_lra::imp {
}
}
// create a bound atom representing term >= k is lower_bound is true, and term <= k if it is false
app_ref mk_bound(lp::lar_term const& term, rational const& k, bool lower_bound) {
expr_ref mk_bound(lp::lar_term const& term, rational const& k, bool lower_bound) {
rational offset;
expr_ref t(m);
return mk_bound(term, k, lower_bound, offset, t);
}

app_ref mk_bound(lp::lar_term const& term, rational const& k, bool lower_bound, rational& offset, expr_ref& t) {
expr_ref mk_bound(lp::lar_term const& term, rational const& k, bool lower_bound, rational& offset, expr_ref& t) {
offset = k;
u_map<rational> coeffs;
term2coeffs(term, coeffs);
Expand Down Expand Up @@ -1782,7 +1782,7 @@ class theory_lra::imp {
// lp().print_term(term, tout << "term: ") << "\n";
// tout << "offset: " << offset << " gcd: " << g << "\n";);

app_ref atom(m);
expr_ref atom(m);
t = coeffs2app(coeffs, rational::zero(), is_int);
if (lower_bound) {
atom = a.mk_ge(t, a.mk_numeral(offset, is_int));
Expand All @@ -1791,6 +1791,7 @@ class theory_lra::imp {
atom = a.mk_le(t, a.mk_numeral(offset, is_int));
}

// ctx().get_rewriter()(atom);
TRACE("arith", tout << t << ": " << atom << "\n";
lp().print_term(term, tout << "bound atom: ") << (lower_bound?" >= ":" <= ") << k << "\n";);
ctx().internalize(atom, true);
Expand Down Expand Up @@ -1920,12 +1921,11 @@ class theory_lra::imp {

case lp::lia_move::branch: {
TRACE("arith", tout << "branch\n";);
app_ref b(m);
bool u = m_lia->is_upper();
auto const & k = m_lia->get_offset();
rational offset;
expr_ref t(m);
b = mk_bound(m_lia->get_term(), k, !u, offset, t);
expr_ref b = mk_bound(m_lia->get_term(), k, !u, offset, t);
if (m.has_trace_stream()) {
app_ref body(m);
body = m.mk_or(b, m.mk_not(b));
Expand Down Expand Up @@ -1953,7 +1953,7 @@ class theory_lra::imp {
}
// The call mk_bound() can set the m_infeasible_column in lar_solver
// so the explanation is safer to take before this call.
expr_ref b(mk_bound(m_lia->get_term(), m_lia->get_offset(), !m_lia->is_upper()), m);
expr_ref b = mk_bound(m_lia->get_term(), m_lia->get_offset(), !m_lia->is_upper());
if (m.has_trace_stream()) {
th.log_axiom_instantiation(b);
m.trace_stream() << "[end-of-instance]\n";
Expand Down Expand Up @@ -2000,7 +2000,7 @@ class theory_lra::imp {
default: UNREACHABLE();
}
TRACE("arith", tout << "is_lower: " << is_lower << " pos " << pos << "\n";);
app_ref atom(m);
expr_ref atom(m);
// TBD utility: lp::lar_term term = mk_term(ineq.m_poly);
// then term is used instead of ineq.m_term
if (is_eq)
Expand Down

0 comments on commit 0556059

Please sign in to comment.