Examples of W-types #
We take the view of W types as inductive types.
Given α : Type
and β : α → Type
, the W type determined by this data, WType β
, is the
inductively with constructors from α
and arities of each constructor a : α
given by β a
.
This file contains Nat
and List
as examples of W types.
Main results #
WType.equivNat
: the construction of the naturals as a W-type is equivalent toNat
WType.equivList
: the construction of lists on a typeγ
as a W-type is equivalent toList γ
The constructors for the naturals
Instances For
WType.Natα
is equivalent to PUnit ⊕ PUnit
.
This is useful when considering the associated polynomial endofunctor.
Equations
Instances For
@[simp]
@[simp]
theorem
WType.NatαEquivPUnitSumPUnit_apply
(c : Natα)
:
NatαEquivPUnitSumPUnit c = match c with
| Natα.zero => Sum.inl PUnit.unit
| Natα.succ => Sum.inr PUnit.unit
Equations
WType.Listα
is equivalent to γ
with an extra point.
This is useful when considering the associated polynomial endofunctor