Skip to content

Commit

Permalink
replace_re axiom placeholder
Browse files Browse the repository at this point in the history
@ahelwer - illustrates placeholder for one approach for axiomatizing replace_re
  • Loading branch information
NikolajBjorner committed Dec 8, 2021
1 parent 773a2ae commit a5bd115
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/ast/rewriter/seq_axioms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,29 @@ namespace seq {
add_clause(le, emp);
}

/**
* Assume that r has the property that if r accepts string p
* then r does *not* accept any suffix of p. It is conceptually easy to
* convert a deterministic automaton for a regex to a suffix blocking acceptor
* by redirecting removing outgoing edges from accepting states and redirecting them
* to a sink. Alternative, introduce a different string membership predicate that is
* prefix sensitive.
*
* Let e = replace_re(s, r, t)
* Then a claim is that the following axioms suffice to encode str.replace_re
*
* s = "" => e = t
* r = "" => e = s + t
* s not in .*r.* => e = t
* s = x + y + [z] + u & y + [z] in r & x + y not in .*r.* => e = x + t + u
*/
void axioms::replace_re_axiom(expr* e) {
expr* s = nullptr, *r = nullptr, *t = nullptr;
VERIFY(seq.str.is_replace_re(e, s, r, t));
NOT_IMPLEMENTED_YET();
}



/**
Unit is injective:
Expand Down Expand Up @@ -1171,4 +1194,5 @@ namespace seq {
return bound_tracker;
}


}
1 change: 1 addition & 0 deletions src/ast/rewriter/seq_axioms.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ namespace seq {
void unit_axiom(expr* n);
void length_axiom(expr* n);
void unroll_not_contains(expr* e);
void replace_re_axiom(expr* e);

expr_ref length_limit(expr* s, unsigned k);
expr_ref is_digit(expr* ch);
Expand Down

0 comments on commit a5bd115

Please sign in to comment.