Repository navigation
Add perf test for lazy delta on applied projections - #381
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
perf/proj-app-lazy-delta, from leanprover/lean4#16613.The test checks
fun a h => h : ∀ a, a ∈ small → a ∈ big N, wherePSetis a structure with one fieldMem(like Mathlib'sSet). Soa ∈ sunfolds to the applied projections.Mem a.smallunfolds tobig Nin one step, which makes the two sides syntactically equal. Reducingbig Nto a constructor takes Θ(N) steps.Official compares bare projections lazily. For applied projections, it reduces the structures with
whnffirst, so it evaluatesbig 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