Skip to content

Commit 9425c41

Browse files
port remaining egraph update
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent a5a819c commit 9425c41

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/ast/euf/euf_egraph.cpp

+12-9
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace euf {
6969
}
7070

7171
enode_bool_pair egraph::insert_table(enode* p) {
72-
TRACE("euf", tout << "insert_table " << bpp(p) << "\n");
72+
TRACE("euf_verbose", tout << "insert_table " << bpp(p) << "\n");
7373
//SASSERT(!m_table.contains_ptr(p));
7474
auto rc = m_table.insert(p);
7575
p->m_cg = rc.first;
@@ -522,7 +522,7 @@ namespace euf {
522522
}
523523

524524
void egraph::remove_parents(enode* r) {
525-
TRACE("euf", tout << bpp(r) << "\n");
525+
TRACE("euf_verbose", tout << bpp(r) << "\n");
526526
SASSERT(all_of(enode_parents(r), [&](enode* p) { return !p->is_marked1(); }));
527527
for (enode* p : enode_parents(r)) {
528528
if (p->is_marked1())
@@ -533,7 +533,7 @@ namespace euf {
533533
SASSERT(m_table.contains_ptr(p));
534534
p->mark1();
535535
erase_from_table(p);
536-
CTRACE("euf", m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout));
536+
CTRACE("euf_verbose", m_table.contains_ptr(p), tout << bpp(p) << "\n"; display(tout));
537537
SASSERT(!m_table.contains_ptr(p));
538538
}
539539
else if (p->is_equality())
@@ -546,11 +546,11 @@ namespace euf {
546546
if (!p->is_marked1())
547547
continue;
548548
p->unmark1();
549-
TRACE("euf", tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";);
549+
TRACE("euf_verbose", tout << "reinsert " << bpp(r1) << " " << bpp(r2) << " " << bpp(p) << " " << p->cgc_enabled() << "\n";);
550550
if (p->cgc_enabled()) {
551551
auto [p_other, comm] = insert_table(p);
552552
SASSERT(m_table.contains_ptr(p) == (p_other == p));
553-
CTRACE("euf", p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n");
553+
CTRACE("euf_verbose", p_other != p, tout << "reinsert " << bpp(p) << " == " << bpp(p_other) << " " << p->value() << " " << p_other->value() << "\n");
554554
if (p_other != p)
555555
m_to_merge.push_back(to_merge(p_other, p, comm));
556556
else
@@ -584,14 +584,14 @@ namespace euf {
584584

585585
void egraph::undo_eq(enode* r1, enode* n1, unsigned r2_num_parents) {
586586
enode* r2 = r1->get_root();
587-
TRACE("euf", tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";);
587+
TRACE("euf_verbose", tout << "undo-eq old-root: " << bpp(r1) << " current-root " << bpp(r2) << " node: " << bpp(n1) << "\n";);
588588
r2->dec_class_size(r1->class_size());
589589
r2->set_is_shared(l_undef);
590590
std::swap(r1->m_next, r2->m_next);
591591
auto begin = r2->begin_parents() + r2_num_parents, end = r2->end_parents();
592592
for (auto it = begin; it != end; ++it) {
593593
enode* p = *it;
594-
TRACE("euf", tout << "erase " << bpp(p) << "\n";);
594+
TRACE("euf_verbose", tout << "erase " << bpp(p) << "\n";);
595595
SASSERT(!p->cgc_enabled() || m_table.contains_ptr(p));
596596
SASSERT(!p->cgc_enabled() || p->is_cgr());
597597
if (p->cgc_enabled())
@@ -673,7 +673,7 @@ namespace euf {
673673
SASSERT(n1->get_root()->reaches(n1));
674674
SASSERT(n1->m_target);
675675
n1->m_target = nullptr;
676-
n1->m_justification = justification::axiom();
676+
n1->m_justification = justification::axiom(null_theory_id);
677677
n1->get_root()->reverse_justification();
678678
// ---------------
679679
// n1 -> ... -> r1
@@ -804,7 +804,10 @@ namespace euf {
804804
explain_eq(justifications, cc, a, b, j2);
805805
}
806806
else if (j.is_equality())
807-
explain_eq(justifications, cc, j.lhs(), j.rhs());
807+
explain_eq(justifications, cc, j.lhs(), j.rhs());
808+
else if (j.is_axiom() && j.get_theory_id() != null_theory_id) {
809+
IF_VERBOSE(20, verbose_stream() << "TODO add theory axiom to justification\n");
810+
}
808811
if (cc && j.is_congruence())
809812
cc->push_back(std::tuple(a->get_app(), b->get_app(), j.timestamp(), j.is_commutative()));
810813
}

0 commit comments

Comments
 (0)