Fix indexof range lemma (#3499)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Wed, 27 Nov 2019 17:03:49 +0000 (11:03 -0600)
committerGitHub <noreply@github.com>
Wed, 27 Nov 2019 17:03:49 +0000 (11:03 -0600)
src/theory/strings/theory_strings.cpp
test/regress/CMakeLists.txt
test/regress/regress0/strings/issue3497.smt2 [new file with mode: 0644]

index 9fad39b6bd870754d2b4e6692cabf495c674da3e..7d10cbadc0acae33dd6135bfa2a115030c4806cf 100644 (file)
@@ -4112,7 +4112,9 @@ void TheoryStrings::registerTerm( Node n, int effort ) {
     Node len = utils::mkNLength(n[0]);
     Node lem = nm->mkNode(AND,
                           nm->mkNode(GEQ, n, nm->mkConst(Rational(-1))),
-                          nm->mkNode(LT, n, len));
+                          nm->mkNode(LEQ, n, len));
+    Trace("strings-lemma") << "Strings::Lemma IDOF range : " << lem
+                           << std::endl;
     d_out->lemma(lem);
   }
 }
index 71ea1baddee0403fae75d9767c134373833af04c..fda31cfdb0a3cb6ae7491941ab9c33b929a5c881 100644 (file)
@@ -871,6 +871,7 @@ set(regress_0_tests
   regress0/strings/indexof-sym-simp.smt2
   regress0/strings/issue1189.smt2
   regress0/strings/issue2958.smt2
+  regress0/strings/issue3497.smt2
   regress0/strings/itos-entail.smt2
   regress0/strings/leadingzero001.smt2
   regress0/strings/loop001.smt2
diff --git a/test/regress/regress0/strings/issue3497.smt2 b/test/regress/regress0/strings/issue3497.smt2
new file mode 100644 (file)
index 0000000..c804de8
--- /dev/null
@@ -0,0 +1,9 @@
+(set-info :smt-lib-version 2.5)
+(set-logic QF_SLIA)
+(set-info :status sat)
+(set-option :strings-exp true)
+(declare-fun x () String)
+(declare-fun y () String)
+(assert (= (str.indexof x y 1) (str.len x)))
+(assert (str.contains x y))
+(check-sat)