3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-10 01:41:57 +00:00

register auxiliary constants from projection operation

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-08-20 08:51:24 -07:00
parent 112fa16bc0
commit 276fdd0e97
8 changed files with 68 additions and 86 deletions

View file

@ -3224,26 +3224,32 @@ void theory_seq::add_indexof_axiom(expr* i) {
/*
let r = replace(a, s, t)
a = "" => s = "" or r = a
contains(a, s) or r = a
s = "" => r = t+a
tightest_prefix(s, x)
(contains(a, s) -> r = xty & a = xsy) &
(!contains(a, s) -> r = a)
*/
void theory_seq::add_replace_axiom(expr* r) {
context& ctx = get_context();
expr* a = 0, *s = 0, *t = 0;
VERIFY(m_util.str.is_replace(r, a, s, t));
expr_ref x = mk_skolem(m_indexof_left, a, s);
expr_ref y = mk_skolem(m_indexof_right, a, s);
expr_ref xty = mk_concat(x, t, y);
expr_ref xsy = mk_concat(x, s, y);
literal a_emp = mk_eq_empty(a, true);
literal s_emp = mk_eq_empty(s, true);
literal cnt = mk_literal(m_util.str.mk_contains(a, s));
literal a_emp = mk_eq_empty(a);
literal s_emp = mk_eq_empty(s);
add_axiom(~a_emp, s_emp, mk_seq_eq(r, a));
add_axiom(cnt, mk_seq_eq(r, a));
add_axiom(~s_emp, mk_seq_eq(r, mk_concat(t, a)));
add_axiom(~cnt, a_emp, s_emp, mk_seq_eq(a, xsy));
add_axiom(~cnt, a_emp, s_emp, mk_seq_eq(r, xty));
ctx.force_phase(cnt);
tightest_prefix(s, x);
}