3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-10 21:20:52 +00:00

handle case where lower bound is above upper

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-09-20 09:54:18 -07:00
parent b506e45845
commit 4101652747
2 changed files with 5 additions and 4 deletions

View file

@ -1824,6 +1824,10 @@ br_status seq_rewriter::mk_re_loop(func_decl* f, unsigned num_args, expr* const*
expr* a = nullptr;
switch (num_args) {
case 1:
if (f->get_num_parameters() == 2 && f->get_parameter(0).get_int() > f->get_parameter(1).get_int()) {
result = m_util.re.mk_loop(args[0], f->get_parameter(1).get_int(), f->get_parameter(1).get_int());
return BR_REWRITE1;
}
// (loop (loop a lo hi) lo2 hi2) = (loop lo*lo2 hi*hi2)
if (m_util.re.is_loop(args[0], a, lo, hi) && f->get_num_parameters() == 2) {
result = m_util.re.mk_loop(a, f->get_parameter(0).get_int() * lo, f->get_parameter(1).get_int() * hi);
@ -1864,7 +1868,7 @@ br_status seq_rewriter::mk_re_loop(func_decl* f, unsigned num_args, expr* const*
break;
case 3:
if (m_autil.is_numeral(args[1], n1) && n1.is_unsigned() &&
m_autil.is_numeral(args[2], n2) && n2.is_unsigned() && n1 <= n2) {
m_autil.is_numeral(args[2], n2) && n2.is_unsigned()) {
result = m_util.re.mk_loop(args[0], n1.get_unsigned(), n2.get_unsigned());
return BR_REWRITE1;
}