The previous implementation was using the following heuristic
```lean
-- heuristic: use non-dependent arrows only if possible for whole group to avoid
-- noisy mix like `(α : Type) → Type → (γ : Type) → ...`.
let dependent := curNames.any fun n => hasIdent n.getId stxBody
```
The result produced by this heuristic was **not** producing an
accidental name capture, but I agree
it was confusing to have `∀ (a : True), ∃ a, a = a : Prop` instead of
`True → ∃ a, a = a : Prop` since there is no dependency.
AFAICT, all examples affected by this commit have a better output now.
cc @digma0 @kha
13 lines
400 B
Text
13 lines
400 B
Text
α : Type ?u
|
||
x✝ : ArrayBuffer α
|
||
cap : Nat
|
||
backing : Fin cap → Option α
|
||
size : Nat
|
||
h_size : size ≤ cap
|
||
h_full : ∀ (i : Nat) (h : i < size), Option.isSome (backing { val := i, isLt := (_ : i < cap) }) = true
|
||
i : Nat
|
||
h : i < size
|
||
⊢ Option.isSome
|
||
(if h_1 : i < cap then backing { val := i, isLt := (_ : { val := i, isLt := (_ : i < cap + cap) }.val < cap) }
|
||
else none) =
|
||
true
|