mirror of
https://github.com/Z3Prover/z3
synced 2025-08-24 12:07:52 +00:00
merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
85eacf9bb1
9 changed files with 64 additions and 11 deletions
|
@ -243,7 +243,7 @@ namespace smt {
|
|||
lit.neg();
|
||||
|
||||
literal lit = mk_diseq(k, v);
|
||||
literals.push_back(lit);
|
||||
literals.push_back(~lit);
|
||||
mk_clause(literals.size(), literals.data(), nullptr);
|
||||
TRACE("context", display_literals_verbose(tout, literals.size(), literals.data()););
|
||||
}
|
||||
|
|
|
@ -560,6 +560,7 @@ namespace smt {
|
|||
|
||||
// Update "equivalence" class size
|
||||
r2->m_class_size += r1->m_class_size;
|
||||
r2->m_is_shared = 2;
|
||||
|
||||
CASSERT("add_eq", check_invariant());
|
||||
}
|
||||
|
@ -920,6 +921,7 @@ namespace smt {
|
|||
|
||||
// restore r2 class size
|
||||
r2->m_class_size -= r1->m_class_size;
|
||||
r2->m_is_shared = 2;
|
||||
|
||||
// unmerge "equivalence" classes
|
||||
std::swap(r1->m_next, r2->m_next);
|
||||
|
@ -4504,8 +4506,15 @@ namespace smt {
|
|||
|
||||
bool context::is_shared(enode * n) const {
|
||||
n = n->get_root();
|
||||
switch (n->is_shared()) {
|
||||
case l_true: return true;
|
||||
case l_false: return false;
|
||||
default: break;
|
||||
}
|
||||
|
||||
unsigned num_th_vars = n->get_num_th_vars();
|
||||
if (m.is_ite(n->get_expr())) {
|
||||
n->set_is_shared(l_true);
|
||||
return true;
|
||||
}
|
||||
switch (num_th_vars) {
|
||||
|
@ -4531,6 +4540,7 @@ namespace smt {
|
|||
TRACE("is_shared", tout << enode_pp(n, *this)
|
||||
<< "\nis shared because of:\n"
|
||||
<< enode_pp(parent, *this) << "\n";);
|
||||
n->set_is_shared(l_true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4561,7 +4571,9 @@ namespace smt {
|
|||
// the theories of (array int int) and (array (array int int) int).
|
||||
// Remark: The inconsistency is not going to be detected if they are
|
||||
// not marked as shared.
|
||||
return get_theory(th_id)->is_shared(l->get_var());
|
||||
bool r = get_theory(th_id)->is_shared(l->get_var());
|
||||
n->set_is_shared(to_lbool(r));
|
||||
return r;
|
||||
}
|
||||
default:
|
||||
return true;
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace smt {
|
|||
n->m_iscope_lvl = iscope_lvl;
|
||||
n->m_lbl_hash = -1;
|
||||
n->m_proof_is_logged = false;
|
||||
n->m_is_shared = 2;
|
||||
unsigned num_args = n->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
enode * arg = app2enode[owner->get_arg(i)->get_id()];
|
||||
|
|
|
@ -77,6 +77,7 @@ namespace smt {
|
|||
unsigned m_bool:1; //!< True if it is a boolean enode
|
||||
unsigned m_merge_tf:1; //!< True if the enode should be merged with true/false when the associated boolean variable is assigned.
|
||||
unsigned m_cgc_enabled:1; //!< True if congruence closure is enabled for this enode.
|
||||
unsigned m_is_shared:2; //!< 0 - not shared, 1 - shared, 2 - invalid state
|
||||
unsigned m_iscope_lvl; //!< When the enode was internalized
|
||||
bool m_proof_is_logged; //!< Indicates that the proof for the enode being equal to its root is in the log.
|
||||
signed char m_lbl_hash; //!< It is different from -1, if enode is used in a pattern
|
||||
|
@ -179,6 +180,21 @@ namespace smt {
|
|||
return m_owner->hash();
|
||||
}
|
||||
|
||||
lbool is_shared() const {
|
||||
switch (m_is_shared) {
|
||||
case 0: return l_false;
|
||||
case 1: return l_true;
|
||||
default: return l_undef;
|
||||
}
|
||||
}
|
||||
|
||||
void set_is_shared(lbool s) {
|
||||
switch (s) {
|
||||
case l_true: m_is_shared = 1; break;
|
||||
case l_false: m_is_shared = 0; break;
|
||||
default: m_is_shared = 2; break;
|
||||
}
|
||||
}
|
||||
|
||||
enode * get_root() const {
|
||||
return m_root;
|
||||
|
|
|
@ -574,9 +574,9 @@ namespace smt {
|
|||
to_delete.push_back(n);
|
||||
}
|
||||
}
|
||||
for (expr* e : to_delete) {
|
||||
for (expr* e : to_delete)
|
||||
s->remove(e);
|
||||
}
|
||||
reset_eval_cache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue