Test "perf/folded-constant-first"
Expected: 👍 accept · Size: 52.0 KB · Lines: 1.3 k · lean4export: 3.1.0 · Lean: 4.34.1 · Timeout: 50.0 s · 📄 Declaration · 🔗 Source
The declaration to check compares
tagged (count #n) and (false, count #n)
where tagged m = (isZero m, m), so unfolding the left side leaves the same
application count #n in both components, forced by isZero in one and
plain in the other.
The plain occurrences are identical, for Θ(1); the forced one evaluates
count #n once. The order matters for a checker that leaves a constant
unfolded once it reduces it: reducing the forced component first replaces
count #n by its value on one side, and the plain comparison then faces a
folded application against an evaluated one. Here the forcing component
comes first; folded-constant-last.lean swaps them, and the ratio between
the two files is what that costs.
N=1000 in the Lean source. From Courant and Leroy, POPL 2026, §10, where the two orders cost Rocq 3 × 10⁻⁵ s and 0.078 s.
| Checker | Result | ⏱️ | 🧠 | |||
|---|---|---|---|---|---|---|
| sokonanoda | 👍 | 3 ms | (÷16) | 47.1 MB | (-32%) | |
| mathgraph | 👍 | 3 ms | (÷16) | 48.3 MB | (-30%) | |
| nanoclo | 👍 | 4 ms | (÷11) | 58.6 MB | (-15%) | |
| con-ron | 👍 | 32 ms | (-21%) | 69.3 MB | (0%) | |
| nanobruijn | 👍 | 7 ms | (÷5.8) | 11.7 MB | (÷5.9) | |
| nanoda | 👍 | 7 ms | (÷5.8) | 4.5 MB | (÷16) | |
| lazylean | 👍 | 5 ms | (÷8.4) | 26.8 MB | (÷2.6) | |
| con-leche | 👍 | 21 ms | (-47%) | 24.5 MB | (÷2.8) | |
| eink0rn | 👍 | 6 ms | (÷7.1) | 18.5 MB | (÷3.8) | |
| official | 👍 | 41 ms | (0%) | 69.3 MB | (0%) | |
| ind-models | 👍 | 121 ms | (×3.0) | 109.9 MB | (+59%) | |
| lean4lean | 👍 | 47 ms | (+14%) | 100.6 MB | (+45%) | |
| tenet | 👍 | 159 ms | (×3.9) | 52.2 MB | (-25%) | |
| tenet-hs | 👍 | 13 ms | (÷3.2) | 31.3 MB | (÷2.2) | |
| lean4cobol | 👍 | 182 ms | (×4.5) | 27.9 MB | (÷2.5) | |
| evmlean | 🚫 | 2.8 s | 264.8 MB | |||
| mini | ⌛ | 0 ms | 0 B | |||
| overfull | ⌛ | 0 ms | 0 B | |||
| metalean-slow | 👍 | 845 ms | (×21) | 768.9 MB | (×11) | |
| tenet-jvm | 👍 | 273 ms | (×6.7) | 76.5 MB | (+10%) | |
| nanoclo-fortran | 👍 | 9 ms | (÷4.6) | 7.9 MB | (÷8.7) | |
| kiota | 👍 | 8 ms | (÷5.1) | 18.7 MB | (÷3.7) | |
| metalean-fast | 👍 | 52 ms | (+27%) | 83.2 MB | (+20%) | |
| canonical-min | 🚫 | 390 ms | 1.1 GB | |||
| rpylean | 👍 | 7 ms | (÷5.5) | 15.8 MB | (÷4.4) | |
| vow-lean-kernel | 👍 | 216 ms | (×5.3) | 22.5 MB | (÷3.1) | |
| parse-only | 👍 | 30 ms | (-25%) | 65.5 MB | (-6%) |