From bd2793a68e021ab58ab07db0cac67cf3d6806ead Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Wed, 27 Nov 2019 11:03:49 -0600 Subject: [PATCH] Fix indexof range lemma (#3499) --- src/theory/strings/theory_strings.cpp | 4 +++- test/regress/CMakeLists.txt | 1 + test/regress/regress0/strings/issue3497.smt2 | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/regress/regress0/strings/issue3497.smt2 diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index 9fad39b6b..7d10cbadc 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -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); } } diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index 71ea1badd..fda31cfdb 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -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 index 000000000..c804de820 --- /dev/null +++ b/test/regress/regress0/strings/issue3497.smt2 @@ -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) -- 2.30.2