GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/bv/bv_solver.h Lines: 21 28 75.0 %
Date: 2021-09-10 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 "smt/env.h"
24
#include "smt/env_obj.h"
25
#include "theory/theory.h"
26
27
namespace cvc5 {
28
namespace theory {
29
namespace bv {
30
31
class BVSolver : protected EnvObj
32
{
33
 public:
34
9913
  BVSolver(Env& env, TheoryState& state, TheoryInferenceManager& inferMgr)
35
9913
      : EnvObj(env), d_state(state), d_im(inferMgr){};
36
37
9910
  virtual ~BVSolver() {}
38
39
  /**
40
   * Returns true if we need an equality engine. If so, we initialize the
41
   * information regarding how it should be setup. For details, see the
42
   * documentation in Theory::needsEqualityEngine.
43
   */
44
  virtual bool needsEqualityEngine(EeSetupInfo& esi) { return false; }
45
46
9911
  virtual void finishInit(){};
47
48
  virtual void preRegisterTerm(TNode n) = 0;
49
50
  /**
51
   * Forwarded from TheoryBV::preCheck().
52
   */
53
935560
  virtual bool preCheck(Theory::Effort level = Theory::Effort::EFFORT_FULL)
54
  {
55
935560
    return false;
56
  }
57
  /**
58
   * Forwarded from TheoryBV::postCheck().
59
   */
60
207096
  virtual void postCheck(Theory::Effort level = Theory::Effort::EFFORT_FULL){};
61
  /**
62
   * Forwarded from TheoryBV:preNotifyFact().
63
   */
64
  virtual bool preNotifyFact(
65
      TNode atom, bool pol, TNode fact, bool isPrereg, bool isInternal)
66
  {
67
    return false;
68
  }
69
  /**
70
   * Forwarded from TheoryBV::notifyFact().
71
   */
72
2689999
  virtual void notifyFact(TNode atom, bool pol, TNode fact, bool isInternal) {}
73
74
8910
  virtual bool needsCheckLastEffort() { return false; }
75
76
1498436
  virtual void propagate(Theory::Effort e) {}
77
78
  virtual TrustNode explain(TNode n)
79
  {
80
    Unimplemented() << "BVSolver propagated a node but doesn't implement the "
81
                       "BVSolver::explain() interface!";
82
    return TrustNode::null();
83
  }
84
85
  /** Additionally collect terms relevant for collecting model values. */
86
1620
  virtual void computeRelevantTerms(std::set<Node>& termSet) {}
87
88
  /** Collect model values in m based on the relevant terms given by termSet */
89
  virtual bool collectModelValues(TheoryModel* m,
90
                                  const std::set<Node>& termSet) = 0;
91
92
  virtual std::string identify() const = 0;
93
94
409416
  virtual TrustNode ppRewrite(TNode t) { return TrustNode::null(); }
95
96
105422
  virtual void ppStaticLearn(TNode in, NodeBuilder& learned) {}
97
98
15237
  virtual void presolve() {}
99
100
92489
  virtual void notifySharedTerm(TNode t) {}
101
102
28965
  virtual EqualityStatus getEqualityStatus(TNode a, TNode b)
103
  {
104
28965
    return EqualityStatus::EQUALITY_UNKNOWN;
105
  }
106
107
  /**
108
   * Get the current value of `node`.
109
   *
110
   * The `initialize` flag indicates whether bits should be zero-initialized
111
   * if they don't have a value yet.
112
   */
113
  virtual Node getValue(TNode node, bool initialize) { return Node::null(); }
114
115
  /** Called by abstraction preprocessing pass. */
116
4
  virtual bool applyAbstraction(const std::vector<Node>& assertions,
117
                                std::vector<Node>& new_assertions)
118
  {
119
4
    new_assertions.insert(
120
8
        new_assertions.end(), assertions.begin(), assertions.end());
121
4
    return false;
122
  };
123
124
 protected:
125
  TheoryState& d_state;
126
  TheoryInferenceManager& d_im;
127
};
128
129
}  // namespace bv
130
}  // namespace theory
131
}  // namespace cvc5
132
133
#endif /* CVC5__THEORY__BV__BV_SOLVER_H */