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 theory equality notify utility. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__THEORY_EQ_NOTIFY_H 16 : : #define CVC5__THEORY__THEORY_EQ_NOTIFY_H 17 : : 18 : : #include "expr/node.h" 19 : : #include "theory/theory_inference_manager.h" 20 : : #include "theory/uf/equality_engine_notify.h" 21 : : 22 : : namespace cvc5::internal { 23 : : namespace theory { 24 : : 25 : : /** 26 : : * The default class for equality engine callbacks for a theory. This forwards 27 : : * calls for trigger predicates, trigger term equalities and conflicts due to 28 : : * constant merges to the provided theory inference manager. 29 : : */ 30 : : class TheoryEqNotifyClass : public eq::EqualityEngineNotify 31 : : { 32 : : public: 33 : 349699 : TheoryEqNotifyClass(TheoryInferenceManager& im) : d_im(im) {} 34 : 347284 : ~TheoryEqNotifyClass() {} 35 : : 36 : 12578729 : bool eqNotifyTriggerPredicate(TNode predicate, bool value) override 37 : : { 38 [ + + ]: 12578729 : if (value) 39 : : { 40 : 4737458 : return d_im.propagateLit(predicate); 41 : : } 42 : 7841271 : return d_im.propagateLit(predicate.notNode()); 43 : : } 44 : 2726131 : bool eqNotifyTriggerTermEquality(CVC5_UNUSED TheoryId tag, 45 : : TNode t1, 46 : : TNode t2, 47 : : bool value) override 48 : : { 49 [ + + ]: 2726131 : if (value) 50 : : { 51 : 1800068 : return d_im.propagateLit(t1.eqNode(t2)); 52 : : } 53 : 926063 : return d_im.propagateLit(t1.eqNode(t2).notNode()); 54 : : } 55 : 10934 : void eqNotifyConstantTermMerge(TNode t1, TNode t2) override 56 : : { 57 : 10934 : d_im.conflictEqConstantMerge(t1, t2); 58 : 10934 : } 59 : 366370 : void eqNotifyNewClass(CVC5_UNUSED TNode t) override 60 : : { 61 : : // do nothing 62 : 366370 : } 63 : 9951212 : void eqNotifyMerge(CVC5_UNUSED TNode t1, CVC5_UNUSED TNode t2) override 64 : : { 65 : : // do nothing 66 : 9951212 : } 67 : 787966 : void eqNotifyDisequal(CVC5_UNUSED TNode t1, 68 : : CVC5_UNUSED TNode t2, 69 : : CVC5_UNUSED TNode reason) override 70 : : { 71 : : // do nothing 72 : 787966 : } 73 : : 74 : : protected: 75 : : /** Reference to the theory inference manager */ 76 : : TheoryInferenceManager& d_im; 77 : : }; 78 : : 79 : : } // namespace theory 80 : : } // namespace cvc5::internal 81 : : 82 : : #endif