mirror of
https://github.com/Z3Prover/z3
synced 2025-07-18 10:30:44 +00:00
fix to arithmetic internalize for multiplier
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
05f63277cf
commit
9c4003d12e
4 changed files with 16 additions and 8 deletions
|
@ -521,12 +521,17 @@ namespace euf {
|
||||||
core_solver->assert_expr(m.mk_not(mk_or(clause)));
|
core_solver->assert_expr(m.mk_not(mk_or(clause)));
|
||||||
lbool ch = core_solver->check_sat(assumptions);
|
lbool ch = core_solver->check_sat(assumptions);
|
||||||
std::cout << "failed to verify\n" << clause << "\n";
|
std::cout << "failed to verify\n" << clause << "\n";
|
||||||
|
std::cout << "check result: " << ch << "\n";
|
||||||
|
|
||||||
if (ch == l_false) {
|
if (ch == l_false) {
|
||||||
core_solver->get_unsat_core(core);
|
core_solver->get_unsat_core(core);
|
||||||
std::cout << "core\n";
|
std::cout << "core\n";
|
||||||
for (expr* f : core)
|
for (expr* f : core)
|
||||||
std::cout << mk_pp(f, m) << "\n";
|
std::cout << mk_pp(f, m) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
SASSERT(false);
|
SASSERT(false);
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace smt {
|
||||||
if (!is_relevant(lit)) out << " n ";
|
if (!is_relevant(lit)) out << " n ";
|
||||||
out << ": ";
|
out << ": ";
|
||||||
display_verbose(out, m, 1, &lit, m_bool_var2expr.data());
|
display_verbose(out, m, 1, &lit, m_bool_var2expr.data());
|
||||||
if (level > 0) {
|
if (level > 0 || true) {
|
||||||
auto j = get_justification(lit.var());
|
auto j = get_justification(lit.var());
|
||||||
display(out << " ", j);
|
display(out << " ", j);
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ namespace smt {
|
||||||
literal_vector lits;
|
literal_vector lits;
|
||||||
const_cast<conflict_resolution&>(*m_conflict_resolution).justification2literals(j.get_justification(), lits);
|
const_cast<conflict_resolution&>(*m_conflict_resolution).justification2literals(j.get_justification(), lits);
|
||||||
out << "justification " << j.get_justification()->get_from_theory() << ": ";
|
out << "justification " << j.get_justification()->get_from_theory() << ": ";
|
||||||
// display_literals_smt2(out, lits);
|
display_literals_smt2(out, lits);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -390,6 +390,7 @@ namespace smt {
|
||||||
if (v == null_theory_var) {
|
if (v == null_theory_var) {
|
||||||
v = mk_var(e);
|
v = mk_var(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ class theory_lra::imp {
|
||||||
if (a.is_extended_numeral(arg2, val))
|
if (a.is_extended_numeral(arg2, val))
|
||||||
std::swap(arg1, arg2);
|
std::swap(arg1, arg2);
|
||||||
if (a.is_extended_numeral(arg1, val)) {
|
if (a.is_extended_numeral(arg1, val)) {
|
||||||
st.add(internalize_term_core(to_app(arg2)), val);
|
st.add(internalize_term_core(to_app(arg2)), sign * val);
|
||||||
if (reflect(arg)) {
|
if (reflect(arg)) {
|
||||||
internalize_term_core(to_app(arg1));
|
internalize_term_core(to_app(arg1));
|
||||||
mk_enode(arg);
|
mk_enode(arg);
|
||||||
|
@ -386,7 +386,8 @@ class theory_lra::imp {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
st.add(internalize_term_core(arg), sign);
|
else
|
||||||
|
st.add(internalize_term_core(arg), sign);
|
||||||
}
|
}
|
||||||
|
|
||||||
theory_var internalize_numeral(app* n, rational const& val) {
|
theory_var internalize_numeral(app* n, rational const& val) {
|
||||||
|
@ -1326,7 +1327,7 @@ public:
|
||||||
n1->get_th_var(get_id()) != null_theory_var &&
|
n1->get_th_var(get_id()) != null_theory_var &&
|
||||||
n2->get_th_var(get_id()) != null_theory_var && n1 != n2) {
|
n2->get_th_var(get_id()) != null_theory_var && n1 != n2) {
|
||||||
// verbose_stream() << "ineq\n";
|
// verbose_stream() << "ineq\n";
|
||||||
m_arith_eq_adapter.mk_axioms(n1, n2);
|
// m_arith_eq_adapter.mk_axioms(n1, n2);
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// verbose_stream() << "skip\n";
|
// verbose_stream() << "skip\n";
|
||||||
|
@ -2120,7 +2121,6 @@ public:
|
||||||
result = final_check_core();
|
result = final_check_core();
|
||||||
TRACE("arith", tout << "result: " << result << "\n";);
|
TRACE("arith", tout << "result: " << result << "\n";);
|
||||||
if (result == FC_DONE) {
|
if (result == FC_DONE) {
|
||||||
verbose_stream() << "second round\n";
|
|
||||||
validate_solution();
|
validate_solution();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -2247,7 +2247,7 @@ public:
|
||||||
}
|
}
|
||||||
if (st == FC_DONE) {
|
if (st == FC_DONE) {
|
||||||
if (assume_eqs()) {
|
if (assume_eqs()) {
|
||||||
verbose_stream() << "not done\n";
|
// verbose_stream() << "not done\n";
|
||||||
return FC_CONTINUE;
|
return FC_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2939,6 +2939,7 @@ public:
|
||||||
literal_vector m_core2;
|
literal_vector m_core2;
|
||||||
|
|
||||||
void assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs, vector<parameter> const& params) {
|
void assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs, vector<parameter> const& params) {
|
||||||
|
TRACE("arith", tout << lit << " <- " << core << " #eqs " << eqs.size() << "\n");
|
||||||
if (core.size() < small_lemma_size() && eqs.empty()) {
|
if (core.size() < small_lemma_size() && eqs.empty()) {
|
||||||
m_core2.reset();
|
m_core2.reset();
|
||||||
for (auto const& c : core) {
|
for (auto const& c : core) {
|
||||||
|
@ -3805,7 +3806,8 @@ public:
|
||||||
for (auto const& p : m_params) tout << " " << p;
|
for (auto const& p : m_params) tout << " " << p;
|
||||||
tout << "\n";
|
tout << "\n";
|
||||||
display_evidence(tout, m_explanation);
|
display_evidence(tout, m_explanation);
|
||||||
display(tout << "is-conflict: " << is_conflict << "\n"););
|
//display(tout << "is-conflict: " << is_conflict << "\n");
|
||||||
|
);
|
||||||
|
|
||||||
TRACE("arith_conflict",
|
TRACE("arith_conflict",
|
||||||
display_evidence(tout, m_explanation);
|
display_evidence(tout, m_explanation);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue