Skip to content

fix: rank a vcgen call's unfoldings below a named or starred spec#14535

Merged
sgraf812 merged 4 commits into
masterfrom
sg/fix-vcgen-nospec
Jul 24, 2026
Merged

fix: rank a vcgen call's unfoldings below a named or starred spec#14535
sgraf812 merged 4 commits into
masterfrom
sg/fix-vcgen-nospec

Conversation

@sgraf812

@sgraf812 sgraf812 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR fixes vcgen [f, h, …] reporting No spec found for a sibling call inside a self-recursive f when the list both brackets f to unfold and supplies a spec h for f, whether h is 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 call vcgen applies that spec and stops rather than unfolding f again 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.

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.
@sgraf812 sgraf812 added the changelog-tactics User facing tactics label Jul 24, 2026
…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]`.
@sgraf812 sgraf812 changed the title fix: rank a vcgen call's unfoldings below a named spec fix: rank a vcgen call's unfoldings below a named or starred spec Jul 24, 2026
sgraf812 added 2 commits July 24, 2026 13:43
… 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.
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 24, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 8d96b70a05ef229a0fe557ff9844360ef866ef61 --onto 3259610687883ec1ea48c481aba2469f2f83facf. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-24 14:06:28)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 8d96b70a05ef229a0fe557ff9844360ef866ef61 --onto 49ff95727f98d43984726b26742d17a1ceea9dd5. You can force reference manual CI using the force-manual-ci label. (2026-07-24 14:06:30)

@sgraf812
sgraf812 marked this pull request as ready for review July 24, 2026 14:16
@sgraf812
sgraf812 enabled auto-merge July 24, 2026 14:16
@sgraf812
sgraf812 added this pull request to the merge queue Jul 24, 2026
Merged via the queue into master with commit 366c0a8 Jul 24, 2026
22 checks passed
@sgraf812
sgraf812 deleted the sg/fix-vcgen-nospec branch July 24, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants