Skip to content

fix: interaction between simp and backward.whnf.reducibleClassField#12622

Merged
leodemoura merged 1 commit intomasterfrom
fix-simp-reducibleClassField
Feb 20, 2026
Merged

fix: interaction between simp and backward.whnf.reducibleClassField#12622
leodemoura merged 1 commit intomasterfrom
fix-simp-reducibleClassField

Conversation

@leodemoura
Copy link
Copy Markdown
Member

@leodemoura leodemoura commented Feb 20, 2026

This PR fixes a bug where simp made no progress on class projection reductions when backward.whnf.reducibleClassField is true.

  • 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, so reduceProjCont? discards the fully-reduced result.
  • The fix uses unfoldDefinitionAny? directly, bypassing reduceProjCont?. The dsimp traversal revisits the result (via .visit) and handles any remaining .proj nodes naturally.

🤖 Generated with Claude Code

@leodemoura leodemoura added the changelog-tactics User facing tactics label Feb 20, 2026
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]>
@leodemoura leodemoura force-pushed the fix-simp-reducibleClassField branch from 33d3ed5 to 41d0be0 Compare February 20, 2026 16:28
@leodemoura leodemoura enabled auto-merge February 20, 2026 16:29
@leodemoura leodemoura added this pull request to the merge queue Feb 20, 2026
Merged via the queue into master with commit 73751bb Feb 20, 2026
15 checks passed
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant