mirror of
https://github.com/Z3Prover/z3
synced 2026-06-28 11:28:49 +00:00
Merge branch 'master' into c3
This commit is contained in:
commit
043c6c0ad1
259 changed files with 18907 additions and 3725 deletions
|
|
@ -750,7 +750,10 @@ bool array_rewriter::add_store(expr_ref_vector& args, unsigned num_idxs, expr* e
|
|||
}
|
||||
if (is_var(e1) && is_ground(e2)) {
|
||||
unsigned idx = to_var(e1)->get_idx();
|
||||
args[num_idxs - idx - 1] = e2;
|
||||
unsigned nidx = num_idxs - idx - 1;
|
||||
if (args.get(nidx) && args.get(nidx) != e2)
|
||||
return false;
|
||||
args[nidx] = e2;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
|
@ -858,19 +861,45 @@ br_status array_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result)
|
|||
return false;
|
||||
};
|
||||
|
||||
auto domain_is_larger_than = [&](sort* s, unsigned num_stores) {
|
||||
unsigned sz = get_array_arity(s);
|
||||
rational dsz(1);
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
sort* d = get_array_domain(s, i);
|
||||
if (d->is_infinite())
|
||||
return true;
|
||||
if (d->is_very_big())
|
||||
return false;
|
||||
dsz *= rational(d->get_num_elements().size(), rational::ui64());
|
||||
if (dsz > rational(num_stores, rational::ui64()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
expr* lhs1 = lhs;
|
||||
expr* rhs1 = rhs;
|
||||
unsigned num_lhs = 0, num_rhs = 0;
|
||||
while (m_util.is_store(lhs1)) {
|
||||
lhs1 = to_app(lhs1)->get_arg(0);
|
||||
++num_lhs;
|
||||
}
|
||||
while (m_util.is_store(rhs1)) {
|
||||
rhs1 = to_app(rhs1)->get_arg(0);
|
||||
++num_rhs;
|
||||
}
|
||||
|
||||
if (m_util.is_const(lhs1, v) && m_util.is_const(rhs1, w) &&
|
||||
domain_is_larger_than(lhs->get_sort(), num_lhs + num_rhs)) {
|
||||
mk_eq(lhs, lhs, rhs, fmls);
|
||||
mk_eq(rhs, lhs, rhs, fmls);
|
||||
fmls.push_back(m().mk_eq(v, w));
|
||||
result = m().mk_and(fmls);
|
||||
return BR_REWRITE_FULL;
|
||||
}
|
||||
|
||||
|
||||
if (m_expand_store_eq) {
|
||||
expr* lhs1 = lhs;
|
||||
expr* rhs1 = rhs;
|
||||
unsigned num_lhs = 0, num_rhs = 0;
|
||||
while (m_util.is_store(lhs1)) {
|
||||
lhs1 = to_app(lhs1)->get_arg(0);
|
||||
++num_lhs;
|
||||
}
|
||||
while (m_util.is_store(rhs1)) {
|
||||
rhs1 = to_app(rhs1)->get_arg(0);
|
||||
++num_rhs;
|
||||
}
|
||||
if (lhs1 == rhs1) {
|
||||
mk_eq(lhs, lhs, rhs, fmls);
|
||||
mk_eq(rhs, lhs, rhs, fmls);
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ struct enum2bv_rewriter::imp {
|
|||
new_body_ref = mk_and(bounds);
|
||||
break;
|
||||
case lambda_k:
|
||||
case choice_k:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -561,9 +561,13 @@ void rewriter_tpl<Config>::process_quantifier(quantifier * q, frame & fr) {
|
|||
expr * const * np = it + 1;
|
||||
expr * const * nnp = np + num_pats;
|
||||
unsigned j = 0;
|
||||
for (unsigned i = 0; i < num_pats; ++i)
|
||||
for (unsigned i = 0; i < num_pats; ++i) {
|
||||
if (m_manager.is_pattern(np[i]))
|
||||
new_pats[j++] = np[i];
|
||||
else {
|
||||
IF_VERBOSE(10, verbose_stream() << "[rewriter] dropping pattern (is_pattern check failed) for qid=" << q->get_qid() << " pattern[" << i << "]: " << mk_ismt2_pp(np[i], m_manager, 3) << "\n";);
|
||||
}
|
||||
}
|
||||
new_pats.shrink(j);
|
||||
num_pats = j;
|
||||
j = 0;
|
||||
|
|
@ -664,7 +668,7 @@ template<typename Config>
|
|||
void rewriter_tpl<Config>::display_bindings(std::ostream& out) {
|
||||
for (unsigned i = 0; i < m_bindings.size(); ++i) {
|
||||
if (m_bindings[i])
|
||||
out << i << ": " << mk_ismt2_pp(m_bindings[i], m()) << ";\n";
|
||||
out << i << ": " << mk_ismt2_pp(m_bindings[i], m()) << " : " << mk_pp(m_bindings[i]->get_sort(), m()) << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue