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