LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/bv - bv_solver.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 24 70.8 %
Date: 2025-01-26 14:42:37 Functions: 14 19 73.7 %
Branches: 0 0 -

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

Generated by: LCOV version 1.14