fix(kernel/abstract): bug in abstract for telescopes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
e6c52d17a6
commit
6dedb480ec
2 changed files with 5 additions and 2 deletions
|
@ -26,14 +26,15 @@ expr abstract(expr const & e, unsigned s, unsigned n, expr const * subst) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
expr abstract(expr const & e, unsigned n, expr const * subst) { return abstract(e, 0, n, subst); }
|
expr abstract(expr const & e, unsigned n, expr const * subst) { return abstract(e, 0, n, subst); }
|
||||||
|
expr abstract(expr const & e, expr const & s, unsigned i) { return abstract(e, i, 1, &s); }
|
||||||
|
|
||||||
telescope abstract(telescope const & t, expr const & s, unsigned i) {
|
telescope abstract(telescope const & t, expr const & s, unsigned i) {
|
||||||
if (is_nil(t)) {
|
if (is_nil(t)) {
|
||||||
return t;
|
return t;
|
||||||
} else {
|
} else {
|
||||||
binder const & b = head(t);
|
binder const & b = head(t);
|
||||||
return telescope(b.update_type(abstract(b.get_type(), i, 1, &s)),
|
return telescope(b.update_type(abstract(b.get_type(), s, i)),
|
||||||
abstract(head(t), s, i+1));
|
abstract(tail(t), s, i+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ namespace lean {
|
||||||
expr abstract(expr const & e, unsigned n, expr const * s);
|
expr abstract(expr const & e, unsigned n, expr const * s);
|
||||||
inline expr abstract(expr const & e, expr const & s) { return abstract(e, 1, &s); }
|
inline expr abstract(expr const & e, expr const & s) { return abstract(e, 1, &s); }
|
||||||
inline expr abstract(expr const & e, std::initializer_list<expr> const & l) { return abstract(e, l.size(), l.begin()); }
|
inline expr abstract(expr const & e, std::initializer_list<expr> const & l) { return abstract(e, l.size(), l.begin()); }
|
||||||
|
/** \brief Replace s with variable #i in the given telescope. \pre s is closed */
|
||||||
|
expr abstract(expr const & e, expr const & s, unsigned i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Replace s with variable #i in the given telescope.
|
\brief Replace s with variable #i in the given telescope.
|
||||||
|
|
Loading…
Reference in a new issue