3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 18:31:49 +00:00

add validation option for debugging regressions

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2024-01-09 09:18:29 -08:00
parent 2934618c50
commit 75005d9077
4 changed files with 14 additions and 6 deletions

View file

@ -99,6 +99,7 @@ def_module_params(module_name='smt',
('arith.enable_hnf', BOOL, True, 'enable hnf (Hermite Normal Form) cuts'),
('arith.bprop_on_pivoted_rows', BOOL, True, 'propagate bounds on rows changed by the pivot operation'),
('arith.print_ext_var_names', BOOL, False, 'print external variable names'),
('arith.validate', BOOL, False, 'validate lemmas generated by arithmetic solver'),
('pb.conflict_frequency', UINT, 1000, 'conflict frequency for Pseudo-Boolean theory'),
('pb.learn_complements', BOOL, True, 'learn complement literals for Pseudo-Boolean theory'),
('array.weak', BOOL, False, 'weak array theory'),

View file

@ -36,6 +36,7 @@ void theory_arith_params::updt_params(params_ref const & _p) {
m_arith_bound_prop = static_cast<bound_prop_mode>(p.arith_propagation_mode());
m_arith_eager_eq_axioms = p.arith_eager_eq_axioms();
m_arith_auto_config_simplex = p.arith_auto_config_simplex();
m_arith_validate = p.arith_validate();
m_nl_arith_propagate_linear_monomials = p.arith_nl_propagate_linear_monomials();
m_nl_arith_optimize_bounds = p.arith_nl_optimize_bounds();
m_nl_arith_cross_nested = p.arith_nl_cross_nested();
@ -95,4 +96,5 @@ void theory_arith_params::display(std::ostream & out) const {
DISPLAY_PARAM(m_nl_arith_propagate_linear_monomials);
DISPLAY_PARAM(m_nl_arith_optimize_bounds);
DISPLAY_PARAM(m_nl_arith_cross_nested);
DISPLAY_PARAM(m_arith_validate);
}

View file

@ -82,6 +82,7 @@ struct theory_arith_params {
bool m_arith_adaptive_gcd = false;
unsigned m_arith_propagation_threshold = UINT_MAX;
bool m_arith_validate = false;
arith_pivot_strategy m_arith_pivot_strategy = arith_pivot_strategy::ARITH_PIVOT_SMALLEST;
// used in diff-logic

View file

@ -2389,7 +2389,9 @@ public:
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& ps) {
if (params().m_arith_validate)
VERIFY(validate_assign(lit, core, eqs));
if (core.size() < small_lemma_size() && eqs.empty()) {
m_core2.reset();
for (auto const& c : core) {
@ -2399,7 +2401,7 @@ public:
justification * js = nullptr;
if (proofs_enabled()) {
js = alloc(theory_lemma_justification, get_id(), ctx(), m_core2.size(), m_core2.data(),
params.size(), params.data());
ps.size(), ps.data());
}
ctx().mk_clause(m_core2.size(), m_core2.data(), js, CLS_TH_LEMMA, nullptr);
}
@ -2408,7 +2410,7 @@ public:
lit, ctx().mk_justification(
ext_theory_propagation_justification(
get_id(), ctx(), core.size(), core.data(),
eqs.size(), eqs.data(), lit, params.size(), params.data())));
eqs.size(), eqs.data(), lit, ps.size(), ps.data())));
}
}
@ -3138,7 +3140,8 @@ public:
std::function<expr*(void)> fn = [&]() { return m.mk_eq(x->get_expr(), y->get_expr()); };
scoped_trace_stream _sts(th, fn);
// VERIFY(validate_eq(x, y));
if (params().m_arith_validate)
VERIFY(validate_eq(x, y));
ctx().assign_eq(x, y, eq_justification(js));
}
@ -3252,8 +3255,9 @@ public:
for (auto ev : m_explanation)
set_evidence(ev.ci(), m_core, m_eqs);
// VERIFY(validate_conflict(m_core, m_eqs));
if (params().m_arith_validate)
VERIFY(validate_conflict(m_core, m_eqs));
if (is_conflict) {
ctx().set_conflict(
ctx().mk_justification(