From: Andrew Reynolds Date: Tue, 19 Jul 2022 15:21:54 +0000 (-0500) Subject: Fix bug in strict symbolic length strip (#8973) X-Git-Tag: cvc5-1.0.1~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ae37634614383713d4c590afb8b772ea8b02e33;p=cvc5.git Fix bug in strict symbolic length strip (#8973) Leads to incorrect rewrites. Fixes #8970. --- diff --git a/src/theory/strings/strings_entail.cpp b/src/theory/strings/strings_entail.cpp index a9e77615e..e5111c94a 100644 --- a/src/theory/strings/strings_entail.cpp +++ b/src/theory/strings/strings_entail.cpp @@ -202,7 +202,12 @@ bool StringsEntail::stripSymbolicLength(std::vector& n1, } } } - if (sindex > 0 && (!strict || curr == zero)) + if (strict && curr != zero) + { + // return false if we did not strip the entire length + ret = false; + } + else if (sindex > 0) { if (dir == 1) { diff --git a/test/regress/cli/CMakeLists.txt b/test/regress/cli/CMakeLists.txt index 51836ea02..41bf5cac9 100644 --- a/test/regress/cli/CMakeLists.txt +++ b/test/regress/cli/CMakeLists.txt @@ -2657,6 +2657,7 @@ set(regress_1_tests regress1/strings/issue8918-str-nth-crange-red.smt2 regress1/strings/issue8932-cmi-unit.smt2 regress1/strings/issue8944-sygus-inst.smt2 + regress1/strings/issue8970-strip-sym-len.smt2 regress1/strings/kaluza-fl.smt2 regress1/strings/loop002.smt2 regress1/strings/loop003.smt2 diff --git a/test/regress/cli/regress1/strings/issue8970-strip-sym-len.smt2 b/test/regress/cli/regress1/strings/issue8970-strip-sym-len.smt2 new file mode 100644 index 000000000..f44d5ae5a --- /dev/null +++ b/test/regress/cli/regress1/strings/issue8970-strip-sym-len.smt2 @@ -0,0 +1,8 @@ +; EXPECT: sat +(set-logic QF_SLIA) +(declare-fun t () String) +(assert (str.prefixof "-" (str.substr t 0 1))) +(assert (> (str.len (str.substr t 0 2)) 1)) +(assert (= "-0" (str.update "-0" 0 t))) +(assert (str.suffixof (str.replace t "-0" "-") "-")) +(check-sat)