feat: add linter for rfl simp theorems at restricted transparency#13317
Merged
leodemoura merged 1 commit intomasterfrom Apr 8, 2026
Merged
feat: add linter for rfl simp theorems at restricted transparency#13317leodemoura merged 1 commit intomasterfrom
leodemoura merged 1 commit intomasterfrom
Conversation
This PR adds an opt-in linter (`set_option simp.rfl.checkTransparency true`) that warns when a `rfl` simp theorem's LHS and RHS are not definitionally equal at `.instances` transparency. Such theorems are problematic because `dsimp` cannot apply them at the transparency level `simp` actually uses. The warning suggests two fixes: use `id rfl` as the proof (to strip the `rfl` status), or mark relevant constants as `[implicit_reducible]`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 8, 2026
This PR amends #13317 to suggest `:= (rfl)` as the recommended way to avoid a theorem to be automatically marked `[defeq]`, for consistency with existing documentation. Rationale: the special treatment of `:= rfl` is based on syntax, not the proof term, so it’s appropriate to use different syntax. And also I like the way it reads like a “muted whisper of `rfl`”.
wkrozowski
pushed a commit
to wkrozowski/lean4
that referenced
this pull request
Apr 10, 2026
…anprover#13317) This PR adds an opt-in linter (`set_option simp.rfl.checkTransparency true`) that warns when a `rfl` simp theorem's LHS and RHS are not definitionally equal at `.instances` transparency. Bad rfl-simp theorems — those that only hold at higher transparency — create problems throughout the system because `simp` and `dsimp` operate at restricted transparency. The linter suggests two fixes: use `id rfl` as the proof (to remove the `rfl` status), or mark relevant constants as `[implicit_reducible]`. This is part of a broader effort to ensure `isDefEq` respects transparency levels. The linter helps systematically identify problematic rfl-simp theorems so they can be fixed incrementally. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
wkrozowski
pushed a commit
to wkrozowski/lean4
that referenced
this pull request
Apr 10, 2026
This PR amends leanprover#13317 to suggest `:= (rfl)` as the recommended way to avoid a theorem to be automatically marked `[defeq]`, for consistency with existing documentation. Rationale: the special treatment of `:= rfl` is based on syntax, not the proof term, so it’s appropriate to use different syntax. And also I like the way it reads like a “muted whisper of `rfl`”.
wkrozowski
pushed a commit
to wkrozowski/lean4
that referenced
this pull request
Apr 12, 2026
This PR amends leanprover#13317 to suggest `:= (rfl)` as the recommended way to avoid a theorem to be automatically marked `[defeq]`, for consistency with existing documentation. Rationale: the special treatment of `:= rfl` is based on syntax, not the proof term, so it’s appropriate to use different syntax. And also I like the way it reads like a “muted whisper of `rfl`”.
volodeyka
pushed a commit
that referenced
this pull request
Apr 16, 2026
…3317) This PR adds an opt-in linter (`set_option simp.rfl.checkTransparency true`) that warns when a `rfl` simp theorem's LHS and RHS are not definitionally equal at `.instances` transparency. Bad rfl-simp theorems — those that only hold at higher transparency — create problems throughout the system because `simp` and `dsimp` operate at restricted transparency. The linter suggests two fixes: use `id rfl` as the proof (to remove the `rfl` status), or mark relevant constants as `[implicit_reducible]`. This is part of a broader effort to ensure `isDefEq` respects transparency levels. The linter helps systematically identify problematic rfl-simp theorems so they can be fixed incrementally. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
volodeyka
pushed a commit
that referenced
this pull request
Apr 16, 2026
This PR amends #13317 to suggest `:= (rfl)` as the recommended way to avoid a theorem to be automatically marked `[defeq]`, for consistency with existing documentation. Rationale: the special treatment of `:= rfl` is based on syntax, not the proof term, so it’s appropriate to use different syntax. And also I like the way it reads like a “muted whisper of `rfl`”.
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 adds an opt-in linter (
set_option simp.rfl.checkTransparency true) that warns when arflsimp theorem's LHS and RHS are not definitionally equal at.instancestransparency. Bad rfl-simp theorems — those that only hold at higher transparency — create problems throughout the system becausesimpanddsimpoperate at restricted transparency. The linter suggests two fixes: useid rflas the proof (to remove therflstatus), or mark relevant constants as[implicit_reducible].This is part of a broader effort to ensure
isDefEqrespects transparency levels. The linter helps systematically identify problematic rfl-simp theorems so they can be fixed incrementally.