NodeManager::NodeManager(context::Context* ctxt,
ExprManager* exprManager) :
- d_optionsAllocated(new Options()),
- d_options(d_optionsAllocated),
+ d_options(),
d_statisticsRegistry(new StatisticsRegistry()),
next_id(0),
d_attrManager(ctxt),
NodeManager::NodeManager(context::Context* ctxt,
ExprManager* exprManager,
const Options& options) :
- d_optionsAllocated(NULL),
- d_options(&options),
+ d_options(options),
d_statisticsRegistry(new StatisticsRegistry()),
next_id(0),
d_attrManager(ctxt),
}
delete d_statisticsRegistry;
- delete d_optionsAllocated;
}
void NodeManager::reclaimZombies() {
Debug("getType") << "getting type for " << n << std::endl;
- if(needsCheck && !d_options->earlyTypeChecking) {
+ if(needsCheck && !d_options.earlyTypeChecking) {
/* Iterate and compute the children bottom up. This avoids stack
overflows in computeType() when the Node graph is really deep,
which should only affect us when we're type checking lazily. */
static CVC4_THREADLOCAL(NodeManager*) s_current;
- const Options* d_optionsAllocated;
- const Options* d_options;
+ Options d_options;
StatisticsRegistry* d_statisticsRegistry;
NodeValuePool d_nodeValuePool;
/** The node manager in the current public-facing CVC4 library context */
static NodeManager* currentNM() { return s_current; }
- /** Get this node manager's options */
+ /** Get this node manager's options (const version) */
const Options* getOptions() const {
- return d_options;
+ return &d_options;
+ }
+
+ /** Get this node manager's options (non-const version) */
+ Options* getOptions() {
+ return &d_options;
}
/** Get this node manager's statistics registry */
// Expr is destructed, there's no active node manager.
//Assert(nm != NULL);
NodeManager::s_current = nm;
- Options::s_current = nm ? nm->d_options : NULL;
+ Options::s_current = nm ? &nm->d_options : NULL;
Debug("current") << "node manager scope: "
<< NodeManager::s_current << "\n";
}
~NodeManagerScope() {
NodeManager::s_current = d_oldNodeManager;
- Options::s_current = d_oldNodeManager ? d_oldNodeManager->d_options : NULL;
+ Options::s_current = d_oldNodeManager ? &d_oldNodeManager->d_options : NULL;
Debug("current") << "node manager scope: "
<< "returning to " << NodeManager::s_current << "\n";
}
status = doCommand(smt, *subcmd, options) && status;
}
} else {
- // by default, symmetry breaker is on only for QF_UF
- if(! options.ufSymmetryBreakerSetByUser) {
- SetBenchmarkLogicCommand *logic = dynamic_cast<SetBenchmarkLogicCommand*>(cmd);
- if(logic != NULL) {
- options.ufSymmetryBreaker = (logic->getLogic() == "QF_UF");
- }
- }
-
if(options.verbosity > 0) {
*options.out << "Invoking: " << *cmd << endl;
}
status = doCommand(smt, *subcmd, options) && status;
}
} else {
- // by default, symmetry breaker is on only for QF_UF
- if(! options.ufSymmetryBreakerSetByUser) {
- SetBenchmarkLogicCommand *logic = dynamic_cast<SetBenchmarkLogicCommand*>(cmd);
- if(logic != NULL) {
- options.ufSymmetryBreaker = (logic->getLogic() == "QF_UF");
- }
- }
-
if(options.verbosity > 0) {
*options.out << "Invoking: " << *cmd << endl;
}
Dump("benchmark") << SetBenchmarkLogicCommand(s) << endl;
}
+ setLogicInternal(s);
+}
+
+void SmtEngine::setLogicInternal(const std::string& s) throw() {
d_logic = s;
- d_theoryEngine->setLogic(s);
+
+ // by default, symmetry breaker is on only for QF_UF
+ if(! Options::current()->ufSymmetryBreakerSetByUser) {
+ NodeManager::currentNM()->getOptions()->ufSymmetryBreaker = (s == "QF_UF");
+ }
// If in arrays, set the UF handler to arrays
if(s == "QF_AX") {
theory::Theory::setUninterpretedSortOwner(theory::THEORY_ARRAY);
+ } else {
+ theory::Theory::setUninterpretedSortOwner(theory::THEORY_UF);
}
}
if(Dump.isOn("benchmark")) {
Dump("benchmark") << SetInfoCommand(key, value) << endl;
}
+
+ // Check for CVC4-specific info keys (prefixed with "cvc4-" or "cvc4_")
+ if(key.length() > 6) {
+ string prefix = key.substr(0, 6);
+ if(prefix == ":cvc4-" || prefix == ":cvc4_") {
+ string cvc4key = key.substr(6);
+ if(cvc4key == "logic") {
+ if(! value.isAtom()) {
+ throw BadOptionException("argument to (set-info :cvc4-logic ..) must be a string");
+ }
+ d_logic = "";
+ setLogic(value.getValue());
+ return;
+ }
+ }
+ }
+
+ // Check for standard info keys (SMT-LIB v1, SMT-LIB v2, ...)
if(key == ":name" ||
key == ":source" ||
key == ":category" ||
void internalPop();
+ /**
+ * Internally handle the setting of a logic.
+ */
+ void setLogicInternal(const std::string& logic) throw();
+
friend class ::CVC4::smt::SmtEnginePrivate;
// === STATISTICS ===
namespace theory {
/** Default value for the uninterpreted sorts is the UF theory */
-TheoryId Theory::d_uninterpretedSortOwner = THEORY_UF;
+TheoryId Theory::s_uninterpretedSortOwner = THEORY_UF;
std::ostream& operator<<(std::ostream& os, Theory::Effort level){
switch(level){
/**
* The theory that owns the uninterpreted sort.
*/
- static TheoryId d_uninterpretedSortOwner;
+ static TheoryId s_uninterpretedSortOwner;
public:
* Return the ID of the theory responsible for the given type.
*/
static inline TheoryId theoryOf(TypeNode typeNode) {
+ Trace("theory") << "theoryOf(" << typeNode << ")" << std::endl;
TheoryId id;
if (typeNode.getKind() == kind::TYPE_CONSTANT) {
id = typeConstantToTheoryId(typeNode.getConst<TypeConstant>());
id = kindToTheoryId(typeNode.getKind());
}
if (id == THEORY_BUILTIN) {
- return d_uninterpretedSortOwner;
+ Trace("theory") << "theoryOf(" << typeNode << ") == " << s_uninterpretedSortOwner << std::endl;
+ return s_uninterpretedSortOwner;
}
return id;
}
* Returns the ID of the theory responsible for the given node.
*/
static inline TheoryId theoryOf(TNode node) {
+ Trace("theory") << "theoryOf(" << node << ")" << std::endl;
// Constants, variables, 0-ary constructors
if (node.getMetaKind() == kind::metakind::VARIABLE || node.getMetaKind() == kind::metakind::CONSTANT) {
return theoryOf(node.getType());
* Set the owner of the uninterpreted sort.
*/
static void setUninterpretedSortOwner(TheoryId theory) {
- d_uninterpretedSortOwner = theory;
+ s_uninterpretedSortOwner = theory;
}
/**
d_hasShutDown(false),
d_incomplete(context, false),
d_sharedAssertions(context),
- d_logic(""),
d_propagatedLiterals(context),
d_propagatedLiteralsIndex(context, 0),
d_decisionRequests(context),
}
}
-void TheoryEngine::setLogic(std::string logic) {
- Assert(d_logic.empty());
- // Set the logic
- d_logic = logic;
-}
-
void TheoryEngine::preRegister(TNode preprocessed) {
if(Dump.isOn("missed-t-propagations")) {
d_possiblePropagations.push_back(preprocessed);
*/
void assertSharedEqualities();
- /** The logic of the problem */
- std::string d_logic;
-
/**
* Literals that are propagated by the theory. Note that these are TNodes.
* The theory can only propagate nodes that have an assigned literal in the