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).

- How to form a new type of this kind. For example $\Pi_{(x : A)} B(x)$
- How to construct elements of this kind. For example, a function type has one constructor: $f(x) :\equiv 2x$.
- 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.
- How the eliminator acts on the constructor. For example, $(\lambda x . \phi)(a)$ is judgementally equal to the expanded function $\lambda f . f(x)$.
- 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: $\Pi$ (which turns out to be a degenerate case of an inductive type, which we will see later) and $\Sigma$.

## The dependent product type ($\Pi$-type)

Instead of defining projections $pr1$ and $pr2$ 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 $f : \Pi_{x : A \times B} C(x)$ by providing $g : \Pi_{x : A} \Pi_{x : B} C((x, y))$ with the defining equation $f((x, y)) = g(x)(y)$.

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 ($\Sigma$-type)

The dependent pair type is written $\Sigma_{x : A}, B(x)$. When the second component doesn't depend on the first, we get the cartesian product type $A \times B$. 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 $\Sigma$-types (the dependent eliminator):

We can then derive a function:

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

Now, we present the type-theoretic axiom of choice where $R : A \rightarrow B \rightarrow U$:

In English, this reads: if $\forall x : A$, there is a $y : B$ such that $R(x, y)$, then $\exists f : A \rightarrow B$ such that $\forall x : A$, we have $R(x, f(x))$. 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:

## $\mathbb{N}$ and primitive recursion

To define infinite types like $\mathbb{N}$, 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 $A$, and illustrates an equality between them: $id_A : A \rightarrow A \rightarrow \mathscr{U}$. The formation rule says that given a type $A : \mathscr{U}$ and two elements $a, b : A$, we can form the type $(a =_A b) : \mathscr{U}$ 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 $C : A \rightarrow \mathscr{U}$, 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 $\texttt{refl}_x : x = x$.

Given functions:

There is a function:

such that

We can conclude that $C(x, y)$ is a reflexive relation that holds whenever $x = y$.

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

with the equality, traditionally called $J$:

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

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

Since every path is of the form $\texttt{refl}_a$, 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 $x =_A y$, as $x$ and $y$ vary over all elements of $A$, inductively defined by the elements of the form $\texttt{refl}_x$. This means that to give an element of any other family, it suffices to consider the cases of the form $(x, y, p)$ dependent on a generic element $(x, y, p)$ of the identity family, it suffices to consider the cases of the form $(x, x, \texttt{refl}_x)$.

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