mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
User Propagator: Return if propagated lemma is redundant (#6791)
* Give users ability to see if propagation failed * Skip propagations in the new core if they are already satisfied
This commit is contained in:
parent
f5c069f899
commit
4cb158a79b
10 changed files with 48 additions and 31 deletions
|
@ -43,15 +43,19 @@ namespace user_solver {
|
|||
m_prop.push_back(prop_info(explain, v, r));
|
||||
}
|
||||
|
||||
void solver::propagate_cb(
|
||||
unsigned num_fixed, expr* const* fixed_ids,
|
||||
unsigned num_eqs, expr* const* eq_lhs, expr* const* eq_rhs,
|
||||
expr* conseq) {
|
||||
bool solver::propagate_cb(
|
||||
unsigned num_fixed, expr* const* fixed_ids,
|
||||
unsigned num_eqs, expr* const* eq_lhs, expr* const* eq_rhs,
|
||||
expr* conseq) {
|
||||
auto* n = ctx.get_enode(conseq);
|
||||
if (n && s().value(ctx.enode2literal(n)) == l_true)
|
||||
return false;
|
||||
m_fixed_ids.reset();
|
||||
for (unsigned i = 0; i < num_fixed; ++i)
|
||||
m_fixed_ids.push_back(get_th_var(fixed_ids[i]));
|
||||
m_prop.push_back(prop_info(num_fixed, m_fixed_ids.data(), num_eqs, eq_lhs, eq_rhs, expr_ref(conseq, m)));
|
||||
DEBUG_CODE(validate_propagation(););
|
||||
return true;
|
||||
}
|
||||
|
||||
void solver::register_cb(expr* e) {
|
||||
|
@ -76,7 +80,7 @@ namespace user_solver {
|
|||
|
||||
sat::check_result solver::check() {
|
||||
if (!(bool)m_final_eh)
|
||||
return sat::check_result::CR_DONE;
|
||||
return sat::check_result::CR_DONE;
|
||||
unsigned sz = m_prop.size();
|
||||
m_final_eh(m_user_context, this);
|
||||
return sz == m_prop.size() ? sat::check_result::CR_DONE : sat::check_result::CR_CONTINUE;
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace user_solver {
|
|||
|
||||
bool has_fixed() const { return (bool)m_fixed_eh; }
|
||||
|
||||
void propagate_cb(unsigned num_fixed, expr* const* fixed_ids, unsigned num_eqs, expr* const* lhs, expr* const* rhs, expr* conseq) override;
|
||||
bool propagate_cb(unsigned num_fixed, expr* const* fixed_ids, unsigned num_eqs, expr* const* lhs, expr* const* rhs, expr* conseq) override;
|
||||
void register_cb(expr* e) override;
|
||||
bool next_split_cb(expr* e, unsigned idx, lbool phase) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue