Lean Kernel Arena (Preview) / perf/loop-unfolded-once

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.

Checker Result 鈴憋笍 馃
gruszka 馃憤 44.3鈥痬s (梅11) 172.6鈥疢B (+39%)
nano-lean 馃憤 36.8鈥痬s (梅13) 162.4鈥疢B (+30%)
pestka 馃憤 102鈥痬s (梅4.6) 83.2鈥疢B (-33%)
con-leche 馃憤 360鈥痬s (-24%) 41.4鈥疢B (梅3.0)
con-ron 馃憤 348鈥痬s (-27%) 90.0鈥疢B (-28%)
nucleus 馃毇 878鈥痬s 111.2鈥疢B
official 馃憤 474鈥痬s 124.6鈥疢B