Lean Kernel Arena / perf/folded-constant-first

Test "perf/folded-constant-first"

Expected: 👍 accept · Size: 52.0 KB · Lines: 1.3 k · lean4export: 3.1.0 · Lean: 4.36.0 · Timeout: 40.0 s · 📄 Declaration · 🔗 Source

The declaration to check compares

tagged (count #n)      and      (false, count #n)

where tagged m = (isZero m, m), so unfolding the left side leaves the same application count #n in both components, forced by isZero in one and plain in the other.

The plain occurrences are identical, for Θ(1); the forced one evaluates count #n once. The order matters for a checker that leaves a constant unfolded once it reduces it: reducing the forced component first replaces count #n by its value on one side, and the plain comparison then faces a folded application against an evaluated one. Here the forcing component comes first; folded-constant-last.lean swaps them, and the ratio between the two files is what that costs.

N=1000 in the Lean source. From Courant and Leroy, POPL 2026, §10, where the two orders cost Rocq 3 × 10⁻⁵ s and 0.078 s.

Checker Result ⏱️ 🧠
nano-lean 👍 1.84 ms (÷24) 33.4 MB (÷2.8)
gruszka 👍 3.72 ms (÷12) 90.9 MB (-4%)
mathgraph 👍 2.82 ms (÷16) 36.4 MB (÷2.6)
sokonanoda 👍 2.66 ms (÷17) 36.2 MB (÷2.6)
pestka 👍 5.96 ms (÷7.6) 23.0 MB (÷4.1)
kefir 👍 3.23 ms (÷14) 9.3 MB (÷10)
kefir-wasm 👍 171 ms (×3.8) 96.2 MB (+2%)
con-ron 👍 34.9 ms (-22%) 41.1 MB (÷2.3)
con-ron-stream 👍 35.5 ms (-21%) 44.6 MB (÷2.1)
con-agua 👍 26.9 ms (-40%) 18.1 MB (÷5.2)
nanobruijn 👍 7.02 ms (÷6.4) 15.3 MB (÷6.2)
nanoda 👍 6.84 ms (÷6.6) 4.3 MB (÷22)
con-leche 👍 12.5 ms (÷3.6) 26.2 MB (÷3.6)
pestka-wasm 👍 550 ms (×12) 332.1 MB (×3.5)
official-nightly 👍 44.1 ms (-2%) 99.9 MB (+5%)
eink0rn 👍 5.76 ms (÷7.8) 18.3 MB (÷5.2)
official 👍 45.0 ms 94.7 MB
ind-models 👍 121 ms (×2.7) 112.3 MB (+19%)
kiota 👍 7.27 ms (÷6.2) 16.5 MB (÷5.7)
tenet 👍 163 ms (×3.6) 51.1 MB (-46%)
tenet-hs 👍 12.7 ms (÷3.6) 30.9 MB (÷3.1)
logos-kernel 👍 2.25 ms (÷20) 6.9 MB (÷14)
evmlean 🚫 2.80 s 284.5 MB
mini ⌛ — —
overfull ⌛ — —
lean4lean 👍 47.9 ms (+7%) 93.2 MB (-2%)
lean4cobol 👍 182 ms (×4.1) 27.9 MB (÷3.4)
tenet-jvm 👍 290 ms (×6.4) 88.3 MB (-7%)
nanoclo 👍 3.74 ms (÷12) 54.5 MB (-42%)
vow-lean-kernel 🚫 249 ms 18.8 MB
canonical-min 🚫 390 ms 1.0 GB
lazylean 👍 4.84 ms (÷9.3) 24.7 MB (÷3.8)
rpylean 👍 1.79 ms (÷25) 13.3 MB (÷7.1)
metalean-slow 👍 845 ms (×19) 756.7 MB (×8.0)
metalean-fast 👍 51.6 ms (+15%) 77.6 MB (-18%)
nanoclo-fortran 👍 9.24 ms (÷4.9) 7.9 MB (÷12)