Skip to content

fix: give call-site vcgen [f] arguments the explicit-spec priority#14528

Merged
sgraf812 merged 1 commit into
masterfrom
sg/vcgen-callsite-unfold-prio
Jul 24, 2026
Merged

fix: give call-site vcgen [f] arguments the explicit-spec priority#14528
sgraf812 merged 1 commit into
masterfrom
sg/vcgen-callsite-unfold-prio

Conversation

@sgraf812

@sgraf812 sgraf812 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR makes every vcgen [f] argument enter the spec database at the call-site priority band, so a definition to unfold or a spec supplied as a term outranks an ambient @[spec] on the same program.

Two paths dropped the band and inserted at the default priority: the equational and unfold specs addSimpSpecs derives from a call's simp-style arguments, and a spec supplied as a compound term (vcgen [show … from h], [f x]) through mkSpecTheoremFromStx. Both now use explicitSpecPrio, the band a bracketed identifier already receives, so a bracketed definition's unfolding and a term spec both outrank a plain @[spec] or @[spec high] keyed on the same program, including when the program's state type is a variable and the entries share a discrimination-tree key.

@sgraf812 sgraf812 added the changelog-tactics User facing tactics label Jul 24, 2026
@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 156bdc91d998a1156341d899f43681190e74d2b8 --onto 3259610687883ec1ea48c481aba2469f2f83facf. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-24 07:53:19)

@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 156bdc91d998a1156341d899f43681190e74d2b8 --onto 49ff95727f98d43984726b26742d17a1ceea9dd5. You can force reference manual CI using the force-manual-ci label. (2026-07-24 07:53:21)

@sgraf812
sgraf812 force-pushed the sg/vcgen-callsite-unfold-prio branch 2 times, most recently from 437f23b to 18b6923 Compare July 24, 2026 08:12
@sgraf812 sgraf812 changed the title fix: give call-site vcgen [f] unfoldings the explicit-spec priority fix: give call-site vcgen [f] arguments the explicit-spec priority Jul 24, 2026
This PR makes every `vcgen [f]` argument enter the spec database at the call-site priority band, so a definition to unfold or a spec supplied as a term outranks an ambient `@[spec]` on the same program.

Two paths dropped the band and inserted at the default priority: the equational and unfold specs `addSimpSpecs` derives from a call's simp-style arguments, and a spec supplied as a compound term (`vcgen [show … from h]`, `[f x]`) through `mkSpecTheoremFromStx`. Both now use `explicitSpecPrio`, the band a bracketed identifier already receives, so a bracketed definition's unfolding and a term spec both outrank a plain `@[spec]` or `@[spec high]` keyed on the same program, including when the program's state type is a variable and the entries share a discrimination-tree key.
@sgraf812
sgraf812 force-pushed the sg/vcgen-callsite-unfold-prio branch from 18b6923 to 14878dd Compare July 24, 2026 08:21
@sgraf812
sgraf812 enabled auto-merge July 24, 2026 08:28
@sgraf812
sgraf812 added this pull request to the merge queue Jul 24, 2026
Merged via the queue into master with commit 22ffba4 Jul 24, 2026
19 checks passed
@sgraf812
sgraf812 deleted the sg/vcgen-callsite-unfold-prio branch July 24, 2026 09:14
Rob23oba pushed a commit to Rob23oba/lean4 that referenced this pull request Jul 24, 2026
…anprover#14535)

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 leanprover#14528, which had raised these unfoldings to the named-spec
priority.
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