Polynomial functor (type theory)

In type theory, a polynomial functor (or container functor) is a kind of endofunctor of a category of types that is intimately related to the concept of inductive and coinductive types. Specifically, all W-types (resp. M-types) are (isomorphic to) initial algebras (resp. final coalgebras) of such functors.

Polynomial functors have been studied in the more general setting of a pretopos with Σ-types; this article deals only with the applications of this concept inside the category of types of a Martin-Löf style type theory.

Definition
Let U be a universe of types, let A : U, and let B : A → U be a family of types indexed by A. The pair (A, B) is sometimes called a signature or a container. The polynomial functor associated to the container (A, B) is defined as follows:

\begin{align} P : U &\longrightarrow U \\ X &\longmapsto \sum_{a:A} (B(a) \to X) \end{align} $$ Any functor naturally isomorphic to P is called a container functor. The action of P on functions is defined by

\begin{align} P^* : (X\to Y) &\longrightarrow (P^*X\to P^*Y) \\ (f, (a,g)) &\longmapsto (a,g\circ f) \end{align} $$ Note that this assignment is not only truly functorial in extensional type theories (see ).

Properties
In intensional type theories, such functions are not truly functors, because the universe type is not strictly a category (the field of homotopy type theory is dedicated to exploring how the universe type behaves more like a higher category). However, it is functorial up to propositional equalities, that is, the following identity types are inhabited:

\begin{align} P^*(f\circ g) &= P^*f\circ P^*g \\ P^*(\mathsf{id}_X) &= \mathsf{id}_{PX} \end{align} $$ for any functions f and g and any type X, where $$\mathsf{id}_X$$ is the identity function on the type X.