3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-21 07:54:42 +00:00

use structured proof hints

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-05-28 09:37:41 -07:00
parent 7da9f12521
commit dd46224a1d
10 changed files with 233 additions and 63 deletions

View file

@ -39,6 +39,8 @@ namespace arith {
lp().settings().set_random_seed(get_config().m_random_seed);
m_lia = alloc(lp::int_solver, *m_solver.get());
m_farkas2.m_ty = sat::hint_type::farkas_h;
m_farkas2.m_literals.resize(2);
}
solver::~solver() {
@ -195,7 +197,13 @@ namespace arith {
reset_evidence();
m_core.push_back(lit1);
TRACE("arith", tout << lit2 << " <- " << m_core << "\n";);
assign(lit2, m_core, m_eqs, "farkas 1 1");
sat::proof_hint* ph = nullptr;
if (ctx.use_drat()) {
ph = &m_farkas2;
m_farkas2.m_literals[0] = std::make_pair(rational(1), lit1);
m_farkas2.m_literals[1] = std::make_pair(rational(1), lit2);
}
assign(lit2, m_core, m_eqs, ph);
++m_stats.m_bounds_propagations;
}
@ -255,7 +263,7 @@ namespace arith {
TRACE("arith", for (auto lit : m_core) tout << lit << ": " << s().value(lit) << "\n";);
DEBUG_CODE(for (auto lit : m_core) { VERIFY(s().value(lit) == l_true); });
++m_stats.m_bound_propagations1;
assign(lit, m_core, m_eqs, bounds_pragma());
assign(lit, m_core, m_eqs, explain(sat::hint_type::bound_h));
}
if (should_refine_bounds() && first)
@ -370,7 +378,7 @@ namespace arith {
reset_evidence();
m_explanation.clear();
lp().explain_implied_bound(be, m_bp);
assign(bound, m_core, m_eqs, nullptr);
assign(bound, m_core, m_eqs, explain(sat::hint_type::bound_h));
}
@ -1169,7 +1177,7 @@ namespace arith {
app_ref b = mk_bound(m_lia->get_term(), m_lia->get_offset(), !m_lia->is_upper());
IF_VERBOSE(4, verbose_stream() << "cut " << b << "\n");
literal lit = expr2literal(b);
assign(lit, m_core, m_eqs, nullptr);
assign(lit, m_core, m_eqs, explain(sat::hint_type::cut_h));
lia_check = l_false;
break;
}
@ -1191,7 +1199,7 @@ namespace arith {
return lia_check;
}
void solver::assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs, char const* pma) {
void solver::assign(literal lit, literal_vector const& core, svector<enode_pair> const& eqs, sat::proof_hint const* pma) {
if (core.size() < small_lemma_size() && eqs.empty()) {
m_core2.reset();
for (auto const& c : core)
@ -1238,7 +1246,7 @@ namespace arith {
for (literal& c : m_core)
c.neg();
add_clause(m_core);
add_clause(m_core, explain(sat::hint_type::farkas_h));
}
bool solver::is_infeasible() const {