%include "smt/smt_engine.i"
%include "smt/modal_exception.i"
+%include "smt/logic_exception.i"
%include "options/options.i"
%include "options/option_exception.i"
command_list.cpp \
command_list.h \
modal_exception.h \
+ logic_exception.h \
simplification_mode.h \
simplification_mode.cpp
options_handlers.h \
smt_options_template.cpp \
modal_exception.i \
+ logic_exception.i \
smt_engine.i
--- /dev/null
+/********************* */
+/*! \file logic_exception.h
+ ** \verbatim
+ ** Original author: mdeters
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 prototype.
+ ** Copyright (c) 2009-2012 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief An exception that is thrown when a feature is used outside
+ ** the logic that CVC4 is currently using
+ **
+ ** \brief An exception that is thrown when a feature is used outside
+ ** the logic that CVC4 is currently using (for example, a quantifier
+ ** is used while running in a quantifier-free logic).
+ **/
+
+#include "cvc4_public.h"
+
+#ifndef __CVC4__SMT__LOGIC_EXCEPTION_H
+#define __CVC4__SMT__LOGIC_EXCEPTION_H
+
+#include "util/exception.h"
+
+namespace CVC4 {
+
+class CVC4_PUBLIC LogicException : public CVC4::Exception {
+public:
+ LogicException() :
+ Exception("Feature used while operating in "
+ "incorrect state") {
+ }
+
+ LogicException(const std::string& msg) :
+ Exception(msg) {
+ }
+
+ LogicException(const char* msg) :
+ Exception(msg) {
+ }
+};/* class LogicException */
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__SMT__LOGIC_EXCEPTION_H */
--- /dev/null
+%{
+#include "smt/logic_exception.h"
+%}
+
+%ignore CVC4::LogicException::LogicException(const char*);
+
+%include "smt/Logic_exception.h"
*
* Returns false if the formula simplifies to "false"
*/
- bool simplifyAssertions() throw(TypeCheckingException);
+ bool simplifyAssertions() throw(TypeCheckingException, LogicException);
public:
* even be simplified.
*/
void addFormula(TNode n)
- throw(TypeCheckingException);
+ throw(TypeCheckingException, LogicException);
/**
* Expand definitions in n.
*/
Node expandDefinitions(TNode n, hash_map<Node, Node, NodeHashFunction>& cache)
- throw(TypeCheckingException);
+ throw(TypeCheckingException, LogicException);
/**
* Simplify node "in" by expanding definitions and applying any
}
Node SmtEnginePrivate::expandDefinitions(TNode n, hash_map<Node, Node, NodeHashFunction>& cache)
- throw(TypeCheckingException) {
+ throw(TypeCheckingException, LogicException) {
Kind k = n.getKind();
// returns false if simplification led to "false"
bool SmtEnginePrivate::simplifyAssertions()
- throw(TypeCheckingException) {
+ throw(TypeCheckingException, LogicException) {
Assert(d_smt.d_pendingPops == 0);
try {
}
void SmtEnginePrivate::addFormula(TNode n)
- throw(TypeCheckingException) {
+ throw(TypeCheckingException, LogicException) {
Trace("smt") << "SmtEnginePrivate::addFormula(" << n << ")" << endl;
}
}
-Result SmtEngine::checkSat(const Expr& ex) throw(TypeCheckingException, ModalException) {
+Result SmtEngine::checkSat(const Expr& ex) throw(TypeCheckingException, ModalException, LogicException) {
Assert(ex.isNull() || ex.getExprManager() == d_exprManager);
SmtScope smts(this);
finalOptionsAreSet();
return r;
}/* SmtEngine::checkSat() */
-Result SmtEngine::query(const Expr& ex) throw(TypeCheckingException, ModalException) {
+Result SmtEngine::query(const Expr& ex) throw(TypeCheckingException, ModalException, LogicException) {
Assert(!ex.isNull());
Assert(ex.getExprManager() == d_exprManager);
SmtScope smts(this);
return r;
}/* SmtEngine::query() */
-Result SmtEngine::assertFormula(const Expr& ex) throw(TypeCheckingException) {
+Result SmtEngine::assertFormula(const Expr& ex) throw(TypeCheckingException, LogicException) {
Assert(ex.getExprManager() == d_exprManager);
SmtScope smts(this);
finalOptionsAreSet();
return quickCheck().asValidityResult();
}
-Expr SmtEngine::simplify(const Expr& ex) throw(TypeCheckingException) {
+Expr SmtEngine::simplify(const Expr& ex) throw(TypeCheckingException, LogicException) {
Assert(ex.getExprManager() == d_exprManager);
SmtScope smts(this);
finalOptionsAreSet();
return d_private->simplify(Node::fromExpr(e)).toExpr();
}
-Expr SmtEngine::expandDefinitions(const Expr& ex) throw(TypeCheckingException) {
+Expr SmtEngine::expandDefinitions(const Expr& ex) throw(TypeCheckingException, LogicException) {
Assert(ex.getExprManager() == d_exprManager);
SmtScope smts(this);
finalOptionsAreSet();
return d_private->expandDefinitions(Node::fromExpr(e), cache).toExpr();
}
-Expr SmtEngine::getValue(const Expr& ex) throw(ModalException) {
+Expr SmtEngine::getValue(const Expr& ex) throw(ModalException, LogicException) {
Assert(ex.getExprManager() == d_exprManager);
SmtScope smts(this);
return vector<Expr>(d_assertionList->begin(), d_assertionList->end());
}
-void SmtEngine::push() throw(ModalException) {
+void SmtEngine::push() throw(ModalException, LogicException) {
SmtScope smts(this);
finalOptionsAreSet();
doPendingPops();
#include "expr/expr_manager.h"
#include "util/proof.h"
#include "smt/modal_exception.h"
+#include "smt/logic_exception.h"
#include "util/hash.h"
#include "options/options.h"
#include "util/result.h"
* literals and conjunction of literals. Returns false iff
* inconsistent.
*/
- Result assertFormula(const Expr& e) throw(TypeCheckingException);
+ Result assertFormula(const Expr& e) throw(TypeCheckingException, LogicException);
/**
* Check validity of an expression with respect to the current set
* of assertions by asserting the query expression's negation and
* calling check(). Returns valid, invalid, or unknown result.
*/
- Result query(const Expr& e) throw(TypeCheckingException, ModalException);
+ Result query(const Expr& e) throw(TypeCheckingException, ModalException, LogicException);
/**
* Assert a formula (if provided) to the current context and call
* check(). Returns sat, unsat, or unknown result.
*/
- Result checkSat(const Expr& e = Expr()) throw(TypeCheckingException, ModalException);
+ Result checkSat(const Expr& e = Expr()) throw(TypeCheckingException, ModalException, LogicException);
/**
* Simplify a formula without doing "much" work. Does not involve
* @todo (design) is this meant to give an equivalent or an
* equisatisfiable formula?
*/
- Expr simplify(const Expr& e) throw(TypeCheckingException);
+ Expr simplify(const Expr& e) throw(TypeCheckingException, LogicException);
/**
* Expand the definitions in a term or formula. No other
* simplification or normalization is done.
*/
- Expr expandDefinitions(const Expr& e) throw(TypeCheckingException);
+ Expr expandDefinitions(const Expr& e) throw(TypeCheckingException, LogicException);
/**
* Get the assigned value of an expr (only if immediately preceded
* by a SAT or INVALID query). Only permitted if the SmtEngine is
* set to operate interactively and produce-models is on.
*/
- Expr getValue(const Expr& e) throw(ModalException);
+ Expr getValue(const Expr& e) throw(ModalException, LogicException);
/**
* Add a function to the set of expressions whose value is to be
/**
* Push a user-level context.
*/
- void push() throw(ModalException);
+ void push() throw(ModalException, LogicException);
/**
* Pop a user-level context. Throws an exception if nothing to pop.
#include "theory/rewriter.h"
#include "theory/theory_traits.h"
+#include "smt/logic_exception.h"
+
#include "util/node_visitor.h"
#include "util/ite_removal.h"
theory::Theory::PPAssertStatus TheoryEngine::solve(TNode literal, SubstitutionMap& substitutionOut) {
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
TNode atom = literal.getKind() == kind::NOT ? literal[0] : literal;
Trace("theory::solve") << "TheoryEngine::solve(" << literal << "): solving with " << theoryOf(atom)->getId() << endl;
ss << "The logic was specified as " << d_logicInfo.getLogicString()
<< ", which doesn't include " << Theory::theoryOf(atom)
<< ", but got an asserted fact to that theory";
- throw Exception(ss.str());
+ throw LogicException(ss.str());
}
Theory::PPAssertStatus solveStatus = theoryOf(atom)->ppAssert(literal, substitutionOut);
ss << "The logic was specified as " << d_logicInfo.getLogicString()
<< ", which doesn't include " << Theory::theoryOf(current)
<< ", but got an asserted fact to that theory";
- throw Exception(ss.str());
+ throw LogicException(ss.str());
}
// If this is an atom, we preprocess its terms with the theory ppRewriter
ss << "The logic was specified as " << d_logicInfo.getLogicString()
<< ", which doesn't include " << toTheoryId
<< ", but got an asserted fact to that theory";
- throw Exception(ss.str());
+ throw LogicException(ss.str());
}
if (d_inConflict) {