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.
- Self-Contained: It does not assume or rely on any pre-existing logic, set theory, or category theory. Instead, logic and mathematics are derived directly from the rules of type theory.
- A Theory of Constructions: Rather than focusing on "what is the case" (the domain of traditional logic), type theory defines how mathematical objects are built (constructed) and manipulated (taken apart and reassembled).
- The Geometric Interpretation: We could translate the structural elements of type theory into geometric language:
- A Type corresponds to a Space.
- An Element of a type corresponds to a Point in that space.
- Proofs are treated as constructions (for example, a formal proof of a statement is represented as a tree-like deduction construction).
2. Basic Concepts and Notations
Types and Elements
We write
This states that
Unlike set theory—where an element can exist independently of any set and we later test the 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:
Examples of Dependency in Standard Mathematics:
- The space of real vectors
depends on a natural number . In type theory, this is expressed under the context of : - The closed interval
depends on the real endpoints and , as well as proof/evidence that :
Judgemental Equality ( )
We establish when two constructions or types are definitionally identical using judgemental equality:
(judgementally equal types) (judgementally equal points in )
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------->
- The Base Space: The type
sits "downstairs" as the base space. - The Fiber: For each point
, there is a space sitting vertically above it. We call the fiber over . - The Total Space: If we collect all the fibers
together over the entire base , we obtain a larger space known as the total space (representing the dependent sum, ). There is a natural projection map from this total space back down to . - The Section: A dependent element
is a rule that assigns to each point a point in the fiber . Geometrically, this traces out a continuous curve cutting across the fibers, known as a section of the family over .
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:
- Geometric Meaning: The total space of the family
over . - Elements: Ordered pairs
where and . - Operations (Eliminators): Projections
and , which split a pair into its constituent parts: - Equations:
- Computation (
-rules): Extracting components from a constructed pair: - Uniqueness (
-rule): Assuring every element in the sum is structurally a pair:
- Computation (
Special Case: Binary Product ( )
If the fiber
- Why "Sum"? If the base space
consists of discrete points , the dependent sum is the disjoint union (the sum of the elements) of the fibers: .
B. The Dependent Product ( -Type)
The dependent product is denoted as:
- Geometric Meaning: The space of all sections of the family
over . - Elements: Functions. We construct them using "lambda abstraction notation":
Where is an expression that may contain the variable . - Operations (Eliminators): Application. If we have a function
and a point , we can apply to to obtain a point in the fiber: This could be written as - Equations:
- Computation (
-rule / Substitution): Applying a lambda abstraction substitutes the argument into the expression: - Uniqueness (
-rule): Every element of a -type behaves as a function: - Extensionality Rule: Two functions are judgementally equal if they yield equal results for all inputs:
- Computation (
Special Case: Function Space ( )
If
- Why "Product"? For a discrete base
, a section must choose one element from , one from , and one from . The number of possible sections is the product of the sizes of the fibers: . If the fibers are of equal size, this yields exponentiation .
C. The Natural Numbers ( )
The natural numbers are defined as an inductive type:
- Constructors (Introduction):
- The Induction Principle (Eliminator): To use or prove properties over
, we are given an induction term. Given a type family over (i.e., ), the induction operator is a function of the type: - Computation Equations:
- Base Case: Applying induction to
yields the base step : - Inductive Step: Applying induction to a successor
recursively computes the step:
- Base Case: Applying induction to
Note: I didn't understand this yet.
D. Finite Types
The Empty Type ( )
- Elements: None.
- Eliminator (Ex Falso Quodlibet): If we are given an element of the empty type, we can construct an element of any other type
:
The Unit Type ( )
- Elements: A single element, denoted by
or : - Uniqueness Equation: Any two elements of the unit type are judgementally equal:
The Booleans ( )
- Elements:
trueandfalse. - Eliminator: Conditionals (if-then-else) represented by case analysis:
E. Universes ( )
To talk about types as mathematical objects themselves, we introduce a Universe
- Avoiding Paradoxes: Having a single universe contain itself (
) leads to Girard's Paradox (the type-theoretic equivalent of Russell’s Paradox). To avoid this, MLTT uses a predicative hierarchy of universes: - Cumulativity: Universes are cumulative. If a type is small enough to fit in
, it also belongs to any larger universe: - Closure: Each universe is closed under all the basic type-forming operations (such as
-types, -types, finite types, and natural numbers). - Representing Type Families: Using universes, we can formally represent a dependent type
over simply as an ordinary function mapping to the universe:
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
1. The Four Judgement Forms
The system is built on exactly four types of judgments:
- Type Validity:
Meaning: Under context , is a well-formed type. - Term Membership:
Meaning: Under context , is a valid construction (element) of type . - Type Equality:
Meaning: Under context , types and are definitionally (judgementally) equal. - Term Equality:
Meaning: Under context , and are definitionally (judgementally) equal elements of type .
2. Rules of Inference
The transitions between these judgments are defined using formal rules of inference, which are written in a fraction-like notation:
- Premises (
): The judgments above the line that must already be derived. - Conclusion (
): The new judgment below the line that we are permitted to derive once the premises are established.
Example:
The Dependent Product (
- Formation Rule (The Box Exists)
- 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 termof type under the assumption that , then you can wrap it in a to make a point in the -space."
Now we know the points in this space are functions (or paths/sections).
- 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 pointin the -space, and you have a point in the base space , you are allowed to combine them via application ( ) to land in the vertical fiber ."
Now we know these functions can be evaluated on inputs.
- 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 , that is definitionally identical to just substituting into the original expression."
Example: how would this formal system machine begin?
| Step | The Literal String (Judgment) | Rule Used | Geometric Translation / Meaning |
|---|---|---|---|
| 1 | Universe Axiom | "The space of all basic spaces ( |
|
| 2 | "The space of all continuous paths mapping spaces to spaces is a valid space in our meta-universe." | ||
| 3 | "The identity path (which takes any space |