The type theory


This brief exposé lays the foundations for studying homotopy type theory; the concepts from here will re-appear in HoTT/2, with fresh interpretations. It corresponds exactly to Ch.1 of the HoTT book.

To specify a new type in HoTT, we need to specify four different rules: formation, introduction, elimintion, computation (FIEC).

  1. How to form a new type of this kind. For example
  2. How to construct elements of this kind. For example, a function type has one constructor: .
  3. How to use elements of this type. These are called eliminators or elimination rules. For instance, a function type has one eliminator, namely function application.
  4. How the eliminator acts on the constructor. For example, is judgementally equal to the expanded function .
  5. An optional uniqueness principle which expresses uniqueness into or out of the type. Every element of the type is uniquely determined by results of applying type eliminators to it. It is often a provable propositional equality: in this case, we call it propositional uniqueness principle.

Broadly speaking, there are two kinds of types: (which turns out to be a degenerate case of an inductive type, which we will see later) and .

The dependent product type (-type)

Instead of defining projections and for the two projections from the pair, we will define a "recursor" as follows:

So that:

In order to be able to write dependent functions over the product type, we can define function by providing with the defining equation .

To prove a property for all elements of a prduct, it is enough to prove it for its canonical elements (the ordered pairs). In the universal case, we call the resulting function induction for product types:

with the defining equation:

Because induction describes how to use an element of the product type, induction is often called the dependent eliminator; recursion is called the non-dependent eliminator.

Comment: the induction for the unit type turns out to be more useful than the recursor:

The dependent pair type (-type)

The dependent pair type is written . When the second component doesn't depend on the first, we get the cartesian product type . The first projection follows a straightforward extraction:

However, the second projection must be a dependent function, whose type involves the first projection function:

Thus, we need the induction principle for -types (the dependent eliminator):

We can then derive a function:

In order to package up the recursion and induction principles into a recursor for , which we will not bother elaborating here. As usual, the recursor is the special case of induction when the family is fixed.

Now, we present the type-theoretic axiom of choice where :

In English, this reads: if , there is a such that , then such that , we have . We will provide a more familar axiom of choice later.

Let's also provide an example of the magma type, in which the second component depends on the first component:

Interlude: Coproduct types and booleans

The recursor for coproduct types can be written as:

The if-then-else pattern in general programming practice utilizes booleans as follows:


and primitive recursion

To define infinite types like , we need the additional concept of well-founded recursion. We can package the recursor into a single function, as previously:

Given step 0, and a next-step function, we can define:

We can generalize general recursion to dependent functions as follows:

with these defining equations:

Identity types

The cornerstone of homotopy type theory is that there can be more than one witness that two objects are equal. These correspond to paths or equivalences in the given space.

The identity family takes two copies of , and illustrates an equality between them: . The formation rule says that given a type and two elements , we can form the type in the same universe. The introduction rule is a dependent function called reflexivity:

The elimination rule for identity types is subtle. We begin by considering the consequence that equals may be substituted for equals, called indiscrenability of identicals. For every family , there is a function

such that:

Path induction

The induction principle for the identity type is called path induction. It can be seen as stating that the family of identity types is freely generated by elements of the form .

Given functions:

There is a function:

such that

We can conclude that is a reflexive relation that holds whenever .

If we package up path induction into a single function, it takes the form:

with the equality, traditionally called :

Indiscrenability of identicals is an instance of path induction, as we will show later.

By fixing a certain , we can show based path induction, a simpler version:

Since every path is of the form , if we prove a property for reflexivity paths, then we have provided it for all paths.

Now, we must resolve a question: how can there be many different elements of the identity type (different paths), but also have an induction principle asserting that the only path is reflexivity? It is not that the identity type that is inductively defined; rather, it is the inductive family. In particular, path induction says that the family of types , as and vary over all elements of , inductively defined by the elements of the form . This means that to give an element of any other family, it suffices to consider the cases of the form dependent on a generic element of the identity family, it suffices to consider the cases of the form .

In the homotopy interpretation, type of triples , where are endpoints of the path (in other words, ), is inductively generated by the constant loops at each point . We will consequently see that that the space corresponding to is a free path space. To conclude, can be regarded as the type of all elements of which are equal to .