case Rewrite::RE_EMPTY_IN_STR_STAR: return "RE_EMPTY_IN_STR_STAR";
case Rewrite::RE_IN_DIST_CHAR_STAR: return "RE_IN_DIST_CHAR_STAR";
case Rewrite::RE_IN_SIGMA_STAR: return "RE_IN_SIGMA_STAR";
+ case Rewrite::RE_IN_CHAR_MODULUS_STAR: return "RE_IN_CHAR_MODULUS_STAR";
case Rewrite::RE_LOOP: return "RE_LOOP";
case Rewrite::RE_LOOP_STAR: return "RE_LOOP_STAR";
case Rewrite::RE_OR_ALL: return "RE_OR_ALL";
Node retNode = NodeManager::currentNM()->mkConst(true);
return returnRewrite(node, retNode, Rewrite::RE_IN_SIGMA_STAR);
}
+ else if (r[0].getKind() == REGEXP_CONCAT)
+ {
+ bool isAllchar = true;
+ for (const Node& rc : r[0])
+ {
+ if (rc.getKind() != REGEXP_ALLCHAR)
+ {
+ isAllchar = false;
+ break;
+ }
+ }
+ if (isAllchar)
+ {
+ // For example:
+ // (str.in_re x (re.* re.allchar re.allchar)) --->
+ // (= (mod (str.len x) 2) 0)
+ Node zero = nm->mkConstInt(Rational(0));
+ Node factor = nm->mkConstInt(Rational(r[0].getNumChildren()));
+ Node t = nm->mkNode(INTS_MODULUS, nm->mkNode(STRING_LENGTH, x), factor);
+ Node retNode = t.eqNode(zero);
+ return returnRewrite(node, retNode, Rewrite::RE_IN_CHAR_MODULUS_STAR);
+ }
+ }
}
else if (r.getKind() == kind::REGEXP_CONCAT)
{