From: Andrew Reynolds Date: Fri, 28 Aug 2020 08:19:32 +0000 (-0500) Subject: Do not delay processing equivalence class merges in datatypes (#4952) X-Git-Tag: cvc5-1.0.0~2946 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d03fa5697e278bef5cbc385978634421cb5a050b;p=cvc5.git Do not delay processing equivalence class merges in datatypes (#4952) Currently, the theory of datatypes buffers its processing of when equivalence class merges are processed. This was an earlier design to avoid using the equality engine while it was doing internal operations. Now, equivalence class merge callbacks are called at a time when it is safe to use the equality engine and thus this level of indirection is unnecessary. This will simplify further work on datatypes towards having a standard inference manager. --- diff --git a/src/theory/datatypes/theory_datatypes.cpp b/src/theory/datatypes/theory_datatypes.cpp index c7e2c7c1b..a98c77a5d 100644 --- a/src/theory/datatypes/theory_datatypes.cpp +++ b/src/theory/datatypes/theory_datatypes.cpp @@ -160,7 +160,7 @@ void TheoryDatatypes::check(Effort e) { if (done() && e& lemmas ){ return ret; } -void TheoryDatatypes::assertFact( Node fact, Node exp ){ - Assert(d_pending_merge.empty()); +void TheoryDatatypes::assertFact( Node fact, Node exp) +{ Trace("datatypes-debug") << "TheoryDatatypes::assertFact : " << fact << std::endl; bool polarity = fact.getKind() != kind::NOT; TNode atom = polarity ? fact : fact[0]; @@ -505,7 +478,6 @@ void TheoryDatatypes::assertFact( Node fact, Node exp ){ }else{ d_equalityEngine->assertPredicate(atom, polarity, exp); } - doPendingMerges(); // could be sygus-specific if (d_sygusExtension) { @@ -523,8 +495,6 @@ void TheoryDatatypes::assertFact( Node fact, Node exp ){ EqcInfo* eqc = getOrMakeEqcInfo( rep, true ); addTester( tindex, fact, eqc, rep, t_arg ); Trace("dt-tester") << "Done assert tester." << std::endl; - //do pending merges - doPendingMerges(); Trace("dt-tester") << "Done pending merges." << std::endl; if( !d_conflict && polarity ){ if (d_sygusExtension) @@ -851,7 +821,7 @@ void TheoryDatatypes::eqNotifyMerge(TNode t1, TNode t2) if( t1.getType().isDatatype() ){ Trace("datatypes-debug") << "NotifyMerge : " << t1 << " " << t2 << std::endl; - d_pending_merge.push_back( t1.eqNode( t2 ) ); + merge(t1,t2); } } diff --git a/src/theory/datatypes/theory_datatypes.h b/src/theory/datatypes/theory_datatypes.h index e9a0ba052..0d5df098d 100644 --- a/src/theory/datatypes/theory_datatypes.h +++ b/src/theory/datatypes/theory_datatypes.h @@ -199,7 +199,6 @@ private: std::vector< Node > d_pending_lem; std::vector< Node > d_pending; std::map< Node, Node > d_pending_exp; - std::vector< Node > d_pending_merge; /** All the function terms that the theory has seen */ context::CDList d_functionTerms; /** counter for forcing assignments (ensures fairness) */ @@ -222,8 +221,6 @@ private: /** flush pending facts */ void flushPendingFacts(); - /** do pending merged */ - void doPendingMerges(); /** do send lemma */ bool doSendLemma( Node lem ); bool doSendLemmas( std::vector< Node >& lem );