Test "perf/church-numerals"
Expected: 👍 accept · Size: 9.6 KB · Lines: 227 · lean4export: 3.1.0 · Lean: 4.29.1 · 📄 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 | 👍 | 2 ms | (÷25) | 43.8 MB | (-42%) | |
| ind-models | 👍 | 81 ms | (+61%) | 108.0 MB | (+43%) | |
| official-nightly | 👍 | 47 ms | (-6%) | 75.8 MB | (0%) | |
| evmlean | 🚫 | 43.2 s | 408.2 MB | |||
| nanoda | 👍 | 22 ms | (÷2.3) | 12.1 MB | (÷6.2) | |
| mini | 💥 | 1.5 m | 138.7 MB | |||
| lean4lean | ✋ | 75 ms | 111.6 MB | |||
| sokonanoda | 👍 | 2 ms | (÷25) | 45.9 MB | (-39%) | |
| zignodamus | 👍 | 3 ms | (÷18) | 10.4 MB | (÷7.3) | |
| nanoclo | 👍 | 7 ms | (÷7.7) | 59.6 MB | (-21%) | |
| nanobruijn | 👍 | 20 ms | (÷2.5) | 28.0 MB | (÷2.7) | |
| kiota | ✋ | 7 ms | 19.3 MB | |||
| official | 👍 | 50 ms | (0%) | 75.5 MB | (0%) | |
| vow-lean-kernel | ✋ | 136 ms | 18.5 MB | |||
| rpylean | ✋ | 12 ms | 14.7 MB | |||
| official-v4.28.0 | 👍 | 58 ms | (+15%) | 77.3 MB | (+2%) | |
| still-nanoda | 👍 | 22 ms | (÷2.3) | 13.3 MB | (÷5.7) | |
| nyaya | ✋ | 16 ms | 13.9 MB | |||
| parse-only | 👍 | 28 ms | (-45%) | 60.7 MB | (-20%) |