Skip to content

feat: add linter for rfl simp theorems at restricted transparency#13317

Merged
leodemoura merged 1 commit intomasterfrom
rfl_simp_linter
Apr 8, 2026
Merged

feat: add linter for rfl simp theorems at restricted transparency#13317
leodemoura merged 1 commit intomasterfrom
rfl_simp_linter

Conversation

@leodemoura
Copy link
Copy Markdown
Member

@leodemoura leodemoura commented Apr 8, 2026

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.

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>
@leodemoura leodemoura added the changelog-language Language features and metaprograms label Apr 8, 2026
@leodemoura leodemoura enabled auto-merge April 8, 2026 04:26
@leodemoura leodemoura added this pull request to the merge queue Apr 8, 2026
Merged via the queue into master with commit fd2723d Apr 8, 2026
25 checks passed
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Apr 8, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 30dca7b5458c58aa01e55993ee1b56ad9e1d0639 --onto 4f6bcc5adac8d6234a9e3def3675402cb89823c6. You can force Mathlib CI using the force-mathlib-ci label. (2026-04-08 05:46:18)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 30dca7b5458c58aa01e55993ee1b56ad9e1d0639 --onto 861bc19e0c1c45b5766cc5c9ef0488568368b236. You can force reference manual CI using the force-manual-ci label. (2026-04-08 05:46:19)

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`”.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants