This PR is a follow-up to #7011, making the Env object available in the TheoryState base class.
namespace theory {
namespace arith {
-ArithState::ArithState(context::Context* c,
- context::UserContext* u,
- Valuation val)
- : TheoryState(c, u, val), d_parent(nullptr)
+ArithState::ArithState(Env& env, Valuation val)
+ : TheoryState(env, val), d_parent(nullptr)
{
}
class ArithState : public TheoryState
{
public:
- ArithState(context::Context* c, context::UserContext* u, Valuation val);
+ ArithState(Env& env,
+ Valuation val);
~ArithState() {}
/** Are we currently in conflict? */
bool isInConflict() const override;
: Theory(THEORY_ARITH, env, out, valuation),
d_ppRewriteTimer(smtStatisticsRegistry().registerTimer(
"theory::arith::ppRewriteTimer")),
- d_astate(getSatContext(), getUserContext(), valuation),
+ d_astate(env, valuation),
d_im(*this, d_astate, d_pnm),
d_ppre(getSatContext(), d_pnm),
d_bab(d_astate, d_im, d_ppre, d_pnm),
d_ppEqualityEngine(getUserContext(), name + "pp", true),
d_ppFacts(getUserContext()),
d_rewriter(d_pnm),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm),
d_literalsToPropagate(getSatContext()),
d_literalsToPropagateIndex(getSatContext(), 0),
namespace theory {
namespace bags {
-SolverState::SolverState(context::Context* c,
- context::UserContext* u,
- Valuation val)
- : TheoryState(c, u, val)
+SolverState::SolverState(Env& env, Valuation val) : TheoryState(env, val)
{
d_true = NodeManager::currentNM()->mkConst(true);
d_false = NodeManager::currentNM()->mkConst(false);
class SolverState : public TheoryState
{
public:
- SolverState(context::Context* c, context::UserContext* u, Valuation val);
+ SolverState(Env& env,
+ Valuation val);
/**
* This function adds the bag representative n to the set d_bags if it is not
TheoryBags::TheoryBags(Env& env, OutputChannel& out, Valuation valuation)
: Theory(THEORY_BAGS, env, out, valuation),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm),
d_ig(&d_state, &d_im),
d_notify(*this, d_im),
TheoryBuiltin::TheoryBuiltin(Env& env, OutputChannel& out, Valuation valuation)
: Theory(THEORY_BUILTIN, env, out, valuation),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm, "theory::builtin::")
{
// indicate we are using the default theory state and inference managers
: Theory(THEORY_BV, env, out, valuation, name),
d_internal(nullptr),
d_rewriter(),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, nullptr, "theory::bv::"),
d_notify(d_im),
d_invalidateModelCache(getSatContext(), true),
d_singleton_eq(getUserContext()),
d_lemmas_produced_c(getUserContext()),
d_sygusExtension(nullptr),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm),
d_notify(d_im, *this)
{
d_floatToRealMap(getUserContext()),
d_abstractionMap(getUserContext()),
d_rewriter(getUserContext()),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm, "theory::fp::", false),
d_wbFactsCache(getUserContext())
{
namespace theory {
namespace quantifiers {
-QuantifiersState::QuantifiersState(context::Context* c,
- context::UserContext* u,
+QuantifiersState::QuantifiersState(Env& env,
Valuation val,
const LogicInfo& logicInfo)
- : TheoryState(c, u, val), d_ierCounterc(c), d_logicInfo(logicInfo)
+ : TheoryState(env, val),
+ d_ierCounterc(env.getContext()),
+ d_logicInfo(logicInfo)
{
// allow theory combination to go first, once initially
d_ierCounter = options::instWhenTcFirst() ? 0 : 1;
class QuantifiersState : public TheoryState
{
public:
- QuantifiersState(context::Context* c,
- context::UserContext* u,
+ QuantifiersState(Env& env,
Valuation val,
const LogicInfo& logicInfo);
~QuantifiersState() {}
OutputChannel& out,
Valuation valuation)
: Theory(THEORY_QUANTIFIERS, env, out, valuation),
- d_qstate(getSatContext(), getUserContext(), valuation, getLogicInfo()),
+ d_qstate(env, valuation, getLogicInfo()),
d_qreg(),
d_treg(d_qstate, d_qreg),
d_qim(*this, d_qstate, d_qreg, d_treg, d_pnm),
: Theory(THEORY_SEP, env, out, valuation),
d_lemmas_produced_c(getUserContext()),
d_bounds_init(false),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm, "theory::sep::"),
d_notify(*this),
d_reduce(getUserContext()),
namespace theory {
namespace sets {
-SolverState::SolverState(context::Context* c,
- context::UserContext* u,
- Valuation val,
- SkolemCache& skc)
- : TheoryState(c, u, val), d_skCache(skc), d_members(c)
+SolverState::SolverState(Env& env, Valuation val, SkolemCache& skc)
+ : TheoryState(env, val), d_skCache(skc), d_members(env.getContext())
{
d_true = NodeManager::currentNM()->mkConst(true);
d_false = NodeManager::currentNM()->mkConst(false);
typedef context::CDHashMap<Node, size_t> NodeIntMap;
public:
- SolverState(context::Context* c,
- context::UserContext* u,
+ SolverState(Env& env,
Valuation val,
SkolemCache& skc);
//-------------------------------- initialize per check
TheorySets::TheorySets(Env& env, OutputChannel& out, Valuation valuation)
: Theory(THEORY_SETS, env, out, valuation),
d_skCache(),
- d_state(getSatContext(), getUserContext(), valuation, d_skCache),
+ d_state(env, valuation, d_skCache),
d_im(*this, d_state, d_pnm),
d_internal(new TheorySetsPrivate(*this, d_state, d_im, d_skCache, d_pnm)),
d_notify(*d_internal.get(), d_im)
namespace theory {
namespace strings {
-SolverState::SolverState(context::Context* c,
- context::UserContext* u,
- Valuation& v)
- : TheoryState(c, u, v), d_eeDisequalities(c), d_pendingConflictSet(c, false), d_pendingConflict(InferenceId::UNKNOWN)
+SolverState::SolverState(Env& env, Valuation& v)
+ : TheoryState(env, v),
+ d_eeDisequalities(env.getContext()),
+ d_pendingConflictSet(env.getContext(), false),
+ d_pendingConflict(InferenceId::UNKNOWN)
{
d_zero = NodeManager::currentNM()->mkConst(Rational(0));
d_false = NodeManager::currentNM()->mkConst(false);
}
if (doMake)
{
- EqcInfo* ei = new EqcInfo(d_context);
+ EqcInfo* ei = new EqcInfo(d_env.getContext());
d_eqcInfo[eqc] = ei;
return ei;
}
typedef context::CDList<Node> NodeList;
public:
- SolverState(context::Context* c,
- context::UserContext* u,
+ SolverState(Env& env,
Valuation& v);
~SolverState();
//-------------------------------------- disequality information
: Theory(THEORY_STRINGS, env, out, valuation),
d_notify(*this),
d_statistics(),
- d_state(getSatContext(), getUserContext(), d_valuation),
+ d_state(env, d_valuation),
d_eagerSolver(d_state),
d_termReg(d_state, d_statistics, d_pnm),
d_extTheoryCb(),
namespace cvc5 {
namespace theory {
-TheoryState::TheoryState(context::Context* c,
- context::UserContext* u,
- Valuation val)
- : d_context(c),
- d_ucontext(u),
+TheoryState::TheoryState(Env& env, Valuation val)
+ : d_env(env),
d_valuation(val),
d_ee(nullptr),
- d_conflict(c, false)
+ d_conflict(d_env.getContext(), false)
{
}
void TheoryState::setEqualityEngine(eq::EqualityEngine* ee) { d_ee = ee; }
-context::Context* TheoryState::getSatContext() const { return d_context; }
+context::Context* TheoryState::getSatContext() const
+{
+ return d_env.getContext();
+}
-context::UserContext* TheoryState::getUserContext() const { return d_ucontext; }
+context::UserContext* TheoryState::getUserContext() const
+{
+ return d_env.getUserContext();
+}
bool TheoryState::hasTerm(TNode a) const
{
#include "context/cdo.h"
#include "expr/node.h"
+#include "smt/env.h"
#include "theory/valuation.h"
namespace cvc5 {
class TheoryState
{
public:
- TheoryState(context::Context* c, context::UserContext* u, Valuation val);
+ TheoryState(Env& env,
+ Valuation val);
virtual ~TheoryState() {}
/**
* Set equality engine, where ee is a pointer to the official equality engine
context::Context* getSatContext() const;
/** Get the user context */
context::UserContext* getUserContext() const;
+ /** Get the environment */
+ Env& getEnv() const { return d_env; }
//-------------------------------------- equality information
/** Is t registered as a term in the equality engine of this class? */
virtual bool hasTerm(TNode a) const;
Valuation& getValuation();
protected:
- /** Pointer to the SAT context object used by the theory. */
- context::Context* d_context;
- /** Pointer to the user context object used by the theory. */
- context::UserContext* d_ucontext;
+ /** Reference to the environment. */
+ Env& d_env;
/**
* The valuation proxy for the Theory to communicate back with the
* theory engine (and other theories).
d_ho(nullptr),
d_functionsTerms(getSatContext()),
d_symb(getUserContext(), instanceName),
- d_state(getSatContext(), getUserContext(), valuation),
+ d_state(env, valuation),
d_im(*this, d_state, d_pnm, "theory::uf::" + instanceName, false),
d_notify(d_im, *this)
{
public:
DummyTheory(Env& env, theory::OutputChannel& out, theory::Valuation valuation)
: Theory(theoryId, env, out, valuation),
- d_state(getSatContext(), getUserContext(), valuation)
+ d_state(env, valuation)
{
// use a default theory state object
d_theoryState = &d_state;