3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-24 05:08:55 +00:00

updates related to issue #5140 (#5463)

* updates related to issue #5140

* updated/simplified some cases

* fixing feedback comments

* fixed comments and added missing case for get_re_head_tail_reversed

* two bug fixes and some other code improvements
This commit is contained in:
Margus Veanes 2021-08-09 10:48:56 -07:00 committed by GitHub
parent af5fd1014f
commit 225204e2f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 202 additions and 38 deletions

View file

@ -180,6 +180,16 @@ class seq_rewriter {
expr_ref mk_seq_concat(expr* a, expr* b);
// Construct the expressions for taking the first element, the last element, the rest, and the butlast element
expr_ref mk_seq_first(expr* s);
expr_ref mk_seq_rest(expr* s);
expr_ref mk_seq_last(expr* s);
expr_ref mk_seq_butlast(expr* s);
bool try_get_unit_values(expr* s, expr_ref_vector& result);
//replace b in a by c into result
void replace_all_subvectors(expr_ref_vector const& as, expr_ref_vector const& bs, expr* c, expr_ref_vector& result);
// Calculate derivative, memoized and enforcing a normal form
expr_ref is_nullable_rec(expr* r);
expr_ref mk_derivative_rec(expr* ele, expr* r);
@ -344,6 +354,16 @@ public:
return result;
}
/*
* makes concat and simplifies
*/
expr_ref mk_re_append(expr* r1, expr* r2) {
expr_ref result(m());
if (mk_re_concat(r1, r2, result) == BR_FAILED)
result = re().mk_concat(r1, r2);
return result;
}
/**
* check if regular expression is of the form all ++ s ++ all ++ t + u ++ all, where, s, t, u are sequences
*/