Polynomial free monads with an empty result type #
When α is empty, a tree in P.FreeM α has only operation nodes. The equivalence
PFunctor.FreeM.equivWOfIsEmpty identifies these trees with the W-type P.W.
Regard a free polynomial tree with no return values as a W-type.
Equations
- (PFunctor.FreeM.pure a).toWOfIsEmpty = isEmptyElim a
- (PFunctor.FreeM.liftBind a cont).toWOfIsEmpty = PFunctor.W.mk (PFunctor.Obj.mk a fun (b : P.B a) => (cont b).toWOfIsEmpty)
Instances For
Regard a W-type as a free polynomial tree with no return nodes.
Equations
- PFunctor.W.toFreeM (WType.mk a cont) = PFunctor.FreeM.liftBind a fun (b : P.B a) => PFunctor.W.toFreeM (cont b)
Instances For
@[simp]
theorem
PFunctor.FreeM.toWOfIsEmpty_lift_bind
{P : PFunctor.{uA, uB}}
{α : Type u}
[IsEmpty α]
(a : P.A)
(cont : P.B a → P.FreeM α)
:
@[simp]
theorem
PFunctor.FreeM.toWOfIsEmpty_lift_bind'
{P : PFunctor.{uA, uB}}
{α : Type uB}
[IsEmpty α]
(a : P.A)
(cont : P.B a → P.FreeM α)
:
@[simp]
@[simp]
theorem
PFunctor.FreeM.toWOfIsEmpty_toFreeM
{P : PFunctor.{uA, uB}}
{α : Type u}
[IsEmpty α]
(x : P.W)
:
@[simp]
theorem
PFunctor.W.toFreeM_toWOfIsEmpty
{P : PFunctor.{uA, uB}}
{α : Type u}
[IsEmpty α]
(x : P.FreeM α)
:
With an empty result type, the free polynomial monad is equivalent to its W-type.
Equations
- PFunctor.FreeM.equivWOfIsEmpty = { toFun := PFunctor.FreeM.toWOfIsEmpty, invFun := PFunctor.W.toFreeM, left_inv := ⋯, right_inv := ⋯ }
Instances For
@[simp]
theorem
PFunctor.FreeM.equivWOfIsEmpty_apply
{P : PFunctor.{uA, uB}}
{α : Type u}
[IsEmpty α]
(a✝ : P.FreeM α)
:
@[simp]
theorem
PFunctor.FreeM.equivWOfIsEmpty_symm_apply
{P : PFunctor.{uA, uB}}
{α : Type u}
[IsEmpty α]
(a✝ : P.W)
: