Repository navigation
Add perf tests for projections of expensive structs - #257
Merged
Merged
Conversation
Distilled from a Palomar submission (roos-j/lean-spherical) that the con-ron bundled with Lean v4.35.0-rc3 failed with "fuel exhausted: whnf loop": a defeq between two projections whose structs are expensive to evaluate but equal by their arguments. Official needs five unfoldings; con-leche and con-ron fully reduce the struct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWm1rSWq3gU3E9qWjqPQup
The counterpart of perf/proj-cheap-struct: two projections whose structs differ but whose projected fields agree. Official compares the structs lazily and projects as soon as neither side unfolds (four unfoldings); a checker that compares the structs completely before projecting evaluates the differing fields. A first attempt to fix proj-cheap-struct in con-leche ran out of fuel here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWm1rSWq3gU3E9qWjqPQup
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.
This adds two perf tests about how a checker compares two projections,
a.i =?= b.i, whose structs are expensive to evaluate.perf/proj-cheap-struct:(S u).re = (S ()).re, where reducingS _to a constructor takes Θ(2^17) steps. Official keeps the structs stuck during definitional equality (whnf_corewithcheap_proj) and finds them equal by their arguments, with five unfoldings in all. A checker that fully reduces a projection's struct evaluatesSon both sides.perf/proj-lazy-struct:(P (slow 100000)).1 = (Q (slow 100001)).1, whereP aandQ aboth unfold to(0, a). The structs differ but the first fields agree. Official unfolds the structs lazily and projects as soon as neither side unfolds any further (lazy_delta_proj_reduction), with four unfoldings. A checker that compares the structs completely before projecting also evaluates the differing second fields.The first test is distilled from a Palomar submission (roos-j/lean-spherical) that the con-ron bundled with Lean v4.35.0-rc3 failed with "fuel exhausted: whnf loop", while nanoda and official accepted it. There the structs are
Finset.sums overFinset.range (2^17)underComplex.re. The second test is a regression that a first attempt at fixing con-leche introduced. A fix has to pass both tests.Local results:
A con-leche fix that mirrors official's
is_def_eq_coreis on the way, and a con-ron port of it is in progress.🤖 Generated with Claude Code
https://claude.ai/code/session_01XWm1rSWq3gU3E9qWjqPQup