Skip to content

Commit 75005d9

Browse files
add validation option for debugging regressions
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent 2934618 commit 75005d9

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

src/smt/params/smt_params_helper.pyg

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

src/smt/params/theory_arith_params.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void theory_arith_params::updt_params(params_ref const & _p) {
3636
m_arith_bound_prop = static_cast<bound_prop_mode>(p.arith_propagation_mode());
3737
m_arith_eager_eq_axioms = p.arith_eager_eq_axioms();
3838
m_arith_auto_config_simplex = p.arith_auto_config_simplex();
39+
m_arith_validate = p.arith_validate();
3940
m_nl_arith_propagate_linear_monomials = p.arith_nl_propagate_linear_monomials();
4041
m_nl_arith_optimize_bounds = p.arith_nl_optimize_bounds();
4142
m_nl_arith_cross_nested = p.arith_nl_cross_nested();
@@ -95,4 +96,5 @@ void theory_arith_params::display(std::ostream & out) const {
9596
DISPLAY_PARAM(m_nl_arith_propagate_linear_monomials);
9697
DISPLAY_PARAM(m_nl_arith_optimize_bounds);
9798
DISPLAY_PARAM(m_nl_arith_cross_nested);
99+
DISPLAY_PARAM(m_arith_validate);
98100
}

src/smt/params/theory_arith_params.h

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct theory_arith_params {
8282
bool m_arith_adaptive_gcd = false;
8383
unsigned m_arith_propagation_threshold = UINT_MAX;
8484

85+
bool m_arith_validate = false;
8586
arith_pivot_strategy m_arith_pivot_strategy = arith_pivot_strategy::ARITH_PIVOT_SMALLEST;
8687

8788
// used in diff-logic

src/smt/theory_lra.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,9 @@ class theory_lra::imp {
23892389

23902390
literal_vector m_core2;
23912391

2392-
void assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs, vector<parameter> const& params) {
2392+
void assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs, vector<parameter> const& ps) {
2393+
if (params().m_arith_validate)
2394+
VERIFY(validate_assign(lit, core, eqs));
23932395
if (core.size() < small_lemma_size() && eqs.empty()) {
23942396
m_core2.reset();
23952397
for (auto const& c : core) {
@@ -2399,7 +2401,7 @@ class theory_lra::imp {
23992401
justification * js = nullptr;
24002402
if (proofs_enabled()) {
24012403
js = alloc(theory_lemma_justification, get_id(), ctx(), m_core2.size(), m_core2.data(),
2402-
params.size(), params.data());
2404+
ps.size(), ps.data());
24032405
}
24042406
ctx().mk_clause(m_core2.size(), m_core2.data(), js, CLS_TH_LEMMA, nullptr);
24052407
}
@@ -2408,7 +2410,7 @@ class theory_lra::imp {
24082410
lit, ctx().mk_justification(
24092411
ext_theory_propagation_justification(
24102412
get_id(), ctx(), core.size(), core.data(),
2411-
eqs.size(), eqs.data(), lit, params.size(), params.data())));
2413+
eqs.size(), eqs.data(), lit, ps.size(), ps.data())));
24122414
}
24132415
}
24142416

@@ -3138,7 +3140,8 @@ class theory_lra::imp {
31383140
std::function<expr*(void)> fn = [&]() { return m.mk_eq(x->get_expr(), y->get_expr()); };
31393141
scoped_trace_stream _sts(th, fn);
31403142

3141-
// VERIFY(validate_eq(x, y));
3143+
if (params().m_arith_validate)
3144+
VERIFY(validate_eq(x, y));
31423145
ctx().assign_eq(x, y, eq_justification(js));
31433146
}
31443147

@@ -3252,8 +3255,9 @@ class theory_lra::imp {
32523255
for (auto ev : m_explanation)
32533256
set_evidence(ev.ci(), m_core, m_eqs);
32543257

3255-
3256-
// VERIFY(validate_conflict(m_core, m_eqs));
3258+
3259+
if (params().m_arith_validate)
3260+
VERIFY(validate_conflict(m_core, m_eqs));
32573261
if (is_conflict) {
32583262
ctx().set_conflict(
32593263
ctx().mk_justification(

0 commit comments

Comments
 (0)