feat: add grind.unusedLemmaThreshold option to report unused E-matching activations#12805
Merged
feat: add grind.unusedLemmaThreshold option to report unused E-matching activations#12805
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
…ng activations This PR adds a `set_option grind.unusedLemmaThreshold` that, when set to N > 0 and `grind` succeeds, reports E-matching lemmas that were activated at least N times but do not appear in the final proof term. This helps identify `@[grind]` annotations that fire frequently without contributing to proofs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
813efd9 to
46f6b43
Compare
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Mar 5, 2026
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 5, 2026
Collaborator
Author
|
This gives lots of juicy data in Mathlib! |
|
Mathlib CI status (docs):
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Mar 6, 2026
This PR removes the `@[grind →]` attribute from `List.getElem_of_getElem?` and `Vector.getElem_of_getElem?`. These lemmas were identified as problematic in Mathlib by leanprover#12805. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Mar 6, 2026
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 6, 2026
|
Mathlib CI status (docs):
|
|
Mathlib CI status (docs):
|
kim-em
added a commit
to kim-em/lean4
that referenced
this pull request
Mar 6, 2026
This PR removes the `@[grind →]` attribute from `List.getElem_of_getElem?` and `Vector.getElem_of_getElem?`. These lemmas were identified as problematic in Mathlib by leanprover#12805. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 6, 2026
This PR removes the `@[grind →]` attribute from `List.getElem_of_getElem?` and `Vector.getElem_of_getElem?`. These were identified as problematic in Mathlib by #12805. 🤖 Prepared with Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
github-actions bot
pushed a commit
that referenced
this pull request
Mar 6, 2026
This PR removes the `@[grind →]` attribute from `List.getElem_of_getElem?` and `Vector.getElem_of_getElem?`. These were identified as problematic in Mathlib by #12805. 🤖 Prepared with Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit a165292)
kim-em
added a commit
that referenced
this pull request
Mar 6, 2026
This PR removes the `@[grind →]` attribute from `List.getElem_of_getElem?` and `Vector.getElem_of_getElem?`. These were identified as problematic in Mathlib by #12805. 🤖 Prepared with Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This PR replaces `getUsedConstantsAsSet` with grind's existing instance-marking infrastructure for precise unused lemma detection. Each E-matching instantiation proof is wrapped in `mdata` with a unique ID, and `collectUsedOrigins` walks the proof term to find exactly which theorems were used. A new `config.markInstances` flag enables the cheap mdata wrapping and `InstanceMap` population without triggering the expensive trace pipeline (`ParamMinimizer.search`, `checkTactic` replay). The flag is automatically set when `grind.unusedLemmaThreshold > 0`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
!radar |
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Mar 7, 2026
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 7, 2026
|
Mathlib CI status (docs):
|
sgraf812
pushed a commit
that referenced
this pull request
Mar 9, 2026
This PR removes the `@[grind →]` attribute from `List.getElem_of_getElem?` and `Vector.getElem_of_getElem?`. These were identified as problematic in Mathlib by #12805. 🤖 Prepared with Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
!radar |
|
Benchmark results for 387a975 against f375286 are in. Significant changes detected! @kim-em
Large changes (1✅)
Small changes (5🟥)
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 a
set_option grind.unusedLemmaThresholdthat, when set to N > 0and
grindsucceeds, reports E-matching lemmas that were activated at least Ntimes but do not appear in the final proof term. This helps identify
@[grind]annotations that fire frequently without contributing to proofs.
🤖 Prepared with Claude Code