diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-08-19 20:34:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 20:34:39 -0500 |
commit | eee14382af077bd043d53b75c038050b325dd04a (patch) | |
tree | c82bcec6f2144b6c225f434fe86d86748a3146bd /src/theory/sep | |
parent | 45412d0158992ae193f8e26b25a21e735ac7be8b (diff) |
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.
Diffstat (limited to 'src/theory/sep')
-rw-r--r-- | src/theory/sep/theory_sep.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/theory/sep/theory_sep.h b/src/theory/sep/theory_sep.h index 84a7025f0..40182fc19 100644 --- a/src/theory/sep/theory_sep.h +++ b/src/theory/sep/theory_sep.h @@ -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, |