namespace CVC4 {
SmtEngine::SmtEngine(ExprManager* em, const Options* opts) throw () :
- d_assertions(),
d_exprManager(em),
d_nodeManager(em->getNodeManager()),
d_options(opts)
return e;
}
-void SmtEngine::processAssertionList() {
- for(unsigned i = 0; i < d_assertions.size(); ++i) {
- d_propEngine->assertFormula(d_assertions[i]);
- }
- d_assertions.clear();
-}
-
Result SmtEngine::check() {
Debug("smt") << "SMT check()" << std::endl;
- processAssertionList();
return d_propEngine->checkSat();
}
Result SmtEngine::quickCheck() {
Debug("smt") << "SMT quickCheck()" << std::endl;
- processAssertionList();
return Result(Result::VALIDITY_UNKNOWN);
}
void SmtEngine::addFormula(const Node& e) {
Debug("smt") << "push_back assertion " << e << std::endl;
- d_assertions.push_back(e);
+ d_propEngine->assertFormula(preprocess(e));
}
Result SmtEngine::checkSat(const BoolExpr& e) {
NodeManagerScope nms(d_nodeManager);
Debug("smt") << "SMT checkSat(" << e << ")" << std::endl;
- Node node_e = preprocess(e.getNode());
- addFormula(node_e);
+ addFormula(e.getNode());
Result r = check().asSatisfiabilityResult();
Debug("smt") << "SMT checkSat(" << e << ") ==> " << r << std::endl;
return r;
Result SmtEngine::query(const BoolExpr& e) {
NodeManagerScope nms(d_nodeManager);
Debug("smt") << "SMT query(" << e << ")" << std::endl;
- Node node_e = preprocess(d_nodeManager->mkNode(NOT, e.getNode()));
- addFormula(node_e);
+ addFormula(e.getNode().notExpr());
Result r = check().asValidityResult();
Debug("smt") << "SMT query(" << e << ") ==> " << r << std::endl;
return r;
Result SmtEngine::assertFormula(const BoolExpr& e) {
NodeManagerScope nms(d_nodeManager);
Debug("smt") << "SMT assertFormula(" << e << ")" << std::endl;
- Node node_e = preprocess(e.getNode());
- addFormula(node_e);
+ addFormula(e.getNode());
return quickCheck().asValidityResult();
}
private:
- /** Current set of assertions. */
- // TODO: make context-aware to handle user-level push/pop.
- std::vector<Node> d_assertions;
-
/** Our expression manager */
ExprManager* d_exprManager;
*/
Result quickCheck();
- /**
- * Process the assertion list: for literals and conjunctions of
- * literals, assert to T-solver.
- */
- void processAssertionList();
-
};/* class SmtEngine */
}/* CVC4 namespace */