mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 22:23:22 +00:00
bugfixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
6f37da5a07
commit
aa67c3655f
6 changed files with 25 additions and 12 deletions
|
@ -547,6 +547,7 @@ namespace arith {
|
||||||
}
|
}
|
||||||
|
|
||||||
void solver::new_diseq_eh(euf::th_eq const& e) {
|
void solver::new_diseq_eh(euf::th_eq const& e) {
|
||||||
|
TRACE("artih", tout << mk_bounded_pp(e.eq(), m) << "\n");
|
||||||
ensure_column(e.v1());
|
ensure_column(e.v1());
|
||||||
ensure_column(e.v2());
|
ensure_column(e.v2());
|
||||||
m_delayed_eqs.push_back(std::make_pair(e, false));
|
m_delayed_eqs.push_back(std::make_pair(e, false));
|
||||||
|
|
|
@ -987,10 +987,10 @@ namespace arith {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool solver::use_nra_model() {
|
bool solver::use_nra_model() {
|
||||||
return m_nla && m_nla->use_nra_model();
|
return m_nla && m_use_nra_model && m_nla->use_nra_model();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool solver::is_eq(theory_var v1, theory_var v2) {
|
bool solver::is_eq(theory_var v1, theory_var v2) {
|
||||||
if (use_nra_model()) {
|
if (use_nra_model()) {
|
||||||
return m_nla->am().eq(nl_value(v1, m_nla->tmp1()), nl_value(v2, m_nla->tmp2()));
|
return m_nla->am().eq(nl_value(v1, m_nla->tmp1()), nl_value(v2, m_nla->tmp2()));
|
||||||
}
|
}
|
||||||
|
@ -1005,6 +1005,8 @@ namespace arith {
|
||||||
IF_VERBOSE(12, verbose_stream() << "final-check " << lp().get_status() << "\n");
|
IF_VERBOSE(12, verbose_stream() << "final-check " << lp().get_status() << "\n");
|
||||||
SASSERT(lp().ax_is_correct());
|
SASSERT(lp().ax_is_correct());
|
||||||
|
|
||||||
|
m_use_nra_model = false;
|
||||||
|
|
||||||
if (!lp().is_feasible() || lp().has_changed_columns()) {
|
if (!lp().is_feasible() || lp().has_changed_columns()) {
|
||||||
switch (make_feasible()) {
|
switch (make_feasible()) {
|
||||||
case l_false:
|
case l_false:
|
||||||
|
@ -1042,6 +1044,7 @@ namespace arith {
|
||||||
|
|
||||||
switch (check_nla()) {
|
switch (check_nla()) {
|
||||||
case l_true:
|
case l_true:
|
||||||
|
m_use_nra_model = true;
|
||||||
break;
|
break;
|
||||||
case l_false:
|
case l_false:
|
||||||
return sat::check_result::CR_CONTINUE;
|
return sat::check_result::CR_CONTINUE;
|
||||||
|
@ -1056,6 +1059,9 @@ namespace arith {
|
||||||
return sat::check_result::CR_CONTINUE;
|
return sat::check_result::CR_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!check_delayed_eqs())
|
||||||
|
return sat::check_result::CR_CONTINUE;
|
||||||
|
|
||||||
if (!int_undef && !check_bv_terms())
|
if (!int_undef && !check_bv_terms())
|
||||||
return sat::check_result::CR_CONTINUE;
|
return sat::check_result::CR_CONTINUE;
|
||||||
|
|
||||||
|
@ -1141,6 +1147,7 @@ namespace arith {
|
||||||
new_eq_eh(e);
|
new_eq_eh(e);
|
||||||
else if (is_eq(e.v1(), e.v2())) {
|
else if (is_eq(e.v1(), e.v2())) {
|
||||||
mk_diseq_axiom(e.v1(), e.v2());
|
mk_diseq_axiom(e.v1(), e.v2());
|
||||||
|
TRACE("arith", tout << mk_bounded_pp(e.eq(), m) << " " << use_nra_model() << "\n");
|
||||||
found_diseq = true;
|
found_diseq = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1271,9 +1278,10 @@ namespace arith {
|
||||||
m_core.push_back(ctx.mk_literal(m.mk_eq(eq.first->get_expr(), eq.second->get_expr())));
|
m_core.push_back(ctx.mk_literal(m.mk_eq(eq.first->get_expr(), eq.second->get_expr())));
|
||||||
for (literal& c : m_core)
|
for (literal& c : m_core)
|
||||||
c.neg();
|
c.neg();
|
||||||
DEBUG_CODE(for (literal c : m_core) { SASSERT(s().value(c) != l_true); });
|
|
||||||
|
|
||||||
for (literal c : m_core) { VERIFY(s().value(c) != l_true); }
|
// it is possible if multiple lemmas are added at the same time.
|
||||||
|
if (any_of(m_core, [&](literal c) { return s().value(c) == l_true; }))
|
||||||
|
return;
|
||||||
|
|
||||||
add_redundant(m_core, explain(ty));
|
add_redundant(m_core, explain(ty));
|
||||||
}
|
}
|
||||||
|
@ -1511,6 +1519,7 @@ namespace arith {
|
||||||
case l_undef:
|
case l_undef:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
TRACE("arith", tout << "nla " << r << "\n");
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ namespace arith {
|
||||||
|
|
||||||
// non-linear arithmetic
|
// non-linear arithmetic
|
||||||
scoped_ptr<nla::solver> m_nla;
|
scoped_ptr<nla::solver> m_nla;
|
||||||
|
bool m_use_nra_model = false;
|
||||||
|
|
||||||
// integer arithmetic
|
// integer arithmetic
|
||||||
scoped_ptr<lp::int_solver> m_lia;
|
scoped_ptr<lp::int_solver> m_lia;
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace sls {
|
||||||
}
|
}
|
||||||
|
|
||||||
void solver::set_finished() {
|
void solver::set_finished() {
|
||||||
m.limit().cancel();
|
ctx.s().set_canceled();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned solver::get_num_bool_vars() const {
|
unsigned solver::get_num_bool_vars() const {
|
||||||
|
|
|
@ -104,8 +104,10 @@ namespace smt {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool context::get_cancel_flag() {
|
bool context::get_cancel_flag() {
|
||||||
if (l_true == m_sls_completed)
|
if (l_true == m_sls_completed && !m.limit().suspended()) {
|
||||||
|
m_last_search_failure = CANCELED;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (m.limit().inc())
|
if (m.limit().inc())
|
||||||
return false;
|
return false;
|
||||||
m_last_search_failure = CANCELED;
|
m_last_search_failure = CANCELED;
|
||||||
|
@ -3506,11 +3508,10 @@ namespace smt {
|
||||||
m_case_split_queue->display(tout << "case splits\n");
|
m_case_split_queue->display(tout << "case splits\n");
|
||||||
);
|
);
|
||||||
display_profile(verbose_stream());
|
display_profile(verbose_stream());
|
||||||
if (r == l_true && get_cancel_flag()) {
|
if (r == l_true && get_cancel_flag())
|
||||||
r = l_undef;
|
r = l_undef;
|
||||||
}
|
|
||||||
if (r == l_undef && m_sls_completed == l_true && has_sls_model()) {
|
if (r == l_undef && m_sls_completed == l_true && has_sls_model()) {
|
||||||
m.limit().reset_cancel();
|
m_last_search_failure = OK;
|
||||||
r = l_true;
|
r = l_true;
|
||||||
}
|
}
|
||||||
m_sls_completed = l_false;
|
m_sls_completed = l_false;
|
||||||
|
|
|
@ -38,11 +38,12 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void theory_sls::initialize_value(expr* t, expr* v) {
|
void theory_sls::initialize_value(expr* t, expr* v) {
|
||||||
ctx.user_propagate_initialize_value(t, v);
|
//ctx.user_propagate_initialize_value(t, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void theory_sls::force_phase(sat::literal lit) {
|
void theory_sls::force_phase(sat::literal lit) {
|
||||||
ctx.force_phase(lit);
|
//
|
||||||
|
// ctx.force_phase(lit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void theory_sls::set_has_new_best_phase(bool b) {
|
void theory_sls::set_has_new_best_phase(bool b) {
|
||||||
|
@ -108,7 +109,7 @@ namespace smt {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_smt_plugin->import_from_sls();
|
// m_smt_plugin->import_from_sls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void theory_sls::init() {
|
void theory_sls::init() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue