1 /********************* */
2 /*! \file theory_state.h
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Morgan Deters, Mathias Preiner
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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.\endverbatim
12 ** \brief A theory state for Theory
15 #include "cvc4_private.h"
17 #ifndef CVC4__THEORY__THEORY_STATE_H
18 #define CVC4__THEORY__THEORY_STATE_H
20 #include "context/cdo.h"
21 #include "expr/node.h"
22 #include "theory/valuation.h"
34 TheoryState(context::Context
* c
, context::UserContext
* u
, Valuation val
);
35 virtual ~TheoryState() {}
37 * Set equality engine, where ee is a pointer to the official equality engine
40 void setEqualityEngine(eq::EqualityEngine
* ee
);
41 /** Get the SAT context */
42 context::Context
* getSatContext() const;
43 /** Get the user context */
44 context::UserContext
* getUserContext() const;
45 //-------------------------------------- equality information
46 /** Is t registered as a term in the equality engine of this class? */
47 virtual bool hasTerm(TNode a
) const;
49 * Get the representative of t in the equality engine of this class, or t
50 * itself if it is not registered as a term.
52 virtual TNode
getRepresentative(TNode t
) const;
54 * Are a and b equal according to the equality engine of this class? Also
55 * returns true if a and b are identical.
57 virtual bool areEqual(TNode a
, TNode b
) const;
59 * Are a and b disequal according to the equality engine of this class? Also
60 * returns true if the representative of a and b are distinct constants.
62 virtual bool areDisequal(TNode a
, TNode b
) const;
63 /** get list of members in the equivalence class of a */
64 virtual void getEquivalenceClass(Node a
, std::vector
<Node
>& eqc
) const;
65 /** get equality engine */
66 eq::EqualityEngine
* getEqualityEngine() const;
67 //-------------------------------------- end equality information
69 * Set that the current state of the solver is in conflict. This should be
70 * called immediately after a call to conflict(...) on the output channel of
73 virtual void notifyInConflict();
74 /** Are we currently in conflict? */
75 virtual bool isInConflict() const;
77 /** Returns true if lit is a SAT literal. */
78 virtual bool isSatLiteral(TNode lit
) const;
80 * Returns pointer to model. This model is only valid during last call effort
83 TheoryModel
* getModel();
85 /** Returns true if n has a current SAT assignment and stores it in value. */
86 virtual bool hasSatValue(TNode n
, bool& value
) const;
88 /** Get the underlying valuation class */
89 Valuation
& getValuation();
92 /** Pointer to the SAT context object used by the theory. */
93 context::Context
* d_context
;
94 /** Pointer to the user context object used by the theory. */
95 context::UserContext
* d_ucontext
;
97 * The valuation proxy for the Theory to communicate back with the
98 * theory engine (and other theories).
100 Valuation d_valuation
;
101 /** Pointer to equality engine of the theory. */
102 eq::EqualityEngine
* d_ee
;
103 /** Are we in conflict? */
104 context::CDO
<bool> d_conflict
;
107 } // namespace theory
110 #endif /* CVC4__THEORY__SOLVER_STATE_H */