fix: strip hypothesis-naming metadata from proof-mode targets#13812
Merged
Conversation
This PR fixes `mconstructor`, `mleft`, and `mright` failing inside `mhave` blocks, as well as `mspecialize` failing after a `mrevert; mintro` round trip. In both cases the inner proof state carried stray hypothesis-naming metadata that downstream tactics' pattern matches did not see through. `elabMHave` and `elabMReplace` placed `hyp.toExpr` (mdata-wrapped) as the inner `haveGoal`'s target; `mRevert` placed the focused hypothesis into the antecedent of the new `SPred.imp` target with mdata still attached, which then got captured into `Hyp.p` by the next `mintro`. Use the raw expression (or `consumeMData`) at those non-hypothesis-leaf positions so the invariant "hyp-naming mdata lives only on hypothesis-conjunction leaves" holds.
Equivalent change; `Hyp.p` is more semantic than stripping mdata defensively.
CI build broke after the previous refactor because `throwError` cannot be typechecked directly in the generic monad `m` of `mRevert`; lift it via `liftMetaM` like the other error sites in this file.
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
mconstructor,mleft, andmrightfailing insidemhaveblocks (#13691), andmspecializefailing after amrevert; mintroround trip. Both cases stem from hypothesis-namingExpr.mdataleaking from hypothesis-conjunction leaves into non-leaf positions (an inner target, or the antecedent of anSPred.imptarget), where downstream pattern matches did not see through it.Fixed by stripping the mdata at the offending non-leaf positions in
elabMHave,elabMReplace, andmRevert.