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
Higher inductive types (HITs) are a generalization of inductive types which allow the constructors to produce, not just points of the type being defined, but also elements of its iterated identity types.
While HITs are already useful in extensional type theory, they are most useful and powerful in homotopy type theory, where they allow the construction of cell complexes, homotopy colimits, truncations, localizations, and many other objects from classical homotopy theory.
Defining what a HIT is “in general” is an open research problem. One mostly precise proposal may be found in (ShulmanLumsdaine16). A more syntactic description of a class of HITs may be found in (Brunerie16). A solution to this problem should determine how to define the concept of an elementary (∞,1)-topos.
See also higher inductive type.
All higher inductive types described below are given together with some pseudo-Coq code, which would implement that HIT if Coq supported HITs natively.
The circle type is:
Inductive circle : Type :=
| base : circle
| loop : base == base.
Using the univalence axiom, one can prove that the loop space base == base
of the circle type is equivalent to the integers.
(Licata & Shulman 13, Bezem, Buchholtz, Grayson & Shulman 19).
The homotopy type of the interval can be encoded as
Inductive interval : Type :=
| zero : interval
| one : interval
| segment : zero == one.
See interval type. The interval can be proven to be contractible. On the other hand, if the constructors zero
and one
satisfy their elimination rules definitionally, then the existence of an interval type implies function extensionality; see this blog post. The interval can be defined as the -1-truncation of the booleans; see here:
Inductive interval : Type :=
| inj : boolean -> interval
| contr0 : forall (p q : interval) p == q
Or more directly:
Inductive interval : Type :=
| zero : interval
| one : interval
| contr0 : forall (p q : interval) p == q
Similarly the homotopy type of the 2-dimensional sphere
Inductive sphere2 : Type :=
| base2 : sphere2
| surf2 : idpath base2 == idpath base2.
Inductive susp (X : Type) : Type :=
| north : susp X
| south : susp X
| merid : X -> north == south.
This is the unpointed suspension. It is also possible to define the pointed suspension. Using either one, we can define the $n$-sphere by induction on $n$, since $S^{n+1}$ is the suspension of $S^n$.
The construction of mapping cylinders is given by
Inductive cyl {X Y : Type} (f : X -> Y) : Y -> Type :=
| cyl_base : forall y:Y, cyl f y
| cyl_top : forall x:X, cyl f (f x)
| cyl_seg : forall x:X, cyl_top x == cyl_base (f x).
Using this construction, one can define a (cofibration, trivial fibration) weak factorization system for types.
Inductive is_inhab (A : Type) : Type :=
| inhab : A -> is_inhab A
| inhab_path : forall (x y: is_inhab A), x == y.
This is the (-1)-truncation into h-propositions. One can prove that is_inhab A
is always a proposition (i.e. $(-1)$-truncated) and that it is the reflection of $A$ into propositions. More generally, one can construct the (effective epi, mono) factorization system by applying is_inhab
fiberwise to a fibration.
Similarly, we have the 0-truncation into h-sets:
Inductive pi0 (X:Type) : Type :=
| cpnt : X -> pi0 X
| pi0_axiomK : forall (l : Circle -> pi0 X), refl (l base) == map l loop.
We can similarly define $n$-truncation for any $n$, and we should be able to define it inductively for all $n$ at once as well.
See at n-truncation modality.
The (homotopy) pushout of $f \colon A\to B$ and $g\colon A\to C$:
Inductive hpushout {A B C : Type} (f : A -> B) (g : A -> C) : Type :=
| inl : B -> hpushout f g
| inr : C -> hpushout f g
| glue : forall (a : A), inl (f a) == inr (g a).
The quotient of a pure or Type-valued equivalence relation:
Inductive quotient (A : Type) (R : A -> A -> Type) : Type :=
| proj : A -> quotient A R
| relate : forall (x y : A), R x y -> proj x == proj y
This definition is translated into Coq from the Cubical Agda library.
The disjunction of two types $A$ and $B$, yielding an hProp:
Inductive disjunction (A B:Type) : Type :=
| inl : A -> disjunction A B
| inr : B -> disjunction A B.
| contr0 : forall (p q : disjunction A B) p == q
The existential quantifier of a type $A$ and a type family $B:A \to Type$, yielding an hProp:
Inductive existquant (A:Type) (B:A->Type) : Type :=
| exist : forall (x:A), B x -> existquant A B
| contr0 : forall (p q : existquant A B) p == q
The quotient of an hProp-value equivalence relation, yielding an hSet (a 0-truncated type):
Inductive quotient (A : Type) (R : A -> A -> hProp) : Type :=
| proj : A -> quotient A R
| relate : forall (x y : A), R x y -> proj x == proj y
| contr1 : forall (x y : quotient A R) (p q : x == y), p == q.
This is already interesting in extensional type theory, where quotient types are not always included. For more general homotopical quotients of “internal groupoids” as in the (∞,1)-Giraud theorem, we first need a good definition of what such an internal groupoid is.
A quotient inductive type is a higher inductive type that includes a “0-truncation” constructor such as contr1
for a set-quotient. Many of these are useful in set-based mathematics; in addition to colimits in Set, they can be used to construct free algebras and colimits of algebras of various sorts. Quotient inductive-inductive types are used to construct sets with propositional relations and various countable completions of structures. Examples can be found at quotient inductive type, including:
Since FinSet is the initial 2-rig, one should be able to construct it as a higher inductive type with a 1-truncation constructor.
According to Homotopy Type Theory – Univalent Foundations of Mathematics the Rezk completion? or stack completion? of a pregroupoid? to a groupoid is a higher inductive type and the 1-truncated analogue of the quotient set construction above.
… (translate into Coq)
A definition of the set of integers as a higher inductive type.
Inductive int : Type :=
| zero : int
| succ : int -> int
| pred1 : int -> int
| pred2 : int -> int
| sec : forall (x : int) pred1 succ x == x
| ret : forall (x : int) succ pred2 x == x
Suppose we are given a family of functions:
Hypothesis I : Type.
Hypothesis S T : I -> Type.
Hypothesis f : forall i, S i -> T i.
A type is said to be $I$-local if it sees each of these functions as an equivalence:
Definition is_local Z := forall i,
is_equiv (fun g : T i -> Z => g o f i).
The following HIT can be shown to be a reflection of all types into the local types, constructing the localization of the category of types at the given family of maps.
Inductive localize X :=
| to_local : X -> localize X
| local_extend : forall (i:I) (h : S i -> localize X),
T i -> localize X
| local_extension : forall (i:I) (h : S i -> localize X) (s : S i),
local_extend i h (f i s) == h s
| local_unextension : forall (i:I) (g : T i -> localize X) (t : T i),
local_extend i (g o f i) t == g t
| local_triangle : forall (i:I) (g : T i -> localize X) (s : S i),
local_unextension i g (f i s) == local_extension i (g o f i) s.
The first constructor gives a map from X
to localize X
, while the other four specify exactly that localize X
is local (by giving adjoint equivalence data to the map that we want to become an equivalence). See this blog post for details. This construction is also already interesting in extensional type theory.
A prespectrum is a sequence of pointed types $X_n$ with pointed maps $X_n \to \Omega X_{n+1}$:
Definition prespectrum :=
{X : nat -> Type &
{ pt : forall n, X n &
{ glue : forall n, X n -> pt (S n) == pt (S n) &
forall n, glue n (pt n) == idpath (pt (S n)) }}}.
A prespectrum is a spectrum if each of these maps is an equivalence.
Definition is_spectrum (X : prespectrum) : Type :=
forall n, is_equiv (pr1 (pr2 (pr2 X)) n).
In classical algebraic topology, there is a spectrification functor which is left adjoint to the inclusion of spectra in prespectra. For instance, this is how a suspension spectrum is constructed: by spectrifying the prespectrum $X_n \coloneqq \Sigma^n A$.
The following HIT should construct spectrification in homotopy type theory (though this has not yet been verified formally). (There are some abuses of notation below, which can be made precise using Coq typeclasses and implicit arguments.)
Inductive spectrify (X : prespectrum) : nat -> Type :=
| to_spectrify : forall n, X n -> spectrify X n
| spectrify_glue : forall n, spectrify X n ->
to_spectrify (S n) (pt (S n)) == to_spectrify (S n) (pt (S n))
| to_spectrify_is_prespectrum_map : forall n (x : X n),
spectrify_glue n (to_spectrify n x)
== loop_functor (to_spectrify (S n)) (glue n x)
| spectrify_glue_retraction : forall n
(p : to_spectrify (S n) (pt (S n)) == to_spectrify (S n) (pt (S n))),
spectrify X n
| spectrify_glue_retraction_is_retraction : forall n (sx : spectrify X n),
spectrify_glue_retraction n (spectrify_glue n sx) == sx
| spectrify_glue_section : forall n
(p : to_spectrify (S n) (pt (S n)) == to_spectrify (S n) (pt (S n))),
spectrify X n
| spectrify_glue_section_is_section : forall n
(p : to_spectrify (S n) (pt (S n)) == to_spectrify (S n) (pt (S n))),
spectrify_glue n (spectrify_glue_section n p) == p.
We can unravel this as follows, using more traditional notation. Let $L X$ denote the spectrification being constructed. The first constructor says that each $(L X)_n$ comes with a map from $X_n$, called $\ell_n$ say (denoted to_spectrify n
above). This induces a basepoint in each type $(L X)_n$, namely the image $\ell_n(*)$ of the basepoint of $X_n$. The many occurrences of
to_spectrify (S n) (pt (S n)) == to_spectrify (S n) (pt (S n))
simply refer to the based loop space of $\Omega_{\ell_{n+1}(*)} (L X)_{n+1}$ of $(L X)_{n+1}$ at this base point.
Thus, the second constructor spectrify_glue
gives the structure maps $(L X)_n \to \Omega (L X)_{n+1}$ to make $L X$ into a prespectrum. Similarly, the third constructor says that the maps $\ell_n\colon X_n \to (L X)_n$ commute with the structure maps up to a specified homotopy.
Since the basepoints of the types $(L X)_n$ are induced from those of each $X_n$, this automatically implies that the maps $(L X)_n \to \Omega (L X)_{n+1}$ are pointed maps (up to a specified homotopy) and that the $\ell_n$ commute with these pointings (up to a specified homotopy). This makes $\ell$ into a map of prespectra.
Finally, the fourth through seventh constructors say that $L X$ is a spectrum, by giving h-isomorphism data: a retraction and a section for each glue map $(L X)_n \to \Omega (L X)_{n+1}$. We could use adjoint equivalence data as we did for localization, but this approach avoids the presence of level-3 path constructors. (We could have used h-iso data in localization too, thereby avoiding even level-2 constructors there.) It is important, in general, to use a sort of equivalence data which forms an h-prop; otherwise we would be adding structure rather than merely the property of such-and-such map being an equivalence.
See (Lumsdaine-Shulman17).
higher inductive type, initial algebra of a presentable ∞-monad
Expositions include
Mike Shulman, Homotopy type theory IV (blog entry)
Peter LeFanu Lumsdaine, Higher inductive types, a tour of the menageries (blog post)
Peter LeFanu Lumsdaine, Higher Inductive Types: The circle and friends, axiomatically (pdf)
Details of the semantics are in
with precursors in
Mike Shulman, Peter LeFanu Lumsdaine, Semantics of higher inductive types, 2012 (pdf)
Mike Shulman, Peter LeFanu Lumsdaine, Semantics and syntax of higher inductive types, 2016, (slides)
Discussion of a subset of the HITs is in:
Kristina Sojakova, Higher Inductive Types as Homotopy-Initial Algebras
Steve Awodey, Nicola Gambino, Kristina Sojakova, Homotopy-initial algebras in type theory (arXiv:1504.05531)
Michael Rathjen, Homotopical Inductive Types on higher inductive types
Implementation in Agda/Coq is discussed in
Guillaume Brunerie, Implementation of higher inductive types in HoTT-Agda, 2016, github
Bruno Barras, Native implementation of Higher Inductive Types (HITs) in Coq PDF