fix: instantiate metavariables when collecting a goal's constants#13748
Merged
Conversation
This PR fixes premise selection silently dropping relevant premises when the goal was reached via `induction`. `MVarId.getRelevantConstants` and `MVarId.getConstants` walked the raw goal type returned by `getType`, which after `induction` is `?motive arg` with `?motive` an assigned-but-unsubstituted metavariable. The constant fold treats the metavariable as an opaque leaf, so every constant in the goal predicate is lost. Instantiating metavariables first recovers them. Thanks to Xavier Généreux for the report. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
|
Reference manual CI status:
|
|
Mathlib CI status (docs):
|
Collaborator
|
This will not see constants behind non-ground delayed assigned meta variables. It may be even more robust to walk the mvar graph and collect constants from there, without instantiations. Not sure if that's relevant in practice. |
…bles Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
I'm inclined to avoid this complexity for now, but I've left a comment in the code. |
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 fixes premise selection silently dropping relevant premises when the goal was reached via
induction.MVarId.getRelevantConstantsandMVarId.getConstantswalked the raw goal type returned bygetType, which afterinductionis?motive argwith?motivean assigned-but-unsubstituted metavariable. The constant fold treats the metavariable as an opaque leaf, so every constant in the goal predicate is lost. Instantiating metavariables first recovers them.Thanks to Xavier Généreux for the report.
🤖 Prepared with Claude Code