lean4-htt/tests/lean/run/1030.lean
Leonardo de Moura 049273afee fix: add workarounds to code generator
The issue is only going to be properly fixed when we rewrite `csimp`
in Lean. The `csimp` performs transformations that do not preserve
typability, but it also uses the kernel `infer_type` which assumes the
input is type correct. In the new `csimp`, we must have a different
`infer_type` which returns an `Any` type in this kind of situation.

The workaround in this commit simply disables optimizations when
`infer_type` fails. It does not fix all occurrences of this problem,
but the two places that issue #1030 triggered.

closes #1030
2022-02-25 08:47:56 -08:00

13 lines
338 B
Text

def foo: List Unit → Type
| [] => Unit → Unit
| _ :: tl => foo tl
partial def bar: (l: List Unit) → foo l → foo l
| [] , f => λ t => f t
| _ :: tl, f => bar tl f
def bar': (l: List Unit) → foo l → foo l
| [] , f => by simp only [foo] at f; exact (λ t => f t)
| _ :: tl, f => bar' tl f
#eval bar [()] id ()