lean4-htt/tests/lean/run/isDefEqPerfIssue.lean
Leonardo de Moura a6bfefe5bd fix: nasty performance problem at isDefEq
This problem was originally exposed by the `Array.eraseIdxAux`.
2022-03-12 10:44:43 -08:00

12 lines
370 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def g (n : Nat) (a : Array α) (i j : Fin a.size) : Array α :=
match n with
| 0 => a.swap i j
| n+1 => g n a j i
partial def f (i : Nat) (a : Array α) : Array α :=
if h : i < a.size then
let a' := g 100 a ⟨i, h⟩ ⟨i - Nat.zero.succ, by exact Nat.lt_of_le_of_lt (Nat.pred_le i) h⟩
have : a'.size - i >= 0 := sorry
f (i+1) a'
else
a