Previously was immediately converted to (re.* re.allchar) upon construction.
{REGEXP_REPEAT, cvc5::Kind::REGEXP_REPEAT},
{REGEXP_LOOP, cvc5::Kind::REGEXP_LOOP},
{REGEXP_NONE, cvc5::Kind::REGEXP_NONE},
+ {REGEXP_ALL, cvc5::Kind::REGEXP_ALL},
{REGEXP_ALLCHAR, cvc5::Kind::REGEXP_ALLCHAR},
{REGEXP_COMPLEMENT, cvc5::Kind::REGEXP_COMPLEMENT},
// maps to the same kind as the string versions
{cvc5::Kind::REGEXP_LOOP, REGEXP_LOOP},
{cvc5::Kind::REGEXP_LOOP_OP, REGEXP_LOOP},
{cvc5::Kind::REGEXP_NONE, REGEXP_NONE},
+ {cvc5::Kind::REGEXP_ALL, REGEXP_ALL},
{cvc5::Kind::REGEXP_ALLCHAR, REGEXP_ALLCHAR},
{cvc5::Kind::REGEXP_COMPLEMENT, REGEXP_COMPLEMENT},
{cvc5::Kind::CONST_SEQUENCE, CONST_SEQUENCE},
Term Solver::mkTermFromKind(Kind kind) const
{
CVC5_API_KIND_CHECK_EXPECTED(kind == PI || kind == REGEXP_NONE
+ || kind == REGEXP_ALL
|| kind == REGEXP_ALLCHAR || kind == SEP_EMP,
kind)
- << "PI, REGEXP_NONE, REGEXP_ALLCHAR or SEP_EMP";
+ << "PI, REGEXP_NONE, REGEXP_ALL, REGEXP_ALLCHAR or SEP_EMP";
//////// all checks before this line
Node res;
cvc5::Kind k = extToIntKind(kind);
- if (kind == REGEXP_NONE || kind == REGEXP_ALLCHAR)
+ if (kind == REGEXP_NONE || kind == REGEXP_ALL || kind == REGEXP_ALLCHAR)
{
Assert(isDefinedIntKind(k));
res = d_nodeMgr->mkNode(k, std::vector<Node>());
{
CVC5_API_TRY_CATCH_BEGIN;
//////// all checks before this line
- Node res = d_nodeMgr->mkNode(
- cvc5::kind::REGEXP_STAR,
- d_nodeMgr->mkNode(cvc5::kind::REGEXP_ALLCHAR, std::vector<cvc5::Node>()));
+ Node res =
+ d_nodeMgr->mkNode(cvc5::kind::REGEXP_ALL, std::vector<cvc5::Node>());
(void)res.getType(true); /* kick off type checking */
return Term(this, res);
////////
* - `Solver::mkTerm(Kind kind) const`
*/
REGEXP_NONE,
+ /**
+ * Regexp all.
+ *
+ * Parameters: none
+ *
+ * Create with:
+ * - `Solver::mkRegexpAll() const`
+ * - `Solver::mkTerm(Kind kind) const`
+ */
+ REGEXP_ALL,
/**
* Regexp all characters.
*
case kind::STRING_IN_REGEXP: return "str.in_re";
case kind::STRING_TO_REGEXP: return "str.to_re";
case kind::REGEXP_NONE: return "re.none";
+ case kind::REGEXP_ALL: return "re.all";
case kind::REGEXP_ALLCHAR: return "re.allchar";
case kind::REGEXP_CONCAT: return "re.++";
case kind::REGEXP_UNION: return "re.union";
operator REGEXP_COMPLEMENT 1 "regexp complement"
operator REGEXP_NONE 0 "regexp empty"
+operator REGEXP_ALL 0 "regexp all"
operator REGEXP_ALLCHAR 0 "regexp all characters"
constant REGEXP_REPEAT_OP \
typerule STRING_TO_REGEXP ::cvc5::theory::strings::StringToRegExpTypeRule
typerule STRING_IN_REGEXP "SimpleTypeRule<RBool, AString, ARegExp>"
typerule REGEXP_NONE "SimpleTypeRule<RRegExp>"
+typerule REGEXP_ALL "SimpleTypeRule<RRegExp>"
typerule REGEXP_ALLCHAR "SimpleTypeRule<RRegExp>"
# we return isConst for some regular expressions, including all that we enumerate
case Rewrite::INDEXOF_RE_INVALID_INDEX: return "INDEXOF_RE_INVALID_INDEX";
case Rewrite::INDEXOF_RE_MAX_INDEX: return "INDEXOF_RE_MAX_INDEX";
case Rewrite::ITOS_EVAL: return "ITOS_EVAL";
+ case Rewrite::RE_ALL_ELIM: return "RE_ALL_ELIM";
case Rewrite::RE_AND_EMPTY: return "RE_AND_EMPTY";
case Rewrite::RE_ANDOR_FLATTEN: return "RE_ANDOR_FLATTEN";
case Rewrite::RE_ANDOR_INC_CONFLICT: return "RE_ANDOR_INC_CONFLICT";
INDEXOF_RE_INVALID_INDEX,
INDEXOF_RE_MAX_INDEX,
ITOS_EVAL,
+ RE_ALL_ELIM,
RE_AND_EMPTY,
RE_ANDOR_FLATTEN,
RE_ANDOR_INC_CONFLICT,
return node;
}
+Node SequencesRewriter::rewriteAllRegExp(TNode node)
+{
+ Assert(node.getKind() == kind::REGEXP_ALL);
+ NodeManager* nm = NodeManager::currentNM();
+ // re.all ----> (re.* re.allchar)
+ Node ret = nm->mkNode(REGEXP_STAR, nm->mkNode(REGEXP_ALLCHAR));
+ return returnRewrite(node, ret, Rewrite::RE_ALL_ELIM);
+}
+
Node SequencesRewriter::rewriteConcatRegExp(TNode node)
{
Assert(node.getKind() == kind::REGEXP_CONCAT);
{
retNode = rewriteMembership(node);
}
+ else if (nk == REGEXP_ALL)
+ {
+ retNode = rewriteAllRegExp(node);
+ }
else if (nk == REGEXP_CONCAT)
{
retNode = rewriteConcatRegExp(node);
StringsEntail& getStringsEntail();
protected:
+ /** rewrite regular expression all
+ *
+ * This is the entry point for post-rewriting applications of re.all.
+ * Returns the rewritten form of node.
+ */
+ Node rewriteAllRegExp(TNode node);
/** rewrite regular expression concatenation
*
* This is the entry point for post-rewriting applications of re.++.
bool isRegExpKind(Kind k)
{
- return k == REGEXP_NONE || k == REGEXP_ALLCHAR || k == STRING_TO_REGEXP
- || k == REGEXP_CONCAT || k == REGEXP_UNION || k == REGEXP_INTER
- || k == REGEXP_STAR || k == REGEXP_PLUS || k == REGEXP_OPT
- || k == REGEXP_RANGE || k == REGEXP_LOOP || k == REGEXP_RV
- || k == REGEXP_COMPLEMENT;
+ return k == REGEXP_NONE || k == REGEXP_ALL || k == REGEXP_ALLCHAR
+ || k == STRING_TO_REGEXP || k == REGEXP_CONCAT || k == REGEXP_UNION
+ || k == REGEXP_INTER || k == REGEXP_STAR || k == REGEXP_PLUS
+ || k == REGEXP_OPT || k == REGEXP_RANGE || k == REGEXP_LOOP
+ || k == REGEXP_RV || k == REGEXP_COMPLEMENT;
}
TypeNode getOwnerStringType(Node n)