feat: add a predicate for monad morphisms - #856
Open
eric-wieser wants to merge 6 commits into
Open
Conversation
We show that various list operations are monad morphisms, and that FreeM.liftM is.
eric-wieser
force-pushed
the
monadHom
branch
from
September 2, 2026 20:43
a3cbe56 to
2798f88
Compare
kim-em
added a commit
to kim-em/cslib
that referenced
this pull request
Sep 5, 2026
The generic List.orderedInsertM/insertionSortM commute with any monad morphism, stated with the IsMonadHom laws of leanprover#856 inlined and needing no lawfulness on either side. Since evaluation against an oracle is a monad morphism to Id, the executable Id instantiation is List.insertionSort with no separate proof about the generic definition, and the framework's complexity bounds apply to the generic program definitionally. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pxy48TaP92UgEq28KGm8BG
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.
We show that various list operations are preserved under monad morphisms, and that FreeM.liftM is.
Note that PolyFun already has the bundled version, but having the unbundled version now does not preclude adding the bundled version later.