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