fix: clean missing-spec error when a selected vcgen spec fails to apply - #14490
Merged
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
sgraf812
force-pushed
the
sg/vcgen-findspec-softmiss
branch
from
July 22, 2026 08:43
6bb56c7 to
17b0fa8
Compare
…pply This PR makes `vcgen` report a clean missing-spec error when the spec it selects for a program turns out not to unify with it, instead of dumping the internal backward rule and its type. The spec discrimination tree over-approximates, so a sole candidate returned by spec selection may not unify with the program. When the selected rule fails to apply, `applySpec` now matches the spec's pattern against the program: if the pattern does not unify, it routes through the same missing-spec handling as every other unmatched-spec case (naming the program and its candidates, or emitting the goal as a verification condition under `-errorOnMissingSpec`); if the pattern does unify, the rule failure is a genuine bug and the original hard error is preserved. The improvement is covered by the updated `recf` expectation in `tests/elab/vcgenUnfoldMatchDef.lean`.
sgraf812
force-pushed
the
sg/vcgen-findspec-softmiss
branch
from
July 22, 2026 09:08
17b0fa8 to
13fe08b
Compare
sgraf812
marked this pull request as ready for review
July 22, 2026 09:11
sgraf812
enabled auto-merge
July 22, 2026 09:12
robsimmons
pushed a commit
that referenced
this pull request
Jul 29, 2026
…pply (#14490) This PR makes `vcgen` report a clean missing-spec error when the spec it selects for a program turns out not to unify with it, instead of dumping the internal backward rule and its type. The spec discrimination tree over-approximates, so a sole candidate returned by spec selection may not unify with the program. When the selected rule fails to apply, `applySpec` now matches the spec's pattern against the program: if the pattern does not unify, it routes through the same missing-spec handling as every other unmatched-spec case; if the pattern does unify, the rule failure is a genuine bug and the original hard error is preserved. The improvement is covered by the updated `recf` expectation in `tests/elab/vcgenUnfoldMatchDef.lean`.
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 makes
vcgenreport a clean missing-spec error when the spec it selects for a program turns out not to unify with it, instead of dumping the internal backward rule and its type.The spec discrimination tree over-approximates, so a sole candidate returned by spec selection may not unify with the program. When the selected rule fails to apply,
applySpecnow matches the spec's pattern against the program: if the pattern does not unify, it routes through the same missing-spec handling as every other unmatched-spec case; if the pattern does unify, the rule failure is a genuine bug and the original hard error is preserved. The improvement is covered by the updatedrecfexpectation intests/elab/vcgenUnfoldMatchDef.lean.