diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2018-09-05 09:14:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-05 09:14:14 -0500 |
commit | cc653cb01f824313d22ffc569ba46bc14b447364 (patch) | |
tree | e32bba095f973d6969625f530ba5322874957e90 /src/theory/strings | |
parent | f7dd482aa1cec323273d98fde724dc072471a5f7 (diff) |
Extended rewriter for string equalities (#2427)
Diffstat (limited to 'src/theory/strings')
-rw-r--r-- | src/theory/strings/theory_strings_rewriter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp index e6f3da03a..e09eefddc 100644 --- a/src/theory/strings/theory_strings_rewriter.cpp +++ b/src/theory/strings/theory_strings_rewriter.cpp @@ -911,6 +911,25 @@ Node TheoryStringsRewriter::rewriteMembership(TNode node) { Node one = nm->mkConst(Rational(1)); retNode = one.eqNode(nm->mkNode(STRING_LENGTH, x)); } else if( r.getKind() == kind::REGEXP_STAR ) { + if (x.isConst()) + { + String s = x.getConst<String>(); + if (s.size() == 0) + { + retNode = nm->mkConst(true); + // e.g. (str.in.re "" (re.* (str.to.re x))) ----> true + return returnRewrite(node, retNode, "re-empty-in-str-star"); + } + else if (s.size() == 1) + { + if (r[0].getKind() == STRING_TO_REGEXP) + { + retNode = r[0][0].eqNode(x); + // e.g. (str.in.re "A" (re.* (str.to.re x))) ----> "A" = x + return returnRewrite(node, retNode, "re-char-in-str-star"); + } + } + } if (r[0].getKind() == kind::REGEXP_SIGMA) { retNode = NodeManager::currentNM()->mkConst( true ); |