Lean Kernel Arena / perf/church-numerals

Test "perf/church-numerals"

Expected: 👍 accept · Size: 9.6 KB · Lines: 227 · lean4export: 3.1.0 · Lean: 4.29.1 · Timeout: 50.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 ⏱️ 🧠
mathgraph 👍 1 ms (÷35) 43.8 MB (-44%)
sokonanoda 👍 1 ms (÷32) 41.7 MB (-46%)
nanoclo 👍 7 ms (÷7.2) 43.8 MB (-44%)
con-ron 👍 38 ms (-19%) 84.6 MB (+8%)
lazylean 👍 17 ms (÷2.7) 30.1 MB (÷2.6)
nanoda 👍 22 ms (÷2.1) 12.4 MB (÷6.3)
nanobruijn 👍 21 ms (÷2.2) 28.1 MB (÷2.8)
con-leche 👍 48 ms (+3%) 41.9 MB (-46%)
eink0rn 👍 9 ms (÷5.2) 26.0 MB (÷3.0)
ind-models 👍 81 ms (+72%) 112.4 MB (+44%)
official 👍 47 ms (0%) 78.0 MB (0%)
lean4lean 👍 100 ms (×2.1) 118.0 MB (+51%)
tenet 👍 182 ms (×3.9) 57.5 MB (-26%)
nanoclo-fortran 👍 16 ms (÷2.9) 21.8 MB (÷3.6)
lean4cobol 👍 428 ms (×9.2) 113.5 MB (+46%)
evmlean 🚫 42.9 s 407.4 MB
mini 💥 1.4 m 136.1 MB
overfull 💥 1.7 m 48.4 MB
kiota 👍 5 ms (÷8.9) 15.5 MB (÷5.0)
canonical-min ✋ 387 ms 1.1 GB
rpylean ✋ 12 ms 10.8 MB
vow-lean-kernel ✋ 136 ms 18.5 MB
official-v4.28.0 👍 58 ms (+24%) 82.1 MB (+5%)
still-nanoda 👍 22 ms (÷2.1) 13.2 MB (÷5.9)
nyaya ✋ 16 ms 13.8 MB
parse-only 👍 28 ms (-41%) 65.3 MB (-16%)