fix(library/definitional/equations): use whnf on recursive definition arguments
The idea is to expose "hidden" datatypes.
This commit is contained in:
parent
3197e6d403
commit
dc2ac92846
2 changed files with 13 additions and 0 deletions
|
@ -467,6 +467,8 @@ class equation_compiler_fn {
|
||||||
for (expr const & fn : m_fns) {
|
for (expr const & fn : m_fns) {
|
||||||
buffer<expr> args;
|
buffer<expr> args;
|
||||||
expr r_type = to_telescope(mlocal_type(fn), args);
|
expr r_type = to_telescope(mlocal_type(fn), args);
|
||||||
|
for (expr & arg : args)
|
||||||
|
arg = update_mlocal(arg, whnf(mlocal_type(arg)));
|
||||||
list<expr> ctx = to_list(args);
|
list<expr> ctx = to_list(args);
|
||||||
list<optional<name>> vstack = map2<optional<name>>(ctx, [](expr const & e) {
|
list<optional<name>> vstack = map2<optional<name>>(ctx, [](expr const & e) {
|
||||||
return optional<name>(mlocal_name(e));
|
return optional<name>(mlocal_name(e));
|
||||||
|
|
11
tests/lean/run/eq25.lean
Normal file
11
tests/lean/run/eq25.lean
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
inductive N :=
|
||||||
|
O : N,
|
||||||
|
S : N → N
|
||||||
|
|
||||||
|
definition Nat := N
|
||||||
|
|
||||||
|
open N
|
||||||
|
|
||||||
|
definition add : Nat → Nat → Nat,
|
||||||
|
add O b := b,
|
||||||
|
add (S a) b := S (add a b)
|
Loading…
Reference in a new issue