Skip to content

feat: warn when simp theorem LHS has variable or unrecognized head symbol#13325

Open
wkrozowski wants to merge 6 commits intoleanprover:masterfrom
wkrozowski:wojciech/simpVarHead2
Open

feat: warn when simp theorem LHS has variable or unrecognized head symbol#13325
wkrozowski wants to merge 6 commits intoleanprover:masterfrom
wkrozowski:wojciech/simpVarHead2

Conversation

@wkrozowski
Copy link
Copy Markdown
Contributor

@wkrozowski wkrozowski commented Apr 8, 2026

This PR adds warnings when registering @[simp] theorems whose left-hand side has a problematic head symbol in the discrimination tree:

  • Variable head (.star key): The theorem will be tried on every simp step, which can be expensive. The warning notes this may be acceptable for local or scoped simp lemmas. Controlled by warning.simp.varHead (default: true).
  • Unrecognized head (.other key, e.g. a lambda expression): The theorem is unlikely to ever be applied by simp. Controlled by warning.simp.otherHead (default: true).

@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 2398d2cc66e3b981504e6066e60896476ff14a31 --onto 4f6bcc5adac8d6234a9e3def3675402cb89823c6. You can force Mathlib CI using the force-mathlib-ci label. (2026-04-08 12:51:22)

@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 2398d2cc66e3b981504e6066e60896476ff14a31 --onto 861bc19e0c1c45b5766cc5c9ef0488568368b236. You can force reference manual CI using the force-manual-ci label. (2026-04-08 12:51:24)

@wkrozowski wkrozowski changed the title feat: add warning for simp lemmas whose LHS is a variable feat: warn when simp theorem LHS has variable or unrecognized head symbol Apr 9, 2026
@wkrozowski wkrozowski added the changelog-language Language features and metaprograms label Apr 9, 2026
@wkrozowski wkrozowski marked this pull request as ready for review April 9, 2026 11:02
@wkrozowski wkrozowski requested a review from leodemoura as a code owner April 9, 2026 11:02
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