mirror of
https://github.com/Z3Prover/z3
synced 2025-04-06 17:44:08 +00:00
don't rewrite empty/non-empty checking predicates
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
b4f994b5c8
commit
615e2cf37c
|
@ -411,8 +411,10 @@ namespace smt {
|
|||
<< "," << expr_id_str(u) << "," << expr_id_str(n) << ") ";);
|
||||
|
||||
expr_ref is_nullable = is_nullable_wrapper(r);
|
||||
if (m.is_true(is_nullable))
|
||||
if (m.is_true(is_nullable)) {
|
||||
TRACE("seq_regex", tout << "is nullable\n";);
|
||||
return;
|
||||
}
|
||||
literal null_lit = th.mk_literal(is_nullable);
|
||||
expr_ref hd = mk_first(r, n);
|
||||
expr_ref d(m);
|
||||
|
@ -433,12 +435,13 @@ namespace smt {
|
|||
rewrite(cond);
|
||||
if (m.is_false(cond))
|
||||
continue;
|
||||
expr_ref next_non_empty = sk().mk_is_non_empty(p.second, re().mk_union(u, r), n);
|
||||
expr_ref next_non_empty = sk().mk_is_non_empty(p.second, re().mk_union(u, p.second), n);
|
||||
if (!m.is_true(cond))
|
||||
next_non_empty = m.mk_and(cond, next_non_empty);
|
||||
lits.push_back(th.mk_literal(next_non_empty));
|
||||
}
|
||||
|
||||
TRACE("seq_regex", tout << lits << "\n";);
|
||||
th.add_axiom(lits);
|
||||
}
|
||||
|
||||
|
@ -518,7 +521,7 @@ namespace smt {
|
|||
expr_ref ncond(mk_not(m, cond), m);
|
||||
lits.push_back(th.mk_literal(mk_forall(m, hd, ncond)));
|
||||
}
|
||||
expr_ref is_empty1 = sk().mk_is_empty(p.second, re().mk_union(u, r), n);
|
||||
expr_ref is_empty1 = sk().mk_is_empty(p.second, re().mk_union(u, p.second), n);
|
||||
lits.push_back(th.mk_literal(is_empty1));
|
||||
th.add_axiom(lits);
|
||||
}
|
||||
|
|
|
@ -40,14 +40,15 @@ seq_skolem::seq_skolem(ast_manager& m, th_rewriter& rw):
|
|||
m_is_non_empty = "re.is_non_empty";
|
||||
}
|
||||
|
||||
expr_ref seq_skolem::mk(symbol const& s, expr* e1, expr* e2, expr* e3, expr* e4, sort* range) {
|
||||
expr_ref seq_skolem::mk(symbol const& s, expr* e1, expr* e2, expr* e3, expr* e4, sort* range, bool rw) {
|
||||
expr* es[4] = { e1, e2, e3, e4 };
|
||||
unsigned len = e4?4:(e3?3:(e2?2:(e1?1:0)));
|
||||
if (!range) {
|
||||
range = m.get_sort(e1);
|
||||
}
|
||||
expr_ref result(seq.mk_skolem(s, len, es, range), m);
|
||||
m_rewrite(result);
|
||||
if (rw)
|
||||
m_rewrite(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace smt {
|
|||
expr_ref mk(symbol const& s, sort* range) { return mk(s, nullptr, nullptr, nullptr, nullptr, range); }
|
||||
expr_ref mk(symbol const& s, expr* e, sort* range) { return mk(s, e, nullptr, nullptr, nullptr, range); }
|
||||
expr_ref mk(symbol const& s, expr* e1, expr* e2, sort* range) { return mk(s, e1, e2, nullptr, nullptr, range); }
|
||||
expr_ref mk(symbol const& s, expr* e1, expr* e2, expr* e3, sort* range) { return mk(s, e1, e2, e3, nullptr, range); }
|
||||
expr_ref mk(symbol const& s, expr* e1, expr* e2 = nullptr, expr* e3 = nullptr, expr* e4 = nullptr, sort* range = nullptr);
|
||||
expr_ref mk(symbol const& s, expr* e1, expr* e2, expr* e3, sort* range, bool rw = true) { return mk(s, e1, e2, e3, nullptr, range, rw); }
|
||||
expr_ref mk(symbol const& s, expr* e1, expr* e2 = nullptr, expr* e3 = nullptr, expr* e4 = nullptr, sort* range = nullptr, bool rw = true);
|
||||
|
||||
expr_ref mk(char const* s, sort* range) { return mk(s, nullptr, nullptr, nullptr, nullptr, range); }
|
||||
expr_ref mk(char const* s, expr* e, sort* range) { return mk(s, e, nullptr, nullptr, nullptr, range); }
|
||||
|
@ -72,8 +72,8 @@ namespace smt {
|
|||
}
|
||||
expr_ref mk_accept(expr_ref_vector const& args) { return expr_ref(seq.mk_skolem(m_accept, args.size(), args.c_ptr(), m.mk_bool_sort()), m); }
|
||||
expr_ref mk_accept(expr* s, expr* i, expr* r) { return mk(m_accept, s, i, r, nullptr, m.mk_bool_sort()); }
|
||||
expr_ref mk_is_non_empty(expr* r, expr* u, expr* n) { return mk(m_is_non_empty, r, u, n, m.mk_bool_sort()); }
|
||||
expr_ref mk_is_empty(expr* r, expr* u, expr* n) { return mk(m_is_empty, r, u, n, m.mk_bool_sort()); }
|
||||
expr_ref mk_is_non_empty(expr* r, expr* u, expr* n) { return mk(m_is_non_empty, r, u, n, m.mk_bool_sort(), false); }
|
||||
expr_ref mk_is_empty(expr* r, expr* u, expr* n) { return mk(m_is_empty, r, u, n, m.mk_bool_sort(), false); }
|
||||
|
||||
expr_ref mk_indexof_left(expr* t, expr* s, expr* offset = nullptr) { return mk(m_indexof_left, t, s, offset); }
|
||||
expr_ref mk_indexof_right(expr* t, expr* s, expr* offset = nullptr) { return mk(m_indexof_right, t, s, offset); }
|
||||
|
|
Loading…
Reference in a new issue