Test "perf/church-numerals"
Expected: 👍 accept · Size: 9.6 KB · Lines: 227 · lean4export: 3.1.0 · Lean: 4.34.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 | ⏱️ | 🧠 | |||
|---|---|---|---|---|---|---|
| sokonanoda | 👍 | 1 ms | (÷36) | 48.2 MB | (-38%) | |
| mathgraph | 👍 | 1 ms | (÷35) | 43.9 MB | (-44%) | |
| nanoclo | 👍 | 6 ms | (÷7.4) | 55.6 MB | (-29%) | |
| con-ron | 👍 | 39 ms | (-17%) | 88.1 MB | (+13%) | |
| nanobruijn | 👍 | 22 ms | (÷2.2) | 28.3 MB | (÷2.8) | |
| nanoda | 👍 | 23 ms | (÷2.1) | 10.6 MB | (÷7.4) | |
| lazylean | 👍 | 17 ms | (÷2.8) | 31.5 MB | (÷2.5) | |
| con-leche | 👍 | 51 ms | (+9%) | 43.5 MB | (-44%) | |
| eink0rn | 👍 | 9 ms | (÷5.4) | 26.6 MB | (÷2.9) | |
| official | 👍 | 47 ms | (0%) | 78.1 MB | (0%) | |
| ind-models | 👍 | 119 ms | (×2.5) | 114.4 MB | (+46%) | |
| lean4lean | 👍 | 100 ms | (×2.1) | 117.9 MB | (+51%) | |
| tenet | 👍 | 182 ms | (×3.9) | 57.8 MB | (-26%) | |
| tenet-hs | 👍 | 25 ms | (-47%) | 57.1 MB | (-27%) | |
| lean4cobol | 👍 | 428 ms | (×9.1) | 113.6 MB | (+45%) | |
| evmlean | 🚫 | 39.2 s | 584.8 MB | |||
| mini | ⌛ | 0 ms | 0 B | |||
| overfull | ⌛ | 0 ms | 0 B | |||
| metalean-slow | ⌛ | 0 ms | 0 B | |||
| tenet-jvm | 👍 | 325 ms | (×6.9) | 101.5 MB | (+30%) | |
| nanoclo-fortran | 👍 | 16 ms | (÷2.9) | 21.7 MB | (÷3.6) | |
| kiota | 👍 | 5 ms | (÷9.2) | 15.5 MB | (÷5.0) | |
| metalean-fast | 👍 | 90 ms | (+92%) | 93.9 MB | (+20%) | |
| canonical-min | ✋ | 387 ms | 1.1 GB | |||
| rpylean | ✋ | 16 ms | 13.4 MB | |||
| vow-lean-kernel | ✋ | 136 ms | 18.9 MB | |||
| parse-only | 👍 | 28 ms | (-41%) | 65.6 MB | (-16%) |