fix: rank a vcgen call's unfoldings below a named or starred spec#14535
Merged
Conversation
This PR fixes a regression where `vcgen [f, h, …]` reported `No spec found` for a sibling call in a self-recursive `f`'s body when the same list both brackets `f` to unfold and names a spec `h` for `f`. The equational and unfold specs a bracketed definition contributes now enter a priority band below an explicitly named spec, so at a recursive call the named spec is applied and `vcgen` stops instead of unfolding the definition again into a branch whose sibling call has no matching spec. The band still sits above `@[spec]` and `@[spec high]`, so a bracketed definition is unfolded ahead of an ambient spec keyed on the same program.
…a starred spec This PR fixes `vcgen [f, *]` reporting `No spec found` for a sibling call in a self-recursive `f`'s body: the bracketed definition's unfolding tied the `*` band and won the tie-break, unfolding `f` again at the recursive call instead of applying the `*`-pulled spec. The call-site priorities are respaced onto the RFC's `n * 1000` grid with the strict ordering explicit > star > unfold > `@[spec high]`: `explicitSpecPrio = high + 3000`, `starSpecPrio = high + 2000`, `unfoldSpecPrio = high + 1000`. A bracketed definition's unfolding now ranks strictly below both a named spec and a `*` hypothesis for the same program, and above `@[spec]`/`@[spec high]`.
… specs This PR introduces the `unfold`, `star`, and `arg` priority classes to the `prio` syntax category, usable as `@[spec arg]` and the like, standardizing the call-site priority band `vcgen` assigns: `arg = high + 3000` for a spec named in a `vcgen [...]` list, `star = high + 2000` for a hypothesis pulled by `*`, and `unfold = high + 1000` for a bracketed definition's unfolding, giving the strict ordering `arg > star > unfold > high`. `vcgen`'s `explicitSpecPrio`, `starSpecPrio`, and `unfoldSpecPrio` now source their values from `eval_prio arg`, `eval_prio star`, and `eval_prio unfold`.
This PR drops the `unfold`/`star`/`arg` `prio` notation classes and inlines their values into `explicitSpecPrio`, `starSpecPrio`, and `unfoldSpecPrio` as `eval_prio high + 3000/2000/1000`, and trims the surrounding comments.
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
sgraf812
marked this pull request as ready for review
July 24, 2026 14:16
sgraf812
enabled auto-merge
July 24, 2026 14:16
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
vcgen [f, h, …]reportingNo spec foundfor a sibling call inside a self-recursivefwhen the list both bracketsfto unfold and supplies a spechforf, whetherhis named or pulled by*. A bracketed definition's unfoldings now rank below both a named spec and a*hypothesis for the same program, so at a recursive callvcgenapplies that spec and stops rather than unfoldingfagain into a branch whose sibling call has no matching spec. The regression came from #14528, which had raised these unfoldings to the named-spec priority.