3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-19 20:33:38 +00:00

propagate has-length over map/mapi

This commit is contained in:
Nikolaj Bjorner 2022-07-12 20:50:28 -07:00
parent 8900db527f
commit 7d0c789af0

View file

@ -2783,30 +2783,29 @@ bool theory_seq::get_length(expr* e, rational& val) {
todo.push_back(e1); todo.push_back(e1);
todo.push_back(e2); todo.push_back(e2);
} }
else if (m_util.str.is_unit(c)) { else if (m_util.str.is_unit(c))
val += rational(1); val += rational(1);
} else if (m_util.str.is_empty(c))
else if (m_util.str.is_empty(c)) {
continue; continue;
} else if (m_util.str.is_map(c, e1, e2))
else if (m_util.str.is_string(c, s)) { todo.push_back(e2);
else if (m_util.str.is_mapi(c, e1, e2, c))
todo.push_back(c);
else if (m_util.str.is_string(c, s))
val += rational(s.length()); val += rational(s.length());
} else
else if (!has_length(c)) { continue;
len = mk_len(c); len = mk_len(c);
if (!has_length(c)) {
add_axiom(mk_literal(m_autil.mk_ge(len, m_autil.mk_int(0)))); add_axiom(mk_literal(m_autil.mk_ge(len, m_autil.mk_int(0))));
TRACE("seq", tout << "literal has no length " << mk_pp(c, m) << "\n";); TRACE("seq", tout << "literal has no length " << mk_pp(c, m) << "\n";);
return false; return false;
} }
else { else if (m_arith_value.get_value(len, val1) && !val1.is_neg())
len = mk_len(c); val += val1;
if (m_arith_value.get_value(len, val1) && !val1.is_neg()) { else {
val += val1; TRACE("seq", tout << "length has not been internalized " << mk_pp(c, m) << "\n";);
} return false;
else {
TRACE("seq", tout << "length has not been internalized " << mk_pp(c, m) << "\n";);
return false;
}
} }
} }
CTRACE("seq", !val.is_int(), tout << "length is not an integer\n";); CTRACE("seq", !val.is_int(), tout << "length is not an integer\n";);