feat: verifiable whileM via ordered fixpoints for stronger specs#13689
Merged
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
eaf161e to
f33b479
Compare
f33b479 to
1f9a595
Compare
This PR makes the unfolding lemma for `whileM` derivable from a `Lean.Order.MonadTail` instance instead of `MonadAttach`/`Acc`. The public entry point is `whileM_eq_of_monadTail` in `Init.Internal.Order.While`; the underlying pinning predicate `whileM.Pred` and the conditional `whileM_eq` lemma in `Init.While` are kept module-internal. The state-aware `Spec.whileM` and `Spec.forIn_loop` in `Std.Do.Triple.SpecLemmas` use the same `WhileInvariant α β ps` cursor over `α ⊕ β`. `WPAdequate` and the supporting `Ensures`/`MayReturn` machinery move to `Std.Do.WP.Adequate` and `Std.Do.Internal.Ensures`.
# Conflicts: # src/Std/Do/Triple/SpecLemmas.lean
1f9a595 to
bac7026
Compare
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 the unfolding lemma for
whileMderivable from aLean.Order.MonadTailinstance. The public entry point iswhileM_eq_of_monadTailinInit.Internal.Order.While; the underlying pinning predicatewhileM.Predand the conditionalwhileM_eqlemma inInit.Whileare kept module-internal.The state-aware
Spec.whileMandSpec.forIn_loopinStd.Do.Triple.SpecLemmasuse the sameWhileInvariant α β psfor expressing termination measures.WPAdequateand the supportingEnsures/MayReturnmachinery move toStd.Do.WP.AdequateandStd.Do.Internal.Ensures.