summaryrefslogtreecommitdiff
path: root/src/smt
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2012-07-08 17:36:50 +0000
committerMorgan Deters <mdeters@gmail.com>2012-07-08 17:36:50 +0000
commitc0dcc5ff59473a45864f818cfdda037c0ee4ea12 (patch)
treefba897c7bea5f5a12b65c0818b7c5260f48e0070 /src/smt
parent8b01efc32d61391d8d3cd2aaac0de49cd8e88ecc (diff)
Bugs resolved by this commit: #314, #322, #359, #364, #365.
See below for details. * Fix the "assert" name-collision bug (resolves bug #364). Our identifiers should never be named "assert", as that's a preprocessor definition in <assert.h>, which is often #included indirectly (so simply having a policy of not including <assert.h> isn't good enough---one of our dependences might include it). It was once the case that we didn't have anything named "assert", but "assert()" has now crept back in. Instead, name things "assertFoo()" or similar. Thanks to Tim for the report. To fix this, I've changed some of Dejan's circuit-propagator code from "assert()" to "assertTrue()". Ditto for Andy's explanation manager. Guys, if you prefer a different name in your code, please change it. * Fix the incorrect parsing of lets in SMT-LIBv2 parser (resolves bug #365). Inner lets now shadow outer lets (previously, they incorrectly gave an error). Additionally, while looking at this, I found that a sequential let was implemented rather than a parallel let. This is now fixed. Thanks to Liana for the report. * Remove ANTLR parser generation warnings in CVC parser (resolves bug #314). * There were a lot of Debug lines in bitvectors that had embedded toString() calls. This wasted a LOT of time in debug builds for BV benchmarks (like in "make regress"). Added if(Debug.isOn(...)) guards; much faster now. * Support for building public-facing interface documentation only (as opposed to all internals documentation). Now "make doc" does the public-facing and "make doc-internals" does documentation of everything. (Along with changes to the nightly build script---which will now build and publish both types of Doxygen documentation---this resolves bug #359). * Fix the lambda typechecking bug (resolves bug #322). Thanks to Andy for the report (a long long time ago--sorry). * The default output language for all streams is now based on the current set of Options (if there is one). This has been a constant annoyance, especially when stringstreams are used to construct output. However, it doesn't work for calls from outside the library, so it's mainly an annoyance-fixer for CVC4 library code itself. * Add some CVC4_UNUSED markers to local variables in theory_arith.cpp that are used only in assertions-enabled builds (and thus give warnings in production builds). This was briefly discussed at the meeting this week.
Diffstat (limited to 'src/smt')
-rw-r--r--src/smt/smt_engine.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp
index 97046a1ae..ddc45228e 100644
--- a/src/smt/smt_engine.cpp
+++ b/src/smt/smt_engine.cpp
@@ -802,17 +802,32 @@ void SmtEngine::defineFunction(Expr func,
Type formulaType = formula.getType(Options::current()->typeChecking);
Type funcType = func.getType();
- Type rangeType = funcType.isFunction() ?
- FunctionType(funcType).getRangeType() : funcType;
- if(formulaType != rangeType) {
- stringstream ss;
- ss << Expr::setlanguage(language::toOutputLanguage(Options::current()->inputLanguage))
- << "Defined function's declared type does not match that of body\n"
- << "The function : " << func << "\n"
- << "Its range type: " << rangeType << "\n"
- << "The body : " << formula << "\n"
- << "Body type : " << formulaType;
- throw TypeCheckingException(func, ss.str());
+ // We distinguish here between definitions of constants and functions,
+ // because the type checking for them is subtly different. Perhaps we
+ // should instead have SmtEngine::defineFunction() and
+ // SmtEngine::defineConstant() for better clarity, although then that
+ // doesn't match the SMT-LIBv2 standard...
+ if(formals.size() > 0) {
+ Type rangeType = FunctionType(funcType).getRangeType();
+ if(formulaType != rangeType) {
+ stringstream ss;
+ ss << "Type of defined function does not match its declaration\n"
+ << "The function : " << func << "\n"
+ << "Declared type : " << rangeType << "\n"
+ << "The body : " << formula << "\n"
+ << "Body type : " << formulaType;
+ throw TypeCheckingException(func, ss.str());
+ }
+ } else {
+ if(formulaType != funcType) {
+ stringstream ss;
+ ss << "Declared type of defined constant does not match its definition\n"
+ << "The constant : " << func << "\n"
+ << "Declared type : " << funcType << "\n"
+ << "The definition : " << formula << "\n"
+ << "Definition type: " << formulaType;
+ throw TypeCheckingException(func, ss.str());
+ }
}
TNode funcNode = func.getTNode();
vector<Node> formalsNodes;
@@ -954,7 +969,7 @@ bool SmtEnginePrivate::nonClausalSimplify() {
for (unsigned i = 0; i < d_assertionsToPreprocess.size(); ++ i) {
Assert(Rewriter::rewrite(d_assertionsToPreprocess[i]) == d_assertionsToPreprocess[i]);
Trace("simplify") << "SmtEnginePrivate::nonClausalSimplify(): asserting " << d_assertionsToPreprocess[i] << endl;
- d_propagator.assert(d_assertionsToPreprocess[i]);
+ d_propagator.assertTrue(d_assertionsToPreprocess[i]);
}
Trace("simplify") << "SmtEnginePrivate::nonClausalSimplify(): "
@@ -1353,8 +1368,7 @@ bool SmtEnginePrivate::simplifyAssertions()
// well-typed, and we don't want the C++ runtime to abort our
// process without any error notice.
stringstream ss;
- ss << Expr::setlanguage(language::toOutputLanguage(Options::current()->inputLanguage))
- << "A bad expression was produced. Original exception follows:\n"
+ ss << "A bad expression was produced. Original exception follows:\n"
<< tcep;
InternalError(ss.str().c_str());
}
@@ -1573,8 +1587,7 @@ void SmtEngine::ensureBoolean(const BoolExpr& e) {
Type boolType = d_exprManager->booleanType();
if(type != boolType) {
stringstream ss;
- ss << Expr::setlanguage(language::toOutputLanguage(Options::current()->inputLanguage))
- << "Expected " << boolType << "\n"
+ ss << "Expected " << boolType << "\n"
<< "The assertion : " << e << "\n"
<< "Its type : " << type;
throw TypeCheckingException(e, ss.str());
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback