Test "perf/unfold-before-literal"
Expected: 馃憤 accept 路 Size: 66.2鈥疜B 路 Lines: 1.2鈥痥 路 lean4export: 3.2.0 路 Lean: 4.38.0-nightly-2026-12-03 路 Timeout: 4.00鈥痬in 路 馃搫 Declaration 路 馃敆 Source
The declarations to check compare
[slowA, 1].sum and slowA + (1 + 0)
(and two variants: the sides swapped, and a longer list), where slowA is
a closed Nat that evaluates in 2^19 unit steps.
List.sum is foldr (路 + 路) 0, so unfolding it three times makes the
sides identical, for 螛(1). But both sides are closed Nat terms
headed by +, and a checker that tries its Nat literal extension before
unfolding evaluates slowA to a literal first, for 螛(2^19). The test
asks whether literal arithmetic waits until unfolding has had its chance.
Official (v4.35.0) needed about 20 s and 1.4 GB here, nearly all of it
evaluating slowA, slowB and slowC. Distilled from
AxiomMath/CFSG's CertificateChecks.KernelJ2Cover.totalC, where the
same shape cost it more than 100 GB.