3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-05 08:30:50 +00:00
This commit is contained in:
Nikolaj Bjorner 2026-05-28 09:01:48 -07:00
parent b34a7b4319
commit 0b56db7f07
4 changed files with 21 additions and 11 deletions

View file

@ -677,12 +677,15 @@ namespace smt {
// The HO quantifier has extra vars at higher indices; drop them.
// Binding is indexed by var index: binding[i] = value for var i.
// First substitute any remaining vars, then keep only original vars.
TRACE(ho_matching, tout << "num bound variables " << q->get_num_decls() << " for " << mk_bounded_pp(q, m)
<< "\n"
<< binding << "\n";);
if (binding.size() > q->get_num_decls()) {
var_subst sub(m);
bool change = true;
while (change) {
change = false;
for (unsigned i = 0; i < binding.size(); ++i) {
for (unsigned i = 1; i < binding.size(); ++i) {
if (!binding.get(i)) continue;
auto r = sub(binding.get(i), binding);
change |= r != binding.get(i);
@ -691,12 +694,15 @@ namespace smt {
}
binding.shrink(q->get_num_decls());
}
if (binding.size() < q->get_num_decls())
return;
binding.reverse();
// Create enodes for the refined bindings and add instance
ptr_buffer<enode> new_bindings;
unsigned max_gen = st.m_max_generation;
for (unsigned i = 0; i < q->get_num_decls(); ++i) {
expr* e = binding.get(i);
for (expr* e : binding) {
if (!e)
return; // incomplete binding
if (!m_context->e_internalized(e)) {
@ -711,7 +717,7 @@ namespace smt {
TRACE(ho_matching,
tout << "ho_match refined for " << mk_pp(q, m) << "\n";
for (unsigned i = 0; i < new_bindings.size(); ++i)
tout << " binding[" << i << "] = " << mk_pp(new_bindings[i]->get_expr(), m) << "\n";);
tout << " binding[" << i << "] = " << mk_bounded_pp(new_bindings[i]->get_expr(), m) << "\n";);
vector<std::tuple<enode*, enode*>> used_enodes;
m_context->add_instance(q, nullptr, new_bindings.size(), new_bindings.data(),