Test "perf/proj-lazy-struct"
Expected: 馃憤 accept 路 Size: 45.5鈥疜B 路 Lines: 808 路 lean4export: 3.2.0 路 Lean: 4.38.0-nightly-2026-12-03 路 Timeout: 40.0鈥痵 路 馃搫 Declaration 路 馃敆 Source
The declaration to check compares
(P (slow 100000)).1 and (Q (slow 100001)).1
where P a and Q a both unfold to (0, a), and slow n takes 螛(n)
steps to evaluate.
A checker that compares two projections of the same structure by lazily
unfolding their structs, and projects as soon as neither side unfolds
any further, compares just the first fields, 0 and 0, after unfolding
P and Q. That is four unfoldings in all. A checker that
instead compares the two structs completely (here (0, slow 100000)
and (0, slow 100001)) before projecting also compares the second
fields, which differ, and does so by evaluating slow.
This is the counterpart of proj-cheap-struct, where the structs must
not be evaluated because they are equal by their arguments.