3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-11 05:30:51 +00:00

fix model bugs

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-01-13 16:12:59 -08:00
parent 4b112d52df
commit 4adb24ede5
10 changed files with 79 additions and 73 deletions

View file

@ -533,11 +533,11 @@ private:
TRACE("sat", g->display_with_dependencies(tout););
// ensure that if goal is already internalized, then import mc from m_solver.
if (!m_sat_mc) m_sat_mc = alloc(sat2goal::mc, m);
m_sat_mc->flush_smc(m_solver);
m_goal2sat(*g, m_params, m_solver, m_map, dep2asm, is_incremental(), is_lemma);
m_goal2sat.get_interpreted_atoms(atoms);
if (!m_sat_mc) m_sat_mc = alloc(sat2goal::mc, m);
m_sat_mc->flush_smc(m_solver, m_map);
if (!atoms.empty()) {
std::stringstream strm;
strm << "interpreted atoms sent to SAT solver " << atoms;
@ -796,18 +796,22 @@ private:
if (m_mc0) {
(*m_mc0)(m_model);
}
SASSERT(m_model);
TRACE("sat", model_smt2_pp(tout, m, *m_model, 0););
DEBUG_CODE(
for (expr * f : m_fmls) {
expr_ref tmp(m);
if (m_model->eval(f, tmp, true)) {
CTRACE("sat", !m.is_true(tmp),
tout << "Evaluation failed: " << mk_pp(f, m) << " to " << tmp << "\n";
model_smt2_pp(tout, m, *(m_model.get()), 0););
SASSERT(m.is_true(tmp));
IF_VERBOSE(0, verbose_stream() << "Verifying solution\n";);
for (expr * f : m_fmls) {
expr_ref tmp(m);
if (m_model->eval(f, tmp, true)) {
CTRACE("sat", !m.is_true(tmp),
tout << "Evaluation failed: " << mk_pp(f, m) << " to " << mk_pp(f, m) << "\n";
model_smt2_pp(tout, m, *(m_model.get()), 0););
if (!m.is_true(tmp)) {
IF_VERBOSE(0, verbose_stream() << "failed to verify: " << tmp << "\n";);
IF_VERBOSE(0, verbose_stream() << m_params << "\n";);
}
});
VERIFY(m.is_true(tmp));
}
}
}
};