Homotopy Type Theory notes

Table of Contents

Notes taken by me and from the HTT book. It's not complete and it'll never be. I currently don't understand more than 55% of the book

1. Type Theory

1.1. Elementary concepts

Notation Definiton
\(a: A\) a is an object of type A
\(a \equiv b : a\) a and b are definitionally equal elements of type A
\(\U_i\) Universe
\(\U_0 : \U_1 :\dots : \U_n\) Hierarchy of universes
\(\Phi \simeq \Psi\) Equivalence; \(\Phi\) and \(\Psi\) are equivalent

1.2. Basic types

Type Notation
Function \(f: A \fun B\)
Dependent function \(g: \Pi_{(x:A)}B(x)\)
Product \((a,b) : A \times B\)
Dependent product \((p,q) : \Sigma_{(x:A)}B(x)\)
Coproduct \(A+B\)

1.2.1. Useful definitons

Notation Definiton
\(B: A \fun \U\) B is called a family of types
\(\Unit : \U\) Unit type; type with one inhabitant
\(\Empty : \U\) Empty type; type with no inhabitants
\(\star : \Unit\) The only element of \(\Unit\)

1.3. Function types

It's a primitive type, unlike set theory. You can apply a function \(f:A \fun B\) on an element \(a: A\) to get an element \(b: B\). They can be constructed both by direct definition and \(\lambda -\) abstraction

1.3.1. Uniqueness principle

Let \(f: A\fun B\) and \(\Phi : B\) (the "function body"), then \[f(x) :\equiv \Phi \equiv f :\equiv\lambda x.\Phi \]

1.4. Dependent function types

Given a type \(A: \U\) and a family of types \(B: A \fun\U\), the type of dependent functions may be constructed \[\Pi_{(x:A)}B(x)\] If B is a constant family this becomes the ordinary function type \[\Pi_{(x:A)}B \equiv A \fun B\]

We may apply a dependent function \(f : \Pi_{(x:A)}B(x)\) to an argument \(a: A\) to obtain an element \(f(a) : B(a)\).

1.4.1. Uniqueness principle

The uniqueness principle is analogue to the not dependent function type, with the difference that \(\Phi : B(x)\) possibly involves the variable \(x: A\).

1.4.2. Polymorphic functions

A polymorphic function is one that takes a type as one of its arguments and then acts on elements of that type. Examples are:

  1. The identity function :: \(id \Pi_{(A: \U)} A \fun A\) such that \(id(A,x) :\equiv x\). It's also written as \(id_A(x)\).
  2. The \(swap\) function :: \(swap : \Pi_{(A:\U)}\Pi_{(B:\U)}\Pi_{(C:\U)} \left( A \fun B \fun C\right) \fun \left( B \fun A \fun C\right)\) such that \(swap(A,B,C,g) :\equiv \lambda a.\lambda b.g(b)(a)\), also written as \(swap_{A,B,C}(g)(a,b) :\equiv g(b,a)\).

If a multiparameter dependent function consists of independent elements of the same type, one may also write them in a condensed form. In the example of the \(swap\) function, one may write \(\Pi_{(A,B,C:\U)}\) since \(A,B,C\) do not depend on eachother.

1.5. Product types

Informally, this is the type of pairs. In type theory this is a primitive concept, unlike set theory. It comes with two functions called projections: \[pr_1(a,b) :\equiv a\] \[pr_2(a,b) :\equiv b\]

1.5.1. Currying

Given \((a,b): A\times B\) and \(g: A \fun B \fun C\) one can always define a function \(f : A \fun B \fun C\) such that \[f((a,b)) :\equiv g(a)(b)\]

1.5.2. Recursion principle and projections

You can define a function called recursor for product types \[rec_{A\times B}:\left(A \fun B \fun C \right) \fun A \times B \fun C\] such function can be used to define the two projections \[pr_1 :\equiv rec_{A\times B}(A, \lambda a.\lambda b. a)\] \[pr_2 :\equiv rec_{A\times B}(B, \lambda a.\lambda b. b)\] On the contrary, one could define the recursor from the two projections

1.5.3. TODO Uniqueness principle

1.6. TODO Dependent product types

1.7. TODO Coproduct types

1.8. TODO \(\Bool\), the type of booleans

1.9. How to study a type in Type theory

1.9.1. How to define a new type

In order to introduce a new type, one needs to provide the following:

Formation rules
How to form the new types;
Construction rules
How to form elements of the new type; these are called constructors or intrduction rules;
Elimination rules (or eliminators)
How to use elements of that type;
Computation rule
How an eliminator acts on a constructor;
(Optional) Uniqueness principle
It may be proved from the rules above, thus it's optional. Expresses uniqueness of maps from or to that type:
Maps "going into" the type
Every element of the type is uniquely determined by the results when applying eliminators to it; moreover every element can be reconstructed from the results by applying a constructor. Essentially, there's a constructor-eliminator duality.
Maps "going out from" the type
Every function (map) from that type is uniquely determined by some data.
  1. Table for basic types
    Type Formation Construction Elimination Computation Uniqueness?
    \(A \fun B\) \(A:\U,B:\U\) \(f:\equiv\lambda x.\Phi\) Function application \(f(a)\) is "substituting every free variable with \(a\)" Defined
    \(A \times B\) \(A:\U,B:\U\) \((,): A\fun B\fun A\times B\) \(A\times B \fun C :\equiv A\fun B\fun C\) Currying: \(f((a,b)) :\equiv g(a)(b)\) Proven
    \(\Pi_{(x:A)}B(x)\) \(x:A,A:\U,B(x):A\) \(g:\equiv\lambda x.\Psi\) Function application \(g(a)\) is "substituting every free variable with \(a\)" Defined

1.9.2. Objects of interest

Uniqueness principle (if not defined)
how can I find which elements of a type are definitionally equal to eachother?
Recursor (or non-dependent eliminator)
a function that satisfies the recursion principle; special case of the induction principle
Induction (dependent eliminator)
a function that satisfies the induction principle, an "iteration of the elements of the type"