Lean Kernel Arena / perf/church-numerals

Test "perf/church-numerals"

Expected: 👍 accept · Size: 9.6 KB · Lines: 227 · lean4export: 3.1.0 · Lean: 4.36.0 · Timeout: 40.0 s · 📄 Declaration · 🔗 Source

The declaration to check compares

cmul (cnum n) (cnum (n+1))      and      cmul (cnum (n+1)) (cnum n)

where cnum k is the Church numeral fun X s z => s (s (... z)) and cmul a b iterates b as many times as a counts.

Both sides have the normal form with n(n+1) applications of the bound s. Unfolding cmul on the left leaves cnum n X (cnum (n+1) X s), where each of the n occurrences of the bound function copies the redex cnum (n+1) X s, so the normal form takes n(n+1) beta steps and shares nothing. No other delta step is available, so the Θ(n²) measured is beta reduction under binders and little else.

N=120 in the Lean source, giving a reduction depth of 14520. From the conv_eval benchmark of András Kovács' smalltt.

Checker Result ⏱️ 🧠
nano-lean 👍 3.52 ms (÷15) 40.2 MB (÷2.6)
gruszka 👍 9.16 ms (÷5.6) 98.7 MB (-5%)
mathgraph 👍 1.30 ms (÷40) 31.7 MB (÷3.3)
sokonanoda 👍 1.25 ms (÷41) 31.6 MB (÷3.3)
pestka 👍 21.3 ms (÷2.4) 34.9 MB (÷3.0)
kefir 👍 9.90 ms (÷5.2) 20.9 MB (÷5.0)
kefir-wasm 👍 181 ms (×3.5) 114.0 MB (+9%)
con-ron 👍 44.2 ms (-14%) 71.4 MB (-32%)
con-ron-stream 👍 44.8 ms (-13%) 73.0 MB (-30%)
con-agua 👍 36.3 ms (-29%) 22.3 MB (÷4.7)
nanobruijn 👍 70.2 ms (+37%) 23.9 MB (÷4.4)
nanoda 👍 106 ms (×2.1) 10.1 MB (÷10)
con-leche 👍 36.1 ms (-30%) 36.8 MB (÷2.8)
pestka-wasm 👍 652 ms (×13) 419.1 MB (×4.0)
official-nightly 👍 52.5 ms (+2%) 109.2 MB (+5%)
eink0rn 👍 8.71 ms (÷5.9) 26.1 MB (÷4.0)
official 👍 51.3 ms 104.4 MB
ind-models 👍 119 ms (×2.3) 116.6 MB (+12%)
kiota 👍 4.45 ms (÷12) 15.5 MB (÷6.7)
tenet 👍 186 ms (×3.6) 58.1 MB (-44%)
tenet-hs 👍 25.0 ms (÷2.1) 56.6 MB (-46%)
logos-kernel 👍 3.21 ms (÷16) 6.7 MB (÷16)
evmlean 🚫 39.5 s 583.2 MB
mini ⌛ — —
overfull ⌛ — —
lean4lean 👍 100 ms (+95%) 114.5 MB (+10%)
lean4cobol 👍 428 ms (×8.3) 113.9 MB (+9%)
tenet-jvm 👍 427 ms (×8.3) 113.9 MB (+9%)
nanoclo 👍 6.34 ms (÷8.1) 57.8 MB (-45%)
vow-lean-kernel 🚫 161 ms 17.2 MB
canonical-min ✋ 387 ms 1.0 GB
lazylean 👍 17.0 ms (÷3.0) 30.8 MB (÷3.4)
rpylean 👍 7.00 ms (÷7.3) 14.0 MB (÷7.5)
metalean-slow ⌛ — —
metalean-fast 👍 90.4 ms (+76%) 88.2 MB (-15%)
nanoclo-fortran 👍 16.3 ms (÷3.1) 21.6 MB (÷4.8)