Lean Kernel Arena / perf/prop-struct-projections

Test "perf/prop-struct-projections"

Expected: 👍 accept · Size: 405.9 KB · Lines: 8.6 k · lean4export: 3.1.0 · Lean: 4.34.1 · Timeout: 60.0 s · 📄 Declaration · 🔗 Source

The declarations to check are the N projection functions of

structure Wide (n : Nat) : Prop where
  (h0 : n + 0 = 0 + n)  …  (h{N-1} : n + (N-1) = (N-1) + n)

reached through a theorem that rebuilds a Wide n from all of them.

Wide is a proposition, so a projection out of it is checked as official's infer_proj does: every earlier field that a later field's type uses must itself be a proposition. Official instantiates the parameter n first and then steps through the fields, so "is field j used later" is a test of the cached loose-variable range of the binder body, constant time per field: Θ(N²) for all N projections.

A checker that asks the question of the stored constructor type instead walks the rest of the telescope for every earlier field of every projection, and the parameter n, a loose bound variable in every field's type there, defeats any loose-variable cutoff: no field is used later, so every walk goes to the end, for Θ(N³).

N=200 in the Lean source. Lean 4.35 builds a propositional structure's casesOn from all its projections, so the same cost appears for every such structure there (e.g. the bv_decide structure benchmarks of the Lean test suite).

Checker Result ⏱️ 🧠
logos-kernel 👍 5.92 ms (÷17) 6.7 MB (÷10)
nano-lean 👍 10.1 ms (÷9.8) 125.6 MB (+79%)
sokonanoda 👍 134 ms (+35%) 83.8 MB (+20%)
pestka 👍 29.5 ms (÷3.4) 18.8 MB (÷3.7)
kefir 👍 65.8 ms (-34%) 13.2 MB (÷5.3)
nanoclo 👍 90.0 ms (-9%) 76.0 MB (+8%)
kefir-wasm 👍 500 ms (×5.0) 110.4 MB (+57%)
con-ron 👍 92.5 ms (-7%) 67.9 MB (-3%)
con-agua 👍 110 ms (+11%) 48.1 MB (-31%)
nanoda 👍 90.6 ms (-9%) 5.0 MB (÷14)
lazylean 👍 28.1 ms (÷3.5) 25.2 MB (÷2.8)
con-leche 👍 451 ms (×4.5) 49.6 MB (-29%)
pestka-wasm 👍 260 ms (×2.6) 209.9 MB (×3.0)
tenet-jvm 👍 637 ms (×6.4) 126.7 MB (+81%)
eink0rn 👍 64.3 ms (-35%) 115.4 MB (+65%)
official 👍 99.2 ms (0%) 70.1 MB (0%)
ind-models 👍 13.4 s (×135) 156.1 MB (×2.2)
lean4lean 👍 108 ms (+9%) 102.5 MB (+46%)
tenet 👍 314 ms (×3.2) 70.5 MB (+1%)
tenet-hs 👍 75.2 ms (-24%) 76.4 MB (+9%)
ocaml4lean 👍 98.7 ms (-1%) 37.2 MB (-47%)
lean4cobol 👍 1.74 s (×18) 21.0 MB (÷3.3)
evmlean 🚫 23.3 s 417.0 MB
overfull ⌛ 0 ms 0 B
vow-lean-kernel 👍 63.3 s (×638) 34.0 MB (÷2.1)
mini 🚫 36.3 ms 73.8 MB
canonical-min ✋ 413 ms 1.1 GB
kiota 👍 3.53 s (×36) 49.4 MB (-30%)
metalean-slow 🚫 81.3 ms 72.3 MB
nanobruijn 👍 156 ms (+57%) 31.3 MB (÷2.2)
metalean-fast 👍 112 ms (+13%) 84.0 MB (+20%)
nanoclo-fortran 👍 183 ms (+85%) 19.1 MB (÷3.7)
rpylean 👍 53.8 ms (-46%) 37.5 MB (-47%)
mathgraph 👍 141 ms (+42%) 91.9 MB (+31%)
parse-only 👍 49.9 ms (-50%) 65.4 MB (-7%)