This is in preparation to make the "lemma context" configurable.
d_setupLiteral(setup),
d_avariables(avars),
d_ee(nullptr),
- d_satContext(context()),
- d_userContext(userContext()),
d_pnm(d_env.isTheoryProofProducing() ? d_env.getProofNodeManager()
: nullptr),
// Construct d_pfGenEe with the SAT context, since its proof include
{
// use our own copy
d_allocEe.reset(
- new eq::EqualityEngine(d_notify, d_satContext, "arithCong::ee", true));
+ new eq::EqualityEngine(d_notify, context(), "arithCong::ee", true));
d_ee = d_allocEe.get();
if (d_pnm != nullptr)
{
// allocate an internal proof equality engine
d_allocPfee.reset(
- new eq::ProofEqEngine(d_satContext, d_userContext, *d_ee, d_pnm));
+ new eq::ProofEqEngine(context(), userContext(), *d_ee, d_pnm));
d_ee->setProofEqualityEngine(d_allocPfee.get());
}
}
eq::EqualityEngine* d_ee;
/** The equality engine we allocated */
std::unique_ptr<eq::EqualityEngine> d_allocEe;
- /** The sat context */
- context::Context* d_satContext;
- /** The user context */
- context::UserContext* d_userContext;
-
/** proof manager */
ProofNodeManager* d_pnm;
/** A proof generator for storing proofs of facts that are asserted to the EQ
d_hasNlTerms(false),
d_checkCounter(0),
d_extTheoryCb(state.getEqualityEngine()),
- d_extTheory(d_extTheoryCb, context(), userContext(), d_im),
+ d_extTheory(env, d_extTheoryCb, d_im),
d_model(),
d_trSlv(d_im, d_model, d_env),
d_extState(d_im, d_model, d_env),
return false;
}
-ExtTheory::ExtTheory(ExtTheoryCallback& p,
- context::Context* c,
- context::UserContext* u,
- TheoryInferenceManager& im)
- : d_parent(p),
+ExtTheory::ExtTheory(Env& env, ExtTheoryCallback& p, TheoryInferenceManager& im)
+ : EnvObj(env),
+ d_parent(p),
d_im(im),
- d_ext_func_terms(c),
- d_extfExtReducedIdMap(c),
- d_ci_inactive(u),
- d_has_extf(c),
- d_lemmas(u),
- d_pp_lemmas(u)
+ d_ext_func_terms(context()),
+ d_extfExtReducedIdMap(context()),
+ d_ci_inactive(userContext()),
+ d_has_extf(context()),
+ d_lemmas(userContext()),
+ d_pp_lemmas(userContext())
{
d_true = NodeManager::currentNM()->mkConst(true);
}
bool processed = false;
if (sterms[i] != terms[i])
{
- Node sr = Rewriter::rewrite(sterms[i]);
+ Node sr = rewrite(sterms[i]);
// ask the theory if this term is reduced, e.g. is it constant or it
// is a non-extf term.
ExtReducedId id;
#include "context/cdo.h"
#include "context/context.h"
#include "expr/node.h"
+#include "smt/env_obj.h"
#include "theory/theory_inference_manager.h"
namespace cvc5 {
* underlying theory for a "derivable substitution", whereby extended functions
* may be reducable.
*/
-class ExtTheory
+class ExtTheory : protected EnvObj
{
using NodeBoolMap = context::CDHashMap<Node, bool>;
using NodeExtReducedIdMap = context::CDHashMap<Node, ExtReducedId>;
*
* If cacheEnabled is false, we do not cache results of getSubstitutedTerm.
*/
- ExtTheory(ExtTheoryCallback& p,
- context::Context* c,
- context::UserContext* u,
- TheoryInferenceManager& im);
+ ExtTheory(Env& env, ExtTheoryCallback& p, TheoryInferenceManager& im);
virtual ~ExtTheory() {}
/** Tells this class to treat terms with Kind k as extended functions */
void addFunctionKind(Kind k) { d_extf_kind[k] = true; }
ssn << "_dyn_rewriter_" << drewrite_counter;
drewrite_counter++;
d_drewrite = std::unique_ptr<DynamicRewriter>(
- new DynamicRewriter(ssn.str(), &d_fake_context));
+ new DynamicRewriter(ssn.str(), &d_fakeContext));
}
bool CandidateRewriteFilter::filterPair(Node n, Node eq_n)
bool d_use_sygus_type;
//----------------------------congruence filtering
- /** a (dummy) user context, used for d_drewrite */
- context::UserContext d_fake_context;
+ /** a (dummy) context, used for d_drewrite */
+ context::Context d_fakeContext;
/** dynamic rewriter class */
std::unique_ptr<DynamicRewriter> d_drewrite;
//----------------------------end congruence filtering
namespace theory {
namespace quantifiers {
-DynamicRewriter::DynamicRewriter(const std::string& name,
- context::UserContext* u)
- : d_equalityEngine(u, "DynamicRewriter::" + name, true), d_rewrites(u)
+DynamicRewriter::DynamicRewriter(const std::string& name, context::Context* c)
+ : d_equalityEngine(c, "DynamicRewriter::" + name, true), d_rewrites(c)
{
d_equalityEngine.addFunctionKind(kind::APPLY_UF);
}
typedef context::CDList<Node> NodeList;
public:
- DynamicRewriter(const std::string& name, context::UserContext* u);
+ DynamicRewriter(const std::string& name, context::Context* c);
~DynamicRewriter() {}
/** inform this class that the equality a = b holds. */
void addRewrite(Node a, Node b);
namespace cvc5 {
namespace theory {
-RelevanceManager::RelevanceManager(context::UserContext* userContext,
- Valuation val)
+RelevanceManager::RelevanceManager(context::Context* lemContext, Valuation val)
: d_val(val),
- d_input(userContext),
+ d_input(lemContext),
d_computed(false),
d_success(false),
d_trackRSetExp(false),
{
if (options::produceDifficulty())
{
- d_dman.reset(new DifficultyManager(userContext, val));
+ d_dman.reset(new DifficultyManager(lemContext, val));
d_trackRSetExp = true;
// we cannot miniscope AND at the top level, since we need to
// preserve the exact form of preprocessed assertions so the dependencies
typedef context::CDList<Node> NodeList;
public:
- RelevanceManager(context::UserContext* userContext, Valuation val);
+ /**
+ * @param lemContext The context which lemmas live at
+ * @param val The valuation class, for computing what is relevant.
+ */
+ RelevanceManager(context::Context* lemContext, Valuation val);
/**
* Notify (preprocessed) assertions. This is called for input formulas or
* lemmas that need justification that have been fully processed, just before
d_theoryEngine(theoryEngine),
d_inConflict(env.getContext(), false),
d_conflictPolarity(),
- d_satContext(env.getContext()),
- d_userContext(env.getUserContext()),
d_equalityEngine(nullptr),
d_pfee(nullptr)
{
if (d_pfee == nullptr)
{
ProofNodeManager* pnm = d_env.getProofNodeManager();
- d_pfeeAlloc.reset(
- new eq::ProofEqEngine(d_satContext, d_userContext, *ee, pnm));
+ d_pfeeAlloc.reset(new eq::ProofEqEngine(
+ d_env.getContext(), d_env.getUserContext(), *ee, pnm));
d_pfee = d_pfeeAlloc.get();
d_equalityEngine->setProofEqualityEngine(d_pfee);
}
* This method gets called on backtracks from the context manager.
*/
void contextNotifyPop() override { backtrack(); }
- /** The SAT search context. */
- context::Context* d_satContext;
- /** The user level assertion context. */
- context::UserContext* d_userContext;
/** Equality engine */
theory::eq::EqualityEngine* d_equalityEngine;
/** Proof equality engine, if we allocated one */
d_termReg(env, d_state, d_statistics, d_pnm),
d_extTheoryCb(),
d_im(env, *this, d_state, d_termReg, d_extTheory, d_statistics, d_pnm),
- d_extTheory(d_extTheoryCb, context(), userContext(), d_im),
+ d_extTheory(env, d_extTheoryCb, d_im),
d_rewriter(env.getRewriter(), &d_statistics.d_rewrites),
d_bsolver(env, d_state, d_im),
d_csolver(env, d_state, d_im, d_termReg, d_bsolver),
namespace cvc5 {
TheoryEngineProofGenerator::TheoryEngineProofGenerator(ProofNodeManager* pnm,
- context::UserContext* u)
- : d_pnm(pnm), d_proofs(u)
+ context::Context* c)
+ : d_pnm(pnm), d_proofs(c)
{
d_false = NodeManager::currentNM()->mkConst(false);
}
NodeLazyCDProofMap;
public:
- TheoryEngineProofGenerator(ProofNodeManager* pnm, context::UserContext* u);
+ TheoryEngineProofGenerator(ProofNodeManager* pnm, context::Context* c);
~TheoryEngineProofGenerator() {}
/**
* Make trust explanation. Called when lpf has a proof of lit from free
namespace eq {
ProofEqEngine::ProofEqEngine(context::Context* c,
- context::UserContext* u,
+ context::Context* lc,
EqualityEngine& ee,
ProofNodeManager* pnm)
- : EagerProofGenerator(pnm, u, "pfee::" + ee.identify()),
+ : EagerProofGenerator(pnm, lc, "pfee::" + ee.identify()),
d_ee(ee),
d_factPg(c, pnm),
d_assumpPg(pnm),
typedef context::CDHashMap<Node, std::shared_ptr<ProofNode>> NodeProofMap;
public:
+ /**
+ * @param c The SAT context
+ * @param lc The context lemmas live in
+ * @param ee The equality engine this is layered on
+ * @param pnm The proof node manager for producing proof nodes.
+ */
ProofEqEngine(context::Context* c,
- context::UserContext* u,
+ context::Context* lc,
EqualityEngine& ee,
ProofNodeManager* pnm);
~ProofEqEngine() {}