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

Fixed next_split call in pop (#6966)

* Give users ability to see if propagation failed

* Skip propagations in the new core if they are already satisfied

* Fix registration in final

* Don't make it too complicated...

* Fixed next_split when called in pop
Made delay_units available even without quantifiers

* Missing push calls before "decide"-callback
This commit is contained in:
Clemens Eisenhofer 2023-10-28 21:46:43 +02:00 committed by GitHub
parent 52d16a11f9
commit e7c17e68b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 32 deletions

View file

@ -4122,7 +4122,6 @@ namespace smt {
// Moreover, I backtrack only one level. // Moreover, I backtrack only one level.
bool delay_forced_restart = bool delay_forced_restart =
m_fparams.m_delay_units && m_fparams.m_delay_units &&
internalized_quantifiers() &&
num_lits == 1 && num_lits == 1 &&
conflict_lvl > m_search_lvl + 1 && conflict_lvl > m_search_lvl + 1 &&
!m.proofs_enabled() && !m.proofs_enabled() &&

View file

@ -79,7 +79,6 @@ void theory_user_propagator::add_expr(expr* term, bool ensure_enode) {
literal_vector explain; literal_vector explain;
if (ctx.is_fixed(n, r, explain)) if (ctx.is_fixed(n, r, explain))
m_prop.push_back(prop_info(explain, v, r)); m_prop.push_back(prop_info(explain, v, r));
} }
bool theory_user_propagator::propagate_cb( bool theory_user_propagator::propagate_cb(
@ -109,14 +108,19 @@ void theory_user_propagator::register_cb(expr* e) {
bool theory_user_propagator::next_split_cb(expr* e, unsigned idx, lbool phase) { bool theory_user_propagator::next_split_cb(expr* e, unsigned idx, lbool phase) {
if (e == nullptr) { // clear if (e == nullptr) { // clear
m_next_split_var = null_bool_var; m_next_split_var = nullptr;
return true;
}
if (!ctx.e_internalized(e)) {
// We may not eagerly internalize it (might crash when done in pop) => delay
m_next_split_var = e;
return true; return true;
} }
ensure_enode(e);
bool_var b = enode_to_bool(ctx.get_enode(e), idx); bool_var b = enode_to_bool(ctx.get_enode(e), idx);
if (b == null_bool_var || ctx.get_assignment(b) != l_undef) if (b == null_bool_var || ctx.get_assignment(b) != l_undef)
return false; return false;
m_next_split_var = b; m_next_split_var = e;
m_next_split_idx = idx;
m_next_split_phase = phase; m_next_split_phase = phase;
return true; return true;
} }
@ -237,6 +241,7 @@ void theory_user_propagator::decide(bool_var& var, bool& is_pos) {
// call the registered callback // call the registered callback
unsigned new_bit = original_bit; unsigned new_bit = original_bit;
force_push();
expr *e = var2expr(v); expr *e = var2expr(v);
m_decide_eh(m_user_context, this, e, new_bit, is_pos); m_decide_eh(m_user_context, this, e, new_bit, is_pos);
@ -252,12 +257,16 @@ void theory_user_propagator::decide(bool_var& var, bool& is_pos) {
} }
bool theory_user_propagator::get_case_split(bool_var& var, bool& is_pos) { bool theory_user_propagator::get_case_split(bool_var& var, bool& is_pos) {
if (m_next_split_var == null_bool_var) if (m_next_split_var == nullptr)
return false; return false;
ensure_enode(m_next_split_var);
var = m_next_split_var; bool_var b = enode_to_bool(ctx.get_enode(m_next_split_var), m_next_split_idx);
if (b == null_bool_var || ctx.get_assignment(b) != l_undef)
return false;
var = b;
is_pos = ctx.guess(var, m_next_split_phase); is_pos = ctx.guess(var, m_next_split_phase);
m_next_split_var = null_bool_var; m_next_split_var = nullptr;
m_next_split_idx = 0;
m_next_split_phase = l_undef; m_next_split_phase = l_undef;
return true; return true;
} }

View file

@ -83,7 +83,8 @@ namespace smt {
expr_ref_vector m_to_add; expr_ref_vector m_to_add;
unsigned_vector m_to_add_lim; unsigned_vector m_to_add_lim;
unsigned m_to_add_qhead = 0; unsigned m_to_add_qhead = 0;
bool_var m_next_split_var = null_bool_var; expr* m_next_split_var = nullptr;
unsigned m_next_split_idx = 0;
lbool m_next_split_phase = l_undef; lbool m_next_split_phase = l_undef;
expr* var2expr(theory_var v) { return m_var2expr.get(v); } expr* var2expr(theory_var v) { return m_var2expr.get(v); }