3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-12-21 03:33:43 +00:00

seq rewriting fixes

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-11-22 10:48:49 -08:00
parent 7b2590c026
commit 498fa87993
4 changed files with 184 additions and 142 deletions

View file

@ -933,16 +933,16 @@ app* seq_util::mk_skolem(symbol const& name, unsigned n, expr* const* args, sort
return m.mk_app(f, n, args);
}
app* seq_util::str::mk_string(zstring const& s) { return u.seq.mk_string(s); }
app* seq_util::str::mk_string(zstring const& s) const {
return u.seq.mk_string(s);
}
app* seq_util::str::mk_char(zstring const& s, unsigned idx) {
app* seq_util::str::mk_char(zstring const& s, unsigned idx) const {
bv_util bvu(m);
return bvu.mk_numeral(s[idx], s.num_bits());
}
app* seq_util::str::mk_char(char ch) {
app* seq_util::str::mk_char(char ch) const {
zstring s(ch, zstring::ascii);
return mk_char(s, 0);
}
@ -969,6 +969,24 @@ void seq_util::str::get_concat(expr* e, expr_ref_vector& es) const {
}
}
void seq_util::str::get_concat_units(expr* e, expr_ref_vector& es) const {
expr* e1, *e2;
while (is_concat(e, e1, e2)) {
get_concat_units(e1, es);
e = e2;
}
zstring s;
if (is_string(e, s)) {
unsigned sz = s.length();
for (unsigned j = 0; j < sz; ++j) {
es.push_back(mk_unit(mk_char(s, j)));
}
}
else if (!is_empty(e)) {
es.push_back(e);
}
}
app* seq_util::re::mk_loop(expr* r, unsigned lo) {
parameter param(lo);
return m.mk_app(m_fid, OP_RE_LOOP, 1, &param, 1, &r);