Skip to content

Commit 52d16a1

Browse files
deal with non-termination in new arithmetic solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
1 parent f6c9ead commit 52d16a1

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

src/sat/smt/arith_axioms.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,12 @@ namespace arith {
386386
ctx.push(push_back_vector<svector<std::pair<euf::th_eq, bool>>>(m_delayed_eqs));
387387
}
388388

389-
void solver::mk_diseq_axiom(euf::th_eq const& e) {
390-
if (is_bool(e.v1()))
389+
void solver::mk_diseq_axiom(theory_var v1, theory_var v2) {
390+
if (is_bool(v1))
391391
return;
392392
force_push();
393-
expr* e1 = var2expr(e.v1());
394-
expr* e2 = var2expr(e.v2());
393+
expr* e1 = var2expr(v1);
394+
expr* e2 = var2expr(v2);
395395
if (e1->get_id() > e2->get_id())
396396
std::swap(e1, e2);
397397
if (m.are_distinct(e1, e2))

src/sat/smt/arith_solver.cpp

+14-5
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,9 @@ namespace arith {
896896
}
897897

898898
bool solver::assume_eqs() {
899+
if (delayed_assume_eqs())
900+
return true;
901+
899902
TRACE("arith", display(tout););
900903
random_update();
901904
m_model_eqs.reset();
@@ -944,8 +947,15 @@ namespace arith {
944947
continue;
945948
literal eq = eq_internalize(n1, n2);
946949
ctx.mark_relevant(eq);
947-
if (s().value(eq) != l_true)
950+
switch (s().value(eq)) {
951+
case l_true:
952+
break;
953+
case l_undef:
948954
return true;
955+
case l_false:
956+
mk_diseq_axiom(v1, v2);
957+
return true;
958+
}
949959
}
950960
return false;
951961
}
@@ -1018,13 +1028,14 @@ namespace arith {
10181028
st = sat::check_result::CR_GIVEUP;
10191029
break;
10201030
}
1021-
1031+
10221032
if (assume_eqs()) {
10231033
++m_stats.m_assume_eqs;
10241034
return sat::check_result::CR_CONTINUE;
10251035
}
10261036
if (!check_delayed_eqs())
10271037
return sat::check_result::CR_CONTINUE;
1038+
10281039
if (ctx.get_config().m_arith_ignore_int && int_undef)
10291040
return sat::check_result::CR_GIVEUP;
10301041
if (m_not_handled != nullptr) {
@@ -1106,7 +1117,7 @@ namespace arith {
11061117
if (p.second)
11071118
new_eq_eh(e);
11081119
else if (is_eq(e.v1(), e.v2())) {
1109-
mk_diseq_axiom(e);
1120+
mk_diseq_axiom(e.v1(), e.v2());
11101121
found_diseq = true;
11111122
break;
11121123
}
@@ -1467,8 +1478,6 @@ namespace arith {
14671478
add_lemmas();
14681479
break;
14691480
case l_true:
1470-
if (assume_eqs())
1471-
return l_false;
14721481
break;
14731482
case l_undef:
14741483
break;

src/sat/smt/arith_solver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ namespace arith {
355355
literal is_bound_implied(lp::lconstraint_kind k, rational const& value, api_bound const& b) const;
356356
void assert_bound(bool is_true, api_bound& b);
357357
void mk_eq_axiom(bool is_eq, euf::th_eq const& eq);
358-
void mk_diseq_axiom(euf::th_eq const& eq);
358+
void mk_diseq_axiom(theory_var v1, theory_var v2);
359359
void assert_idiv_mod_axioms(theory_var u, theory_var v, theory_var w, rational const& r);
360360
api_bound* mk_var_bound(sat::literal lit, theory_var v, lp_api::bound_kind bk, rational const& bound);
361361
lp::lconstraint_kind bound2constraint_kind(bool is_int, lp_api::bound_kind bk, bool is_true);

0 commit comments

Comments
 (0)