Repository navigation
Conversation
Add the canonical map `PFunctor.W.toM` and identify `P.W` with the well-founded trees of `P.M`, together with Lambek's lemma `M.destEquiv` and an induction principle for `PFunctor.W` through `W.mk`. Identify `P.FreeM α` with the W-type of `C α + P`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `PFunctor.Resumption P α`, the M-type of `C α + P`: possibly non-terminating programs that return an `α` or perform an operation of `P`. It has a corecursor, a bisimulation principle and a lawful monad structure, and `FreeM.toResumption` is an injective monad morphism whose image is exactly the well-founded resumptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use `liftBind` as the implementation-detail constructor with simp-normal form `(lift a).bind k`, as for `PFunctor.FreeM`, and name the cases and lemmas accordingly (`lift_bind`, `liftBind_bind`, `dest_lift_bind`, `map_bind`, `bind_pure_comp`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `M.toResumption`, `Resumption.toMOfIsEmpty` and `equivMOfIsEmpty`, mirroring the W-type embedding of free programs, and show that embedding W-trees commutes with these maps. Describe the four tree types and the maps between them in the module documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dtumad
requested review from
SamuelSchlesinger,
arademaker,
chenson2018,
crei,
fmontesi and
sorrachai
as code owners
October 5, 2026 23:56
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.
Completes the polynomial tree types with coinductive resumptions and relates the four representations.
PFunctor.WandPFunctor.Mare the initial algebra and final coalgebra ofP;PFunctor.FreeM P αand the newPFunctor.Resumption P αare those ofX ↦ α ⊕ P X, the W- and M-types ofC α + P(FreeM.equivW). The canonical mapsW.toMandFreeM.toResumptionare injective with image the well-founded trees, the latter a monad morphism, and they commute with the embeddings of trees that never return (W.toFreeM,M.toResumption), which are equivalences when nothing can be returned.Resumptions have a corecursor, a bisimulation principle and a lawful monad structure whose API mirrors
PFunctor.FreeM. Overythey are Capretta's delay monad; they give semantics to loops whose termination is not structural, such as rejection sampling or machine execution. Adapted from PolyFun.AI agents were used to adapt VCVio definitions/proofs to Cslib definitions and conventions.