summaryrefslogtreecommitdiff
path: root/src/theory/strings/strings_entail.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2021-04-03 13:21:55 -0500
committerGitHub <noreply@github.com>2021-04-03 13:21:55 -0500
commit69b463e1b1150715b2f4179786ddab8ba0c43b37 (patch)
treee3c1dcb7d32dc0dbb3dd159cc37ab92371bc9ce3 /src/theory/strings/strings_entail.cpp
parentfba1437c772b6733ce678b93b5ef7d95e366c82d (diff)
Disable substring component contains in strip endpoints (#6266)
Fixes the first benchmark from #6203.
Diffstat (limited to 'src/theory/strings/strings_entail.cpp')
-rw-r--r--src/theory/strings/strings_entail.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/theory/strings/strings_entail.cpp b/src/theory/strings/strings_entail.cpp
index 62ba41743..54af1ddcd 100644
--- a/src/theory/strings/strings_entail.cpp
+++ b/src/theory/strings/strings_entail.cpp
@@ -517,7 +517,7 @@ bool StringsEntail::stripConstantEndpoints(std::vector<Node>& n1,
n1cmp = utils::decomposeSubstrChain(n1cmp, sss, sls);
Trace("strings-rewrite-debug2")
<< "stripConstantEndpoints : Compare " << n1cmp << " " << n2[index1]
- << ", dir = " << dir << std::endl;
+ << ", dir = " << r << ", sss/sls=" << sss << "/" << sls << std::endl;
if (n1cmp.isConst())
{
Node s = n1cmp;
@@ -536,6 +536,8 @@ bool StringsEntail::stripConstantEndpoints(std::vector<Node>& n1,
// can remove everything
// e.g. str.contains( "abc", str.++( "ba", x ) ) -->
// str.contains( "", str.++( "ba", x ) )
+ // or std.contains( str.substr( "abc", x, y ), "d" ) --->
+ // str.contains( "", "d" )
removeComponent = true;
}
else if (sss.empty()) // only if not substr
@@ -546,15 +548,11 @@ bool StringsEntail::stripConstantEndpoints(std::vector<Node>& n1,
// str.contains( str.++( "c", x ), str.++( "cd", y ) )
overlap = r == 0 ? Word::overlap(s, t) : Word::overlap(t, s);
}
- else
- {
- // if we are looking at a substring, we can remove the component
- // if there is no overlap
- // e.g. str.contains( str.++( str.substr( "c", i, j ), x), "a" )
- // --> str.contains( x, "a" )
- removeComponent =
- ((r == 0 ? Word::overlap(s, t) : Word::overlap(t, s)) == 0);
- }
+ // note that we cannot process substring here, since t may
+ // match only part of s. Consider:
+ // (str.++ "C" (str.substr "AB" x y)), "CB"
+ // where "AB" and "CB" have no overlap, but "C" is not part of what
+ // is matched with "AB".
}
else if (sss.empty()) // only if not substr
{
@@ -572,6 +570,7 @@ bool StringsEntail::stripConstantEndpoints(std::vector<Node>& n1,
{
// inconclusive
}
+ Trace("strings-rewrite-debug2") << "rem = " << removeComponent << ", overlap = " << overlap << std::endl;
// process the overlap
if (overlap < slen)
{
@@ -635,6 +634,7 @@ bool StringsEntail::stripConstantEndpoints(std::vector<Node>& n1,
}
if (removeComponent)
{
+ Trace("strings-rewrite-debug2") << "...remove component" << std::endl;
// can drop entire first (resp. last) component
if (r == 0)
{
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback