@@ -117,6 +117,7 @@ namespace euf {
117117
118118    enode* egraph::mk (expr* f, unsigned  generation, unsigned  num_args, enode *const * args) {
119119        SASSERT (!find (f));
120+         TRACE (euf, tout << " mk: "   << mk_bounded_pp (f, m) << "  generation: "   << generation << "  num_args: "   << num_args << " \n "  ;);
120121        force_push ();
121122        enode *n = mk_enode (f, generation, num_args, args);
122123
@@ -157,6 +158,21 @@ namespace euf {
157158    }
158159
159160    void  egraph::propagate_plugins () {
161+         if  (m_plugins.empty ())
162+             return ;
163+         if  (m_plugin_qhead < m_new_th_eqs.size ())
164+             m_updates.push_back (update_record (m_plugin_qhead, update_record::plugin_qhead ()));
165+ 
166+         for  (; m_plugin_qhead < m_new_th_eqs.size (); ++m_plugin_qhead) {
167+             auto  const & eq = m_new_th_eqs[m_plugin_qhead];
168+             auto * p = get_plugin (eq.id ());
169+             if  (!p)
170+                 continue ;
171+             if  (eq.is_eq ()) 
172+                 p->merge_eh (eq.child (), eq.root ());            
173+             else  
174+                 p->diseq_eh (eq.eq ());
175+         }
160176        for  (auto * p : m_plugins)
161177            if  (p)
162178                p->propagate ();        
@@ -167,23 +183,18 @@ namespace euf {
167183        m_new_th_eqs.push_back (th_eq (id, v1, v2, c, r));
168184        m_updates.push_back (update_record (update_record::new_th_eq ()));
169185        ++m_stats.m_num_th_eqs ;
170-         auto * p = get_plugin (id);
171-         if  (p)
172-             p->merge_eh (c, r);
173186    }
174187
175188    void  egraph::add_th_diseq (theory_id id, theory_var v1, theory_var v2, enode* eq) {
176189        if  (!th_propagates_diseqs (id))
177190            return ;
178191        TRACE (euf_verbose, tout << " eq: "   << v1 << "  != "   << v2 << " \n "  ;);
179-         m_new_th_eqs.push_back (th_eq (id, v1, v2, eq-> get_expr () ));
192+         m_new_th_eqs.push_back (th_eq (id, v1, v2, eq));
180193        m_updates.push_back (update_record (update_record::new_th_eq ()));
181-         auto * p = get_plugin (id);
182-         if  (p)
183-             p->diseq_eh (eq);
194+ 
184195        ++m_stats.m_num_th_diseqs ;
185196    }
186- 
197+      
187198    void  egraph::add_literal (enode* n, enode* ante) {
188199        TRACE (euf, tout << " propagate "   << bpp (n) << "  "   << bpp (ante) << " \n "  );
189200        if  (!m_on_propagate_literal)
@@ -447,6 +458,9 @@ namespace euf {
447458            case  update_record::tag_t ::is_new_th_eq_qhead:
448459                m_new_th_eqs_qhead = p.qhead ;
449460                break ;
461+             case  update_record::tag_t ::is_plugin_qhead:
462+                 m_plugin_qhead = p.qhead ;
463+                 break ;
450464            case  update_record::tag_t ::is_inconsistent:
451465                m_inconsistent = p.m_inconsistent ;
452466                break ;
@@ -546,16 +560,18 @@ namespace euf {
546560    void  egraph::remove_parents (enode* r) {
547561        TRACE (euf_verbose, tout << bpp (r) << " \n "  );
548562        SASSERT (all_of (enode_parents (r), [&](enode* p) { return  !p->is_marked1 (); }));
563+         TRACE (euf, tout << " remove_parents "   << bpp (r) << " \n "  );
549564        for  (enode* p : enode_parents (r)) {
550565            if  (p->is_marked1 ())
551566                continue ;
552567            if  (p->cgc_enabled ()) {
553568                if  (!p->is_cgr ())
554569                    continue ;
570+                 TRACE (euf, tout << " removing "   << m_table.contains_ptr (p) << "  "   << bpp (p) << " \n "  );
555571                SASSERT (m_table.contains_ptr (p));
556572                p->mark1 ();
557573                erase_from_table (p);
558-                 CTRACE (euf_verbose , m_table.contains_ptr (p), tout << bpp (p) << " \n "  ; display (tout));
574+                 CTRACE (euf , m_table.contains_ptr (p), tout << bpp (p) << " \n "  ; display (tout));
559575                SASSERT (!m_table.contains_ptr (p));
560576            }
561577            else  if  (p->is_equality ())
@@ -564,15 +580,16 @@ namespace euf {
564580    }
565581
566582    void  egraph::reinsert_parents (enode* r1, enode* r2) {
583+         TRACE (euf, tout << " reinsert_parents "   << bpp (r1) << "  "   << bpp (r2) << " \n "  ;);
567584        for  (enode* p : enode_parents (r1)) {
568585            if  (!p->is_marked1 ())
569586                continue ;
570587            p->unmark1 ();
571-             TRACE (euf_verbose , tout << " reinsert "   << bpp (r1) << "  "   << bpp (r2) << "  "   << bpp (p) << "  "   << p->cgc_enabled () << " \n "  ;);
588+             TRACE (euf , tout << " reinsert "   << bpp (r1) << "  "   << bpp (r2) << "  "   << bpp (p) << "  "   << p->cgc_enabled () << " \n "  ;);
572589            if  (p->cgc_enabled ()) {
573590                auto  [p_other, comm] = insert_table (p);
574591                SASSERT (m_table.contains_ptr (p) == (p_other == p));
575-                 CTRACE (euf_verbose , p_other != p, tout << " reinsert "   << bpp (p) << "  == "   << bpp (p_other) << "  "   << p->value () << "  "   << p_other->value () << " \n "  );
592+                 CTRACE (euf , p_other != p, tout << " reinsert "   << bpp (p) << "  == "   << bpp (p_other) << "  "   << p->value () << "  "   << p_other->value () << " \n "  );
576593                if  (p_other != p) 
577594                    m_to_merge.push_back (to_merge (p_other, p, comm));                
578595                else 
@@ -957,6 +974,9 @@ namespace euf {
957974        st.update (" euf propagations theory eqs"  , m_stats.m_num_th_eqs );
958975        st.update (" euf propagations theory diseqs"  , m_stats.m_num_th_diseqs );
959976        st.update (" euf propagations literal"  , m_stats.m_num_lits );
977+         for  (auto  p : m_plugins) 
978+             if  (p) 
979+                 p->collect_statistics (st);                   
960980    }
961981
962982    void  egraph::copy_from (egraph const & src, std::function<void *(void *)>& copy_justification) {
0 commit comments