namespace cvc5 {
-ProofNodeManager::ProofNodeManager(ProofChecker* pc) : d_checker(pc)
+ProofNodeManager::ProofNodeManager(theory::Rewriter* rr, ProofChecker* pc)
+ : d_rewriter(rr), d_checker(pc)
{
d_true = NodeManager::currentNM()->mkConst(true);
// we always allocate a proof checker, regardless of the proof checking mode
computedAcr = true;
for (const Node& acc : ac)
{
- Node accr = theory::Rewriter::rewrite(acc);
+ Node accr = d_rewriter->rewrite(acc);
if (accr != acc)
{
acr[accr] = acc;
}
}
}
- Node ar = theory::Rewriter::rewrite(a);
+ Node ar = d_rewriter->rewrite(a);
std::unordered_map<Node, Node>::iterator itr = acr.find(ar);
if (itr != acr.end())
{
class ProofChecker;
class ProofNode;
+namespace theory {
+class Rewriter;
+}
+
/**
* A manager for proof node objects. This is a trusted interface for creating
* and updating ProofNode objects.
class ProofNodeManager
{
public:
- ProofNodeManager(ProofChecker* pc = nullptr);
+ ProofNodeManager(theory::Rewriter* rr, ProofChecker* pc = nullptr);
~ProofNodeManager() {}
/**
* This constructs a ProofNode with the given arguments. The expected
static ProofNode* cancelDoubleSymm(ProofNode* pn);
private:
+ /** The rewriter */
+ theory::Rewriter* d_rewriter;
/** The (optional) proof checker */
ProofChecker* d_checker;
/** the true node */
namespace cvc5 {
namespace smt {
-CheckModels::CheckModels(Env& e) : d_env(e) {}
-CheckModels::~CheckModels() {}
+CheckModels::CheckModels(Env& e) : EnvObj(e) {}
void CheckModels::checkModel(TheoryModel* m,
const context::CDList<Node>& al,
Notice() << "SolverEngine::checkModel(): -- substitutes to " << n
<< std::endl;
- n = Rewriter::rewrite(n);
+ n = rewrite(n);
Notice() << "SolverEngine::checkModel(): -- rewrites to " << n << std::endl;
// We look up the value before simplifying. If n contains quantifiers,
#include "context/cdlist.h"
#include "expr/node.h"
+#include "smt/env_obj.h"
namespace cvc5 {
-class Env;
-
namespace theory {
class TheoryModel;
}
/**
* This utility is responsible for checking the current model.
*/
-class CheckModels
+class CheckModels : protected EnvObj
{
public:
CheckModels(Env& e);
- ~CheckModels();
/**
* Check model m against the current set of input assertions al.
*
void checkModel(theory::TheoryModel* m,
const context::CDList<Node>& al,
bool hardFailure);
-
- private:
- /** Reference to the environment */
- Env& d_env;
};
} // namespace smt
namespace cvc5 {
+ModelBlocker::ModelBlocker(Env& e) : EnvObj(e) {}
+
Node ModelBlocker::getModelBlocker(const std::vector<Node>& assertions,
theory::TheoryModel* m,
options::BlockModelsMode mode,
#include "expr/node.h"
#include "options/smt_options.h"
+#include "smt/env_obj.h"
namespace cvc5 {
/**
* A utility for blocking the current model.
*/
-class ModelBlocker
+class ModelBlocker : protected EnvObj
{
public:
+ ModelBlocker(Env& e);
/** get model blocker
*
* This returns a disjunction of literals ~L1 V ... V ~Ln with the following
* our input. In other words, we do not return ~(x < 0) V ~(w < 0) since the
* left disjunct is always false.
*/
- static Node getModelBlocker(
+ Node getModelBlocker(
const std::vector<Node>& assertions,
theory::TheoryModel* m,
options::BlockModelsMode mode,
d_env.getPrinter().toStreamCmdSimplify(d_env.getDumpOut(), node);
}
Node ret = expandDefinitions(node);
- ret = theory::Rewriter::rewrite(ret);
+ ret = rewrite(ret);
return ret;
}
d_pchecker(new ProofChecker(
options().proof.proofCheck == options::ProofCheckMode::EAGER,
options().proof.proofPedantic)),
- d_pnm(new ProofNodeManager(d_pchecker.get())),
+ d_pnm(new ProofNodeManager(env.getRewriter(), d_pchecker.get())),
d_pppg(new PreprocessProofGenerator(
d_pnm.get(), env.getUserContext(), "smt::PreprocessProofGenerator")),
d_pfpp(nullptr),
: d_env(env),
d_pnm(env.getProofNodeManager()),
d_pppg(pppg),
- d_wfpm(env.getProofNodeManager()),
+ d_wfpm(env),
d_updateScopedAssumptions(updateScopedAssumptions)
{
d_true = NodeManager::currentNM()->mkConst(true);
// AJR : necessary?
if (!n.getType().isFunction())
{
- n = Rewriter::rewrite(n);
+ n = d_env->getRewriter()->rewrite(n);
}
Trace("smt") << "--- getting value of " << n << endl;
// get expanded assertions
std::vector<Node> eassertsProc = getExpandedAssertions();
- Node eblocker = ModelBlocker::getModelBlocker(
+ ModelBlocker mb(*d_env.get());
+ Node eblocker = mb.getModelBlocker(
eassertsProc, m, d_env->getOptions().smt.blockModelsMode);
Trace("smt") << "Block formula: " << eblocker << std::endl;
return assertFormula(eblocker);
// get expanded assertions
std::vector<Node> eassertsProc = getExpandedAssertions();
// we always do block model values mode here
- Node eblocker = ModelBlocker::getModelBlocker(
+ ModelBlocker mb(*d_env.get());
+ Node eblocker = mb.getModelBlocker(
eassertsProc, m, options::BlockModelsMode::VALUES, exprs);
return assertFormula(eblocker);
}
// problem are rewritten to true. If this is not the case, then the
// assertions module of the subsolver will complain about assertions
// with free variables.
- Node ar = theory::Rewriter::rewrite(a);
+ Node ar = rewrite(a);
solChecker->assertFormula(ar);
}
Result r = solChecker->checkSat();
#include "smt/witness_form.h"
#include "expr/skolem_manager.h"
+#include "smt/env.h"
#include "theory/rewriter.h"
namespace cvc5 {
namespace smt {
-WitnessFormGenerator::WitnessFormGenerator(ProofNodeManager* pnm)
- : d_tcpg(pnm,
+WitnessFormGenerator::WitnessFormGenerator(Env& env)
+ : d_rewriter(env.getRewriter()),
+ d_tcpg(env.getProofNodeManager(),
nullptr,
TConvPolicy::FIXPOINT,
TConvCachePolicy::NEVER,
"WfGenerator::TConvProofGenerator",
nullptr,
true),
- d_wintroPf(pnm, nullptr, nullptr, "WfGenerator::LazyCDProof"),
- d_pskPf(pnm, nullptr, "WfGenerator::PurifySkolemProof")
+ d_wintroPf(env.getProofNodeManager(),
+ nullptr,
+ nullptr,
+ "WfGenerator::LazyCDProof"),
+ d_pskPf(
+ env.getProofNodeManager(), nullptr, "WfGenerator::PurifySkolemProof")
{
}
bool WitnessFormGenerator::requiresWitnessFormTransform(Node t, Node s) const
{
- return theory::Rewriter::rewrite(t) != theory::Rewriter::rewrite(s);
+ return d_rewriter->rewrite(t) != d_rewriter->rewrite(s);
}
bool WitnessFormGenerator::requiresWitnessFormIntro(Node t) const
{
- Node tr = theory::Rewriter::rewrite(t);
+ Node tr = d_rewriter->rewrite(t);
return !tr.isConst() || !tr.getConst<bool>();
}
#include "proof/proof_generator.h"
namespace cvc5 {
+
+class Env;
+
+namespace theory {
+class Rewriter;
+}
+
namespace smt {
/**
class WitnessFormGenerator : public ProofGenerator
{
public:
- WitnessFormGenerator(ProofNodeManager* pnm);
+ WitnessFormGenerator(Env& env);
~WitnessFormGenerator() {}
/**
* Get proof for, which expects an equality of the form t = toWitness(t).
* Return a proof generator that can prove the given axiom exists.
*/
ProofGenerator* convertExistsInternal(Node exists);
+ /** The rewriter we are using */
+ theory::Rewriter* d_rewriter;
/** The term conversion proof generator */
TConvProofGenerator d_tcpg;
/** The nodes we have already added rewrite steps for in d_tcpg */