[WIP] feat: port SatisfiesM lemmas to mvcgen#1649
Closed
cmlsharp wants to merge 8 commits intoleanprover-community:mainfrom
Closed
[WIP] feat: port SatisfiesM lemmas to mvcgen#1649cmlsharp wants to merge 8 commits intoleanprover-community:mainfrom
cmlsharp wants to merge 8 commits intoleanprover-community:mainfrom
Conversation
Contributor
Author
|
WIP |
sgraf812
reviewed
Feb 3, 2026
| set_option mvcgen.warning false | ||
|
|
||
| @[spec] | ||
| theorem Spec.mapM_array {α β : Type w} [Monad m] [LawfulMonad m] [WPMonad m ps] |
Contributor
There was a problem hiding this comment.
WPMonad extends LawfulMonad
Suggested change
| theorem Spec.mapM_array {α β : Type w} [Monad m] [LawfulMonad m] [WPMonad m ps] | |
| theorem Spec.mapM_array {α β : Type w} [Monad m] [WPMonad m ps] |
Comment on lines
+38
to
+40
| {tru : Assertion ps} | ||
| {fal : xs.toList.Cursor → Assertion ps} | ||
| {exc : ExceptConds ps} |
Contributor
There was a problem hiding this comment.
Can you express this property in terms of {inv : Invariant xs.toList Bool ps}? The reason is that Invariant has special support in mvcgen so that it won't be accidentally instantiated when trying to discharge VCs by rfl.
| ⦃⌜True⌝⦄ f i xs[i] h ⦃(fun b => ⌜p i b h ∧ motive (i + 1)⌝, exc)⦄) : | ||
| ⦃⌜True⌝⦄ | ||
| xs.mapFinIdxM f | ||
| ⦃(fun bs => ⌜motive xs.size ∧ ∃ eq : bs.size = xs.size, ∀ i h, p i bs[i] h⌝, exc)⦄ := by |
Contributor
There was a problem hiding this comment.
The name of the spec and the attached @[spec] attribute suggest to me that it should allow a similarly general invariant as that for Spec.mapM
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.
Per this Zulip thread there is interest in porting the existing
SatisfiesMtheorems to mvcgen. This PR begins this progress (still WIP). Thus far I have specs for List/Array mapM, anyM, and mapFinIdx as well as a few lemmas about them.I'm still learning mvcgen myself, so it is highly likely even these proofs could be tightened up.