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
In type theory, by a -type [Martin-LΓΆf (1982), pp. 171, (1984), pp. 43] one means a type which is defined inductively in a ell-founded way based on a type of βconstructorsβ and a type of of βaritiesβ. As such, -types are special kinds of inductive types (see below).
The same terminology β-typeβ is used [Moerdijk & Palmgren (2000)] for objects in (suitable pre-)toposes which provide categorical semantics for the type-theoretic notion (see further below).
Concretely, the terms/elements of a -type may be thought of as βrooted well-founded treesβ with a certain branching type; different -types are distinguished by their branching signatures: In categorical semantics in Sets, a branching signature is represented by a family of sets such that
each node of the tree is labeled with an element β referring to a constructor;
if a node is labeled by then it has exactly outgoing edges, each labeled by some β the arity of the constructor .
If one discards the requirement that the trees be well-founded, then the notion of -type becomes that of a coinductive type called an M-type (presumably since βMβ is like a βWβ upside down).
In practice, -types are used to:
provide a constructive counterpart of the classical notion of a well-ordering
uniformly define a variety of well-behaved inductive types.
More complex inductive types, with multiple constructors that are assumed only to be strictly positive, can be reduced to -types, at least in the presence of other structure such as sum types and function extensionality; see for instance Abbott, Altenkirch & Ghani (2004). This can even be extended to inductive families.
In most set theoretic mathematical foundations, -types can be proven to exist, but in predicative mathematics and in type theory, where this is not the case, they are often introduced axiomatically (as usual for inductive types more generally).
There are two slightly different formulations of W-types:
(due to Martin-LΓΆf (1984), pp. 43; streamlined review e.g. in Awodey, Gambino & Sojakova (2012, Β§2))
If the type theory is extensional, i.e. identities have unique proofs and (dependent) function types are extensional ( if and only if for all ), then this is more or less equivalent to the 1-category-theoretic definition below. The type theories that are the internal logic of familiar kinds of categories are all extensional in this sense.
The main distinction from the naive categorical theory below is that the map (1) must be assumed to be a display map, i.e. to exhibit as a dependent type over , in order that the dependent product be defined.
In the case of dependent polynomial functors, it seems that must also be a display map, in order to define . However, using adjointness, one can still define the W-type even if is not a display map. This more general version is what in type theory is called an indexed W-type; if is a display map then one sometimes refers to non-uniform parameters instead of indices. (By contrast, uniform parameters are the kind discussed above where , so that the entire construction takes place in a single slice category This is an instance of the red herring principle, since non-uniform parameters are not really parameters at all, but a special kind of indices.) For example, identity types are indexed W-types but not parametrized ones (even non-uniformly); see this blog post.)
In intensional type theory, a -type is only an initial algebra with respect to propositional equality, not definitional equality. In particular, the constructors are injective only propositionally, not definitionally. This applies already for the natural numbers type (Exp. ).
We discuss the categorical semantics of -types, due to Moerdijk & Palmgren (2000).
Here one describes a -type as an initial algebra for an endofunctor on an ambient category . The family can be thought of as a morphism
in some category (such that the fiber over is ), and the endofunctor in question is the composite
where
denotes context extension, hence the pullback functor (a.k.a. );
denotes the interpretation of the dependent product, i.e. the right base change along ;
the denotes the interpretation of the dependent sum, i.e. the left base change given by the forgetful functor from to .
Equivalently, it is the composite
where is the reader monad . In other words, the dependent product is not actually dependent.
Such a composite is called a polynomial endofunctor. Explicitly, it is the functor .
This definition makes sense in any locally cartesian closed category, although the W-type (the initial algebra) may or may not exist in any given such category. (A non-elementary construction of them is given by the transfinite construction of free algebras.)
The above definition is most useful when the category is not just locally cartesian closed but is a Ξ -pretopos, since often we want to use at least coproducts in constructing and . For example, a natural numbers object (Exp. ) is a -type specified by one of the coproduct inclusions , and the list object is a -type specified by . More generally, endofunctors that look like polynomials in the traditional sense:
can be constructed as polynomial endofunctors in the above sense for any lextensive category, and hence in any -pretopos. A -pretopos in which all W-types exist is called a Ξ W-pretopos.
In a topos with a natural numbers object (NNO), W-types for any polynomial endofunctor can be constructed as certain sets of well-founded trees; thus every topos with a NNO is a Ξ W-pretopos. This applies in particular in the topos Set (unless one is a predicativist, in which case is not a topos and W-types in it must be postulated explicitly).
The above has a natural generalization to dependent or indexed W-types (Gambino & Hyland (2004)) with a type of indices:
given a diagram of the form
there is the dependent polynomial functor
This reduces to the above for the terminal object.
Notice that we do not necessarily have , so this is not just a polynomial endofunctor of considered as a lccc in its own right. If we do have , then is called a type of parameters instead of indices.
(natural numbers type as a -type)
The natural numbers type is equivalently the -type (Def. ) with
;
(empty type);
(Danielsson (2012))
In homotopy type theory, if has h-level , then any -type of the form has h-level (as it should be for -colimits).
The original definition in type theory is due to
Per Martin-LΓΆf, pp. 171 of: Constructive Mathematics and Computer Programming, in: Proceedings of the Sixth International Congress of Logic, Methodology and Philosophy of Science (1979), Studies in Logic and the Foundations of Mathematics 104 (1982) 153-175 doi:10.1016/S0049-237X(09)70189-2, ISBN:978-0-444-85423-0
Per Martin-LΓΆf (notes by Giovanni Sambin), pp. 43 of: Intuitionistic type theory, Lecture notes Padua 1984, Bibliopolis, Napoli (1984) [pdf, pdf]
On the h-level of W-types:
Nils Anders Danielsson, Positive h-levels are closed under W (2012) [web]
which also computes the identity types of W-types (and more generally indexed W-types).
The observation that the categorical semantics of well-founded inductive types (-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, -types in sheaves [arXiv:0810.2398]
Generalization to inductive families (dependent -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 -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 August 25, 2024 at 10:06:02. See the history of this page for a list of all contributions to it.