Free Monad of a Polynomial Functor #
We define the free monad on a polynomial functor (PFunctor), and prove some basic properties.
Simp set for structurally unfolding FreeM and displayed-family operations.
This set is reserved for one-way unfolding lemmas: constructor equations for
FreeM operations, displayed-family operations, and local-hom recursion through
roll. Folding and normalization lemmas should not be tagged with this
attribute.
Instances For
The free monad on a polynomial functor.
This extends the W-type construction with an extra pure constructor.
- pure {P : PFunctor.{uA, uB}} {α : Type v} (x : α) : P.FreeM α
- roll {P : PFunctor.{uA, uB}} {α : Type v} (a : P.A) (r : P.B a → P.FreeM α) : P.FreeM α
Instances For
Instances For
Lift an object of the base polynomial functor into the free monad.
Instances For
Lift a position of the base polynomial functor into the free monad.
Instances For
Bind operator on FreeM P operation used in the monad definition.
Instances For
Transport a free polynomial tree along a polynomial lens.
The source polynomial P is the abstract/control interface. The target
polynomial Q is the concrete/runtime interface. At each P-node, the lens
chooses a Q-position by toFunA; when runtime supplies a Q-direction,
toFunB maps it back to the corresponding P-direction selecting the
control continuation.
Instances For
Proving a predicate C of FreeM P α requires two cases:
pure xfor somex : αroll x r hfor somex : P.A,r : P.B x → FreeM P α, andh : ∀ y, C (r y)Note that we can't useSort vinstead ofPropdue to universe levels.
Instances For
FreeM.mapM as a monad homomorphism.