@kha the following idiom is not safe
```
while (is_pi(t)) {
t = whnf(binding_body(t));
}
```
`whnf(e)` assumes that `e` does not have dangling deBruijn variables.
We should use (the more expensive):
```
while (is_pi(t)) {
t = whnf(instantiate(binding_body(t), locals.push_local_from_binding(t)));
}
```
BTW, this problem is not related to the assertion violation at #1930
I just stumbled on it when fixing the violation.
4 lines
156 B
Text
4 lines
156 B
Text
1930.lean:3:24: error: invalid field notation, type is not of the form (C ...) where C is a constant
|
|
prod
|
|
has type
|
|
Type ? → Type ? → Type (max ? ?)
|