Martin-Löf Type Theory

1. Type Theory as a Foundation

Source: this video.
Unlike classical mathematics, which is typically built on top of first-order logic and axiomatic set theory (such as ZFC), Martin-Löf Type Theory is a foundational system that stands entirely on its own.


2. Basic Concepts and Notations

Types and Elements

We write A type to declare that A is a type (or a "space"). If t is a construction of type A, we write:

t:A

This states that t is an element (or a point) of A.
Unlike set theory—where an element can exist independently of any set and we later test the proposition xS—in type theory, an element always belongs to a specific type by definition. All the terms of a type share a pre-defined "structured". The statement t:A is a "judgment", not a proposition.

Contexts and Dependency

MLTT is a dependent type theory, meaning that types and points can depend on other points. We collect our assumptions and free variables in a context (traditionally denoted by the Greek letter Γ).
A dependent type is written as:

x1:A1,x2:A2(x1),,xn:An(x1,,xn1)B(x1,,xn) type

Examples of Dependency in Standard Mathematics:

  1. The space of real vectors Rn depends on a natural number n. In type theory, this is expressed under the context of n:n:NRn type
  2. The closed interval [a,b] depends on the real endpoints a and b, as well as proof/evidence p that ab:a:R,b:R,p:(ab)[a,b] type

Judgemental Equality ()

We establish when two constructions or types are definitionally identical using judgemental equality:

Judgemental equality is checked purely by the computational rules of the system (we will see later).


3. The Geometric Picture: Fibrations and Sections

To visualize dependency, we use the language of fiber bundles (fibrations) [1, 2]:

      Total Space: Σ (x:A). B(x)
       +-----------------------+
       |       / \  <-- Fiber B(x)
       |      |   |            |
       |      |   |            |  
       |       \ /             |
       +--------|-------|-------+
                | Projection
                v
       Base Space A:
       ---------x-------y------->

4. Core Type Constructions

Every type constructor in MLTT is defined by four sets of rules: formation (how to build the type), introduction (how to build elements of the type), elimination (how to use/destruct elements), and computation/uniqueness (how the introduction and elimination rules interact).

A. The Dependent Sum (Σ-Type)

The dependent sum is denoted as:

Σ(x:A).B(x)

Special Case: Binary Product (A×B)

If the fiber B does not actually vary with x (i.e., B is a constant space independent of A), the dependent sum simplifies to the ordinary cartesian product A×B.


B. The Dependent Product (Π-Type)

The dependent product is denoted as:

Π(x:A).B(x)

Special Case: Function Space (AB)

If B is constant and independent of A, the dependent product simplifies to the ordinary function space AB.


C. The Natural Numbers (N)

The natural numbers are defined as an inductive type:

Note: I didn't understand this yet.


D. Finite Types

The Empty Type (0)

The Unit Type (1)

The Booleans (2)


E. Universes (U)

To talk about types as mathematical objects themselves, we introduce a Universe U, which is a "type of types". Its elements are types:

A:UA type

5. Type Theory as a Formal System

To define MLTT rigorously as a formal system, we specify it using hypothetical judgments (judgments made under a context Γ, which acts as a set of available hypotheses) and rules of inference.

1. The Four Judgement Forms

The system is built on exactly four types of judgments:

  1. Type Validity:ΓA typeMeaning: Under context Γ, A is a well-formed type.
  2. Term Membership:Γt:AMeaning: Under context Γ, t is a valid construction (element) of type A.
  3. Type Equality:ΓABMeaning: Under context Γ, types A and B are definitionally (judgementally) equal.
  4. Term Equality:ΓsAtMeaning: Under context Γ, s and t are definitionally (judgementally) equal elements of type A.

2. Rules of Inference

The transitions between these judgments are defined using formal rules of inference, which are written in a fraction-like notation:

P1P2PnC

Example:
The Dependent Product (Π-Type) is "made" of 4 inference rules

  1. Formation Rule (The Box Exists)
ΓA typeΓ,x:AB(x) typeΓΠ(x:A).B(x) type
  1. Introduction Rule (What the "Points" Look Like)
    This rule tells you exactly what kind of objects are allowed to live inside this new space. It says: "If you can construct a term e of type B(x) under the assumption that x:A, then you can wrap it in a λ to make a point in the Π-space."
Γ,x:Ae:B(x)Γ(λx:A.,e):Π(x:A).B(x)

Now we know the points in this space are functions (or paths/sections).

  1. Elimination Rule (How to Use the Points)
    This rule tells you how to interact with an object from this space. It says: "If you have a point f in the Π-space, and you have a point t in the base space A, you are allowed to combine them via application (ft) to land in the vertical fiber B(t)."
Γf:Π(x:A).B(x)Γt:AΓf,t:B(t)

Now we know these functions can be evaluated on inputs.

  1. Computation Rule (How the Points Move / Interact)
    This final rule locks in the actual mechanical behavior. It bridges the Introduction rule (how we made the function) and the Elimination rule (how we used it) using Judgemental Equality (). It says: "If you build a function using λ and immediately evaluate it using an input t, that is definitionally identical to just substituting t into the original expression."
Γ,x:Ae:B(x)Γt:AΓ(λx:A.,e),tB(t)e[x:=t]

Example: how would this formal system machine begin?

Step The Literal String (Judgment) Rule Used Geometric Translation / Meaning
1 U0:U1 Universe Axiom "The space of all basic spaces (U0) is itself a point inside a higher meta-space (U1)."
2 (U0U0):U1 Π-Formation Rule applied to Step 1 "The space of all continuous paths mapping spaces to spaces is a valid space in our meta-universe."
3 (λ(X:U0).X):U0U0 λ-Abstraction Rule "The identity path (which takes any space X and maps it to itself) is a valid point inside the space of paths we defined in Step 2."