#include "preprocessing/learned_literal_manager.h"
+#include "smt/env.h"
#include "theory/rewriter.h"
+#include "theory/trust_substitutions.h"
namespace cvc5 {
namespace preprocessing {
-LearnedLiteralManager::LearnedLiteralManager(theory::TrustSubstitutionMap& tls,
- context::UserContext* u,
- ProofNodeManager* pnm)
- : d_topLevelSubs(tls), d_learnedLits(u)
+LearnedLiteralManager::LearnedLiteralManager(Env& env)
+ : EnvObj(env), d_learnedLits(userContext())
{
}
std::vector<Node> LearnedLiteralManager::getLearnedLiterals() const
{
+ theory::TrustSubstitutionMap& tls = d_env.getTopLevelSubstitutions();
std::vector<Node> currLearnedLits;
for (const auto& lit: d_learnedLits)
{
// update based on substitutions
- Node tlsNode = d_topLevelSubs.get().apply(lit);
- tlsNode = theory::Rewriter::rewrite(tlsNode);
+ Node tlsNode = tls.get().apply(lit);
+ tlsNode = rewrite(tlsNode);
currLearnedLits.push_back(tlsNode);
Trace("pp-llm") << "Learned literal : " << tlsNode << " from " << lit
<< std::endl;
#include "context/cdhashset.h"
#include "expr/node.h"
-#include "theory/trust_substitutions.h"
+#include "smt/env_obj.h"
namespace cvc5 {
namespace preprocessing {
* a literal like (> x t) is learned at top-level, it may be useful to remember
* this information. This class is concerned with the latter kind of literals.
*/
-class LearnedLiteralManager
+class LearnedLiteralManager : protected EnvObj
{
public:
- LearnedLiteralManager(theory::TrustSubstitutionMap& tls,
- context::UserContext* u,
- ProofNodeManager* pnm);
+ LearnedLiteralManager(Env& env);
/**
* Notify learned literal. This method is called when a literal is
* entailed by the current set of assertions.
private:
/** Learned literal map */
typedef context::CDHashSet<Node> NodeSet;
- /* The top level substitutions */
- theory::TrustSubstitutionMap& d_topLevelSubs;
/** Learned literals */
NodeSet d_learnedLits;
};
NonClausalSimp::NonClausalSimp(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "non-clausal-simp"),
d_statistics(statisticsRegistry()),
- d_pnm(preprocContext->getProofNodeManager()),
+ d_pnm(d_env.getProofNodeManager()),
d_llpg(d_pnm ? new smt::PreprocessProofGenerator(
- d_pnm, userContext(), "NonClausalSimp::llpg")
+ d_pnm, userContext(), "NonClausalSimp::llpg")
: nullptr),
d_llra(d_pnm ? new LazyCDProof(
- d_pnm, nullptr, userContext(), "NonClausalSimp::llra")
+ d_pnm, nullptr, userContext(), "NonClausalSimp::llra")
: nullptr),
d_tsubsList(userContext())
{
d_theoryEngine(te),
d_propEngine(pe),
d_circuitPropagator(circuitPropagator),
- d_llm(
- env.getTopLevelSubstitutions(), userContext(), getProofNodeManager()),
+ d_llm(env),
d_symsInAssertions(userContext())
{
}
getTopLevelSubstitutions().addSubstitution(lhs, rhs, id, {}, args);
}
-ProofNodeManager* PreprocessingPassContext::getProofNodeManager() const
-{
- return d_env.getProofNodeManager();
-}
-
} // namespace preprocessing
} // namespace cvc5
#include "preprocessing/learned_literal_manager.h"
#include "smt/env_obj.h"
#include "theory/logic_info.h"
+#include "theory/trust_substitutions.h"
#include "util/resource_manager.h"
namespace cvc5 {
PfRule id,
const std::vector<Node>& args);
- /** The the proof node manager associated with this context, if it exists */
- ProofNodeManager* getProofNodeManager() const;
private:
/** Pointer to the theory engine associated with this context. */
namespace smt {
SmtEngineState::SmtEngineState(Env& env, SolverEngine& slv)
- : d_slv(slv),
- d_env(env),
+ : EnvObj(env),
+ d_slv(slv),
d_pendingPops(0),
d_fullyInited(false),
d_queryMade(false),
Assert(status == "sat" || status == "unsat" || status == "unknown")
<< "SmtEngineState::notifyExpectedStatus: unexpected status string "
<< status;
- d_expectedStatus = Result(status, d_env.getOptions().driver.filename);
+ d_expectedStatus = Result(status, options().driver.filename);
}
void SmtEngineState::notifyResetAssertions()
}
// Remember the global push/pop around everything when beyond Start mode
// (see solver execution modes in the SMT-LIB standard)
- Assert(d_userLevels.size() == 0 && getUserContext()->getLevel() == 1);
+ Assert(d_userLevels.size() == 0 && userContext()->getLevel() == 1);
popto(0);
}
{
doPendingPops();
- while (options::incrementalSolving() && getUserContext()->getLevel() > 1)
+ while (options::incrementalSolving() && userContext()->getLevel() > 1)
{
internalPop(true);
}
// staying symmetric with pop.
d_smtMode = SmtMode::ASSERT;
- d_userLevels.push_back(getUserContext()->getLevel());
+ d_userLevels.push_back(userContext()->getLevel());
internalPush();
Trace("userpushpop") << "SmtEngineState: pushed to level "
- << getUserContext()->getLevel() << std::endl;
+ << userContext()->getLevel() << std::endl;
}
void SmtEngineState::userPop()
// is no longer in scope!).
d_smtMode = SmtMode::ASSERT;
- AlwaysAssert(getUserContext()->getLevel() > 0);
- AlwaysAssert(d_userLevels.back() < getUserContext()->getLevel());
- while (d_userLevels.back() < getUserContext()->getLevel())
+ AlwaysAssert(userContext()->getLevel() > 0);
+ AlwaysAssert(d_userLevels.back() < userContext()->getLevel());
+ while (d_userLevels.back() < userContext()->getLevel())
{
internalPop(true);
}
d_userLevels.pop_back();
}
-context::Context* SmtEngineState::getContext() { return d_env.getContext(); }
-context::UserContext* SmtEngineState::getUserContext()
-{
- return d_env.getUserContext();
-}
void SmtEngineState::push()
{
- getUserContext()->push();
- getContext()->push();
+ userContext()->push();
+ context()->push();
}
void SmtEngineState::pop()
{
- getUserContext()->pop();
- getContext()->pop();
+ userContext()->pop();
+ context()->pop();
}
void SmtEngineState::popto(int toLevel)
{
- getContext()->popto(toLevel);
- getUserContext()->popto(toLevel);
+ context()->popto(toLevel);
+ userContext()->popto(toLevel);
}
Result SmtEngineState::getStatus() const { return d_status; }
{
// notifies the SolverEngine to process the assertions immediately
d_slv.notifyPushPre();
- getUserContext()->push();
+ userContext()->push();
// the context push is done inside of the SAT solver
d_slv.notifyPushPost();
}
// the context pop is done inside of the SAT solver
d_slv.notifyPopPre();
// pop the context
- getUserContext()->pop();
+ userContext()->pop();
--d_pendingPops;
// no need for pop post (for now)
}
#include <string>
#include "context/context.h"
+#include "smt/env_obj.h"
#include "smt/smt_mode.h"
#include "util/result.h"
namespace cvc5 {
class SolverEngine;
-class Env;
namespace smt {
* It maintains a reference to the SolverEngine for the sake of making
* callbacks.
*/
-class SmtEngineState
+class SmtEngineState : protected EnvObj
{
public:
SmtEngineState(Env& env, SolverEngine& smt);
//---------------------------- end queries
private:
- /** get the sat context we are using */
- context::Context* getContext();
- /** get the user context we are using */
- context::UserContext* getUserContext();
/** Pushes the user and SAT contexts */
void push();
/** Pops the user and SAT contexts */
void internalPop(bool immediate = false);
/** Reference to the SolverEngine */
SolverEngine& d_slv;
- /** Reference to the env of the parent SolverEngine */
- Env& d_env;
/** The context levels of user pushes */
std::vector<int> d_userLevels;