This removes the remaining dependencies of SmtEngine on the Expr layer. It now takes a NodeManager instead of a ExprManager.
Solver::Solver(Options* opts)
{
d_exprMgr.reset(new ExprManager);
- d_smtEngine.reset(new SmtEngine(d_exprMgr.get(), opts));
+ d_smtEngine.reset(new SmtEngine(d_exprMgr->getNodeManager(), opts));
d_smtEngine->setSolver(this);
Options& o = d_smtEngine->getOptions();
d_rng.reset(new Random(o[options::seed]));
class TypeNode;
struct CVC4_PUBLIC ExprManagerMapCollection;
-class CVC4_PUBLIC SmtEngine;
+class SmtEngine;
class CVC4_PUBLIC Datatype;
class Record;
{
solver->getSmtEngine()->setUserAttribute(
d_attr,
- d_term.getExpr(),
- api::termVectorToExprs(d_termValues),
+ d_term.getNode(),
+ api::termVectorToNodes(d_termValues),
d_strValue);
}
d_commandStatus = CommandSuccess::instance();
namespace CVC4 {
-SmtEngine::SmtEngine(ExprManager* em, Options* optr)
+SmtEngine::SmtEngine(NodeManager* nm, Options* optr)
: d_state(new SmtEngineState(*this)),
- d_exprManager(em),
- d_nodeManager(d_exprManager->getNodeManager()),
+ d_nodeManager(nm),
d_absValues(new AbstractValues(d_nodeManager)),
d_asserts(new Assertions(getUserContext(), *d_absValues.get())),
d_dumpm(new DumpManager(getUserContext())),
if (key == "all-statistics")
{
vector<SExpr> stats;
- for (StatisticsRegistry::const_iterator i =
- NodeManager::fromExprManager(d_exprManager)
- ->getStatisticsRegistry()
- ->begin();
- i
- != NodeManager::fromExprManager(d_exprManager)
- ->getStatisticsRegistry()
- ->end();
+ StatisticsRegistry* sr = d_nodeManager->getStatisticsRegistry();
+ for (StatisticsRegistry::const_iterator i = sr->begin(); i != sr->end();
++i)
{
vector<SExpr> v;
void SmtEngine::reset()
{
SmtScope smts(this);
- ExprManager *em = d_exprManager;
Trace("smt") << "SMT reset()" << endl;
if(Dump.isOn("benchmark")) {
getOutputManager().getPrinter().toStreamCmdReset(
Options opts;
opts.copyValues(d_originalOptions);
this->~SmtEngine();
- new (this) SmtEngine(em, &opts);
+ new (this) SmtEngine(d_nodeManager, &opts);
// Restore data set after creation
notifyStartParsing(filename);
}
return d_resourceManager->getResourceRemaining();
}
-NodeManager* SmtEngine::getNodeManager() const
-{
- return d_exprManager->getNodeManager();
-}
+NodeManager* SmtEngine::getNodeManager() const { return d_nodeManager; }
Statistics SmtEngine::getStatistics() const
{
}
void SmtEngine::setUserAttribute(const std::string& attr,
- Expr expr,
- const std::vector<Expr>& expr_values,
+ Node expr,
+ const std::vector<Node>& expr_values,
const std::string& str_value)
{
SmtScope smts(this);
finishInit();
- std::vector<Node> node_values;
- for (std::size_t i = 0, n = expr_values.size(); i < n; i++)
- {
- node_values.push_back( expr_values[i].getNode() );
- }
TheoryEngine* te = getTheoryEngine();
Assert(te != nullptr);
- te->setUserAttribute(attr, expr.getNode(), node_values, str_value);
+ te->setUserAttribute(attr, expr, expr_values, str_value);
}
void SmtEngine::setOption(const std::string& key, const CVC4::SExpr& value)
#include <string>
#include <vector>
+#include <map>
#include "base/modal_exception.h"
#include "context/cdhashmap_forward.h"
#include "context/cdhashset_forward.h"
#include "context/cdlist_forward.h"
-#include "expr/expr.h"
-#include "expr/expr_manager.h"
#include "options/options.h"
#include "smt/logic_exception.h"
#include "smt/output_manager.h"
template <bool ref_count> class NodeTemplate;
typedef NodeTemplate<true> Node;
typedef NodeTemplate<false> TNode;
+class TypeNode;
struct NodeHashFunction;
-class SmtEngine;
+class NodeManager;
class DecisionEngine;
class TheoryEngine;
class ProofManager;
class LogicRequest;
class StatisticsRegistry;
class Printer;
+class ResourceManager;
/* -------------------------------------------------------------------------- */
* If provided, optr is a pointer to a set of options that should initialize the values
* of the options object owned by this class.
*/
- SmtEngine(ExprManager* em, Options* optr = nullptr);
+ SmtEngine(NodeManager* nm, Options* optr = nullptr);
/** Destruct the SMT engine. */
~SmtEngine();
/**
* Completely reset the state of the solver, as though destroyed and
* recreated. The result is as if newly constructed (so it still
- * retains the same options structure and ExprManager).
+ * retains the same options structure and NodeManager).
*/
void reset();
*/
unsigned long getResourceRemaining() const;
- /** Permit access to the underlying ExprManager. */
- ExprManager* getExprManager() const { return d_exprManager; }
-
/** Permit access to the underlying NodeManager. */
NodeManager* getNodeManager() const;
* In SMT-LIBv2 this is done via the syntax (! expr :attr)
*/
void setUserAttribute(const std::string& attr,
- Expr expr,
- const std::vector<Expr>& expr_values,
+ Node expr,
+ const std::vector<Node>& expr_values,
const std::string& str_value);
/** Get the options object (const and non-const versions) */
*/
std::unique_ptr<smt::SmtEngineState> d_state;
- /** Our expression manager */
- ExprManager* d_exprManager;
- /** Our internal expression/node manager */
+ /** Our internal node manager */
NodeManager* d_nodeManager;
/** Abstract values */
std::unique_ptr<smt::AbstractValues> d_absValues;
NodeManager* nm = NodeManager::currentNM();
SmtEngine* smtCurr = smt::currentSmtEngine();
// must copy the options
- smte.reset(new SmtEngine(nm->toExprManager(), &smtCurr->getOptions()));
+ smte.reset(new SmtEngine(nm, &smtCurr->getOptions()));
smte->setIsInternalSubsolver();
smte->setLogic(smtCurr->getLogicInfo());
// set the options
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smtEngine = new SmtEngine(d_em);
+ d_smtEngine = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smtEngine);
d_booleanType = new TypeNode(d_nm->booleanType());
}
{
d_em = new ExprManager();
d_nm = d_em->getNodeManager();
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new NodeManagerScope(d_nm);
}
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
void setUp() override
{
d_exprManager = new ExprManager();
- d_smt = new SmtEngine(d_exprManager);
- d_smt->d_logic.lock();
d_nodeManager = NodeManager::fromExprManager(d_exprManager);
+ d_smt = new SmtEngine(d_nodeManager);
+ d_smt->d_logic.lock();
d_scope = new SmtScope(d_smt);
// Notice that this unit test uses the theory engine of a created SMT
opts.setOutputLanguage(language::output::LANG_SMTLIB_V2);
d_em = new ExprManager;
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em, &opts);
+ d_smt = new SmtEngine(d_nm, &opts);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
}
Options opts;
opts.setOutputLanguage(language::output::LANG_SMTLIB_V2);
d_em = new ExprManager;
- d_smt = new SmtEngine(d_em, &opts);
+ d_nm = NodeManager::fromExprManager(d_em);
+ d_smt = new SmtEngine(d_nm, &opts);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
d_rewriter = new ExtendedRewriter(true);
-
- d_nm = NodeManager::currentNM();
}
void tearDown() override
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_smt->setOption("incremental", CVC4::SExpr(false));
d_ctxt = d_smt->getContext();
d_uctxt = d_smt->getUserContext();
void setUp() override
{
d_em.reset(new ExprManager());
- d_smt.reset(new SmtEngine(d_em.get()));
d_nm.reset(NodeManager::fromExprManager(d_em.get()));
+ d_smt.reset(new SmtEngine(d_nm.get()));
d_smt->finishInit();
d_rewriter.reset(new BagsRewriter(nullptr));
}
void setUp() override
{
d_em.reset(new ExprManager());
- d_smt.reset(new SmtEngine(d_em.get()));
d_nm.reset(NodeManager::fromExprManager(d_em.get()));
+ d_smt.reset(new SmtEngine(d_nm.get()));
d_smt->finishInit();
d_rewriter.reset(new BagsRewriter(nullptr));
}
void setUp() override
{
d_em.reset(new ExprManager());
- d_smt.reset(new SmtEngine(d_em.get()));
d_nm.reset(NodeManager::fromExprManager(d_em.get()));
+ d_smt.reset(new SmtEngine(d_nm.get()));
d_smt->finishInit();
}
Options opts;
opts.setOutputLanguage(language::output::LANG_SMTLIB_V2);
d_em = new ExprManager;
- d_smt = new SmtEngine(d_em, &opts);
+ d_nm = NodeManager::fromExprManager(d_em);
+ d_smt = new SmtEngine(d_nm, &opts);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
-
- d_nm = NodeManager::currentNM();
}
void tearDown() override
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smt);
}
void setUp() override {
d_em = new ExprManager();
- d_smt = new SmtEngine(d_em);
d_nm = NodeManager::fromExprManager(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smt);
d_ctxt = d_smt->getContext();
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
}
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_smt->setOption("cegqi-full", CVC4::SExpr(true));
d_smt->setOption("produce-models", CVC4::SExpr(true));
d_scope = new SmtScope(d_smt);
void setUp() override
{
d_em = new ExprManager();
- d_smt = new SmtEngine(d_em);
d_nm = NodeManager::fromExprManager(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
}
{
d_slv.reset(new Solver());
d_em.reset(new ExprManager());
- d_smt.reset(new SmtEngine(d_em.get()));
d_nm.reset(NodeManager::fromExprManager(d_em.get()));
+ d_smt.reset(new SmtEngine(d_nm.get()));
d_smt->finishInit();
}
void setUp() override
{
d_em.reset(new ExprManager());
- d_smt.reset(new SmtEngine(d_em.get()));
+ d_nm = NodeManager::fromExprManager(d_em.get());
+ d_smt.reset(new SmtEngine(d_nm));
d_scope.reset(new SmtScope(d_smt.get()));
// Ensure that the SMT engine is fully initialized (required for the
// rewriter)
d_smt->push();
- d_nm = NodeManager::fromExprManager(d_em.get());
}
void tearDown() override {}
Options opts;
opts.setOutputLanguage(language::output::LANG_SMTLIB_V2);
d_em = new ExprManager;
- d_smt = new SmtEngine(d_em, &opts);
+ d_nm = NodeManager::fromExprManager(d_em);
+ d_smt = new SmtEngine(d_nm, &opts);
d_scope = new SmtScope(d_smt);
- d_nm = NodeManager::currentNM();
}
void tearDown() override
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
- d_smt = new SmtEngine(d_em);
+ d_smt = new SmtEngine(d_nm);
d_ctxt = d_smt->getContext();
d_uctxt = d_smt->getUserContext();
d_scope = new SmtScope(d_smt);
void setUp() override
{
d_em = new ExprManager();
- d_smt = new SmtEngine(d_em);
d_nm = NodeManager::fromExprManager(d_em);
+ d_smt = new SmtEngine(d_nm);
d_scope = new SmtScope(d_smt);
d_smt->finishInit();
}