lean4-htt/tests/lean/run/compiler_bug3.lean
Leonardo de Moura 9d3aa5b627 fix(library/compiler/elim_recursors): bug in elim_recursors
We may fail to type check auxiliary definitions that use rec_fn_macro.
The problem is that this macro cannot be unfolded.
So, we fix the problem by not type checking them. We add them as
constants, and store the definition in an auxiliary vector.
2016-11-02 14:19:28 -07:00

9 lines
276 B
Text

inductive tree (A : Type*)
| leaf : A -> tree
| node : list tree -> tree
def foo {A : Type*} : nat → tree A → nat
| 0 _ := 0
| (n+1) (tree.leaf a) := 0
| (n+1) (tree.node []) := foo n (tree.node [])
| (n+1) (tree.node (x::xs)) := foo n x