Lean Kernel Arena (Preview) / perf/folded-constant-first

Test "perf/folded-constant-first"

Expected: 馃憤 accept 路 Size: 52.3鈥疜B 路 Lines: 1.3鈥痥 路 lean4export: 3.2.0 路 Lean: 4.38.0-nightly-2026-12-03 路 Timeout: 40.0鈥痵 路 馃搫 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 鈴憋笍 馃
gruszka 馃憤 3.73鈥痬s (梅14) 93.1鈥疢B (-20%)
nano-lean 馃憤 1.83鈥痬s (梅29) 35.3鈥疢B (梅3.3)
pestka 馃憤 5.96鈥痬s (梅8.9) 23.5鈥疢B (梅4.9)
con-leche 馃憤 12.4鈥痬s (梅4.3) 26.3鈥疢B (梅4.4)
con-ron 馃憤 34.3鈥痬s (-35%) 47.3鈥疢B (梅2.5)
nucleus 馃毇 135鈥痬s 17.7鈥疢B
official 馃憤 52.8鈥痬s 116.0鈥疢B