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