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