summaryrefslogtreecommitdiff
path: root/src/theory
diff options
context:
space:
mode:
Diffstat (limited to 'src/theory')
-rw-r--r--src/theory/strings/rewrites.cpp1
-rw-r--r--src/theory/strings/rewrites.h1
-rw-r--r--src/theory/strings/sequences_rewriter.cpp7
3 files changed, 9 insertions, 0 deletions
diff --git a/src/theory/strings/rewrites.cpp b/src/theory/strings/rewrites.cpp
index 5f3c83869..b67315935 100644
--- a/src/theory/strings/rewrites.cpp
+++ b/src/theory/strings/rewrites.cpp
@@ -113,6 +113,7 @@ const char* toString(Rewrite r)
case Rewrite::RPL_X_Y_X_SIMP: return "RPL_X_Y_X_SIMP";
case Rewrite::REPLACE_RE_EVAL: return "REPLACE_RE_EVAL";
case Rewrite::REPLACE_RE_ALL_EVAL: return "REPLACE_RE_ALL_EVAL";
+ case Rewrite::REPLACE_RE_EMP_RE: return "REPLACE_RE_EMP_RE";
case Rewrite::SPLIT_EQ: return "SPLIT_EQ";
case Rewrite::SPLIT_EQ_STRIP_L: return "SPLIT_EQ_STRIP_L";
case Rewrite::SPLIT_EQ_STRIP_R: return "SPLIT_EQ_STRIP_R";
diff --git a/src/theory/strings/rewrites.h b/src/theory/strings/rewrites.h
index 62350c403..3b23e1e39 100644
--- a/src/theory/strings/rewrites.h
+++ b/src/theory/strings/rewrites.h
@@ -118,6 +118,7 @@ enum class Rewrite : uint32_t
RPL_X_Y_X_SIMP,
REPLACE_RE_EVAL,
REPLACE_RE_ALL_EVAL,
+ REPLACE_RE_EMP_RE,
SPLIT_EQ,
SPLIT_EQ_STRIP_L,
SPLIT_EQ_STRIP_R,
diff --git a/src/theory/strings/sequences_rewriter.cpp b/src/theory/strings/sequences_rewriter.cpp
index 3c40062f5..befe52574 100644
--- a/src/theory/strings/sequences_rewriter.cpp
+++ b/src/theory/strings/sequences_rewriter.cpp
@@ -2948,6 +2948,13 @@ Node SequencesRewriter::rewriteReplaceRe(Node node)
return returnRewrite(node, x, Rewrite::REPLACE_RE_EVAL);
}
}
+ // str.replace_re( x, y, z ) ---> z ++ x if "" in y ---> true
+ String emptyStr("");
+ if (RegExpEntail::testConstStringInRegExp(emptyStr, 0, y))
+ {
+ Node ret = nm->mkNode(STRING_CONCAT, z, x);
+ return returnRewrite(node, ret, Rewrite::REPLACE_RE_EMP_RE);
+ }
return node;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback