Skip to content

Commit

Permalink
handle small powers in theory_lra #4616
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <[email protected]>
  • Loading branch information
NikolajBjorner committed Aug 13, 2020
1 parent c63ad2e commit 9df6c10
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/smt/theory_lra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@ class theory_lra::imp {
vars.push_back(v);
++index;
}
else if(a.is_power(n, n1, n2) && is_app(n1) && is_numeral(n2, r) && r.is_unsigned() && r <= 10) {
theory_var v = internalize_power(to_app(n), to_app(n1), r.get_unsigned());
coeffs[vars.size()] = coeffs[index];
vars.push_back(v);
++index;
}
else if (a.is_numeral(n, r)) {
offset += coeffs[index]*r;
++index;
Expand Down Expand Up @@ -600,6 +606,23 @@ class theory_lra::imp {
}
}

theory_var internalize_power(app* t, app* n, unsigned p) {
internalize_args(t, true);
bool _has_var = has_var(t);
mk_enode(t);
theory_var v = mk_var(t);
if (_has_var)
return v;
theory_var w = mk_var(n);
svector<lpvar> vars;
for (unsigned i = 0; i < p; ++i)
vars.push_back(register_theory_var_in_lar_solver(w));
ensure_nla();
m_solver->register_existing_terms();
m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.c_ptr());
return v;
}

theory_var internalize_mul(app* t) {
SASSERT(a.is_mul(t));
internalize_args(t, true);
Expand Down

0 comments on commit 9df6c10

Please sign in to comment.