fix: report a missing spec for an un-steppable vcgen program head - #14688
Open
sgraf812 wants to merge 2 commits into
Open
fix: report a missing spec for an un-steppable vcgen program head#14688sgraf812 wants to merge 2 commits into
vcgen program head#14688sgraf812 wants to merge 2 commits into
Conversation
When `vcgen`'s program-shape phase reaches a `wp⟦e⟧` whose program `e` has a
head that no strategy steps and no spec keys on, report it as a missing spec,
the result `findSpec` already returns for a constant head with no registered
spec, rather than a hard "This should not happen" failure.
Unfolding `liftMach c = liftM (fun s => match c s.machine with …)` reaches this
case: the `monadLift` spec chain rewrites the lift down to the bare anonymous
state transformer `fun s => match c s.machine with …`, whose head is a lambda.
abbrev Base := EStateM Unit Nat
abbrev M := ReaderT Unit (StateT Unit (EStateM Unit Sys))
def liftMach {α} (c : Base α) : M α :=
liftM (m := EStateM Unit Sys) (fun s => match c s.machine with
| .ok a m => .ok a { s with machine := m }
| .error e m => .error e { s with machine := m })
def prog : M Unit := do let v ← liftMach (get : Base Nat); liftMach (set v)
theorem prog_spec : ⦃ fun r n s => Q () r n s ⦄ prog ⦃ Q; E ⦄ := by
vcgen [prog, liftMach] -- No spec found for program fun s => match …
sgraf812
force-pushed
the
sg/vcgen-liftm-loop-fix
branch
from
August 7, 2026 18:08
7b1191c to
3b56da8
Compare
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
sgraf812
marked this pull request as ready for review
August 11, 2026 07:40
sgraf812
enabled auto-merge
August 11, 2026 07:40
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
vcgenreportNo spec found for program …when the program head is one that no strategy steps and no spec keys on, such as the barefun s => …left by unfolding aliftMof an anonymous state transformer. Previously this failed withFailed to decompose weakest precondition … This should not happen.