3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-02 03:36:53 +00:00

update model validate to include arithmetic

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2023-08-03 15:51:29 -07:00
parent 23da36126a
commit 4637339091
7 changed files with 39 additions and 10 deletions

View file

@ -3882,6 +3882,30 @@ public:
}
void validate_model(proto_model& mdl) {
rational r1, r2;
expr_ref res(m);
if (!m_model_is_initialized)
return;
for (unsigned v = 0; v < th.get_num_vars(); ++v) {
if (!is_registered_var(v))
continue;
enode* n = get_enode(v);
if (!n)
continue;
if (!th.is_relevant_and_shared(n))
continue;
rational r1 = get_value(v);
if (!mdl.eval(n->get_expr(), res, false))
continue;
if (!a.is_numeral(res, r2))
continue;
if (r1 != r2)
IF_VERBOSE(1, verbose_stream() << enode_pp(n, ctx()) << " evaluates to " << r2 << " but arith solver has " << r1 << "\n");
}
}
};
theory_lra::theory_lra(context& ctx):
@ -4009,6 +4033,10 @@ void theory_lra::setup() {
m_imp->setup();
}
void theory_lra::validate_model(proto_model& mdl) {
m_imp->validate_model(mdl);
}
}
template class lp::lp_bound_propagator<smt::theory_lra::imp>;
template void lp::lar_solver::propagate_bounds_for_touched_rows<smt::theory_lra::imp>(lp::lp_bound_propagator<smt::theory_lra::imp>&);