3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
This commit is contained in:
Nikolaj Bjorner 2021-06-05 15:44:47 -07:00
parent 1fd6b66ecc
commit df95ed64e0
4 changed files with 27 additions and 26 deletions

View file

@ -41,28 +41,28 @@ namespace euf {
const theory_id null_theory_id = -1; const theory_id null_theory_id = -1;
class enode { class enode {
expr* m_expr{ nullptr }; expr* m_expr = nullptr;
bool m_mark1{ false }; bool m_mark1 = false;
bool m_mark2{ false }; bool m_mark2 = false;
bool m_commutative{ false }; bool m_commutative = false;
bool m_update_children{ false }; bool m_update_children = false;
bool m_interpreted{ false }; bool m_interpreted = false;
bool m_merge_enabled{ true }; bool m_merge_enabled = true;
bool m_is_equality{ false }; // Does the expression represent an equality bool m_is_equality = false; // Does the expression represent an equality
lbool m_value; // Assignment by SAT solver for Boolean node lbool m_value = l_undef; // Assignment by SAT solver for Boolean node
unsigned m_bool_var { UINT_MAX }; // SAT solver variable associated with Boolean node unsigned m_bool_var = UINT_MAX; // SAT solver variable associated with Boolean node
unsigned m_class_size{ 1 }; // Size of the equivalence class if the enode is the root. unsigned m_class_size = 1; // Size of the equivalence class if the enode is the root.
unsigned m_table_id{ UINT_MAX }; unsigned m_table_id = UINT_MAX;
unsigned m_generation { 0 }; // Tracks how many quantifier instantiation rounds were needed to generate this enode. unsigned m_generation = 0; // Tracks how many quantifier instantiation rounds were needed to generate this enode.
enode_vector m_parents; enode_vector m_parents;
enode* m_next { nullptr }; enode* m_next = nullptr;
enode* m_root { nullptr }; enode* m_root = nullptr;
enode* m_target { nullptr }; enode* m_target = nullptr;
enode* m_cg { nullptr }; enode* m_cg = nullptr;
th_var_list m_th_vars; th_var_list m_th_vars;
justification m_justification; justification m_justification;
unsigned m_num_args{ 0 }; unsigned m_num_args = 0;
signed char m_lbl_hash { -1 }; // It is different from -1, if enode is used in a pattern signed char m_lbl_hash = -1; // It is different from -1, if enode is used in a pattern
approx_set m_lbls; approx_set m_lbls;
approx_set m_plbls; approx_set m_plbls;
enode* m_args[0]; enode* m_args[0];

View file

@ -229,11 +229,12 @@ namespace q {
TRACE("q", tout << "on-binding " << mk_pp(q, m) << "\n";); TRACE("q", tout << "on-binding " << mk_pp(q, m) << "\n";);
unsigned idx = m_q2clauses[q]; unsigned idx = m_q2clauses[q];
clause& c = *m_clauses[idx]; clause& c = *m_clauses[idx];
if (!propagate(_binding, max_generation, c)) bool new_propagation = false;
if (!propagate(_binding, max_generation, c, new_propagation))
add_binding(c, pat, _binding, max_generation, min_gen, max_gen); add_binding(c, pat, _binding, max_generation, min_gen, max_gen);
} }
bool ematch::propagate(euf::enode* const* binding, unsigned max_generation, clause& c) { bool ematch::propagate(euf::enode* const* binding, unsigned max_generation, clause& c, bool& propagated) {
TRACE("q", c.display(ctx, tout) << "\n";); TRACE("q", c.display(ctx, tout) << "\n";);
unsigned idx = UINT_MAX; unsigned idx = UINT_MAX;
lbool ev = m_eval(binding, c, idx); lbool ev = m_eval(binding, c, idx);
@ -260,6 +261,7 @@ namespace q {
++m_stats.m_num_propagations; ++m_stats.m_num_propagations;
ctx.propagate(instantiate(c, binding, c[idx]), j_idx); ctx.propagate(instantiate(c, binding, c[idx]), j_idx);
} }
propagated = true;
return true; return true;
} }
@ -479,10 +481,8 @@ namespace q {
continue; continue;
do { do {
if (propagate(b->m_nodes, b->m_max_generation, c)) { if (propagate(b->m_nodes, b->m_max_generation, c, propagated))
to_remove.push_back(b); to_remove.push_back(b);
propagated = true;
}
else if (flush) { else if (flush) {
instantiate(*b, c); instantiate(*b, c);
to_remove.push_back(b); to_remove.push_back(b);

View file

@ -130,7 +130,7 @@ namespace q {
void add_instantiation(clause& c, binding& b, sat::literal lit); void add_instantiation(clause& c, binding& b, sat::literal lit);
bool propagate(euf::enode* const* binding, unsigned max_generation, clause& c); bool propagate(euf::enode* const* binding, unsigned max_generation, clause& c, bool& new_propagation);
std::ostream& display(std::ostream& out) const; std::ostream& display(std::ostream& out) const;

View file

@ -145,7 +145,8 @@ namespace q {
ent.m_instantiated = true; ent.m_instantiated = true;
unsigned gen = get_new_gen(f, ent.m_cost); unsigned gen = get_new_gen(f, ent.m_cost);
if (em.propagate(f.nodes(), gen, *f.c)) bool new_propagation = false;
if (em.propagate(f.nodes(), gen, *f.c, new_propagation))
return; return;
auto* ebindings = m_subst(q, num_bindings); auto* ebindings = m_subst(q, num_bindings);