3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-12 22:20:54 +00:00

smarter explanation.h (#4385)

* smarter explanation.h

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

* clean explanation API

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

* suppress warnings

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

* disable the warnings

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2020-05-19 12:38:44 -07:00 committed by GitHub
parent 3b0c40044f
commit af2f74c05f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 109 additions and 89 deletions

View file

@ -2018,11 +2018,11 @@ public:
}
}
for (auto const& ev : ex) {
lp().constraints().display(out << ev.first << ": ", ev.second);
lp().constraints().display(out << ev.coeff() << ": ", ev.ci());
}
expr_ref_vector fmls(m);
for (auto const& ev : ex) {
fmls.push_back(constraint2fml(ev.second));
fmls.push_back(constraint2fml(ev.ci()));
}
expr_ref t(term2expr(term), m);
if (upper) {
@ -2081,9 +2081,7 @@ public:
// m_explanation implies term <= k
reset_evidence();
for (auto const& ev : m_explanation) {
if (!ev.first.is_zero()) {
set_evidence(ev.second, m_core, m_eqs);
}
set_evidence(ev.ci(), m_core, m_eqs);
}
// The call mk_bound() can set the m_infeasible_column in lar_solver
// so the explanation is safer to take before this call.
@ -2335,7 +2333,7 @@ public:
void consume(rational const& v, lp::constraint_index j) override {
m_imp.set_evidence(j, m_imp.m_core, m_imp.m_eqs);
m_imp.m_explanation.push_justification(j, v);
m_imp.m_explanation.add_with_coeff(j, v);
}
};
@ -3273,9 +3271,7 @@ public:
TRACE("arith", tout << "scope: " << ctx().get_scope_level() << "\n"; display_evidence(tout, m_explanation); );
TRACE("arith", display(tout << "is-conflict: " << is_conflict << "\n"););
for (auto const& ev : m_explanation) {
if (!ev.first.is_zero()) {
set_evidence(ev.second, m_core, m_eqs);
}
set_evidence(ev.ci(), m_core, m_eqs);
}
// SASSERT(validate_conflict(m_core, m_eqs));
dump_conflict(m_core, m_eqs);
@ -3785,11 +3781,11 @@ public:
void display_evidence(std::ostream& out, lp::explanation const& evidence) {
for (auto const& ev : evidence) {
expr_ref e(m);
SASSERT(!ev.first.is_zero());
if (ev.first.is_zero()) {
SASSERT(!ev.coeff().is_zero());
if (ev.coeff().is_zero()) {
continue;
}
unsigned idx = ev.second;
unsigned idx = ev.ci();
switch (m_constraint_sources.get(idx, null_source)) {
case inequality_source: {
literal lit = m_inequalities[idx];
@ -3816,7 +3812,7 @@ public:
}
}
for (auto const& ev : evidence) {
lp().constraints().display(out << ev.first << ": ", ev.second);
lp().constraints().display(out << ev.coeff() << ": ", ev.ci());
}
}