Skip to content

Commit 589024a

Browse files
fix #6969
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
1 parent 9d57bdd commit 589024a

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/math/lp/nla_grobner.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,22 @@ namespace nla {
199199
// IF_VERBOSE(0, verbose_stream() << "factored " << q << " : " << vars << "\n");
200200

201201
term t;
202+
rational lc(1);
203+
auto ql = q;
204+
while (!ql.is_val()) {
205+
lc = lcm(lc, denominator(ql.hi().val()));
206+
ql = q.lo();
207+
}
208+
lc = lcm(denominator(ql.val()), lc);
209+
202210
while (!q.is_val()) {
203-
t.add_monomial(q.hi().val(), q.var());
211+
t.add_monomial(lc*q.hi().val(), q.var());
204212
q = q.lo();
205213
}
206214
vector<ineq> ineqs;
207215
for (auto v : vars)
208216
ineqs.push_back(ineq(v, llc::EQ, rational::zero()));
209-
ineqs.push_back(ineq(t, llc::EQ, -q.val()));
217+
ineqs.push_back(ineq(t, llc::EQ, -lc*q.val()));
210218
for (auto const& i : ineqs)
211219
if (c().ineq_holds(i))
212220
return false;

src/smt/theory_lra.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,15 @@ class theory_lra::imp {
589589

590590
void mk_clause(literal l1, literal l2, unsigned num_params, parameter * params) {
591591
TRACE("arith", literal lits[2]; lits[0] = l1; lits[1] = l2; ctx().display_literals_verbose(tout, 2, lits); tout << "\n";);
592-
ctx().mk_th_axiom(get_id(), l1, l2, num_params, params);
592+
// static unsigned num_bin = 0;
593+
// std::cout << "binary " << (num_bin++) << "\n";
594+
ctx().mk_th_lemma(get_id(), l1, l2, num_params, params);
593595
}
594596

595597
void mk_clause(literal l1, literal l2, literal l3, unsigned num_params, parameter * params) {
596598
TRACE("arith", literal lits[3]; lits[0] = l1; lits[1] = l2; lits[2] = l3; ctx().display_literals_smt2(tout, 3, lits); tout << "\n";);
599+
static unsigned num_ter = 0;
600+
std::cout << "ternary " << (num_ter++) << "\n";
597601
ctx().mk_th_axiom(get_id(), l1, l2, l3, num_params, params);
598602
}
599603

@@ -3342,7 +3346,7 @@ class theory_lra::imp {
33423346
// The lemmas can come in batches
33433347
// and the same literal can appear in several lemmas in a batch: it becomes l_true
33443348
// in earlier processing, but it was not so when the lemma was produced
3345-
ctx().mk_th_axiom(get_id(), m_core.size(), m_core.data());
3349+
ctx().mk_th_lemma(get_id(), m_core.size(), m_core.data());
33463350
}
33473351
}
33483352

@@ -3703,17 +3707,16 @@ class theory_lra::imp {
37033707

37043708
app_ref coeffs2app(u_map<rational> const& coeffs, rational const& offset, bool is_int) {
37053709
expr_ref_vector args(m);
3706-
for (auto const& kv : coeffs) {
3707-
theory_var w = kv.m_key;
3710+
for (auto const& [w, coeff] : coeffs) {
37083711
expr* o = get_enode(w)->get_expr();
3709-
if (kv.m_value.is_zero()) {
3712+
if (coeff.is_zero()) {
37103713
// continue
37113714
}
3712-
else if (kv.m_value.is_one()) {
3715+
else if (coeff.is_one()) {
37133716
args.push_back(o);
37143717
}
37153718
else {
3716-
args.push_back(a.mk_mul(a.mk_numeral(kv.m_value, is_int), o));
3719+
args.push_back(a.mk_mul(a.mk_numeral(coeff, is_int), o));
37173720
}
37183721
}
37193722
if (!offset.is_zero()) {

0 commit comments

Comments
 (0)