Lean Kernel Arena / perf/unfold-before-literal

Test "perf/unfold-before-literal"

Expected: 👍 accept · Size: 65.5 KB · Lines: 1.2 k · lean4export: 3.1.0 · Lean: 4.36.0 · Timeout: 4.00 min · 📄 Declaration · 🔗 Source

The declarations to check compare

[slowA, 1].sum      and      slowA + (1 + 0)

(and two variants: the sides swapped, and a longer list), where slowA is a closed Nat that evaluates in 2^19 unit steps.

List.sum is foldr (· + ·) 0, so unfolding it three times makes the sides identical, for Θ(1). But both sides are closed Nat terms headed by +, and a checker that tries its Nat literal extension before unfolding evaluates slowA to a literal first, for Θ(2^19). The test asks whether literal arithmetic waits until unfolding has had its chance.

Official (v4.35.0) needs about 20 s and 1.4 GB here, nearly all of it evaluating slowA, slowB and slowC. Distilled from AxiomMath/CFSG's CertificateChecks.KernelJ2Cover.totalC, where the same shape costs it more than 100 GB.

Checker Result ⏱️ 🧠
nano-lean 👍 2.65 s (÷5.5) 3.2 GB (×2.2)
gruszka 👍 5.28 ms (÷2741) 48.6 MB (÷30)
sokonanoda 👍 2.51 s (÷5.8) 1.6 GB (+10%)
rpylean 👍 1.62 ms (÷8916) 11.4 MB (÷128)
pestka 👍 3.45 ms (÷4192) 15.7 MB (÷93)
kefir 👍 4.04 ms (÷3579) 6.3 MB (÷232)
palladium 💥 1.84 s 755.9 MB
con-ron 👍 10.3 s (-29%) 2.7 GB (+88%)
kefir-wasm 👍 226 ms (÷64) 106.9 MB (÷14)
con-agua 👍 12.0 s (-17%) 3.4 GB (×2.4)
nanobruijn 👍 10.6 s (-27%) 3.2 GB (×2.2)
nanoda 👍 12.7 s (-12%) 2.6 GB (+85%)
con-leche 👍 14.7 s (+1%) 3.2 GB (×2.2)
pestka-wasm 👍 120 ms (÷120) 118.8 MB (÷12)
tenet-jvm 👍 22.5 s (+55%) 3.7 GB (×2.6)
official-nightly 👍 11.4 s (-21%) 1.4 GB (0%)
eink0rn 👍 12.5 s (-14%) 2.3 GB (+63%)
official 👍 14.5 s 1.4 GB
ind-models 👍 14.5 s (0%) 1.4 GB (+1%)
tenet 👍 55.2 s (×3.8) 5.6 GB (×4.0)
tenet-hs 👍 23.3 s (+61%) 824.4 MB (-43%)
kiota 🚫 172 ms 58.4 MB
ocaml4lean 👍 4.77 min (×20) 4.9 GB (×3.4)
logos-kernel 🚫 294 ms 318.1 MB
evmlean 🚫 43.1 s 379.9 MB
mini 🚫 37.7 ms 65.8 MB
overfull ⌛ — —
lean4cobol 🚫 9.03 s 393.4 MB
lean4lean ✋ 793 ms 234.6 MB
canonical-min ✋ 394 ms 1.0 GB
nanoclo 👍 4.88 s (÷3.0) 3.6 GB (×2.5)
vow-lean-kernel 👍 529 ms (÷27) 17.8 MB (÷82)
lazylean 👍 3.93 s (÷3.7) 326.4 MB (÷4.4)
metalean-slow 🚫 75.2 ms 63.3 MB
metalean-fast 👍 17.4 s (+20%) 3.7 GB (×2.6)
nanoclo-fortran 👍 8.11 s (-44%) 4.9 GB (×3.4)
mathgraph 👍 3.77 s (÷3.8) 2.1 GB (+45%)