diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-11-07 10:28:25 -0800 |
---|---|---|
committer | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2018-11-07 12:28:25 -0600 |
commit | 58ac30a778baf698603af98ff01aa8c17d430b32 (patch) | |
tree | 401b61a75e5db4478047601af551d98db44494d5 | |
parent | de5552dfde079d161d52016e1be367e59fed1a7c (diff) |
Fix collectEmptyEqs in string rewriter (#2692)
-rw-r--r-- | src/theory/strings/theory_strings_rewriter.cpp | 2 | ||||
-rw-r--r-- | test/regress/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/regress/regress0/strings/unsound-repl-rewrite.smt2 | 8 | ||||
-rw-r--r-- | test/unit/theory/theory_strings_rewriter_white.h | 12 |
4 files changed, 22 insertions, 1 deletions
diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp index 5ba9d6e3f..e94a23c87 100644 --- a/src/theory/strings/theory_strings_rewriter.cpp +++ b/src/theory/strings/theory_strings_rewriter.cpp @@ -4948,7 +4948,7 @@ std::pair<bool, std::vector<Node> > TheoryStringsRewriter::collectEmptyEqs( allEmptyEqs = false; } } - else + else if (x.getKind() == kind::AND) { for (const Node& c : x) { diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index 0313f0b13..5304fcab5 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -839,6 +839,7 @@ set(regress_0_tests regress0/strings/substr-rewrites.smt2 regress0/strings/type001.smt2 regress0/strings/unsound-0908.smt2 + regress0/strings/unsound-repl-rewrite.smt2 regress0/sygus/General_plus10.sy regress0/sygus/aig-si.sy regress0/sygus/c100.sy diff --git a/test/regress/regress0/strings/unsound-repl-rewrite.smt2 b/test/regress/regress0/strings/unsound-repl-rewrite.smt2 new file mode 100644 index 000000000..02e4cc0b2 --- /dev/null +++ b/test/regress/regress0/strings/unsound-repl-rewrite.smt2 @@ -0,0 +1,8 @@ +; COMMAND-LINE: --strings-exp +; EXPECT: sat +(set-logic QF_S) +(declare-fun x () String) +(declare-fun y () String) +(declare-fun z () Int) +(assert (not (= (str.replace "B" (str.replace "" x "A") "B") (str.replace "B" x "B")))) +(check-sat) diff --git a/test/unit/theory/theory_strings_rewriter_white.h b/test/unit/theory/theory_strings_rewriter_white.h index 87aef3704..42ac2cdd9 100644 --- a/test/unit/theory/theory_strings_rewriter_white.h +++ b/test/unit/theory/theory_strings_rewriter_white.h @@ -604,6 +604,18 @@ class TheoryStringsRewriterWhite : public CxxTest::TestSuite b); repl = d_nm->mkNode(kind::STRING_STRREPL, b, x, b); sameNormalForm(repl_repl, repl); + + // Different normal forms for: + // + // (str.replace "B" (str.replace "" x "A") "B") + // + // (str.replace "B" x "B") + repl_repl = d_nm->mkNode(kind::STRING_STRREPL, + b, + d_nm->mkNode(kind::STRING_STRREPL, empty, x, a), + b); + repl = d_nm->mkNode(kind::STRING_STRREPL, b, x, b); + differentNormalForms(repl_repl, repl); } void testRewriteContains() |