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 : : * Bit-vector solver interface. 11 : : * 12 : : * Describes the interface for the internal bit-vector solver of TheoryBV. 13 : : */ 14 : : 15 : : #include "cvc5_private.h" 16 : : 17 : : #ifndef CVC5__THEORY__BV__BV_SOLVER_H 18 : : #define CVC5__THEORY__BV__BV_SOLVER_H 19 : : 20 : : #include "smt/env_obj.h" 21 : : #include "theory/theory.h" 22 : : 23 : : namespace cvc5::internal { 24 : : namespace theory { 25 : : namespace bv { 26 : : 27 : : class BVSolver : protected EnvObj 28 : : { 29 : : public: 30 : 51003 : BVSolver(Env& env, TheoryState& state, TheoryInferenceManager& inferMgr) 31 : 51003 : : EnvObj(env), d_state(state), d_im(inferMgr) {}; 32 : : 33 : 50658 : virtual ~BVSolver() {} 34 : : 35 : : /** 36 : : * Returns true if we need an equality engine. If so, we initialize the 37 : : * information regarding how it should be setup. For details, see the 38 : : * documentation in Theory::needsEqualityEngine. 39 : : */ 40 : 0 : virtual bool needsEqualityEngine(CVC5_UNUSED EeSetupInfo& esi) 41 : : { 42 : 0 : return false; 43 : : } 44 : : 45 : 51003 : virtual void finishInit() {}; 46 : : 47 : : virtual void preRegisterTerm(TNode n) = 0; 48 : : 49 : : /** 50 : : * Forwarded from TheoryBV::preCheck(). 51 : : */ 52 : 2847689 : virtual bool preCheck( 53 : : CVC5_UNUSED Theory::Effort level = Theory::Effort::EFFORT_FULL) 54 : : { 55 : 2847689 : return false; 56 : : } 57 : : /** 58 : : * Forwarded from TheoryBV::postCheck(). 59 : : */ 60 : 467672 : virtual void postCheck( 61 : 467672 : CVC5_UNUSED Theory::Effort level = Theory::Effort::EFFORT_FULL) {}; 62 : : /** 63 : : * Forwarded from TheoryBV:preNotifyFact(). 64 : : */ 65 : 0 : virtual bool preNotifyFact(CVC5_UNUSED TNode atom, 66 : : CVC5_UNUSED bool pol, 67 : : CVC5_UNUSED TNode fact, 68 : : CVC5_UNUSED bool isPrereg, 69 : : CVC5_UNUSED bool isInternal) 70 : : { 71 : 0 : return false; 72 : : } 73 : : /** 74 : : * Forwarded from TheoryBV::notifyFact(). 75 : : */ 76 : 7611456 : virtual void notifyFact(CVC5_UNUSED TNode atom, 77 : : CVC5_UNUSED bool pol, 78 : : CVC5_UNUSED TNode fact, 79 : : CVC5_UNUSED bool isInternal) 80 : : { 81 : 7611456 : } 82 : : 83 : 30282 : virtual bool needsCheckLastEffort() { return false; } 84 : : 85 : 4415308 : virtual void propagate(CVC5_UNUSED Theory::Effort e) {} 86 : : 87 : 0 : virtual TrustNode explain(CVC5_UNUSED TNode n) 88 : : { 89 : 0 : Unimplemented() << "BVSolver propagated a node but doesn't implement the " 90 : 0 : "BVSolver::explain() interface!"; 91 : : return TrustNode::null(); 92 : : } 93 : : 94 : : /** Additionally collect terms relevant for collecting model values. */ 95 : 4351 : virtual void computeRelevantTerms(CVC5_UNUSED std::set<Node>& termSet) {} 96 : : 97 : : /** Collect model values in m based on the relevant terms given by termSet */ 98 : : virtual bool collectModelValues(TheoryModel* m, 99 : : const std::set<Node>& termSet) = 0; 100 : : 101 : : virtual std::string identify() const = 0; 102 : : 103 : 340857 : virtual TrustNode ppRewrite(CVC5_UNUSED TNode t) { return TrustNode::null(); } 104 : : 105 : 345225 : virtual void ppStaticLearn(CVC5_UNUSED TNode in, 106 : : CVC5_UNUSED std::vector<TrustNode>& learned) 107 : : { 108 : 345225 : } 109 : : 110 : 50438 : virtual void presolve() {} 111 : : 112 : 129395 : virtual void notifySharedTerm(CVC5_UNUSED TNode t) {} 113 : : 114 : 37154 : virtual EqualityStatus getEqualityStatus(CVC5_UNUSED TNode a, 115 : : CVC5_UNUSED TNode b) 116 : : { 117 : 37154 : return EqualityStatus::EQUALITY_UNKNOWN; 118 : : } 119 : : 120 : : /** 121 : : * Get the current value of `node`. 122 : : * 123 : : * The `initialize` flag indicates whether bits should be zero-initialized 124 : : * if they don't have a value yet. 125 : : */ 126 : 0 : virtual Node getValue(CVC5_UNUSED TNode node, CVC5_UNUSED bool initialize) 127 : : { 128 : 0 : return Node::null(); 129 : : } 130 : : 131 : : protected: 132 : : TheoryState& d_state; 133 : : TheoryInferenceManager& d_im; 134 : : }; 135 : : 136 : : } // namespace bv 137 : : } // namespace theory 138 : : } // namespace cvc5::internal 139 : : 140 : : #endif /* CVC5__THEORY__BV__BV_SOLVER_H */