mirror of
https://github.com/Z3Prover/z3
synced 2025-04-07 09:55:19 +00:00
added rewrite for itos
This commit is contained in:
parent
e398959732
commit
847724fb21
|
@ -2201,6 +2201,20 @@ br_status seq_rewriter::mk_str_itos(expr* a, expr_ref& result) {
|
||||||
}
|
}
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
// itos(stoi(s)) -> if s = '0' or .... or s = '9' then s else ""
|
||||||
|
// when |s| <= 1
|
||||||
|
expr* b = nullptr;
|
||||||
|
|
||||||
|
if (str().is_stoi(a, b) && max_length(b, r) && r <= 1) {
|
||||||
|
expr_ref_vector eqs(m());
|
||||||
|
for (unsigned i = 0; i < 10; ++i) {
|
||||||
|
zstring s('0' + i);
|
||||||
|
eqs.push_back(m().mk_eq(b, str().mk_string(s)));
|
||||||
|
}
|
||||||
|
result = m().mk_or(eqs);
|
||||||
|
result = m().mk_ite(result, b, str().mk_string(symbol("")));
|
||||||
|
return BR_REWRITE2;
|
||||||
|
}
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue