Simplify trigger notifications in equality engine (#4921)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Thu, 20 Aug 2020 01:34:39 +0000 (20:34 -0500)
committerGitHub <noreply@github.com>
Thu, 20 Aug 2020 01:34:39 +0000 (20:34 -0500)
This is further work towards a centralized approach for equality engines.

This PR merges the eqNotifyTriggerEquality callback with the eqNotifyTriggerPredicate callback, and adds assertions that capture the current behavior. It furthermore makes addTriggerEquality private in equality engine and invoked as a special case of addTriggerPredicate. Note this PR does not impact the internal implementation of these methods in equality engine, which indeed is different.

There are two reasons to merge these callbacks:
(1) all theories implement exactly the same method for the two callbacks, whenever they implement both. It would be trivial to do something different (by case splitting on the kind of predicate that is being notified), and moreover it is not recommended they do anything other than immediately propagate the predicate (regardless of whether it is an equality).
(2) It leads to some confusion with eqNotifyTriggerTermEquality, which is invoked when two trigger terms are merged.

25 files changed:
src/theory/arith/congruence_manager.cpp
src/theory/arith/congruence_manager.h
src/theory/arrays/theory_arrays.cpp
src/theory/arrays/theory_arrays.h
src/theory/bv/bv_subtheory_core.cpp
src/theory/bv/bv_subtheory_core.h
src/theory/datatypes/theory_datatypes.cpp
src/theory/datatypes/theory_datatypes.h
src/theory/ee_manager_distributed.h
src/theory/fp/theory_fp.cpp
src/theory/fp/theory_fp.h
src/theory/quantifiers/conjecture_generator.h
src/theory/sep/theory_sep.h
src/theory/sets/theory_sets.cpp
src/theory/sets/theory_sets.h
src/theory/sets/theory_sets_private.cpp
src/theory/shared_terms_database.cpp
src/theory/shared_terms_database.h
src/theory/strings/term_registry.cpp
src/theory/strings/theory_strings.h
src/theory/uf/equality_engine.cpp
src/theory/uf/equality_engine.h
src/theory/uf/equality_engine_notify.h
src/theory/uf/theory_uf.cpp
src/theory/uf/theory_uf.h

index a70339c017f4571ad46f1851b579be8175ca8e60..a13b02900d9b195c664b1fb6c0f50b8ffdc54073 100644 (file)
@@ -97,16 +97,17 @@ ArithCongruenceManager::ArithCongruenceNotify::ArithCongruenceNotify(ArithCongru
   : d_acm(acm)
 {}
 
-bool ArithCongruenceManager::ArithCongruenceNotify::eqNotifyTriggerEquality(TNode equality, bool value) {
-  Debug("arith::congruences") << "ArithCongruenceNotify::eqNotifyTriggerEquality(" << equality << ", " << (value ? "true" : "false") << ")" << std::endl;
+bool ArithCongruenceManager::ArithCongruenceNotify::eqNotifyTriggerPredicate(
+    TNode predicate, bool value)
+{
+  Assert(predicate.getKind() == kind::EQUAL);
+  Debug("arith::congruences")
+      << "ArithCongruenceNotify::eqNotifyTriggerPredicate(" << predicate << ", "
+      << (value ? "true" : "false") << ")" << std::endl;
   if (value) {
-    return d_acm.propagate(equality);
-  } else {
-    return d_acm.propagate(equality.notNode());
+    return d_acm.propagate(predicate);
   }
-}
-bool ArithCongruenceManager::ArithCongruenceNotify::eqNotifyTriggerPredicate(TNode predicate, bool value) {
-  Unreachable();
+  return d_acm.propagate(predicate.notNode());
 }
 
 bool ArithCongruenceManager::ArithCongruenceNotify::eqNotifyTriggerTermEquality(TheoryId tag, TNode t1, TNode t2, bool value) {
index f3b5641b45a167e7934bbad0161a465f5d85e873..d46346fd889b416f12d162f876e99848685ae96f 100644 (file)
@@ -61,8 +61,6 @@ private:
   public:
     ArithCongruenceNotify(ArithCongruenceManager& acm);
 
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override;
-
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override;
 
     bool eqNotifyTriggerTermEquality(TheoryId tag,
index 51e1b367c20dcc94a4fc5da277eabbebbefcd91e..4cc51a87eadd02c239ed5d46787d8b416918f7bb 100644 (file)
@@ -697,7 +697,7 @@ void TheoryArrays::preRegisterTermInternal(TNode node)
   case kind::EQUAL:
     // Add the trigger for equality
     // NOTE: note that if the equality is true or false already, it might not be added
-    d_equalityEngine->addTriggerEquality(node);
+    d_equalityEngine->addTriggerPredicate(node);
     break;
   case kind::SELECT: {
     // Invariant: array terms should be preregistered before being added to the equality engine
index 530f8e0e1e918c8f0abb75f758720737e08b1f83..b69450ac45189224686ab5db1f4ad9303700d51a 100644 (file)
@@ -296,26 +296,17 @@ class TheoryArrays : public Theory {
   public:
     NotifyClass(TheoryArrays& arrays): d_arrays(arrays) {}
 
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
-    {
-      Debug("arrays::propagate") << spaces(d_arrays.getSatContext()->getLevel()) << "NotifyClass::eqNotifyTriggerEquality(" << equality << ", " << (value ? "true" : "false") << ")" << std::endl;
-      // Just forward to arrays
-      if (value) {
-        return d_arrays.propagate(equality);
-      } else {
-        return d_arrays.propagate(equality.notNode());
-      }
-    }
-
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
-      Debug("arrays::propagate") << spaces(d_arrays.getSatContext()->getLevel()) << "NotifyClass::eqNotifyTriggerEquality(" << predicate << ", " << (value ? "true" : "false") << ")" << std::endl;
+      Debug("arrays::propagate")
+          << spaces(d_arrays.getSatContext()->getLevel())
+          << "NotifyClass::eqNotifyTriggerPredicate(" << predicate << ", "
+          << (value ? "true" : "false") << ")" << std::endl;
       // Just forward to arrays
       if (value) {
         return d_arrays.propagate(predicate);
-      } else {
-        return d_arrays.propagate(predicate.notNode());
       }
+      return d_arrays.propagate(predicate.notNode());
     }
 
     bool eqNotifyTriggerTermEquality(TheoryId tag,
index 48ec81a1e071f51455a2f56cb67e2ee9aaae8ea0..7e2b8a8b0faf6d1f6ce3eb49cd563d963aaa0280 100644 (file)
@@ -105,7 +105,7 @@ void CoreSolver::enableSlicer() {
 void CoreSolver::preRegister(TNode node) {
   d_preregisterCalled = true;
   if (node.getKind() == kind::EQUAL) {
-    d_equalityEngine->addTriggerEquality(node);
+    d_equalityEngine->addTriggerPredicate(node);
     if (d_useSlicer)
     {
       d_slicer->processEquality(node);
@@ -383,22 +383,12 @@ bool CoreSolver::assertFactToEqualityEngine(TNode fact, TNode reason) {
   return true;
 }
 
-bool CoreSolver::NotifyClass::eqNotifyTriggerEquality(TNode equality, bool value) {
-  Debug("bitvector::core") << "NotifyClass::eqNotifyTriggerEquality(" << equality << ", " << (value ? "true" : "false" )<< ")" << std::endl;
-  if (value) {
-    return d_solver.storePropagation(equality);
-  } else {
-    return d_solver.storePropagation(equality.notNode());
-  }
-}
-
 bool CoreSolver::NotifyClass::eqNotifyTriggerPredicate(TNode predicate, bool value) {
   Debug("bitvector::core") << "NotifyClass::eqNotifyTriggerPredicate(" << predicate << ", " << (value ? "true" : "false" ) << ")" << std::endl;
   if (value) {
     return d_solver.storePropagation(predicate);
-  } else {
-    return d_solver.storePropagation(predicate.notNode());
   }
+  return d_solver.storePropagation(predicate.notNode());
 }
 
 bool CoreSolver::NotifyClass::eqNotifyTriggerTermEquality(TheoryId tag, TNode t1, TNode t2, bool value) {
index 33f119e5fbbaac85b0240a7be570b8813e23b241..19183c129b1be586b0761efa6e804c1c6b858d10 100644 (file)
@@ -54,7 +54,6 @@ class CoreSolver : public SubtheorySolver {
 
   public:
     NotifyClass(CoreSolver& solver): d_solver(solver) {}
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override;
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override;
     bool eqNotifyTriggerTermEquality(TheoryId tag,
                                      TNode t1,
index e625f57ebf3475d189182fa9668bb3a6ccab7dec..ee750e6465aedd8ea177c30c3233911d3cb058eb 100644 (file)
@@ -542,10 +542,8 @@ void TheoryDatatypes::preRegisterTerm(TNode n) {
   collectTerms( n );
   switch (n.getKind()) {
   case kind::EQUAL:
-    // Add the trigger for equality
-    d_equalityEngine->addTriggerEquality(n);
-    break;
   case kind::APPLY_TESTER:
+    // add predicate trigger for testers and equalities
     // Get triggered for both equal and dis-equal
     d_equalityEngine->addTriggerPredicate(n);
     break;
index bdc13b5e525349e19fb459009f784f0425d59e02..37848f10e1073b4d9a95755c4cd14befd722a2f8 100644 (file)
@@ -58,24 +58,13 @@ class TheoryDatatypes : public Theory {
     TheoryDatatypes& d_dt;
   public:
     NotifyClass(TheoryDatatypes& dt): d_dt(dt) {}
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
-    {
-      Debug("dt") << "NotifyClass::eqNotifyTriggerEquality(" << equality << ", " << (value ? "true" : "false" )<< ")" << std::endl;
-      if (value) {
-        return d_dt.propagate(equality);
-      } else {
-        // We use only literal triggers so taking not is safe
-        return d_dt.propagate(equality.notNode());
-      }
-    }
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
       Debug("dt") << "NotifyClass::eqNotifyTriggerPredicate(" << predicate << ", " << (value ? "true" : "false") << ")" << std::endl;
       if (value) {
         return d_dt.propagate(predicate);
-      } else {
-       return d_dt.propagate(predicate.notNode());
       }
+      return d_dt.propagate(predicate.notNode());
     }
     bool eqNotifyTriggerTermEquality(TheoryId tag,
                                      TNode t1,
index 8cac225be84c9a050ca97e733cd219cbd3ea1689..ededa956eae6a2fb5998f81d2ee04df231b752bd 100644 (file)
@@ -107,10 +107,6 @@ class EqEngineManagerDistributed : public EqEngineManager
      */
     void eqNotifyNewClass(TNode t) override;
 
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
-    {
-      return true;
-    }
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
       return true;
index f5cc16ea92b176cabde092bf7de3be6ceab99d42..ff08558895aef1138ecdec8e1fea34f5a4d2b469 100644 (file)
@@ -816,7 +816,7 @@ void TheoryFp::registerTerm(TNode node) {
     // Add to the equality engine
     if (k == kind::EQUAL)
     {
-      d_equalityEngine->addTriggerEquality(node);
+      d_equalityEngine->addTriggerPredicate(node);
     }
     else
     {
@@ -1143,19 +1143,6 @@ bool TheoryFp::collectModelInfo(TheoryModel *m)
   return true;
 }
 
-bool TheoryFp::NotifyClass::eqNotifyTriggerEquality(TNode equality,
-                                                    bool value) {
-  Debug("fp-eq")
-      << "TheoryFp::eqNotifyTriggerEquality(): call back as equality "
-      << equality << " is " << value << std::endl;
-
-  if (value) {
-    return d_theorySolver.handlePropagation(equality);
-  } else {
-    return d_theorySolver.handlePropagation(equality.notNode());
-  }
-}
-
 bool TheoryFp::NotifyClass::eqNotifyTriggerPredicate(TNode predicate,
                                                      bool value) {
   Debug("fp-eq")
@@ -1164,9 +1151,8 @@ bool TheoryFp::NotifyClass::eqNotifyTriggerPredicate(TNode predicate,
 
   if (value) {
     return d_theorySolver.handlePropagation(predicate);
-  } else {
-    return d_theorySolver.handlePropagation(predicate.notNode());
   }
+  return d_theorySolver.handlePropagation(predicate.notNode());
 }
 
 bool TheoryFp::NotifyClass::eqNotifyTriggerTermEquality(TheoryId tag, TNode t1,
index 02e7e4232b2ec7704157e346fe20dca6cd53acc9..2584d574e3d6c48100087772099dfb6bcd8e5957 100644 (file)
@@ -80,7 +80,6 @@ class TheoryFp : public Theory {
 
    public:
     NotifyClass(TheoryFp& solver) : d_theorySolver(solver) {}
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override;
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override;
     bool eqNotifyTriggerTermEquality(TheoryId tag,
                                      TNode t1,
index 1e8099054a14ac1bd2ccdd10651935c3fda0d945..9ecee88962a4b212d788359e8d085b82cad9cdf8 100644 (file)
@@ -246,10 +246,6 @@ private:
     ConjectureGenerator& d_sg;
   public:
     NotifyClass(ConjectureGenerator& sg): d_sg(sg) {}
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
-    {
-      return true;
-    }
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
       return true;
index 84a7025f0b6cb51e2ebe05249d9b7253ab645dc8..40182fc1926b16608a682048abbf43937ac9a4ab 100644 (file)
@@ -152,27 +152,19 @@ class TheorySep : public Theory {
    public:
     NotifyClass(TheorySep& sep) : d_sep(sep) {}
 
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
+    bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
       Debug("sep::propagate")
-          << "NotifyClass::eqNotifyTriggerEquality(" << equality << ", "
+          << "NotifyClass::eqNotifyTriggerPredicate(" << predicate << ", "
           << (value ? "true" : "false") << ")" << std::endl;
+      Assert(predicate.getKind() == kind::EQUAL);
       // Just forward to sep
       if (value)
       {
-        return d_sep.propagate(equality);
-      }
-      else
-      {
-        return d_sep.propagate(equality.notNode());
+        return d_sep.propagate(predicate);
       }
+      return d_sep.propagate(predicate.notNode());
     }
-
-    bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
-    {
-      Unreachable();
-    }
-
     bool eqNotifyTriggerTermEquality(TheoryId tag,
                                      TNode t1,
                                      TNode t2,
index fc544f46f56a61aa5a1bab59bf399a852a2526e3..2627f72e33d6076d597efaa14bcdecdff8f132fa 100644 (file)
@@ -206,22 +206,6 @@ bool TheorySets::isEntailed( Node n, bool pol ) {
 
 /**************************** eq::NotifyClass *****************************/
 
-bool TheorySets::NotifyClass::eqNotifyTriggerEquality(TNode equality,
-                                                      bool value)
-{
-  Debug("sets-eq") << "[sets-eq] eqNotifyTriggerEquality: equality = "
-                   << equality << " value = " << value << std::endl;
-  if (value)
-  {
-    return d_theory.propagate(equality);
-  }
-  else
-  {
-    // We use only literal triggers so taking not is safe
-    return d_theory.propagate(equality.notNode());
-  }
-}
-
 bool TheorySets::NotifyClass::eqNotifyTriggerPredicate(TNode predicate,
                                                        bool value)
 {
@@ -231,10 +215,7 @@ bool TheorySets::NotifyClass::eqNotifyTriggerPredicate(TNode predicate,
   {
     return d_theory.propagate(predicate);
   }
-  else
-  {
-    return d_theory.propagate(predicate.notNode());
-  }
+  return d_theory.propagate(predicate.notNode());
 }
 
 bool TheorySets::NotifyClass::eqNotifyTriggerTermEquality(TheoryId tag,
index cb8fdfbc3cba362590e81893223dea6836ba537f..36e6ac65d97cd8c632d85ec777a6302a97403114 100644 (file)
@@ -78,7 +78,6 @@ class TheorySets : public Theory
   {
    public:
     NotifyClass(TheorySetsPrivate& theory) : d_theory(theory) {}
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override;
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override;
     bool eqNotifyTriggerTermEquality(TheoryId tag,
                                      TNode t1,
index 879862d151fc71741ca169febbdbf7de2a07da08..f7c7ae7f933572a0a6a78a59bac4737630b20aab 100644 (file)
@@ -1464,8 +1464,13 @@ void TheorySetsPrivate::preRegisterTerm(TNode node)
                 << std::endl;
   switch (node.getKind())
   {
-    case kind::EQUAL: d_equalityEngine->addTriggerEquality(node); break;
-    case kind::MEMBER: d_equalityEngine->addTriggerPredicate(node); break;
+    case kind::EQUAL:
+    case kind::MEMBER:
+    {
+      // add trigger predicate for equality and membership
+      d_equalityEngine->addTriggerPredicate(node);
+    }
+    break;
     case kind::CARD: d_equalityEngine->addTriggerTerm(node, THEORY_SETS); break;
     default: d_equalityEngine->addTerm(node); break;
   }
index 52ce34756dd1b76f65033e927c408b100909971f..99584b167e86392b59db6e58459c0d9e8328aa97 100644 (file)
@@ -46,7 +46,7 @@ SharedTermsDatabase::~SharedTermsDatabase()
 
 void SharedTermsDatabase::addEqualityToPropagate(TNode equality) {
   d_registeredEqualities.insert(equality);
-  d_equalityEngine.addTriggerEquality(equality);
+  d_equalityEngine.addTriggerPredicate(equality);
   checkForConflict();
 }
 
index 55cd84e584234f8f5697005e6a60bf015c08644f..05ce88d998025a3728e20602cf140eecbdb711d2 100644 (file)
@@ -78,15 +78,10 @@ private:
     SharedTermsDatabase& d_sharedTerms;
   public:
     EENotifyClass(SharedTermsDatabase& shared): d_sharedTerms(shared) {}
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
-    {
-      d_sharedTerms.propagateEquality(equality, value);
-      return true;
-    }
-
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
-      Unreachable();
+      Assert(predicate.getKind() == kind::EQUAL);
+      d_sharedTerms.propagateEquality(predicate, value);
       return true;
     }
 
index 353e89668c7fdfcfb84dd1c84ecc4d748c9375c4..3e6f66b7383302681e34c2fdafaf155aa6c6bc14 100644 (file)
@@ -155,7 +155,7 @@ void TermRegistry::preRegisterTerm(TNode n)
       ss << "Equality between regular expressions is not supported";
       throw LogicException(ss.str());
     }
-    ee->addTriggerEquality(n);
+    ee->addTriggerPredicate(n);
     return;
   }
   else if (k == STRING_IN_REGEXP)
index 500daac1f1bc97de23b2f1899ba2661863202fd3..da48ece90396c4bc4488c3fc72f7da9007937a48 100644 (file)
@@ -126,28 +126,13 @@ class TheoryStrings : public Theory {
   class NotifyClass : public eq::EqualityEngineNotify {
   public:
    NotifyClass(TheoryStrings& ts) : d_str(ts), d_state(ts.d_state) {}
-   bool eqNotifyTriggerEquality(TNode equality, bool value) override
-   {
-     Debug("strings") << "NotifyClass::eqNotifyTriggerEquality(" << equality
-                      << ", " << (value ? "true" : "false") << ")" << std::endl;
-     if (value)
-     {
-       return d_str.propagate(equality);
-     }
-     else
-     {
-       // We use only literal triggers so taking not is safe
-       return d_str.propagate(equality.notNode());
-     }
-    }
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
       Debug("strings") << "NotifyClass::eqNotifyTriggerPredicate(" << predicate << ", " << (value ? "true" : "false") << ")" << std::endl;
       if (value) {
         return d_str.propagate(predicate);
-      } else {
-        return d_str.propagate(predicate.notNode());
       }
+      return d_str.propagate(predicate.notNode());
     }
     bool eqNotifyTriggerTermEquality(TheoryId tag,
                                      TNode t1,
index 643029b05eada9847169a6b316dfe7f9be1469b5..5ccda1dc2b3b00ca1bcbf14acb9dbf7db5016c39 100644 (file)
@@ -1704,11 +1704,11 @@ void EqualityEngine::addTriggerEquality(TNode eq) {
 
   // If they are equal or disequal already, no need for the trigger
   if (areEqual(eq[0], eq[1])) {
-    d_notify.eqNotifyTriggerEquality(eq, true);
+    d_notify.eqNotifyTriggerPredicate(eq, true);
     skipTrigger = true;
   }
   if (areDisequal(eq[0], eq[1], true)) {
-    d_notify.eqNotifyTriggerEquality(eq, false);
+    d_notify.eqNotifyTriggerPredicate(eq, false);
     skipTrigger = true;
   }
 
@@ -1726,8 +1726,12 @@ void EqualityEngine::addTriggerEquality(TNode eq) {
 }
 
 void EqualityEngine::addTriggerPredicate(TNode predicate) {
-  Assert(predicate.getKind() != kind::NOT
-         && predicate.getKind() != kind::EQUAL);
+  Assert(predicate.getKind() != kind::NOT);
+  if (predicate.getKind() == kind::EQUAL)
+  {
+    // equality is handled separately
+    return addTriggerEquality(predicate);
+  }
   Assert(d_congruenceKinds.tst(predicate.getKind()))
       << "No point in adding non-congruence predicates";
 
@@ -1997,8 +2001,8 @@ void EqualityEngine::propagate() {
                 d_deducedDisequalityReasons.push_back(EqualityPair(original, d_falseId));
               }
               storePropagatedDisequality(THEORY_LAST, lhsId, rhsId);
-              if (!d_notify.eqNotifyTriggerEquality(triggerInfo.d_trigger,
-                                                    triggerInfo.d_polarity))
+              if (!d_notify.eqNotifyTriggerPredicate(triggerInfo.d_trigger,
+                                                     triggerInfo.d_polarity))
               {
                 d_done = true;
               }
@@ -2007,8 +2011,8 @@ void EqualityEngine::propagate() {
           else
           {
             // Equalities are simple
-            if (!d_notify.eqNotifyTriggerEquality(triggerInfo.d_trigger,
-                                                  triggerInfo.d_polarity))
+            if (!d_notify.eqNotifyTriggerPredicate(triggerInfo.d_trigger,
+                                                   triggerInfo.d_polarity))
             {
               d_done = true;
             }
index 9d1fc6165d196107a0739b6ced4f0fd3739b6e37..c3041dfe79849844f98d2221b41aeb32c0bca3c8 100644 (file)
@@ -658,9 +658,15 @@ private:
 
   /** The internal addTerm */
   void addTermInternal(TNode t, bool isOperator = false);
+  /**
+   * Adds a notify trigger for equality. When equality becomes true
+   * eqNotifyTriggerPredicate will be called with value = true, and when
+   * equality becomes false eqNotifyTriggerPredicate will be called with value =
+   * false.
+   */
+  void addTriggerEquality(TNode equality);
 
-public:
-
+ public:
   /**
    * Adds a term to the term database.
    */
@@ -787,16 +793,13 @@ public:
   TNode getTriggerTermRepresentative(TNode t, TheoryId theoryTag) const;
 
   /**
-   * Adds a notify trigger for equality. When equality becomes true eqNotifyTriggerEquality
-   * will be called with value = true, and when equality becomes false eqNotifyTriggerEquality
-   * will be called with value = false.
-   */
-  void addTriggerEquality(TNode equality);
-
-  /**
-   * Adds a notify trigger for the predicate p. When the predicate becomes true
-   * eqNotifyTriggerPredicate will be called with value = true, and when equality becomes false
+   * Adds a notify trigger for the predicate p, where notice that p can be
+   * an equality. When the predicate becomes true, eqNotifyTriggerPredicate will
+   * be called with value = true, and when predicate becomes false
    * eqNotifyTriggerPredicate will be called with value = false.
+   *
+   * Notice that if p is an equality, then we use a separate method for
+   * determining when to call eqNotifyTriggerPredicate.
    */
   void addTriggerPredicate(TNode predicate);
 
index f63a887ef06c5f420308812953ed32880fcfd38e..1467cacf3e377ba9f54f5d440eda047fb210ed47 100644 (file)
@@ -33,15 +33,8 @@ class EqualityEngineNotify
   virtual ~EqualityEngineNotify(){};
 
   /**
-   * Notifies about a trigger equality that became true or false.
-   *
-   * @param equality the equality that became true or false
-   * @param value the value of the equality
-   */
-  virtual bool eqNotifyTriggerEquality(TNode equality, bool value) = 0;
-
-  /**
-   * Notifies about a trigger predicate that became true or false.
+   * Notifies about a trigger predicate that became true or false. Notice that
+   * predicate can be an equality.
    *
    * @param predicate the trigger predicate that became true or false
    * @param value the value of the predicate
@@ -103,10 +96,6 @@ class EqualityEngineNotify
 class EqualityEngineNotifyNone : public EqualityEngineNotify
 {
  public:
-  bool eqNotifyTriggerEquality(TNode equality, bool value) override
-  {
-    return true;
-  }
   bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
   {
     return true;
index 4f9c3bed5e016b108a023c6a0f71f58bc857fc2f..7bca9da74dd0342009add45b727c3445814824fc 100644 (file)
@@ -246,7 +246,7 @@ void TheoryUF::preRegisterTerm(TNode node) {
   switch (node.getKind()) {
   case kind::EQUAL:
     // Add the trigger for equality
-    d_equalityEngine->addTriggerEquality(node);
+    d_equalityEngine->addTriggerPredicate(node);
     break;
   case kind::APPLY_UF:
   case kind::HO_APPLY:
index 001c947e9db2e022825ae70410981a9093f7eeae..414a2dd6aa43aea4e1e7bd412ff95293f8fd4e1d 100644 (file)
@@ -45,17 +45,6 @@ public:
   public:
     NotifyClass(TheoryUF& uf): d_uf(uf) {}
 
-    bool eqNotifyTriggerEquality(TNode equality, bool value) override
-    {
-      Debug("uf") << "NotifyClass::eqNotifyTriggerEquality(" << equality << ", " << (value ? "true" : "false" )<< ")" << std::endl;
-      if (value) {
-        return d_uf.propagate(equality);
-      } else {
-        // We use only literal triggers so taking not is safe
-        return d_uf.propagate(equality.notNode());
-      }
-    }
-
     bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
     {
       Debug("uf") << "NotifyClass::eqNotifyTriggerPredicate(" << predicate << ", " << (value ? "true" : "false") << ")" << std::endl;