GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/bv/bv_solver.h Lines: 21 28 75.0 %
Date: 2021-08-16 Branches: 1 8 12.5 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mathias Preiner, Andrew Reynolds, Andres Noetzli
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 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 "theory/theory.h"
24
25
namespace cvc5 {
26
namespace theory {
27
namespace bv {
28
29
class BVSolver
30
{
31
 public:
32
9853
  BVSolver(TheoryState& state, TheoryInferenceManager& inferMgr)
33
9853
      : d_state(state), d_im(inferMgr){};
34
35
9853
  virtual ~BVSolver() {}
36
37
  /**
38
   * Returns true if we need an equality engine. If so, we initialize the
39
   * information regarding how it should be setup. For details, see the
40
   * documentation in Theory::needsEqualityEngine.
41
   */
42
  virtual bool needsEqualityEngine(EeSetupInfo& esi) { return false; }
43
44
9851
  virtual void finishInit(){};
45
46
  virtual void preRegisterTerm(TNode n) = 0;
47
48
  /**
49
   * Forwarded from TheoryBV::preCheck().
50
   */
51
934074
  virtual bool preCheck(Theory::Effort level = Theory::Effort::EFFORT_FULL)
52
  {
53
934074
    return false;
54
  }
55
  /**
56
   * Forwarded from TheoryBV::postCheck().
57
   */
58
205194
  virtual void postCheck(Theory::Effort level = Theory::Effort::EFFORT_FULL){};
59
  /**
60
   * Forwarded from TheoryBV:preNotifyFact().
61
   */
62
  virtual bool preNotifyFact(
63
      TNode atom, bool pol, TNode fact, bool isPrereg, bool isInternal)
64
  {
65
    return false;
66
  }
67
  /**
68
   * Forwarded from TheoryBV::notifyFact().
69
   */
70
2626321
  virtual void notifyFact(TNode atom, bool pol, TNode fact, bool isInternal) {}
71
72
9154
  virtual bool needsCheckLastEffort() { return false; }
73
74
1549408
  virtual void propagate(Theory::Effort e) {}
75
76
  virtual TrustNode explain(TNode n)
77
  {
78
    Unimplemented() << "BVSolver propagated a node but doesn't implement the "
79
                       "BVSolver::explain() interface!";
80
    return TrustNode::null();
81
  }
82
83
  /** Additionally collect terms relevant for collecting model values. */
84
1633
  virtual void computeRelevantTerms(std::set<Node>& termSet) {}
85
86
  /** Collect model values in m based on the relevant terms given by termSet */
87
  virtual bool collectModelValues(TheoryModel* m,
88
                                  const std::set<Node>& termSet) = 0;
89
90
  virtual std::string identify() const = 0;
91
92
409811
  virtual TrustNode ppRewrite(TNode t) { return TrustNode::null(); }
93
94
105238
  virtual void ppStaticLearn(TNode in, NodeBuilder& learned) {}
95
96
15204
  virtual void presolve() {}
97
98
92487
  virtual void notifySharedTerm(TNode t) {}
99
100
28965
  virtual EqualityStatus getEqualityStatus(TNode a, TNode b)
101
  {
102
28965
    return EqualityStatus::EQUALITY_UNKNOWN;
103
  }
104
105
  /**
106
   * Get the current value of `node`.
107
   *
108
   * The `initialize` flag indicates whether bits should be zero-initialized
109
   * if they don't have a value yet.
110
   */
111
  virtual Node getValue(TNode node, bool initialize) { return Node::null(); }
112
113
  /** Called by abstraction preprocessing pass. */
114
4
  virtual bool applyAbstraction(const std::vector<Node>& assertions,
115
                                std::vector<Node>& new_assertions)
116
  {
117
4
    new_assertions.insert(
118
8
        new_assertions.end(), assertions.begin(), assertions.end());
119
4
    return false;
120
  };
121
122
 protected:
123
  TheoryState& d_state;
124
  TheoryInferenceManager& d_im;
125
};
126
127
}  // namespace bv
128
}  // namespace theory
129
}  // namespace cvc5
130
131
#endif /* CVC5__THEORY__BV__BV_SOLVER_H */