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
A W-type is a set or type which is defined inductively in a well-founded way based on a type of “constructors” and a type of “arities”, with one constructor having a certain canonical form. As such it is a particular kind of inductive type.
In most set theories, W-types can be proven to exist, but in predicative mathematics or type theory, where this is not the case, they are often assumed explicitly to exist. In particular, W-types can be used to provide a constructive counterpart of the classical notion of a well-ordering and to uniformly define a variety of inductive types. More complex inductive types, with multiple constructors that are assumed only to be strictly positive, can be reduced to W-types, at least in the presence of other structure such as sum types and function extensionality; see for instance AAG. This can even be extended to inductive families.
The terms/elements of a W-type can be considered to be “rooted well-founded trees” with a certain branching type; different W-types are distinguished by their branching signatures. A branching signature is represented essentially by a family of sets which can be interpreted as requiring that each node of the tree is labeled with an element of the set , and that if a node is labeled by then it has exactly outgoing edges, each labeled by an element of . From a more computational point of view, the W-type can be viewed as a data type, where indexes the set of constructors and is the arity of the constructor .
If we remove the requirement that the trees are well-founded, we obtain instead a kind of coinductive type called an M-type (presumably since “M” is like a “W” upside down).
Actually, there are two slightly different formulations of W-types.
This version of W-types is the most natural for mathematicians used to thinking in terms of set theory or category theory, the categorical semantics of W-types, due to (Moerdijk-Palmgren 00).
Here we describe a W-type as the initial algebra for an endofunctor. The family can be thought of as a morphism in some category (the fiber over being ), and the endofunctor in question is the composite
where is context extension, hence is the pullback functor (a.k.a. ), is a dependent product, and is a dependent sum (a.k.a. the forgetful functor from to ).
Such a composite is called a polynomial endofunctor.
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.)
This 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 is a W-type specified by one of the coproduct inclusions , and the list object is a W-type specified by . More generally, endofunctors that look like polynomials in the traditional sense:
can be constructed as polynomial endofunctors in the above sense 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 04) 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 simply 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.
In type theory, W-types are introduced by giving explicit constructors and destructors, a.k.a. term introduction and term elimination rules. 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 categorical version given above. The type theories that are the internal logic of familiar kinds of categories are all extensional in this sense.
The rules for -types in extensional type theory are the following:
(1) -formation rule
Andreas Abel: A and B are used exactly the other way round in the introductory text to this page. (Before, A was the arity, now B is the arity.) Harmonize!?
In the following we will sometimes abbreviate by .
(2) -introduction rule
(3) -elimination rule
(4) -computation rule
(Awodey-Gambino-Sojakova §2, originally from Martin-Löf)
The main distinction from the naive categorical theory above is that the map (from the lines above the rules) 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.)
Note also that in intensional type theory, a W-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.
In homotopy type theory, if as h-level , then has h-level (as it should be for (infinity,1)-colimits). A formal proof of this is discussed in (Danielsson).
The original definition in type theory is due to
The categorical semantics of W-types by initial algebras of polynomial endofunctors is due to
Dependent W-type were introduced in
Related work is:
Discussion in relation to identity types and homotopy type theory is in
Steve Awodey, Nicola Gambino, Kristina Sojakova, Inductive types in homotopy type theory (arXiv:1201.3898)
Steve Awodey, Nicola Gambino, Kristina Sojakova, Homotopy-initial algebras in type theory (arXiv:1504.05531)
Work towards dependent W-types in HoTT is here; see also inductive families.
A formal proof about the h-level of W-types is discussed in
and also in
which also computes the identity types of W-types (and more generally indexed W-types).
Discussion of W-types in homotopy type theory, or rather in model categories presenting homotopy theories, is in
Last revised on August 15, 2021 at 13:07:43. See the history of this page for a list of all contributions to it.