3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-10 03:07:07 +00:00

add diagnostics option to new arithmetic solver

This commit is contained in:
Nikolaj Bjorner 2024-01-22 16:23:19 -08:00
parent 839b7101ae
commit 8d4e7fac6b
4 changed files with 24 additions and 1 deletions

View file

@ -15,6 +15,8 @@ Author:
--*/
#include "util/cancel_eh.h"
#include "util/scoped_timer.h"
#include "ast/ast_util.h"
#include "ast/scoped_proof.h"
#include "sat/smt/euf_solver.h"
@ -242,4 +244,21 @@ namespace arith {
return m.mk_app(symbol(name), args.size(), args.data(), m.mk_proof_sort());
}
bool solver::validate_conflict() {
scoped_ptr<::solver> vs = mk_smt2_solver(m, ctx.s().params(), symbol::null);
for (auto lit : m_core)
vs->assert_expr(ctx.literal2expr(lit));
for (auto [a, b] : m_eqs)
vs->assert_expr(m.mk_eq(a->get_expr(), b->get_expr()));
cancel_eh<reslimit> eh(m.limit());
scoped_timer timer(1000, &eh);
bool result = l_true != vs->check_sat();
CTRACE("arith", !result, vs->display(tout));
CTRACE("arith", !result, s().display(tout));
SASSERT(result);
return result;
}
}

View file

@ -472,7 +472,7 @@ namespace arith {
bool _has_var = has_var(t);
mk_enode(t);
theory_var v = mk_evar(t);
if (!_has_var) {
svector<lpvar> vars;
for (expr* n : *t) {

View file

@ -1251,6 +1251,9 @@ namespace arith {
for (literal c : m_core) tout << c << ": " << literal2expr(c) << "\n";
for (auto p : m_eqs) tout << ctx.bpp(p.first) << " == " << ctx.bpp(p.second) << "\n";);
if (ctx.get_config().m_arith_validate)
VERIFY(validate_conflict());
if (is_conflict) {
DEBUG_CODE(
for (literal c : m_core) VERIFY(s().value(c) == l_true);

View file

@ -483,6 +483,7 @@ namespace arith {
arith_proof_hint const* explain_conflict(hint_type ty, sat::literal_vector const& core, euf::enode_pair_vector const& eqs);
void explain_assumptions(lp::explanation const& e);
bool validate_conflict();
public:
solver(euf::solver& ctx, theory_id id);