Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * The virtual class for notifications from the equality engine. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__UF__EQUALITY_ENGINE_NOTIFY_H 16 : : #define CVC5__THEORY__UF__EQUALITY_ENGINE_NOTIFY_H 17 : : 18 : : #include "expr/node.h" 19 : : 20 : : namespace cvc5::internal { 21 : : namespace theory { 22 : : namespace eq { 23 : : 24 : : /** 25 : : * Interface for equality engine notifications. All the notifications 26 : : * are safe as TNodes, but not necessarily for negations. 27 : : */ 28 : : class EqualityEngineNotify 29 : : { 30 : : public: 31 : 667571 : virtual ~EqualityEngineNotify(){}; 32 : : 33 : : /** 34 : : * Notifies about a trigger predicate that became true or false. Notice that 35 : : * predicate can be an equality. 36 : : * 37 : : * @param predicate the trigger predicate that became true or false 38 : : * @param value the value of the predicate 39 : : */ 40 : : virtual bool eqNotifyTriggerPredicate(TNode predicate, bool value) = 0; 41 : : 42 : : /** 43 : : * Notifies about the merge of two trigger terms. 44 : : * 45 : : * @param tag the theory that both triggers were tagged with 46 : : * @param t1 a term marked as trigger 47 : : * @param t2 a term marked as trigger 48 : : * @param value true if equal, false if dis-equal 49 : : */ 50 : : virtual bool eqNotifyTriggerTermEquality(TheoryId tag, 51 : : TNode t1, 52 : : TNode t2, 53 : : bool value) = 0; 54 : : 55 : : /** 56 : : * Notifies about the merge of two constant terms. After this, all work is 57 : : * suspended and all you can do is ask for explanations. 58 : : * 59 : : * @param t1 a constant term 60 : : * @param t2 a constant term 61 : : */ 62 : : virtual void eqNotifyConstantTermMerge(TNode t1, TNode t2) = 0; 63 : : 64 : : /** 65 : : * Notifies about the creation of a new equality class. 66 : : * 67 : : * @param t the term forming the new class 68 : : */ 69 : : virtual void eqNotifyNewClass(TNode t) = 0; 70 : : 71 : : /** 72 : : * Notifies about the merge of two classes (just after the merge). 73 : : * 74 : : * @param t1 a term 75 : : * @param t2 a term 76 : : */ 77 : : virtual void eqNotifyMerge(TNode t1, TNode t2) = 0; 78 : : 79 : : /** 80 : : * Notifies about the disequality of two terms. 81 : : * 82 : : * @param t1 a term 83 : : * @param t2 a term 84 : : * @param reason the reason 85 : : */ 86 : : virtual void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) = 0; 87 : : 88 : : }; /* class EqualityEngineNotify */ 89 : : 90 : : /** 91 : : * Implementation of the notification interface that ignores all the 92 : : * notifications. 93 : : */ 94 : : class EqualityEngineNotifyNone : public EqualityEngineNotify 95 : : { 96 : : public: 97 : 0 : bool eqNotifyTriggerPredicate(CVC5_UNUSED TNode predicate, 98 : : CVC5_UNUSED bool value) override 99 : : { 100 : 0 : return true; 101 : : } 102 : 0 : bool eqNotifyTriggerTermEquality(CVC5_UNUSED TheoryId tag, 103 : : CVC5_UNUSED TNode t1, 104 : : CVC5_UNUSED TNode t2, 105 : : CVC5_UNUSED bool value) override 106 : : { 107 : 0 : return true; 108 : : } 109 : 9 : void eqNotifyConstantTermMerge(CVC5_UNUSED TNode t1, 110 : : CVC5_UNUSED TNode t2) override 111 : : { 112 : 9 : } 113 : 4060137 : void eqNotifyNewClass(CVC5_UNUSED TNode t) override {} 114 : 1341332 : void eqNotifyMerge(CVC5_UNUSED TNode t1, CVC5_UNUSED TNode t2) override {} 115 : 104 : void eqNotifyDisequal(CVC5_UNUSED TNode t1, 116 : : CVC5_UNUSED TNode t2, 117 : : CVC5_UNUSED TNode reason) override 118 : : { 119 : 104 : } 120 : : }; /* class EqualityEngineNotifyNone */ 121 : : 122 : : } // Namespace eq 123 : : } // Namespace theory 124 : : } // namespace cvc5::internal 125 : : 126 : : #endif