Previously, there was methods for being informed just before and just after equivalence classes are merged (eqNotifyPreMerge and eqNotifyPostMerge). The purpose of this was to allow e.g. the theory to inspect the equivalence classes in question before the equality engine modified them. However this is no longer used, and moreover is discouraged since Theory should generally buffer their usage of EqualityEngine while it is making internal calls.
TheoryStrings was the only theory to use eqNotifyPreMerge (somewhat arbitrarily), all others used eqNotifyPostMerge. This makes post-merge the default, renames it to eqNotifyMerge and removes pre notifications.
This will simplify the work of the new theory combination methods as well as leading to fewer spurious calls to callbacks in equality engine.
}
void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyNewClass(TNode t) {
}
-void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyPreMerge(TNode t1, TNode t2) {
-}
-void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyPostMerge(TNode t1, TNode t2) {
+void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyMerge(TNode t1,
+ TNode t2)
+{
}
void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyDisequal(TNode t1, TNode t2, TNode reason) {
}
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override;
void eqNotifyNewClass(TNode t) override;
- void eqNotifyPreMerge(TNode t1, TNode t2) override;
- void eqNotifyPostMerge(TNode t1, TNode t2) override;
+ void eqNotifyMerge(TNode t1, TNode t2) override;
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override;
};
ArithCongruenceNotify d_notify;
}
void eqNotifyNewClass(TNode t) override {}
- void eqNotifyPreMerge(TNode t1, TNode t2) override {}
- void eqNotifyPostMerge(TNode t1, TNode t2) override
+ void eqNotifyMerge(TNode t1, TNode t2) override
{
if (t1.getType().isArray()) {
d_arrays.mergeArrays(t1, t2);
bool value) override;
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override;
void eqNotifyNewClass(TNode t) override;
- void eqNotifyPreMerge(TNode t1, TNode t2) override {}
- void eqNotifyPostMerge(TNode t1, TNode t2) override {}
+ void eqNotifyMerge(TNode t1, TNode t2) override {}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {}
};
}
}
-/** called when two equivalance classes will merge */
-void TheoryDatatypes::eqNotifyPreMerge(TNode t1, TNode t2){
-
-}
-
/** called when two equivalance classes have merged */
-void TheoryDatatypes::eqNotifyPostMerge(TNode t1, TNode t2){
+void TheoryDatatypes::eqNotifyMerge(TNode t1, TNode t2)
+{
if( t1.getType().isDatatype() ){
- Trace("datatypes-debug") << "NotifyPostMerge : " << t1 << " " << t2 << std::endl;
+ Trace("datatypes-debug")
+ << "NotifyMerge : " << t1 << " " << t2 << std::endl;
d_pending_merge.push_back( t1.eqNode( t2 ) );
}
}
}
}
-/** called when two equivalence classes are made disequal */
-void TheoryDatatypes::eqNotifyDisequal(TNode t1, TNode t2, TNode reason){
-
-}
-
TheoryDatatypes::EqcInfo::EqcInfo( context::Context* c )
: d_inst( c, false )
, d_constructor( c, Node::null() )
Debug("dt") << "NotifyClass::eqNotifyNewClass(" << t << ")" << std::endl;
d_dt.eqNotifyNewClass(t);
}
- void eqNotifyPreMerge(TNode t1, TNode t2) override
+ void eqNotifyMerge(TNode t1, TNode t2) override
{
- Debug("dt") << "NotifyClass::eqNotifyPreMerge(" << t1 << ", " << t2 << ")" << std::endl;
- d_dt.eqNotifyPreMerge(t1, t2);
- }
- void eqNotifyPostMerge(TNode t1, TNode t2) override
- {
- Debug("dt") << "NotifyClass::eqNotifyPostMerge(" << t1 << ", " << t2 << ")" << std::endl;
- d_dt.eqNotifyPostMerge(t1, t2);
+ Debug("dt") << "NotifyClass::eqNotifyMerge(" << t1 << ", " << t2 << ")"
+ << std::endl;
+ d_dt.eqNotifyMerge(t1, t2);
}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
{
- Debug("dt") << "NotifyClass::eqNotifyDisequal(" << t1 << ", " << t2 << ", " << reason << ")" << std::endl;
- d_dt.eqNotifyDisequal(t1, t2, reason);
}
};/* class TheoryDatatypes::NotifyClass */
private:
void conflict(TNode a, TNode b);
/** called when a new equivalance class is created */
void eqNotifyNewClass(TNode t);
- /** called when two equivalance classes will merge */
- void eqNotifyPreMerge(TNode t1, TNode t2);
/** called when two equivalance classes have merged */
- void eqNotifyPostMerge(TNode t1, TNode t2);
- /** called when two equivalence classes are made disequal */
- void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);
+ void eqNotifyMerge(TNode t1, TNode t2);
void check(Effort e) override;
bool needsCheckLastEffort() override;
return true;
}
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override {}
- void eqNotifyPreMerge(TNode t1, TNode t2) override {}
- void eqNotifyPostMerge(TNode t1, TNode t2) override {}
+ void eqNotifyMerge(TNode t1, TNode t2) override {}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {}
private:
bool value) override;
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override;
void eqNotifyNewClass(TNode t) override {}
- void eqNotifyPreMerge(TNode t1, TNode t2) override {}
- void eqNotifyPostMerge(TNode t1, TNode t2) override {}
+ void eqNotifyMerge(TNode t1, TNode t2) override {}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {}
};
friend NotifyClass;
d_upendingAdds.push_back( t );
}
-void ConjectureGenerator::eqNotifyPreMerge(TNode t1, TNode t2) {
+void ConjectureGenerator::eqNotifyMerge(TNode t1, TNode t2)
+{
//get maintained representatives
TNode rt1 = t1;
TNode rt2 = t2;
}
}
-void ConjectureGenerator::eqNotifyPostMerge(TNode t1, TNode t2) {
-
-}
-
-void ConjectureGenerator::eqNotifyDisequal(TNode t1, TNode t2, TNode reason) {
- Trace("thm-ee-debug") << "UEE : disequality holds : " << t1 << " != " << t2 << std::endl;
-
-}
-
ConjectureGenerator::EqcInfo::EqcInfo( context::Context* c ) : d_rep( c, Node::null() ){
}
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override {}
void eqNotifyNewClass(TNode t) override { d_sg.eqNotifyNewClass(t); }
- void eqNotifyPreMerge(TNode t1, TNode t2) override
+ void eqNotifyMerge(TNode t1, TNode t2) override
{
- d_sg.eqNotifyPreMerge(t1, t2);
- }
- void eqNotifyPostMerge(TNode t1, TNode t2) override
- {
- d_sg.eqNotifyPostMerge(t1, t2);
+ d_sg.eqNotifyMerge(t1, t2);
}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
{
- d_sg.eqNotifyDisequal(t1, t2, reason);
}
};/* class ConjectureGenerator::NotifyClass */
/** The notify class */
std::map< Node, EqcInfo* > d_eqc_info;
/** called when a new equivalance class is created */
void eqNotifyNewClass(TNode t);
- /** called when two equivalance classes will merge */
- void eqNotifyPreMerge(TNode t1, TNode t2);
/** called when two equivalance classes have merged */
- void eqNotifyPostMerge(TNode t1, TNode t2);
- /** called when two equivalence classes are made disequal */
- void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);
+ void eqNotifyMerge(TNode t1, TNode t2);
/** are universal equal */
bool areUniversalEqual( TNode n1, TNode n2 );
/** are universal disequal */
return false;
}
-
-void TheorySep::eqNotifyPreMerge(TNode t1, TNode t2) {
-
-}
-
-void TheorySep::eqNotifyPostMerge(TNode t1, TNode t2) {
+void TheorySep::eqNotifyMerge(TNode t1, TNode t2)
+{
HeapAssertInfo * e2 = getOrMakeEqcInfo( t2, false );
if( e2 && ( !e2->d_pto.get().isNull() || e2->d_has_neg_pto.get() ) ){
HeapAssertInfo * e1 = getOrMakeEqcInfo( t1, true );
}
void eqNotifyNewClass(TNode t) override {}
- void eqNotifyPreMerge(TNode t1, TNode t2) override
+ void eqNotifyMerge(TNode t1, TNode t2) override
{
- d_sep.eqNotifyPreMerge(t1, t2);
- }
- void eqNotifyPostMerge(TNode t1, TNode t2) override
- {
- d_sep.eqNotifyPostMerge(t1, t2);
+ d_sep.eqNotifyMerge(t1, t2);
}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {}
};
bool hasTerm( Node a );
bool areEqual( Node a, Node b );
bool areDisequal( Node a, Node b );
- void eqNotifyPreMerge(TNode t1, TNode t2);
- void eqNotifyPostMerge(TNode t1, TNode t2);
+ void eqNotifyMerge(TNode t1, TNode t2);
void sendLemma( std::vector< Node >& ant, Node conc, const char * c, bool infer = false );
void doPendingFacts();
d_theory.eqNotifyNewClass(t);
}
-void TheorySets::NotifyClass::eqNotifyPreMerge(TNode t1, TNode t2)
+void TheorySets::NotifyClass::eqNotifyMerge(TNode t1, TNode t2)
{
- Debug("sets-eq") << "[sets-eq] eqNotifyPreMerge:"
+ Debug("sets-eq") << "[sets-eq] eqNotifyMerge:"
<< " t1 = " << t1 << " t2 = " << t2 << std::endl;
- d_theory.eqNotifyPreMerge(t1, t2);
-}
-
-void TheorySets::NotifyClass::eqNotifyPostMerge(TNode t1, TNode t2)
-{
- Debug("sets-eq") << "[sets-eq] eqNotifyPostMerge:"
- << " t1 = " << t1 << " t2 = " << t2 << std::endl;
- d_theory.eqNotifyPostMerge(t1, t2);
+ d_theory.eqNotifyMerge(t1, t2);
}
void TheorySets::NotifyClass::eqNotifyDisequal(TNode t1, TNode t2, TNode reason)
bool value) override;
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override;
void eqNotifyNewClass(TNode t) override;
- void eqNotifyPreMerge(TNode t1, TNode t2) override;
- void eqNotifyPostMerge(TNode t1, TNode t2) override;
+ void eqNotifyMerge(TNode t1, TNode t2) override;
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override;
private:
}
}
-void TheorySetsPrivate::eqNotifyPreMerge(TNode t1, TNode t2) {}
-
-void TheorySetsPrivate::eqNotifyPostMerge(TNode t1, TNode t2)
+void TheorySetsPrivate::eqNotifyMerge(TNode t1, TNode t2)
{
if (!d_state.isInConflict())
{
public:
void eqNotifyNewClass(TNode t);
- void eqNotifyPreMerge(TNode t1, TNode t2);
- void eqNotifyPostMerge(TNode t1, TNode t2);
+ void eqNotifyMerge(TNode t1, TNode t2);
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);
/** Assert fact holds in the current context with explanation exp.
*
}
void eqNotifyNewClass(TNode t) override {}
- void eqNotifyPreMerge(TNode t1, TNode t2) override {}
- void eqNotifyPostMerge(TNode t1, TNode t2) override {}
+ void eqNotifyMerge(TNode t1, TNode t2) override {}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {}
};
}
}
-void SolverState::eqNotifyPreMerge(TNode t1, TNode t2)
+void SolverState::eqNotifyMerge(TNode t1, TNode t2)
{
EqcInfo* e2 = getOrMakeEqcInfo(t2, false);
if (e2)
//-------------------------------------- notifications for equalities
/** called when a new equivalence class is created */
void eqNotifyNewClass(TNode t);
- /** called when two equivalence classes will merge */
- void eqNotifyPreMerge(TNode t1, TNode t2);
+ /** called when two equivalence classes merge */
+ void eqNotifyMerge(TNode t1, TNode t2);
/** called when two equivalence classes are made disequal */
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);
//-------------------------------------- end notifications for equalities
Debug("strings") << "NotifyClass::eqNotifyNewClass(" << t << std::endl;
d_str.eqNotifyNewClass(t);
}
- void eqNotifyPreMerge(TNode t1, TNode t2) override
+ void eqNotifyMerge(TNode t1, TNode t2) override
{
- Debug("strings") << "NotifyClass::eqNotifyPreMerge(" << t1 << ", " << t2 << std::endl;
- d_state.eqNotifyPreMerge(t1, t2);
- }
- void eqNotifyPostMerge(TNode t1, TNode t2) override
- {
- Debug("strings") << "NotifyClass::eqNotifyPostMerge(" << t1 << ", " << t2 << std::endl;
+ Debug("strings") << "NotifyClass::eqNotifyMerge(" << t1 << ", " << t2
+ << std::endl;
+ d_state.eqNotifyMerge(t1, t2);
}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
{
}
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override {}
void eqNotifyNewClass(TNode t) override { d_te.eqNotifyNewClass(t); }
- void eqNotifyPreMerge(TNode t1, TNode t2) override
- {
- }
- void eqNotifyPostMerge(TNode t1, TNode t2) override
- {
- }
+ void eqNotifyMerge(TNode t1, TNode t2) override {}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
{
}
* notification methods
*/
void eqNotifyNewClass(TNode t);
- void eqNotifyPreMerge(TNode t1, TNode t2);
- void eqNotifyPostMerge(TNode t1, TNode t2);
- void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);
/**
* The quantifiers engine
EqualityNode cc1 = getEqualityNode(n1);
EqualityNode cc2 = getEqualityNode(n2);
bool doNotify = false;
- // notify the theory
- // the second part of this check is needed due to the internal implementation of this class.
- // It ensures that we are merging terms and not operators.
- if (d_performNotify && class1Id==cc1.getFind() && class2Id==cc2.getFind()) {
+ // Determine if we should notify the owner of this class of this merge.
+ // The second part of this check is needed due to the internal implementation
+ // of this class. It ensures that we are merging terms and not operators.
+ if (d_performNotify && class1Id == cc1.getFind() && class2Id == cc2.getFind())
+ {
doNotify = true;
}
- if (doNotify) {
- d_notify.eqNotifyPreMerge(n1, n2);
- }
// Check for constant merges
bool class1isConstant = d_isConstant[class1Id];
// notify the theory
if (doNotify) {
- d_notify.eqNotifyPostMerge(n1, n2);
+ d_notify.eqNotifyMerge(n1, n2);
}
// Go through the trigger term disequalities and propagate
*/
virtual void eqNotifyNewClass(TNode t) = 0;
- /**
- * Notifies about the merge of two classes (just before the merge).
- *
- * @param t1 a term
- * @param t2 a term
- */
- virtual void eqNotifyPreMerge(TNode t1, TNode t2) = 0;
-
/**
* Notifies about the merge of two classes (just after the merge).
*
* @param t1 a term
* @param t2 a term
*/
- virtual void eqNotifyPostMerge(TNode t1, TNode t2) = 0;
+ virtual void eqNotifyMerge(TNode t1, TNode t2) = 0;
/**
* Notifies about the disequality of two terms.
}
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override {}
void eqNotifyNewClass(TNode t) override {}
- void eqNotifyPreMerge(TNode t1, TNode t2) override {}
- void eqNotifyPostMerge(TNode t1, TNode t2) override {}
+ void eqNotifyMerge(TNode t1, TNode t2) override {}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {}
}; /* class EqualityEngineNotifyNone */
}
}
-void TheoryUF::eqNotifyPreMerge(TNode t1, TNode t2) {
- //if (getLogicInfo().isQuantified()) {
- //getQuantifiersEngine()->getEfficientEMatcher()->merge( t1, t2 );
- //}
-}
-
-void TheoryUF::eqNotifyPostMerge(TNode t1, TNode t2) {
+void TheoryUF::eqNotifyMerge(TNode t1, TNode t2)
+{
if (d_thss != NULL) {
d_thss->merge(t1, t2);
}
d_uf.eqNotifyNewClass(t);
}
- void eqNotifyPreMerge(TNode t1, TNode t2) override
+ void eqNotifyMerge(TNode t1, TNode t2) override
{
- Debug("uf-notify") << "NotifyClass::eqNotifyPreMerge(" << t1 << ", " << t2 << ")" << std::endl;
- d_uf.eqNotifyPreMerge(t1, t2);
- }
-
- void eqNotifyPostMerge(TNode t1, TNode t2) override
- {
- Debug("uf-notify") << "NotifyClass::eqNotifyPostMerge(" << t1 << ", " << t2 << ")" << std::endl;
- d_uf.eqNotifyPostMerge(t1, t2);
+ Debug("uf-notify") << "NotifyClass::eqNotifyMerge(" << t1 << ", " << t2
+ << ")" << std::endl;
+ d_uf.eqNotifyMerge(t1, t2);
}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
/** called when a new equivalance class is created */
void eqNotifyNewClass(TNode t);
- /** called when two equivalance classes will merge */
- void eqNotifyPreMerge(TNode t1, TNode t2);
-
/** called when two equivalance classes have merged */
- void eqNotifyPostMerge(TNode t1, TNode t2);
+ void eqNotifyMerge(TNode t1, TNode t2);
/** called when two equivalence classes are made disequal */
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);