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