mirror of
https://github.com/Z3Prover/z3
synced 2025-10-03 14:33:56 +00:00
new core perf - add merge_tf and enable_cgc distinction
perf fix for propagation behavior for equalities in the new core. The old behavior was not to allow congruence closure on equalities. The new behavior is to just not allow merging tf with equalities unless they appear somewhere in a foreign context (not under a Boolean operator) The change re-surfaces merge_tf and enable_cgc distinction from the old core. They can both be turned on or off. merge_enabled renamed to cgc_enabled The change is highly likely to introduce regressions in the new core. Change propagation of literals from congruence: - track antecedent enode. There are four ways to propagate literals from the egraph. - the literal is an equality and the two arguments are congruent - the antecedent is merged with node n and the antecedent has a Boolean variable assignment. - the antecedent is true or false, they are merged. - the merge_tf flag is toggled to true but the node n has not been merged with true/false
This commit is contained in:
parent
11b712fee0
commit
22353c2d6c
10 changed files with 177 additions and 132 deletions
|
@ -48,7 +48,8 @@ namespace euf {
|
|||
bool m_mark3 = false;
|
||||
bool m_commutative = false;
|
||||
bool m_interpreted = false;
|
||||
bool m_merge_enabled = true;
|
||||
bool m_cgc_enabled = true;
|
||||
bool m_merge_tf_enabled = false;
|
||||
bool m_is_equality = false; // Does the expression represent an equality
|
||||
bool m_is_relevant = false;
|
||||
lbool m_value = l_undef; // Assignment by SAT solver for Boolean node
|
||||
|
@ -91,7 +92,7 @@ namespace euf {
|
|||
n->m_generation = generation,
|
||||
n->m_commutative = num_args == 2 && is_app(f) && to_app(f)->get_decl()->is_commutative();
|
||||
n->m_num_args = num_args;
|
||||
n->m_merge_enabled = true;
|
||||
n->m_cgc_enabled = true;
|
||||
for (unsigned i = 0; i < num_args; ++i) {
|
||||
SASSERT(to_app(f)->get_arg(i) == args[i]->get_expr());
|
||||
n->m_args[i] = args[i];
|
||||
|
@ -107,7 +108,7 @@ namespace euf {
|
|||
n->m_root = n;
|
||||
n->m_commutative = true;
|
||||
n->m_num_args = 2;
|
||||
n->m_merge_enabled = true;
|
||||
n->m_cgc_enabled = true;
|
||||
for (unsigned i = 0; i < num_args; ++i)
|
||||
n->m_args[i] = nullptr;
|
||||
return n;
|
||||
|
@ -121,7 +122,7 @@ namespace euf {
|
|||
n->m_root = n;
|
||||
n->m_commutative = true;
|
||||
n->m_num_args = 2;
|
||||
n->m_merge_enabled = true;
|
||||
n->m_cgc_enabled = true;
|
||||
for (unsigned i = 0; i < num_args; ++i)
|
||||
n->m_args[i] = nullptr;
|
||||
return n;
|
||||
|
@ -132,7 +133,8 @@ namespace euf {
|
|||
void add_th_var(theory_var v, theory_id id, region & r) { m_th_vars.add_var(v, id, r); }
|
||||
void replace_th_var(theory_var v, theory_id id) { m_th_vars.replace(v, id); }
|
||||
void del_th_var(theory_id id) { m_th_vars.del_var(id); }
|
||||
void set_merge_enabled(bool m) { m_merge_enabled = m; }
|
||||
void set_cgc_enabled(bool m) { m_cgc_enabled = m; }
|
||||
void set_merge_tf(bool m) { m_merge_tf_enabled = m; }
|
||||
void set_value(lbool v) { m_value = v; }
|
||||
void set_justification(justification j) { m_justification = j; }
|
||||
void set_is_equality() { m_is_equality = true; }
|
||||
|
@ -152,14 +154,13 @@ namespace euf {
|
|||
bool is_relevant() const { return m_is_relevant; }
|
||||
void set_relevant(bool b) { m_is_relevant = b; }
|
||||
lbool value() const { return m_value; }
|
||||
bool value_conflict() const { return value() != l_undef && get_root()->value() != l_undef && value() != get_root()->value(); }
|
||||
sat::bool_var bool_var() const { return m_bool_var; }
|
||||
bool is_cgr() const { return this == m_cg; }
|
||||
enode* get_cg() const { return m_cg; }
|
||||
bool commutative() const { return m_commutative; }
|
||||
void mark_interpreted() { SASSERT(num_args() == 0); m_interpreted = true; }
|
||||
bool merge_enabled() const { return m_merge_enabled; }
|
||||
bool merge_tf() const { return merge_enabled() && (class_size() > 1 || num_parents() > 0 || num_args() > 0); }
|
||||
bool cgc_enabled() const { return m_cgc_enabled; }
|
||||
bool merge_tf() const { return m_merge_tf_enabled && (class_size() > 1 || num_parents() > 0 || num_args() > 0); }
|
||||
|
||||
enode* get_arg(unsigned i) const { SASSERT(i < num_args()); return m_args[i]; }
|
||||
unsigned hash() const { return m_expr->get_id(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue