mirror of
https://github.com/Z3Prover/z3
synced 2026-05-20 08:59:34 +00:00
The side-condition of the "if"-split belongs on the edges
This commit is contained in:
parent
bb639af485
commit
c9fb432191
5 changed files with 44 additions and 22 deletions
|
|
@ -473,10 +473,12 @@ namespace smt {
|
|||
|
||||
if (!get_fparams().m_nseq_regex_factorization_threshold)
|
||||
return;
|
||||
std::cout << "Trying " << seq::mem_pp(mem, m);
|
||||
|
||||
// Boolean Closure Propagations
|
||||
expr* re_expr = mem.m_regex->get_expr();
|
||||
if (m_seq.re.is_intersection(re_expr)) {
|
||||
std::cout << "Propagating intersection " << seq::mem_pp(mem, m) << std::endl;
|
||||
for (expr* arg : *to_app(re_expr)) {
|
||||
expr_ref in_r(m_seq.re.mk_in_re(s_expr, arg), m);
|
||||
literal_vector lits;
|
||||
|
|
@ -484,8 +486,12 @@ namespace smt {
|
|||
lits.push_back(mk_literal(in_r));
|
||||
ctx.mk_th_axiom(get_id(), lits.size(), lits.data());
|
||||
}
|
||||
m_ignored_mem.insert(mem.lit);
|
||||
ctx.push_trail(insert_map(m_ignored_mem, mem.lit));
|
||||
return;
|
||||
}
|
||||
else if (m_seq.re.is_union(re_expr)) {
|
||||
if (m_seq.re.is_union(re_expr)) {
|
||||
std::cout << "Propagating union " << seq::mem_pp(mem, m) << std::endl;
|
||||
literal_vector lits;
|
||||
lits.push_back(~mem.lit);
|
||||
for (expr* arg : *to_app(re_expr)) {
|
||||
|
|
@ -493,14 +499,23 @@ namespace smt {
|
|||
lits.push_back(mk_literal(in_r));
|
||||
}
|
||||
ctx.mk_th_axiom(get_id(), lits.size(), lits.data());
|
||||
m_ignored_mem.insert(mem.lit);
|
||||
ctx.push_trail(insert_map(m_ignored_mem, mem.lit));
|
||||
return;
|
||||
}
|
||||
else if (m_seq.re.is_complement(re_expr)) {
|
||||
expr* arg = to_app(re_expr)->get_arg(0);
|
||||
expr_ref in_r(m_seq.re.mk_in_re(s_expr, arg), m);
|
||||
literal_vector lits;
|
||||
lits.push_back(~mem.lit);
|
||||
lits.push_back(~mk_literal(in_r));
|
||||
ctx.mk_th_axiom(get_id(), lits.size(), lits.data());
|
||||
if (m_seq.re.is_to_re(re_expr)) {
|
||||
return;
|
||||
zstring s;
|
||||
expr_ref arg(to_app(re_expr)->get_arg(0), m);
|
||||
if (m_seq.str.is_string(arg, s)) {
|
||||
std::cout << "Propagating const matching " << seq::mem_pp(mem, m) << std::endl;
|
||||
literal_vector lits;
|
||||
lits.push_back(~mem.lit);
|
||||
lits.push_back(mk_literal(m.mk_eq(s_expr, arg)));
|
||||
ctx.mk_th_axiom(get_id(), lits.size(), lits.data());
|
||||
m_ignored_mem.insert(mem.lit);
|
||||
ctx.push_trail(insert_map(m_ignored_mem, mem.lit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -618,6 +633,8 @@ namespace smt {
|
|||
++num_mems;
|
||||
continue;
|
||||
}
|
||||
/*if (m_ignored_mem.contains(mem.lit))
|
||||
continue; // already handled via Boolean closure, skip*/
|
||||
// pre-process: consume ground prefix characters
|
||||
vector<seq::str_mem> processed;
|
||||
if (!m_regex.process_str_mem(mem, processed)) {
|
||||
|
|
@ -997,7 +1014,7 @@ namespace smt {
|
|||
}
|
||||
idx = 0;
|
||||
for (auto& mem : m_nielsen.root()->str_mems()) {
|
||||
std::cout << "[" << (idx++) << "]: " << seq::mem_pp(m, mem);
|
||||
std::cout << "[" << (idx++) << "]: " << seq::mem_pp(mem, m);
|
||||
}
|
||||
std::flush(std::cout);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue