GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/theory_state.h Lines: 1 1 100.0 %
Date: 2021-09-10 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Morgan Deters, Mathias Preiner
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
 * A theory state for Theory.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__THEORY_STATE_H
19
#define CVC5__THEORY__THEORY_STATE_H
20
21
#include "context/cdo.h"
22
#include "expr/node.h"
23
#include "smt/env.h"
24
#include "smt/env_obj.h"
25
#include "theory/valuation.h"
26
27
namespace cvc5 {
28
namespace theory {
29
30
namespace eq {
31
class EqualityEngine;
32
}
33
34
class TheoryState : protected EnvObj
35
{
36
 public:
37
  TheoryState(Env& env,
38
              Valuation val);
39
118962
  virtual ~TheoryState() {}
40
  /**
41
   * Set equality engine, where ee is a pointer to the official equality engine
42
   * of theory.
43
   */
44
  void setEqualityEngine(eq::EqualityEngine* ee);
45
  /** Get the SAT context */
46
  context::Context* getSatContext() const;
47
  /** Get the user context */
48
  context::UserContext* getUserContext() const;
49
  //-------------------------------------- equality information
50
  /** Is t registered as a term in the equality engine of this class? */
51
  virtual bool hasTerm(TNode a) const;
52
  /**
53
   * Get the representative of t in the equality engine of this class, or t
54
   * itself if it is not registered as a term.
55
   */
56
  virtual TNode getRepresentative(TNode t) const;
57
  /**
58
   * Are a and b equal according to the equality engine of this class? Also
59
   * returns true if a and b are identical.
60
   */
61
  virtual bool areEqual(TNode a, TNode b) const;
62
  /**
63
   * Are a and b disequal according to the equality engine of this class? Also
64
   * returns true if the representative of a and b are distinct constants.
65
   */
66
  virtual bool areDisequal(TNode a, TNode b) const;
67
  /** get list of members in the equivalence class of a */
68
  virtual void getEquivalenceClass(Node a, std::vector<Node>& eqc) const;
69
  /** get equality engine */
70
  eq::EqualityEngine* getEqualityEngine() const;
71
  //-------------------------------------- end equality information
72
  /**
73
   * Set that the current state of the solver is in conflict. This should be
74
   * called immediately after a call to conflict(...) on the output channel of
75
   * the theory.
76
   */
77
  virtual void notifyInConflict();
78
  /** Are we currently in conflict? */
79
  virtual bool isInConflict() const;
80
81
  /** Returns true if lit is a SAT literal. */
82
  virtual bool isSatLiteral(TNode lit) const;
83
  /**
84
   * Returns pointer to model. This model is only valid during last call effort
85
   * check.
86
   */
87
  TheoryModel* getModel();
88
  /**
89
   * Returns a pointer to the sort inference module, which lives in TheoryEngine
90
   * and is non-null when options::sortInference is true.
91
   */
92
  SortInference* getSortInference();
93
94
  /** Returns true if n has a current SAT assignment and stores it in value. */
95
  virtual bool hasSatValue(TNode n, bool& value) const;
96
97
  //------------------------------------------- access methods for assertions
98
  /**
99
   * The following methods are intended only to be used in limited use cases,
100
   * for cases where a theory (e.g. quantifiers) requires knowing about the
101
   * assertions from other theories.
102
   */
103
  /** The beginning iterator of facts for theory tid.*/
104
  context::CDList<Assertion>::const_iterator factsBegin(TheoryId tid);
105
  /** The beginning iterator of facts for theory tid.*/
106
  context::CDList<Assertion>::const_iterator factsEnd(TheoryId tid);
107
  /**
108
   * Is the cardinality of type tn finite? This method depends on whether
109
   * finite model finding is enabled. For details, see theory_engine.h.
110
   */
111
  bool isFiniteType(TypeNode tn) const;
112
113
  /** Get the underlying valuation class */
114
  Valuation& getValuation();
115
116
 protected:
117
  /**
118
   * The valuation proxy for the Theory to communicate back with the
119
   * theory engine (and other theories).
120
   */
121
  Valuation d_valuation;
122
  /** Pointer to equality engine of the theory. */
123
  eq::EqualityEngine* d_ee;
124
  /** Are we in conflict? */
125
  context::CDO<bool> d_conflict;
126
};
127
128
}  // namespace theory
129
}  // namespace cvc5
130
131
#endif /* CVC5__THEORY__SOLVER_STATE_H */