Test "perf/loop-unfolded-once"
Expected: 馃憤 accept 路 Size: 4.1鈥疢B 路 Lines: 84.9鈥痥 路 lean4export: 3.2.0 路 Lean: 4.38.0-nightly-2026-12-03 路 Timeout: 40.0鈥痵 路 馃搫 Declaration 路 馃敆 Source
The declaration to check compares
allInK 0 N (fun i => g w i)
decide (Nat.allTR (N - 0) (fun k _ => (fun i => g w i) (0 + k)) = true)
with N = 1000000 and g, w variables, where
allInK lo hi p := Nat.allTR (hi - lo) fun k _ => p (lo + k).
Unfolding allInK once gives the Nat.allTR term on the right, and
decide (b = true) reduces to b through instDecidableEqBool, for
螛(1). A checker that unfolds Nat.allTR and its tail-recursive
loop instead lays out the && of N tests stuck on g, for 螛(N)
time and nesting depth.
Official (v4.36.0) needed 0.3 s here. Distilled from AxiomMath/CFSG's
CFSG.Sporadic.HNSchreier.Native.Kernel.orbitTreeCheck_certificate,
where a change leaves the same comparison over 1140000 points.