Lean Kernel Arena (Preview) / perf/church-numerals

Test "perf/church-numerals"

Expected: 馃憤 accept 路 Size: 9.7鈥疜B 路 Lines: 227 路 lean4export: 3.2.0 路 Lean: 4.38.0-nightly-2026-12-03 路 Timeout: 40.0鈥痵 路 馃搫 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 鈴憋笍 馃
gruszka 馃憤 9.16鈥痬s (梅6.8) 91.1鈥疢B (-27%)
nano-lean 馃憤 3.48鈥痬s (梅18) 35.9鈥疢B (梅3.5)
pestka 馃憤 21.2鈥痬s (梅2.9) 34.7鈥疢B (梅3.6)
con-leche 馃憤 36.0鈥痬s (-42%) 34.5鈥疢B (梅3.6)
con-ron 馃憤 43.6鈥痬s (-30%) 71.4鈥疢B (-43%)
nucleus 馃憤 21.5鈥痵 (脳347) 26.6鈥疢B (梅4.7)
official 馃憤 62.0鈥痬s 125.2鈥疢B