Skip to content

Conversation

@kim-em
Copy link
Collaborator

@kim-em kim-em commented Jan 6, 2026

This PR filters deprecated lemmas from exact? and rw? suggestions.

Previously, both tactics would suggest deprecated lemmas, which could be confusing for users since using the suggestion would trigger a deprecation warning.

Now, lemmas marked with @[deprecated] are filtered out in the addImport functions that populate the discrimination trees used by these tactics.

Example (before this PR):

import Mathlib.Logic.Basic

example (h : ∃ n : Nat, n > 0) : True := by
  choose (n : Nat) (hn : n > 0 + 0) using h
  guard_hyp hn : n > 0  -- `rw?` would suggest `Eq.rec_eq_cast` which is deprecated

Zulip discussion: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/deprecated.20lemma.20from.20rw.3F/near/554106870

🤖 Prepared with Claude Code

This PR filters deprecated lemmas from `exact?` and `rw?` suggestions.

Previously, both tactics would suggest deprecated lemmas, which could be
confusing for users since using the suggestion would trigger a
deprecation warning.

Now, lemmas marked with `@[deprecated]` are filtered out in the
`addImport` functions that populate the discrimination trees used by
these tactics.

Closes leanprover-community/mathlib4#... (Zulip discussion)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kim-em kim-em requested a review from leodemoura as a code owner January 6, 2026 23:31
@kim-em kim-em added the changelog-tactics User facing tactics label Jan 6, 2026
@kim-em kim-em changed the title feat(exact?/rw?): filter out deprecated lemmas from suggestions feat: filter out deprecated lemmas from suggestions in exact?/rw? Jan 6, 2026
@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 Jan 7, 2026
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 11e4e44be070ec99bc734e40f8431fd92725842d --onto 0f866236c7c2e77e8d12ff61d08ef48694a0cbfb. You can force Mathlib CI using the force-mathlib-ci label. (2026-01-07 00:34:33)

@leanprover-bot
Copy link
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 11e4e44be070ec99bc734e40f8431fd92725842d --onto 0f866236c7c2e77e8d12ff61d08ef48694a0cbfb. You can force reference manual CI using the force-manual-ci label. (2026-01-07 00:34:34)

@kim-em kim-em added this pull request to the merge queue Jan 7, 2026
Merged via the queue into leanprover:master with commit 975a81c Jan 8, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics 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.

3 participants