{
// if empty, drop it
// e.g. this ensures we rewrite (_)* ++ (a)* ---> (_)*
- if (testConstStringInRegExp(emptyStr, 0, curr))
+ if (isConstRegExp(curr) && testConstStringInRegExp(emptyStr, 0, curr))
{
curr = Node::null();
}
lastAllStar = true;
// go back and remove empty ones from back of cvec
// e.g. this ensures we rewrite (a)* ++ (_)* ---> (_)*
- while (!cvec.empty()
+ while (!cvec.empty() && isConstRegExp(cvec.back())
&& testConstStringInRegExp(emptyStr, 0, cvec.back()))
{
cvec.pop_back();
regress0/strings/issue3440.smt2
regress0/strings/issue3497.smt2
regress0/strings/issue3657-evalLeq.smt2
+ regress0/strings/issue4070.smt2
regress0/strings/itos-entail.smt2
regress0/strings/large-model.smt2
regress0/strings/leadingzero001.smt2
delete d_em;
}
+ void inNormalForm(Node t)
+ {
+ Node res_t = d_rewriter->extendedRewrite(t);
+
+ std::cout << std::endl;
+ std::cout << t << " ---> " << res_t << std::endl;
+ TS_ASSERT_EQUALS(t, res_t);
+ }
+
void sameNormalForm(Node t1, Node t2)
{
Node res_t1 = d_rewriter->extendedRewrite(t1);
}
}
+ void testRewriteRegexpConcat()
+ {
+ TypeNode strType = d_nm->stringType();
+
+ std::vector<Node> emptyArgs;
+ Node x = d_nm->mkVar("x", strType);
+ Node y = d_nm->mkVar("y", strType);
+ Node allStar = d_nm->mkNode(kind::REGEXP_STAR,
+ d_nm->mkNode(kind::REGEXP_SIGMA, emptyArgs));
+ Node xReg = d_nm->mkNode(kind::STRING_TO_REGEXP, x);
+ Node yReg = d_nm->mkNode(kind::STRING_TO_REGEXP, y);
+
+ {
+ // In normal form:
+ //
+ // (re.++ (re.* re.allchar) (re.union (str.to.re x) (str.to.re y)))
+ Node n = d_nm->mkNode(kind::REGEXP_CONCAT,
+ allStar,
+ d_nm->mkNode(kind::REGEXP_UNION, xReg, yReg));
+ inNormalForm(n);
+ }
+
+ {
+ // In normal form:
+ //
+ // (re.++ (str.to.re x) (re.* re.allchar))
+ Node n = d_nm->mkNode(kind::REGEXP_CONCAT, xReg, allStar);
+ inNormalForm(n);
+ }
+ }
+
private:
ExprManager* d_em;
SmtEngine* d_smt;