Skip to content

Add perf test for lazy delta on applied projections - #381

Merged
nomeata merged 1 commit into
masterfrom
joachim/proj-app-lazy-delta
Nov 21, 2026
Merged

nomeata merged 1 commit into
masterfrom
joachim/proj-app-lazy-delta

Conversation

@nomeata

@nomeata nomeata commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Adds perf/proj-app-lazy-delta, from leanprover/lean4#16613.

The test checks fun a h => h : ∀ a, a ∈ small → a ∈ big N, where PSet is a structure with one field Mem (like Mathlib's Set). So a ∈ s unfolds to the applied projection s.Mem a. small unfolds to big N in one step, which makes the two sides syntactically equal. Reducing big N to a constructor takes Θ(N) steps.

Official compares bare projections lazily. For applied projections, it reduces the structures with whnf first, so it evaluates big N. That takes about 2 s at N = 100000. The variant with a bare projection is instant.

The issue uses 2 ^ (2 ^ 32), where official gives up with an error. This test uses a Θ(N) counting loop, so official accepts the test, just slowly.

🤖 Generated with Claude Code

Adds `perf/proj-app-lazy-delta`, from leanprover/lean4#16613: the kernel
compares `small.1 a =?= (big N).1 a`, where one unfolding of `small` makes
the sides syntactically equal, but reducing `big N` to a constructor takes
Θ(N) steps. Official reduces the structures of applied projections with
`whnf` before comparing them, so it pays Θ(N) (about 2 s at N = 100000),
while the bare-projection variant is instant.

🤖 Built with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nomeata
nomeata enabled auto-merge (squash) November 21, 2026 10:43
@nomeata
nomeata merged commit fdc02de into master Nov 21, 2026
42 checks passed
@nomeata
nomeata deleted the joachim/proj-app-lazy-delta branch November 21, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant