NodeBuilder<> learned(kind::AND);
learned << d_assertionsToCheck[i];
- d_smt.d_theoryEngine->staticLearning(d_assertionsToCheck[i], learned);
+ d_smt.d_theoryEngine->ppStaticLearn(d_assertionsToCheck[i], learned);
if(learned.getNumChildren() == 1) {
learned.clear();
} else {
// Solve it with the corresponding theory
Trace("simplify") << "SmtEnginePrivate::nonClausalSimplify(): "
<< "solving " << learnedLiteral << endl;
- Theory::SolveStatus solveStatus =
+ Theory::PPAssertStatus solveStatus =
d_smt.d_theoryEngine->solve(learnedLiteral, d_topLevelSubstitutions);
switch (solveStatus) {
- case Theory::SOLVE_STATUS_CONFLICT:
+ case Theory::PP_ASSERT_STATUS_CONFLICT:
// If in conflict, we return false
Trace("simplify") << "SmtEnginePrivate::nonClausalSimplify(): "
<< "conflict while solving "
d_assertionsToPreprocess.clear();
d_assertionsToCheck.push_back(NodeManager::currentNM()->mkConst<bool>(false));
return;
- case Theory::SOLVE_STATUS_SOLVED:
+ case Theory::PP_ASSERT_STATUS_SOLVED:
// The literal should rewrite to true
Trace("simplify") << "SmtEnginePrivate::nonClausalSimplify(): "
<< "solved " << learnedLiteral << endl;
d_differenceManager.addSharedTerm(n);
}
-Node TheoryArith::preprocess(TNode atom) {
+Node TheoryArith::ppRewrite(TNode atom) {
Debug("arith::preprocess") << "arith::preprocess() : " << atom << endl;
Node a = d_pbSubstitutions.apply(atom);
return a;
}
-Theory::SolveStatus TheoryArith::solve(TNode in, SubstitutionMap& outSubstitutions) {
+Theory::PPAssertStatus TheoryArith::ppAsert(TNode in, SubstitutionMap& outSubstitutions) {
TimerStat::CodeTimer codeTimer(d_statistics.d_simplifyTimer);
Debug("simplify") << "TheoryArith::solve(" << in << ")" << endl;
// substitution is integral
Debug("simplify") << "TheoryArith::solve(): substitution " << minVar << " |-> " << elim << endl;
outSubstitutions.addSubstitution(minVar, elim);
- return SOLVE_STATUS_SOLVED;
+ return PP_ASSERT_STATUS_SOLVED;
} else {
Debug("simplify") << "TheoryArith::solve(): can't substitute b/c it's integer: " << minVar << ":" << minVar.getType() << " |-> " << elim << ":" << elim.getType() << endl;
}
break;
}
- return SOLVE_STATUS_UNSOLVED;
+ return PP_ASSERT_STATUS_UNSOLVED;
}
-void TheoryArith::staticLearning(TNode n, NodeBuilder<>& learned) {
+void TheoryArith::ppStaticLearn(TNode n, NodeBuilder<>& learned) {
TimerStat::CodeTimer codeTimer(d_statistics.d_staticLearningTimer);
d_learner.staticLearning(n, learned);
void presolve();
void notifyRestart();
- SolveStatus solve(TNode in, SubstitutionMap& outSubstitutions);
- Node preprocess(TNode atom);
- void staticLearning(TNode in, NodeBuilder<>& learned);
+ PPAssertStatus ppAsert(TNode in, SubstitutionMap& outSubstitutions);
+ Node ppRewrite(TNode atom);
+ void ppStaticLearn(TNode in, NodeBuilder<>& learned);
std::string identify() const { return std::string("TheoryArith"); }
}
}
-Theory::SolveStatus TheoryArrays::solve(TNode in, SubstitutionMap& outSubstitutions) {
+Theory::PPAssertStatus TheoryArrays::ppAsert(TNode in, SubstitutionMap& outSubstitutions) {
switch(in.getKind()) {
case kind::EQUAL:
{
d_staticFactManager.addEq(in);
if (in[0].getMetaKind() == kind::metakind::VARIABLE && !in[1].hasSubterm(in[0])) {
outSubstitutions.addSubstitution(in[0], in[1]);
- return SOLVE_STATUS_SOLVED;
+ return PP_ASSERT_STATUS_SOLVED;
}
if (in[1].getMetaKind() == kind::metakind::VARIABLE && !in[0].hasSubterm(in[1])) {
outSubstitutions.addSubstitution(in[1], in[0]);
- return SOLVE_STATUS_SOLVED;
+ return PP_ASSERT_STATUS_SOLVED;
}
break;
}
default:
break;
}
- return SOLVE_STATUS_UNSOLVED;
+ return PP_ASSERT_STATUS_UNSOLVED;
}
Node TheoryArrays::preprocessTerm(TNode term) {
return newTerm;
}
-Node TheoryArrays::preprocess(TNode atom) {
+Node TheoryArrays::ppRewrite(TNode atom) {
if (d_donePreregister) return atom;
Assert(atom.getKind() == kind::EQUAL, "expected EQUAL, got %s", atom.toString().c_str());
return recursivePreprocessTerm(atom);
Node explain(TNode n);
Node getValue(TNode n);
- SolveStatus solve(TNode in, SubstitutionMap& outSubstitutions);
- Node preprocess(TNode atom);
+ PPAssertStatus ppAsert(TNode in, SubstitutionMap& outSubstitutions);
+ Node ppRewrite(TNode atom);
void shutdown() { }
std::string identify() const { return std::string("TheoryArrays"); }
}
}
-Theory::SolveStatus TheoryBool::solve(TNode in, SubstitutionMap& outSubstitutions) {
+Theory::PPAssertStatus TheoryBool::ppAsert(TNode in, SubstitutionMap& outSubstitutions) {
if (in.getKind() == kind::CONST_BOOLEAN && !in.getConst<bool>()) {
// If we get a false literal, we're in conflict
- return SOLVE_STATUS_CONFLICT;
+ return PP_ASSERT_STATUS_CONFLICT;
}
// Add the substitution from the variable to it's value
if (in[0].getKind() == kind::VARIABLE) {
outSubstitutions.addSubstitution(in[0], NodeManager::currentNM()->mkConst<bool>(false));
} else {
- return SOLVE_STATUS_UNSOLVED;
+ return PP_ASSERT_STATUS_UNSOLVED;
}
} else {
if (in.getKind() == kind::VARIABLE) {
outSubstitutions.addSubstitution(in, NodeManager::currentNM()->mkConst<bool>(true));
} else {
- return SOLVE_STATUS_UNSOLVED;
+ return PP_ASSERT_STATUS_UNSOLVED;
}
}
- return SOLVE_STATUS_SOLVED;
+ return PP_ASSERT_STATUS_SOLVED;
}
Node getValue(TNode n);
- SolveStatus solve(TNode in, SubstitutionMap& outSubstitutions);
+ PPAssertStatus ppAsert(TNode in, SubstitutionMap& outSubstitutions);
std::string identify() const { return std::string("TheoryBool"); }
};/* class TheoryBool */
* *never* clear it. It is a conjunction to add to the formula at
* the top-level and may contain other theories' contributions.
*/
- virtual void staticLearning(TNode in, NodeBuilder<>& learned) { }
+ virtual void ppStaticLearn(TNode in, NodeBuilder<>& learned) { }
- enum SolveStatus {
+ enum PPAssertStatus {
/** Atom has been solved */
- SOLVE_STATUS_SOLVED,
+ PP_ASSERT_STATUS_SOLVED,
/** Atom has not been solved */
- SOLVE_STATUS_UNSOLVED,
+ PP_ASSERT_STATUS_UNSOLVED,
/** Atom is inconsistent */
- SOLVE_STATUS_CONFLICT
+ PP_ASSERT_STATUS_CONFLICT
};
/**
* Given a literal, add the solved substitutions to the map, if any.
* The method should return true if the literal can be safely removed.
*/
- virtual SolveStatus solve(TNode in, SubstitutionMap& outSubstitutions) {
+ virtual PPAssertStatus ppAsert(TNode in, SubstitutionMap& outSubstitutions) {
if (in.getKind() == kind::EQUAL) {
if (in[0].getMetaKind() == kind::metakind::VARIABLE && !in[1].hasSubterm(in[0])) {
outSubstitutions.addSubstitution(in[0], in[1]);
- return SOLVE_STATUS_SOLVED;
+ return PP_ASSERT_STATUS_SOLVED;
}
if (in[1].getMetaKind() == kind::metakind::VARIABLE && !in[0].hasSubterm(in[1])) {
outSubstitutions.addSubstitution(in[1], in[0]);
- return SOLVE_STATUS_SOLVED;
+ return PP_ASSERT_STATUS_SOLVED;
}
if (in[0].getMetaKind() == kind::metakind::CONSTANT && in[1].getMetaKind() == kind::metakind::CONSTANT) {
if (in[0] != in[1]) {
- return SOLVE_STATUS_CONFLICT;
+ return PP_ASSERT_STATUS_CONFLICT;
}
}
}
- return SOLVE_STATUS_UNSOLVED;
+ return PP_ASSERT_STATUS_UNSOLVED;
}
/**
* the atom into an equivalent form. This is only called just
* before an input atom to the engine.
*/
- virtual Node preprocess(TNode atom) { return atom; }
+ virtual Node ppRewrite(TNode atom) { return atom; }
/**
* A Theory is called with presolve exactly one time per user
return out << theory.identify();
}
-inline std::ostream& operator << (std::ostream& out, theory::Theory::SolveStatus status) {
+inline std::ostream& operator << (std::ostream& out, theory::Theory::PPAssertStatus status) {
switch (status) {
- case theory::Theory::SOLVE_STATUS_SOLVED:
+ case theory::Theory::PP_ASSERT_STATUS_SOLVED:
out << "SOLVE_STATUS_SOLVED"; break;
- case theory::Theory::SOLVE_STATUS_UNSOLVED:
+ case theory::Theory::PP_ASSERT_STATUS_UNSOLVED:
out << "SOLVE_STATUS_UNSOLVED"; break;
- case theory::Theory::SOLVE_STATUS_CONFLICT:
+ case theory::Theory::PP_ASSERT_STATUS_CONFLICT:
out << "SOLVE_STATUS_CONFLICT"; break;
default:
Unhandled();
CVC4_FOR_EACH_THEORY;
}
-void TheoryEngine::staticLearning(TNode in, NodeBuilder<>& learned) {
+void TheoryEngine::ppStaticLearn(TNode in, NodeBuilder<>& learned) {
// NOTE that we don't look at d_theoryIsActive[] here. First of
// all, we haven't done any pre-registration yet, so we don't know
// which theories are active. Second, let's give each theory a shot
#endif
#define CVC4_FOR_EACH_THEORY_STATEMENT(THEORY) \
if (theory::TheoryTraits<THEORY>::hasStaticLearning) { \
- reinterpret_cast<theory::TheoryTraits<THEORY>::theory_class*>(theoryOf(THEORY))->staticLearning(in, learned); \
+ reinterpret_cast<theory::TheoryTraits<THEORY>::theory_class*>(theoryOf(THEORY))->ppStaticLearn(in, learned); \
}
// static learning for each theory using the statement above
theory::Rewriter::shutdown();
}
-theory::Theory::SolveStatus TheoryEngine::solve(TNode literal, SubstitutionMap& substitutionOut) {
+theory::Theory::PPAssertStatus TheoryEngine::solve(TNode literal, SubstitutionMap& substitutionOut) {
TNode atom = literal.getKind() == kind::NOT ? literal[0] : literal;
Trace("theory::solve") << "TheoryEngine::solve(" << literal << "): solving with " << theoryOf(atom)->getId() << endl;
- Theory::SolveStatus solveStatus = theoryOf(atom)->solve(literal, substitutionOut);
+ Theory::PPAssertStatus solveStatus = theoryOf(atom)->ppAsert(literal, substitutionOut);
Trace("theory::solve") << "TheoryEngine::solve(" << literal << ") => " << solveStatus << endl;
return solveStatus;
}
// If this is an atom, we preprocess it with the theory
if (Theory::theoryOf(current) != THEORY_BOOL) {
- d_atomPreprocessingCache[current] = theoryOf(current)->preprocess(current);
+ d_atomPreprocessingCache[current] = theoryOf(current)->ppRewrite(current);
continue;
}
/**
* Solve the given literal with a theory that owns it.
*/
- theory::Theory::SolveStatus solve(TNode literal,
+ theory::Theory::PPAssertStatus solve(TNode literal,
theory::SubstitutionMap& substitutionOut);
/**
void combineTheories();
/**
- * Calls staticLearning() on all theories, accumulating their
+ * Calls ppStaticLearn() on all theories, accumulating their
* combined contributions in the "learned" builder.
*/
- void staticLearning(TNode in, NodeBuilder<>& learned);
+ void ppStaticLearn(TNode in, NodeBuilder<>& learned);
/**
* Calls presolve() on all theories and returns true
Debug("uf") << "uf: end presolve()" << endl;
}
-void TheoryUF::staticLearning(TNode n, NodeBuilder<>& learned) {
+void TheoryUF::ppStaticLearn(TNode n, NodeBuilder<>& learned) {
//TimerStat::CodeTimer codeTimer(d_staticLearningTimer);
vector<TNode> workList;
if(Options::current()->ufSymmetryBreaker) {
d_symb.assertFormula(n);
}
-}/* TheoryUF::staticLearning() */
+}/* TheoryUF::ppStaticLearn() */
EqualityStatus TheoryUF::getEqualityStatus(TNode a, TNode b) {
if (d_equalityEngine.areEqual(a, b)) {
void preRegisterTerm(TNode term);
Node explain(TNode n);
- void staticLearning(TNode in, NodeBuilder<>& learned);
+ void ppStaticLearn(TNode in, NodeBuilder<>& learned);
void presolve();
void addSharedTerm(TNode n);