Lean Kernel Arena (Preview) / perf/app-lam

Test "perf/app-lam"

Expected: 👍 accept · Size: 1.2 MB · Lines: 28.6 k · lean4export: 3.2.0 · Lean: 4.38.0-nightly-2026-12-03 · Timeout: 70.0 s · 📄 Declaration · 🔗 Source

A synthetically generated term with n levels of alternating applications and lambdas, with DAG sharing.

At each level, a constant is applied to two identical lambda arguments. The export format records these as a single shared expression (DAG). Each lambda body grows with the nesting depth, referencing all enclosing binders.

This tests two aspects of checker performance:

Infer cache: Since both arguments at each level are the same expression, a checker without an infer cache re-infers the type of each shared subterm, doubling work at every level — O(2ⁿ) total.

Substitution cost: Even with a cache, type-inferring each lambda requires substituting into its body (size O(n)) at each of the n levels, giving O(n²) total. Whether this cost arises depends on the checker's binder representation.

Checker Result ⏱️ 🧠
gruszka 👍 74.0 ms (÷36) 133.1 MB (÷11)
nano-lean 👍 6.95 ms (÷388) 62.0 MB (÷24)
pestka 👍 188 ms (÷14) 134.0 MB (÷11)
con-leche 👍 3.99 s (+48%) 1.2 GB (-14%)
con-ron 👍 4.78 s (+77%) 1.4 GB (0%)
nucleus 🚫 301 ms 35.1 MB
official 👍 2.70 s 1.4 GB