summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/smt/smt_engine.cpp28
-rw-r--r--test/regress/regress0/Makefile.am3
-rw-r--r--test/regress/regress0/bug421b.smt215
3 files changed, 36 insertions, 10 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp
index 84f8c4f95..fa619c653 100644
--- a/src/smt/smt_engine.cpp
+++ b/src/smt/smt_engine.cpp
@@ -390,7 +390,21 @@ public:
throw(TypeCheckingException);
/**
- * pre-skolemize quantifiers
+ * Simplify node "in" by expanding definitions and applying any
+ * substitutions learned from preprocessing.
+ */
+ Node simplify(TNode in) {
+ // Substitute out any abstract values in ex.
+ // Expand definitions.
+ hash_map<Node, Node, NodeHashFunction> cache;
+ Node n = expandDefinitions(in, cache).toExpr();
+ // Make sure we've done all preprocessing, etc.
+ Assert(d_assertionsToCheck.size() == 0 && d_assertionsToPreprocess.size() == 0);
+ return applySubstitutions(n).toExpr();
+ }
+
+ /**
+ * Pre-skolemize quantifiers.
*/
Node preSkolemizeQuantifiers(Node n, bool polarity, std::vector<Node>& fvs);
@@ -2094,18 +2108,14 @@ Expr SmtEngine::simplify(const Expr& ex) throw(TypeCheckingException) {
Dump("benchmark") << SimplifyCommand(ex);
}
- // Substitute out any abstract values in ex.
Expr e = d_private->substituteAbstractValues(Node::fromExpr(ex)).toExpr();
if( options::typeChecking() ) {
e.getType(true);// ensure expr is type-checked at this point
}
- // Expand definitions.
- hash_map<Node, Node, NodeHashFunction> cache;
- e = d_private->expandDefinitions(Node::fromExpr(e), cache).toExpr();
- // Make sure we've done simple preprocessing, unit detection, etc.
- Trace("smt") << "SmtEngine::check(): processing assertions" << endl;
+
+ // Make sure all preprocessing is done
d_private->processAssertions();
- return d_private->applySubstitutions(e).toExpr();
+ return d_private->simplify(Node::fromExpr(e)).toExpr();
}
Expr SmtEngine::expandDefinitions(const Expr& ex) throw(TypeCheckingException) {
@@ -2424,7 +2434,7 @@ void SmtEngine::checkModel(bool hardFailure) {
Notice() << "SmtEngine::checkModel(): -- substitutes to " << n << endl;
// Simplify the result.
- n = Node::fromExpr(simplify(n.toExpr()));
+ n = d_private->simplify(n);
Notice() << "SmtEngine::checkModel(): -- simplifies to " << n << endl;
TheoryId thy = Theory::theoryOf(n);
diff --git a/test/regress/regress0/Makefile.am b/test/regress/regress0/Makefile.am
index de1c8eca5..4a4f02d91 100644
--- a/test/regress/regress0/Makefile.am
+++ b/test/regress/regress0/Makefile.am
@@ -132,7 +132,8 @@ BUG_TESTS = \
bug382.smt2 \
bug383.smt2 \
bug398.smt2 \
- bug421.smt2
+ bug421.smt2 \
+ bug421b.smt2
TESTS = $(SMT_TESTS) $(SMT2_TESTS) $(CVC_TESTS) $(TPTP_TESTS) $(BUG_TESTS)
diff --git a/test/regress/regress0/bug421b.smt2 b/test/regress/regress0/bug421b.smt2
new file mode 100644
index 000000000..a47efb6fb
--- /dev/null
+++ b/test/regress/regress0/bug421b.smt2
@@ -0,0 +1,15 @@
+; same as bug421.smt2 but adds --check-models on command line:
+; this actually caused the same bug for a different reason, so
+; we check them both independently in regressions
+;
+; COMMAND-LINE: --incremental --abstract-values --check-models
+; EXPECT: sat
+; EXPECT: ((a @1) (b @2))
+; EXIT: 10
+(set-logic QF_AUFLIA)
+(set-option :produce-models true)
+(declare-fun a () (Array Int Int))
+(declare-fun b () (Array Int Int))
+(assert (not (= a b)))
+(check-sat)
+(get-value (a b))
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback