Skip to content

Conversation

@leodemoura
Copy link
Member

This PR ensures that ground theorems are properly handled as grind parameters. Additionally, grind [(thm)] and grind [thm] should be handled the same way.

@leodemoura leodemoura requested a review from kim-em as a code owner December 10, 2025 10:30
@leodemoura leodemoura added the changelog-tactics User facing tactics label Dec 10, 2025
@leodemoura leodemoura enabled auto-merge December 10, 2025 10:30
This PR ensures that ground theorems are properly handled as `grind`
parameters. Additionally, `grind [(thm)]` and `grind [thm]` should be
handled the same way.
@kim-em kim-em force-pushed the grind_ground_thm_param branch from b0daa99 to 725598e Compare December 11, 2025 05:53
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.


Bug: Missing syntax tracking for ground constructors in grind

When processing constructors via the .intro modifier (lines 140-141) or the inductive predicate loop in .infer (lines 155-157), if a constructor has zero parameters (like True.intro), it now goes to extraFacts due to the new ground theorem handling at lines 70-82. However, unlike other call sites (.ematch kind at 128-131, .infer else branch at 159-162), these loops don't track syntax in extraFactsSyntax. This means grind? suggestions would be incomplete when ground constructors are involved. The other call sites correctly check if extraFacts.size grew and push to extraFactsSyntax, but these two loops do not.

src/Lean/Elab/Tactic/Grind/Param.lean#L139-L141

if incremental then throwError "`cases` parameter are not supported here"
for ctor in info.ctors do
params ← withRef p <| addEMatchTheorem params id ctor (.default false) minIndexable

src/Lean/Elab/Tactic/Grind/Param.lean#L154-L157

-- we also add the constructors (intro rules) as E-matching rules
for ctor in info.ctors do
-- **Note**: We should not warn if `declName` is an inductive
params ← withRef p <| addEMatchTheorem params id ctor (.default false) minIndexable (warn := False)

Fix in Cursor Fix in Web


@leodemoura leodemoura added this pull request to the merge queue Dec 11, 2025
Merged via the queue into master with commit aa4aff2 Dec 11, 2025
15 checks passed
leodemoura added a commit that referenced this pull request Dec 11, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2025
This PR fixes how theorems without parameters are handled in `grind`.

This is a better fix than #11579

---------

Co-authored-by: Kim Morrison <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants