fix(kernel/metavar): make sure instantiate_metavars_fn does not loop on 'fake' recursive dependencies, we say they are fake because they disappear after applying beta-reduction
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
08174f904b
commit
77c0456be4
1 changed files with 20 additions and 11 deletions
|
@ -151,19 +151,28 @@ protected:
|
||||||
|
|
||||||
virtual expr visit_app(expr const & e) {
|
virtual expr visit_app(expr const & e) {
|
||||||
buffer<expr> args;
|
buffer<expr> args;
|
||||||
expr const * it = &e;
|
expr const & f = get_app_rev_args(e, args);
|
||||||
while (is_app(*it)) {
|
if (is_metavar(f)) {
|
||||||
args.push_back(visit(app_arg(*it)));
|
if (auto p1 = m_subst.get_expr_assignment(mlocal_name(f))) {
|
||||||
it = &app_fn(*it);
|
if (m_use_jst)
|
||||||
|
save_jst(p1->second);
|
||||||
|
expr new_app = apply_beta(p1->first, args.size(), args.data());
|
||||||
|
return visit(new_app);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
expr const & f = *it;
|
expr new_f = visit(f);
|
||||||
if (is_metavar(f) && m_subst.is_expr_assigned(mlocal_name(f))) {
|
buffer<expr> new_args;
|
||||||
expr new_f = visit_meta(f);
|
bool modified = !is_eqp(new_f, f);
|
||||||
return apply_beta(new_f, args.size(), args.data());
|
for (expr const & arg : args) {
|
||||||
} else {
|
expr new_arg = visit(arg);
|
||||||
args.push_back(visit(f));
|
if (!is_eqp(arg, new_arg))
|
||||||
return update_rev_app(e, args);
|
modified = true;
|
||||||
|
new_args.push_back(new_arg);
|
||||||
}
|
}
|
||||||
|
if (!modified)
|
||||||
|
return e;
|
||||||
|
else
|
||||||
|
return mk_rev_app(new_f, new_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual expr visit(expr const & e) {
|
virtual expr visit(expr const & e) {
|
||||||
|
|
Loading…
Reference in a new issue