3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

add missing axioms for str.at. Issue #953

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-03-25 19:31:01 +01:00
parent ec47706226
commit 3a9857940e
4 changed files with 35 additions and 29 deletions

View file

@ -1981,6 +1981,7 @@ bool theory_seq::solve_nc(unsigned idx) {
}
if (c != n.contains()) {
m_ncs.push_back(nc(c, deps));
m_new_propagation = true;
return true;
}
return false;
@ -2403,6 +2404,14 @@ void theory_seq::display(std::ostream & out) const {
}
}
if (!m_ncs.empty()) {
out << "Non contains:\n";
for (unsigned i = 0; i < m_ncs.size(); ++i) {
out << "not " << mk_pp(m_ncs[i].contains(), m) << "\n";
display_deps(out << " <- ", m_ncs[i].deps()); out << "\n";
}
}
}
void theory_seq::display_equations(std::ostream& out) const {
@ -3496,6 +3505,7 @@ void theory_seq::add_extract_suffix_axiom(expr* e, expr* s, expr* i) {
let e = at(s, i)
0 <= i < len(s) -> s = xey & len(x) = i & len(e) = 1
i < 0 \/ i >= len(s) -> e = empty
*/
void theory_seq::add_at_axiom(expr* e) {
@ -3509,13 +3519,18 @@ void theory_seq::add_at_axiom(expr* e) {
expr_ref y = mk_skolem(m_post, s, mk_sub(mk_sub(len_s, i), one));
expr_ref xey = mk_concat(x, e, y);
expr_ref len_x(m_util.str.mk_length(x), m);
expr_ref emp(m_util.str.mk_empty(m.get_sort(e)), m);
literal i_ge_0 = mk_literal(m_autil.mk_ge(i, zero));
literal i_ge_len_s = mk_literal(m_autil.mk_ge(mk_sub(i, m_util.str.mk_length(s)), zero));
add_axiom(~i_ge_0, i_ge_len_s, mk_seq_eq(s, xey));
add_axiom(~i_ge_0, i_ge_len_s, mk_eq(one, len_e, false));
add_axiom(~i_ge_0, i_ge_len_s, mk_eq(i, len_x, false));
add_axiom(i_ge_0, mk_eq(s, emp, false));
add_axiom(~i_ge_len_s, mk_eq(s, emp, false));
}
/**