natural deduction metalanguage, practical foundations
type theory (dependent, intensional, observational type theory, homotopy type theory)
computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory
An inductive type is…
In terms of categorical semantics, an inductive type is a type whose interpretation is given by an initial algebra of an endofunctor.
This has the usual meaning in ordinary category theory. In applications to (∞,1)-category theory, the uniqueness clause in the notion of initial object is modified to allow for a contractible space of choices (as discussed at initial object in an (∞,1)-category), and this difference is reflected accordingly in the type-theoretic set-up. The syntax will give back the traditional meaning whenever equality is interpreted extensionally.
There are two equivalent ways of defining the judgement rules for inductive types. The first describes elimination on dependent types over the given type. This is the formalization of the notion of induction, and discussed below in
The second describes elimination on absolute types. This is the formalization of the notion of recursion, and discussed below
(…)
(…)
We discuss the categorical semantics of inductive types.
The categorical interpretation of induction, hence of the dependent elimination and computation rules from above are the following.
Let $\mathcal{C}$ be the ambient category.
The interpretation of inductive term introduction is by an endofunctor $F : \mathcal{C} \to \mathcal{C}$ and an algebra over an endofunctor, exhibited by a morphism in $\mathcal{C}$ of the form
The interpretation of the dependent elimination rule says that given a display map $B \to W$, where $B$ is given an $F$-algebra structure and the display map is an $F$-algebra homomorphism, the dependent eliminator is interpreted as a specified section $\sigma : W \to B \in \mathcal{C}_{/W}$, hence as a commuting diagram of the form
in $\mathcal{C}$.
The interpretation of the dependent computation rules is that the section $\sigma$ from above is required to be an algebra homomorphism.
The categorical interpretation of recursion, hence of the absolute elimination rules from above in a suitable category $\mathcal{C}$ is the following
The interpretation of inductive term introduction is by an endofunctor $F : \mathcal{C} \to \mathcal{C}$ and an algebra over an endofunctor, exhibited by a morphism in $\mathcal{C}$ of the form
The interpretation of the absolute elimination rule is that for $A$ any other $F$-algebra, there is a morphism $W \to A$ in $\mathcal{C}$.
The interpretation of the absolute computation rule says that the morphism $W \to A$ from above is an algebra homomorphism and is unique as such.
In summary this says that the recursion rules are interpreted as an initial algebra of an endofunctor.
When interpreted in a category $\mathcal{C}$ of homotopy 0-types = sets, definition and definition are indeed equivalent.
First suppose that $W$ is an initial $F$-algebra as in def. . Then since initiality entails first of all the existence of a morphims to any other object it follows that with $B$ another $F$-algebra there is a homomorphism $W \to B$, and since secondly initiality entails uniqueness of this morphism, it follows that given a homomorphism $B \to W$ the composite $W \to B \to W$ has to equal the identity $id_W$, hence that $B \to W$ has a section, and uniquely so.
Conversely, assume that $W$ satisfies definition . For $A$ any other $F$-algebra we can form the trivial display map $W \times A \to W$ by projection and a section of this is equivalently just a morphism $W \to A$, so we have a homomorphism from $W$ to any other $F$-algebra $A$. Therefore to show that $W$ is an initial $F$-algebra it remains to show that for $f, g : W \to A$ two algebra homomorphism, they are necessarily equal.
To that end, notice that by the assumption of 0-truncation, the diagonal $\delta \colon A \to A \times A$ is a display map / fibration.
Form its pullback $P$
which is also an algebra homomorphism. Therefore by the interpretation of the elimination rule it has a (specified) section $\sigma : W \to P$. But $P \to W$ is the pullback of a monomorphism and therefore itself a monomorphism, and so the section forces it to be in fact an isomorphism. This in turn means that $f$ and $g$ are equal.
In intensional type theory, where the diagonal is not a display map, we can perform the same argument using a path object $P A \to A \times A$ (represented in type theory by an identity type), showing thereby that $f$ and $g$ are homotopic. A fancier version of this argument enables us to show that the space of algebra maps $W\to A$ is actually contractible. In other words, the axioms for an inductive type still imply that algebra maps out of $W$ are essentially unique, even though the axioms do not state this explicitly.
Any inductive type $W$ is a homotopy initial F-algebra: the space of $F$-algebra maps $W \to X$ is contractible.
[Awodey, Gambino & Sojakova (2012)]
In the first examples to follow, the computation rules are written with ordinary equality signs “=”. At least for extensional inductive types these are judgemental equalities.
The inductive inference rules for the empty type:
The inductive inference rules for the unit type:
The inference rules for the type of classical truth values/bits (the classical boolean domain):
See at Boolean domain – In type theory
The inductive inference rules for the natural numbers type:
and
If $X$ is any set, then the inductive type $L X$ of lists of elements of $X$ has $|X|+1$ constructors:
Therefore, $nil$ is a list, $cons(x,\ell)$ is a list for any list $\ell$ and $x\in X$, and all lists are generated in this way.
The introduction, elimination and computation rules for identity types are discussed there.
In Coq-syntax the identity types are the inductive types (or more precisely, the inductive family) defined by
Inductive id {A} : A -> A -> Type :=
idpath : forall x, id x x.
We may interpret identity types in suitable categories $\mathcal{C}$ such as a type-theoretic model category.
The categorical interpretation of identity types in a category $\mathcal{C}$ is as the initial algebra for the endofunctor
of the slice category $\mathcal{C}_{/A \times A}$ over $A\times A$ which is constant at the diagonal $A\to A\times A$:
So an algebra for this endofunctor is a morphism
and the initial such is the path space object $A^I \to A \times A$.
We spell out in detail how the the induction principle def. for identity types is the principle of substitution of equals for equals.
To have an $F$-algebra $\langle E \to A\times A\rangle$ over $\langle A^I \to A \times A\rangle$ means precisely to have a diagram
in $\mathcal{C}$.
This is the interpretation of the elimination rule: $E \to A^I$ is the interpretation of a type
and the lift $A \to E$ is a section of the pullback of $E$ to $A$, hence an interpretation of a term in the substitution
The elimination rule then says that this extends to a section $A^I \to E$, hence a “proof of $E$ over all identifications” $a = b$.
We spell out how the the recursion principle def. for identity types is related to the Segal-completeness condition and in particular to univalence.
Notice that an algebra over the endofunctor that defines identity types, example ,
constitutes the 1-skeleton of a simplicial object
The recursion principle says that the degeneracy map $\sigma_0$ factors through the path space object of $X_0$ as a lift $\hat \sigma_0$ in the diagram
Semantically, this lift exists because $X_0 \to X_0^I$ is an acyclic cofibration by definition of path space object, and $X_1 \to X_0 \times X_0$ is a fibration (display map) by the interpretation rule for dependent types.
This morphism
lifts paths/morphisms that exist in $X_0$ to the morphisms exhibited by $X_1$, if we think of the above as the 1-skeleton of a simplicial object that represents an internal category in an (infinity,1)-category.
Suppose this exists, then there will be a notion of equivalences in $X_1$, those morphisms that are invertible with respect to the given composition operation. In good situations this will give the core inclusion
In this case the Segal-completeness condition in degree 1 says that the path recursion $\hat \sigma_0$ exhibits this inclusion
In the case that $X_\bullet$ is the classifier of the codomain fibration, then this is called the univalence-condition.
Historical references on the definition of inductive types.
A first type theoretic formulation of general inductive definitions:
The induction principle for identity types (also known as “path induction” or the “J-rule”) is first stated in:
and in the modern form of inference rules in:
The special case of inductive W-types is formulated in:
Early proposals for a general formal definition of inductive types:
Robert L. Constable, N. Paul Francis Mendler, Recursive definitions in type theory, in Logic of Programs 1985, Lecture Notes in Computer Science 193 Springer (1985) $[$doi:10.1007/3-540-15648-8_5$]$
Paul Francis Mendler, Inductive Definition in Type Theory, Cornell (1987) $[$hdl:1813/6710$]$
Roland Backhouse, On the Meaning and Construction of the Rules of Martin-Löf’s Theory of Types, in: Workshop on General Logic, ECS-LFCS-88-52 (1988) $[$pdf, pdf$]$
The modern notion of inductive types and inductive families in intensional type theory independently due to
Peter Dybjer, Inductive sets and families in Martin-Löf’s type theory and their set-theoretic semantics, Logical frameworks (1991) 280-306 $[$doi:10.1017/CBO9780511569807.012, pdf$]$
Peter Dybjer, Inductive families, Formal Aspects of Computing 6 (1994) 440–465 $[$doi:10.1007/BF01211308, doi:10.1007/BF01211308, pdf$]$
and due to
which became the basis of the calculus of inductive constructions used in the Coq-proof assistant:
Frank Pfenning, Christine Paulin-Mohring, Inductively defined types in the Calculus of Constructions, in: Mathematical Foundations of Programming Semantics MFPS 1989, Lecture Notes in Computer Science 442, Springer (1990) $[$doi:10.1007/BFb0040259$]$
Christine Paulin-Mohring, Inductive definitions in the system Coq – Rules and Properties, in: Typed Lambda Calculi and Applications TLCA 1993, Lecture Notes in Computer Science 664 Springer (1993) $[$doi:10.1007/BFb0037116$]$
reviewed in
Zhaohui Luo, §9.2.2 in: Computation and Reasoning – A Type Theory for Computer Science, Clarendon Press (1994) $[$ISBN:9780198538356, pdf$]$
Christine Paulin-Mohring, §2.2. in: Introduction to the Calculus of Inductive Constructions, contribution to: Vienna Summer of Logic (2014) $[$hal:01094195, pdf, pdf slides$]$
with streamlined exposition in:
The generalization to inductive-recursive types is due to
Peter Dybjer, A general formulation of simultaneous inductive-recursive definitions in type theory, The Journal of Symbolic Logic 65 2 (2000) 525-549 $[$doi:10.2307/2586554, pdf$]$
Peter Dybjer, Anton Setzer, Indexed induction-recursion, in Proof Theory in Computer Science PTCS 2001. Lecture Notes in Computer Science2183 Springer (2001) $[$doi:10.1007/3-540-45504-3_7, pdf$]$
See also:
Textbook accounts:
Simon Thompson, §4.10 in: Type Theory and Functional Programming, Addison-Wesley (1991) [ISBN:0-201-41667-0, webpage, pdf]
Adam Chlipala, §3 of: Certified programming with dependent types, MIT Press 2013 [ISBN:9780262026659, pdf, book webpage]
(discussion for the Coq proof assistant)
Robert Harper, §15 in: Practical Foundations for Programming Languages, Cambridge University Press (2016) [ISBN:9781107150300, pdf]
See also:
Exposition with an eye towards explaining identity types in Martin-Löf type theory/homotopy type theory:
Formalization in proof assistants:
in Coq:
in Lean:
On inductive types in the context of linear type theory:
Expositions with an eye towards higher inductive types:
Mike Shulman, Homotopy type theory IV (web)
Peter LeFanu Lumsdaine, Higher inductive types, a tour of the menagerie (blog post)
Mike Shulman, Inductive and higher inductive types, talk slides (2012) (pdf)
Discussion of homotopy-initiality of inductive types in homotopy type theory (cf. also at higher inductive type):
Steve Awodey, Nicola Gambino, Kristina Sojakova, Inductive types in homotopy type theory, LICS’12: (2012) 95–104 [arXiv:1201.3898, doi:10.1109/LICS.2012.21, Coq code]
Exposition:
Steve Awodey, Inductive types in HoTT (Jan 2012) [blog post]
The observation that the categorical semantics of well-founded inductive types ($\mathcal{W}$-types) is given by initial algebras over polynomial endofunctors on the type system:
Peter Dybjer, Representing inductively defined sets by wellorderings in Martin-Löf’s type theory, Theoretical Computer Science 176 1–2 (1997) 329-335 $[$doi:10.1016/S0304-3975(96)00145-4$]$
Ieke Moerdijk, Erik Palmgren, Wellfounded trees in categories, Annals of Pure and Applied Logic 104 1-3 (2000) 189-218 $[$doi:10.1016/S0168-0072(00)00012-9$]$
Further discussion:
Michael Abbott, Thorsten Altenkirch, Neil Ghani, Containers: Constructing strictly positive types, Theoretical Computer Science 342 1 (2005) 3-27 $[$doi:10.1016/j.tcs.2005.06.002$]$
Benno van den Berg, Ieke Moerdijk, $W$-types in sheaves [arXiv:0810.2398]
Generalization to inductive families (dependent $\mathcal{W}$-types):
Nicola Gambino, Martin Hyland, Wellfounded Trees and Dependent Polynomial Functors, in: Types for Proofs and Programs TYPES 200, Lecture Notes in Computer Science 3085, Springer (2004) $[$doi:10.1007/978-3-540-24849-1_14$]$
Michael Abbott, Thorsten Altenkirch, Neil Ghani: Representing Nested Inductive Types using W-types, in: Automata, Languages and Programming, ICALP 2004, Lecture Notes in Computer Science, 3142, Springer (2004) $[$doi:10.1007/978-3-540-27836-8_8, pdf$]$
exposition: Inductive Types for Free – Representing nested inductive types using W-types, talk at ICALP (2004) $[$pdf$]$
Generalization to homotopy-initial algebras as categorical semantics for $\mathcal{W}$-types in homotopy type theory:
Steve Awodey, Nicola Gambino, Kristina Sojakova, Inductive types in homotopy type theory, LICS’12: (2012) 95–104 $[$arXiv:1201.3898, doi:10.1109/LICS.2012.21, Coq code$]$
Benno van den Berg, Ieke Moerdijk, W-types in Homotopy Type Theory, Mathematical Structures in Computer Science 25 Special Issue 5: From type theory and homotopy theory to Univalent Foundations of Mathematics (2015) 1100-1115 $[$arXiv:1307.2765, doi:10.1017/S0960129514000516$]$
Kristina Sojakova, Higher Inductive Types as Homotopy-Initial Algebras, ACM SIGPLAN Notices 50 1 (2015) 31–42 $[$arXiv:1402.0761, doi:10.1145/2775051.2676983$]$
Steve Awodey, Nicola Gambino, Kristina Sojakova, Homotopy-initial algebras in type theory, Journal of the ACM 63 6 (2017) 1–45 $[$arXiv:1504.05531, doi:10.1145/3006383$]$
Benno van den Berg, Ieke Moerdijk, W-types in Homotopy Type Theory, Mathematical Structures in Computer Science 25 Special Issue 5: From type theory and homotopy theory to Univalent Foundations of Mathematics (2015) 1100-1115 [arXiv:1307.2765, doi:10.1017/S0960129514000516]
Towards combining generalization to dependent and homotopical W-types:
Last revised on January 25, 2023 at 21:37:53. See the history of this page for a list of all contributions to it.