fix: interaction between simp and backward.whnf.reducibleClassField#12622
Merged
leodemoura merged 1 commit intomasterfrom Feb 20, 2026
Merged
fix: interaction between simp and backward.whnf.reducibleClassField#12622leodemoura merged 1 commit intomasterfrom
simp and backward.whnf.reducibleClassField#12622leodemoura merged 1 commit intomasterfrom
Conversation
This PR fixes a bug where `simp` made no progress on class projection reductions when `backward.whnf.reducibleClassField` is `true`. The issue was in `reduceProjFn?`: for class projections applied to constructor instances (`Class.projFn (Class.mk ...)`), the code called `reduceProjCont? (← unfoldDefinitionAny? e)`. The helper `reduceProjCont?` expects the unfolded result to have a `.proj` head so it can apply `reduceProj?`. However, when `reducibleClassField` is enabled, `unfoldDefault` in WHNF.lean already reduces the `.proj` node during unfolding. The fully-reduced result no longer has a `.proj` head, so `reduceProjCont?` discards it and returns `none`. The fix uses `unfoldDefinitionAny?` directly, bypassing `reduceProjCont?`. The dsimp traversal revisits the result (via `.visit`) and handles any remaining `.proj` nodes naturally. Co-Authored-By: Claude Opus 4.6 <[email protected]>
33d3ed5 to
41d0be0
Compare
leodemoura
added a commit
that referenced
this pull request
Feb 22, 2026
The two-step `simp only [...]; simp [LE.le]` workaround is no longer needed after #12622 fixed `reduceProjFn?` in simp. Restore the clean single-step `simp [LE.le, IntN.le]` proofs for all five signed integer types (Int8/16/32/64/ISize). Co-Authored-By: Claude Opus 4.6 <[email protected]>
kim-em
pushed a commit
that referenced
this pull request
Feb 22, 2026
The two-step `simp only [...]; simp [LE.le]` workaround is no longer needed after #12622 fixed `reduceProjFn?` in simp. Restore the clean single-step `simp [LE.le, IntN.le]` proofs for all five signed integer types (Int8/16/32/64/ISize). Co-Authored-By: Claude Opus 4.6 <[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.
This PR fixes a bug where
simpmade no progress on class projection reductions whenbackward.whnf.reducibleClassFieldistrue.reduceProjFn?, for class projections applied to constructor instances (Class.projFn (Class.mk ...)), the code calledreduceProjCont? (← unfoldDefinitionAny? e). The helperreduceProjCont?expects the unfolded result to have a.projhead so it can applyreduceProj?. However, whenreducibleClassFieldis enabled,unfoldDefaultin WHNF.lean already reduces the.projnode during unfolding, soreduceProjCont?discards the fully-reduced result.unfoldDefinitionAny?directly, bypassingreduceProjCont?. The dsimp traversal revisits the result (via.visit) and handles any remaining.projnodes naturally.🤖 Generated with Claude Code