mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
parent
ae502bc2c4
commit
a08082e392
5 changed files with 31 additions and 4 deletions
|
@ -813,12 +813,17 @@ br_status bool_rewriter::mk_ite_core(expr * c, expr * t, expr * e, expr_ref & re
|
|||
s = true;
|
||||
}
|
||||
|
||||
// (ite c (ite c t1 t2) t3) ==> (ite c t1 t3)
|
||||
// (ite c (ite c t1 t2) t3) ==> (ite c t1 t3
|
||||
if (m().is_ite(t) && to_app(t)->get_arg(0) == c) {
|
||||
// Remark: (ite c (ite (not c) t1 t2) t3) ==> (ite c t2 t3) does not happen if applying rewrites bottom up
|
||||
t = to_app(t)->get_arg(1);
|
||||
s = true;
|
||||
}
|
||||
// (ite c t1 (ite c2 t1 t2)) ==> (ite (or c c2) t1 t2)
|
||||
if (m().is_ite(e) && to_app(e)->get_arg(1) == t) {
|
||||
result = m().mk_ite(m().mk_or(c, to_app(e)->get_arg(0)), t, to_app(e)->get_arg(2));
|
||||
return BR_REWRITE3;
|
||||
}
|
||||
|
||||
// (ite c t1 (ite c t2 t3)) ==> (ite c t1 t3)
|
||||
if (m().is_ite(e) && to_app(e)->get_arg(0) == c) {
|
||||
|
|
|
@ -824,6 +824,26 @@ br_status seq_rewriter::mk_seq_length(expr* a, expr_ref& result) {
|
|||
result = m_autil.mk_add(es.size(), es.c_ptr());
|
||||
return BR_REWRITE2;
|
||||
}
|
||||
#if 0
|
||||
expr* s = nullptr, *offset = nullptr, *length = nullptr;
|
||||
if (str().is_extract(a, s, offset, length)) {
|
||||
expr_ref len_s(str().mk_length(s), m());
|
||||
// if offset < 0 then 0
|
||||
// elif length <= 0 then 0
|
||||
// elif offset >= len(s) then 0
|
||||
// elif offset + length > len(s) then len(s) - offset
|
||||
// else length
|
||||
expr_ref zero(m_autil.mk_int(0), m());
|
||||
result = length;
|
||||
result = m().mk_ite(m_autil.mk_gt(m_autil.mk_add(offset, length), len_s),
|
||||
m_autil.mk_sub(len_s, offset),
|
||||
result);
|
||||
result = m().mk_ite(m().mk_or(m_autil.mk_ge(offset, len_s), m_autil.mk_le(length, zero), m_autil.mk_lt(offset, zero)),
|
||||
zero,
|
||||
result);
|
||||
return BR_REWRITE_FULL;
|
||||
}
|
||||
#endif
|
||||
return BR_FAILED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue