fix: vcgen [f] unfolding of definitions by root match#14429
Open
sgraf812 wants to merge 1 commit into
Open
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
This PR makes `vcgen [f]` handle a definition `f` whose body is a `match` on its arguments like `simp [f]` does. A call with an opaque discriminant now rewrites with the unfold theorem `f.eq_def` and splits the exposed `match`, instead of reporting a missing spec. Wildcard-row equations guarded by an overlap hypothesis are no longer used as specs; applying one committed the goal to the wildcard alternative and left the overlap hypothesis as an unprovable verification condition. The spec database now interprets a simp set the way `simp` itself does: equations arrive as simp theorem entries, and a `toUnfold` entry contributes `f.eq_def` at priority `0` as the spec counterpart of delta unfolding, guarded by `isRecursiveDefinition` where `simp` relies on smart unfolding at rewrite time. The `attribute [spec] f` path derives its entries from `mkSimpEntryOfDeclToUnfold` as well, and `mkSpecTheoremFromSimpDecl?` rejects overlap-guarded equations, which `vcgen` cannot apply the way `simp` does because spec application emits hypotheses as verification conditions rather than attempting to discharge them.
sgraf812
force-pushed
the
sg/vcgen-unfold-fallback
branch
from
July 17, 2026 11:19
eb05cfd to
dd239ef
Compare
sgraf812
marked this pull request as ready for review
July 17, 2026 15:51
Contributor
Author
|
!bench |
|
Benchmark results for dd239ef against 78745e2 are in. No significant results found. @sgraf812
Medium changes (1✅)
Small changes (2✅, 1🟥)
|
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
vcgen [f]handle a definitionfwhose body is amatchon its arguments likesimp [f]does. A call with an opaque discriminant now rewrites with the unfold theoremf.eq_defand splits the exposedmatch, instead of reporting a missing spec. Wildcard-row equations guarded by an overlap hypothesis are no longer used as specs; applying one committed the goal to the wildcard alternative and left the overlap hypothesis as an unprovable verification condition.The spec database now interprets a simp set the way
simpitself does: equations arrive as simp theorem entries, and atoUnfoldentry contributesf.eq_defat priority0as the spec counterpart of delta unfolding, guarded byisRecursiveDefinitionwheresimprelies on smart unfolding at rewrite time. Theattribute [spec] fpath derives its entries frommkSimpEntryOfDeclToUnfoldas well, andmkSpecTheoremFromSimpDecl?rejects overlap-guarded equations, whichvcgencannot apply the waysimpdoes because spec application emits hypotheses as verification conditions rather than attempting to discharge them.