Assert(alreadyVisited(current, parent));
}
-void PreRegisterVisitor::start(TNode node) {
- d_multipleTheories = false;
-}
-
-bool PreRegisterVisitor::done(TNode node) {
- // We have multiple theories if removing the node theory from others is non-empty
- return Theory::setRemove(Theory::theoryOf(node), d_theories);
-}
-
std::string SharedTermsVisitor::toString() const {
std::stringstream ss;
TNodeVisitedMap::const_iterator it = d_visited.begin();
*/
theory::Theory::Set d_theories;
- /**
- * Is true if the term we're traversing involves multiple theories.
- */
- bool d_multipleTheories;
-
/**
* String representation of the visited map, for debugging purposes.
*/
public:
- /** Return type tells us if there are more than one theory or not */
- typedef bool return_type;
+ /** Returned set tells us which theories there are */
+ typedef theory::Theory::Set return_type;
PreRegisterVisitor(TheoryEngine* engine, context::Context* context)
: d_engine(engine)
, d_visited(context)
, d_theories(0)
- , d_multipleTheories(false)
{}
/**
/**
* Marks the node as the starting literal.
*/
- void start(TNode node);
+ void start(TNode node) { }
/**
* Notifies the engine of all the theories used.
*/
- bool done(TNode node);
-
+ theory::Theory::Set done(TNode node) { return d_theories; }
};
}
// Pre-register the terms in the atom
- bool multipleTheories = NodeVisitor<PreRegisterVisitor>::run(d_preRegistrationVisitor, preprocessed);
+ Theory::Set theories = NodeVisitor<PreRegisterVisitor>::run(d_preRegistrationVisitor, preprocessed);
+ theories = Theory::setRemove(THEORY_BOOL, theories);
+ // Remove the top theory, if any more that means multiple theories were involved
+ bool multipleTheories = Theory::setRemove(Theory::theoryOf(preprocessed), theories);
+ TheoryId i;
+ while((i = Theory::setPop(theories)) != THEORY_LAST) {
+ if(!d_logicInfo.isTheoryEnabled(i)) {
+ LogicInfo newLogicInfo = d_logicInfo.getUnlockedCopy();
+ newLogicInfo.enableTheory(i);
+ newLogicInfo.lock();
+ stringstream ss;
+ ss << "The logic was specified as " << d_logicInfo.getLogicString()
+ << ", which doesn't include " << i
+ << ", but found a term in that theory." << endl
+ << "You might want to extend your logic to " << newLogicInfo
+ << endl;
+ throw LogicException(ss.str());
+ }
+ }
if (multipleTheories) {
// Collect the shared terms if there are multipe theories
NodeVisitor<SharedTermsVisitor>::run(d_sharedTermsVisitor, preprocessed);