mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
parent
17280846f8
commit
007af9cb8a
|
@ -5572,42 +5572,37 @@ bool seq_rewriter::min_length(expr_ref_vector const& es, unsigned& len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool seq_rewriter::max_length(expr* e, rational& len) {
|
bool seq_rewriter::max_length(expr* e, rational& len) {
|
||||||
if (str().is_unit(e)) {
|
ptr_buffer<expr> es;
|
||||||
len = 1;
|
es.push_back(e);
|
||||||
return true;
|
len = 0;
|
||||||
}
|
|
||||||
if (str().is_at(e)) {
|
|
||||||
len = 1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
zstring s;
|
zstring s;
|
||||||
if (str().is_string(e, s)) {
|
|
||||||
len = rational(s.length());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (str().is_empty(e)) {
|
|
||||||
len = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
expr* s1 = nullptr, *i = nullptr, *l = nullptr;
|
expr* s1 = nullptr, *i = nullptr, *l = nullptr;
|
||||||
rational n;
|
rational n;
|
||||||
if (str().is_extract(e, s1, i, l) && m_autil.is_numeral(l, n) && !n.is_neg()) {
|
|
||||||
len = n;
|
while (!es.empty()) {
|
||||||
return true;
|
e = es.back();
|
||||||
}
|
es.pop_back();
|
||||||
if (str().is_concat(e)) {
|
if (str().is_unit(e))
|
||||||
rational l(0);
|
len += 1;
|
||||||
len = 0;
|
else if (str().is_at(e))
|
||||||
for (expr* arg : *to_app(e)) {
|
len += 1;
|
||||||
if (!max_length(arg, l))
|
else if (str().is_string(e, s))
|
||||||
return false;
|
len += rational(s.length());
|
||||||
len += l;
|
else if (str().is_extract(e, s1, i, l) && m_autil.is_numeral(l, n) && !n.is_neg())
|
||||||
|
len += n;
|
||||||
|
else if (str().is_empty(e))
|
||||||
|
continue;
|
||||||
|
else if (str().is_concat(e)) {
|
||||||
|
for (expr* arg : *to_app(e))
|
||||||
|
es.push_back(arg);
|
||||||
}
|
}
|
||||||
return true;
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool seq_rewriter::is_string(unsigned n, expr* const* es, zstring& s) const {
|
bool seq_rewriter::is_string(unsigned n, expr* const* es, zstring& s) const {
|
||||||
zstring s1;
|
zstring s1;
|
||||||
expr* e;
|
expr* e;
|
||||||
|
|
Loading…
Reference in a new issue