Multivariate polynomial functors. #
Multivariate polynomial functors are used for defining M-types and W-types.
They map a type vector α
to the type Σ a : A, B a ⟹ α
, with A : Type
and
B : A → TypeVec n
. They interact well with Lean's inductive definitions because
they guarantee that occurrences of α
are positive.
multivariate polynomial functors
- A : Type u
The head type
- B : self.A → TypeVec.{u} n
The child family of types
Instances For
Equations
- MvPFunctor.instCoeFunForallTypeVecType = { coe := MvPFunctor.Obj }
Applying P
to a morphism of Type
Equations
- P.map f ⟨a, g⟩ = ⟨a, TypeVec.comp f g⟩
Instances For
Equations
- MvPFunctor.instInhabited = { default := { A := default, B := default } }
Equations
- MvPFunctor.Obj.inhabited P = { default := ⟨default, fun (x : Fin2 n) (x_1 : P.B default x) => default⟩ }
Equations
- P.instMvFunctorObj = { map := @MvPFunctor.map n P }
Constant functor where the input object does not affect the output
Equations
- MvPFunctor.const n A = { A := A, B := fun (x : A) (x : Fin2 n) => PEmpty.{?u.17 + 1} }
Instances For
Constructor for the constant functor
Equations
- MvPFunctor.const.mk n x = ⟨x, fun (x_1 : Fin2 n) (a : (MvPFunctor.const n A).B x x_1) => PEmpty.elim a⟩
Instances For
Destructor for the constant functor
Equations
- MvPFunctor.const.get x = x.fst
Instances For
Functor composition on polynomial functors
Equations
- One or more equations did not get rendered due to their size.
Instances For
Constructor for functor composition
Equations
- One or more equations did not get rendered due to their size.
Instances For
Destructor for functor composition
Equations
- MvPFunctor.comp.get x = ⟨x.fst.fst, fun (i : Fin2 n) (a : P.B x.fst.fst i) => ⟨x.fst.snd i a, fun (j : Fin2 m) (b : (Q i).B (x.fst.snd i a) j) => x.snd j ⟨i, ⟨a, b⟩⟩⟩⟩
Instances For
Split polynomial functor, get an n-ary functor
from an n+1
-ary functor
Equations
- P.drop = { A := P.A, B := fun (a : P.A) => (P.B a).drop }
Instances For
Split polynomial functor, get a univariate functor
from an n+1
-ary functor
Equations
- P.last = { A := P.A, B := fun (a : P.A) => (P.B a).last }
Instances For
append arrows of a polynomial functor application
Equations
- P.appendContents f' f = TypeVec.splitFun f' f