From eee14382af077bd043d53b75c038050b325dd04a Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Wed, 19 Aug 2020 20:34:39 -0500 Subject: Simplify trigger notifications in equality engine (#4921) 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. --- src/theory/arith/congruence_manager.cpp | 17 +++++++++-------- src/theory/arith/congruence_manager.h | 2 -- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/theory/arith') diff --git a/src/theory/arith/congruence_manager.cpp b/src/theory/arith/congruence_manager.cpp index a70339c01..a13b02900 100644 --- a/src/theory/arith/congruence_manager.cpp +++ b/src/theory/arith/congruence_manager.cpp @@ -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) { diff --git a/src/theory/arith/congruence_manager.h b/src/theory/arith/congruence_manager.h index f3b5641b4..d46346fd8 100644 --- a/src/theory/arith/congruence_manager.h +++ b/src/theory/arith/congruence_manager.h @@ -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, -- cgit v1.2.3