mirror of
https://github.com/Z3Prover/z3
synced 2025-07-01 02:18:46 +00:00
add regex support for reverse and left/right derivative rewriting (#4477)
* partial work on adding 'reverse' (broken code) * new op codes for derivative and reverse + associated rewrite rules * incorporate reverses and derivatives in rewriter + some fixes * enable rewriting str.in_re constraints with right derivative
This commit is contained in:
parent
3d9d52f742
commit
c939195c10
5 changed files with 254 additions and 110 deletions
|
@ -566,6 +566,7 @@ void seq_decl_plugin::init() {
|
|||
sort* seqAseqA[2] = { seqA, seqA };
|
||||
sort* seqAreA[2] = { seqA, reA };
|
||||
sort* reAreA[2] = { reA, reA };
|
||||
sort* AreA[2] = { A, reA };
|
||||
sort* seqAint2T[3] = { seqA, intT, intT };
|
||||
sort* seq2AintT[3] = { seqA, seqA, intT };
|
||||
sort* str2T[2] = { strT, strT };
|
||||
|
@ -607,6 +608,8 @@ void seq_decl_plugin::init() {
|
|||
m_sigs[OP_RE_FULL_SEQ_SET] = alloc(psig, m, "re.all", 1, 0, nullptr, reA);
|
||||
m_sigs[OP_RE_FULL_CHAR_SET] = alloc(psig, m, "re.allchar", 1, 0, nullptr, reA);
|
||||
m_sigs[OP_RE_OF_PRED] = alloc(psig, m, "re.of.pred", 1, 1, &predA, reA);
|
||||
m_sigs[OP_RE_REVERSE] = alloc(psig, m, "re.reverse", 1, 1, &reA, reA);
|
||||
m_sigs[OP_RE_DERIVATIVE] = alloc(psig, m, "re.derivative", 1, 2, AreA, reA);
|
||||
m_sigs[OP_SEQ_TO_RE] = alloc(psig, m, "seq.to.re", 1, 1, &seqA, reA);
|
||||
m_sigs[OP_SEQ_IN_RE] = alloc(psig, m, "seq.in.re", 1, 2, seqAreA, boolT);
|
||||
m_sigs[OP_SEQ_REPLACE_RE_ALL] = alloc(psig, m, "str.replace_re_all", 1, 3, seqAreAseqA, seqA);
|
||||
|
@ -748,6 +751,8 @@ func_decl * seq_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters,
|
|||
case OP_RE_RANGE:
|
||||
case OP_RE_OF_PRED:
|
||||
case OP_RE_COMPLEMENT:
|
||||
case OP_RE_REVERSE:
|
||||
case OP_RE_DERIVATIVE:
|
||||
m_has_re = true;
|
||||
// fall-through
|
||||
case OP_SEQ_UNIT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue