Context
Type theory
Foundations
foundations
The basis of it all
-
mathematical logic
-
deduction system, natural deduction, sequent calculus, lambda-calculus, judgment
-
type theory, simple type theory, dependent type theory
-
collection, object, type, term, set, element
-
equality, judgmental equality, typal equality
-
universe, size issues
-
higher-order logic
Set theory
Foundational axioms
Removing axioms
Contents
Idea
Book HoTT is the dependent type theory which appears in the HoTT book. It is notable in that, unlike most other dependent type theories which have been formally written in natural deduction, it does not have a separate type judgment. Instead, it only has term judgments, and an infinite sequence of Russell universes indexed by a natural numbers primitive. Types are represented by terms of a Russell universe.
However, when formally defining the natural numbers primitive, in order to ensure that the dependent type theory does not have a separate type judgment, one has to define the natural numbers primitive in a separate layer, meaning that formal book HoTT is a layered type theory. There are many different ways to define the layer containing the natural numbers primitive:
The presentation of formal book HoTT we have chosen is a two-layered type theory. The first level consists of a basic objective type theory consisting only of type judgments, term judgments, identity types, and a natural numbers type. The second level is the homotopy type theory, and contains term judgments and judgmental equality of terms, Russell universes, and all the other type formers in homotopy type theory. To distinguish between the two layers, we shall call the types in the first layer “metatypes”, as the first layer behaves as a metatheory or external theory.
First layer
Judgments and contexts
We begin with the formal rules of the first layer. The first layer consists of three judgments: metatype judgments , where we judge to be a metatype, metatyping judgments, where we judge to be an element of , , and metacontext judgments, where we judge to be a metacontext, . Metacontexts are lists of metatyping judgments , , , et cetera, and are formalized by the rules for the empty metacontext and extending the metacontext by a metatyping judgment
Structural rules
The three standard structural rules, the variable rule, the weakening rule, and the substitution rule, are also included in the theory. Let be any arbitrary judgment. Then we have the following rules:
In addition, there are identity metatypes: the natural deduction rules for identity metatypes are as follows
Natural numbers primitive
Finally, we have the natural numbers primitive, given by the following natural deduction rules:
Second layer
Judgments, contexts, and Russell universes
Now, we introduce the second layer, which consists of a dependent type theory with two judgments, the typing judgment , which says that is a term of the type , and judgmental equality , which says that and are judgmentally equal terms of the type . Instead of type judgments, we introduce a special kind of type called a Russell universe, whose terms are the types themselves. We also assume cumulativity for the Russell universes. Russell universes are formalized with the following rules:
Contexts are defined as a metacontext with a list of typing judgments, with the metacontext always preceding the list of typing judgments:
The general rules for Russell universes then follows:
In addition, if there is a term of a type , then the type is a term of some Russell universe .
Structural rules
There are three structural rules in dependent type theory, the variable rule, the weakening rule, and the substitution rule.
The variable rule states that we may derive a typing judgment if the typing judgment is in the context already:
Let be any arbitrary judgment. Then we have the following rules:
The weakening rule:
The substitution rule:
The weakening and substitution rules are admissible rules: they do not need to be explicitly included in the type theory as they could be proven by induction on the structure of all possible derivations.
Structural rules for judgmental equality
Judgmental equality has its own structural rules: introduction rules for judgmentally equal terms, reflexivity, symmetry, transitivity, the principle of substitution, and the variable conversion rule.
-
Introduction rules for judgmentally equal terms
-
Reflexivity of judgmental equality
-
Symmetry of judgmental equality
-
Transitivity of judgmental equality
-
Principle of substitution:
-
Variable conversion rule:
Dependent product types
- Formation rules for dependent product types:
- Introduction rules for dependent product types:
- Elimination rules for dependent product types:
- Computation rules for dependent product types:
- Uniqueness rules for dependent product types:
Dependent sum types
- Formation rules for dependent sum types:
- Introduction rules for dependent sum types:
- Elimination rules for dependent sum types:
- Computation rules for dependent sum types:
- Uniqueness rules for dependent sum types:
Sum types
- Formation rules for sum types:
- Introduction rules for sum types:
- Elimination rules for sum types:
- Computation rules for sum types:
Empty type
- Formation rules for the empty type:
- Elimination rules for the empty type:
Unit type
- Formation rules for the unit type:
- Introduction rules for the unit type:
- Elimination rules for the unit type:
- Computation rules for the unit type:
Natural numbers
-
Formation rules for the natural numbers:
-
Introduction rules for the natural numbers:
-
Elimination rules for the natural numbers:
-
Computation rules for the natural numbers:
Identity types
There is another version of equality in book HoTT, called typal equality. Typal equality is represented by the identity type.
-
Formation rule for identity types:
-
Introduction rule for identity types:
-
Elimination rule for identity types:
-
Computation rules for identity types:
Univalence
Given types and , a function is an equivalence of types if the fiber of at each element of has exactly one element. The property of the type having exactly one element is represented by the isContr modality which states that the type is contractible. The fiber of at an element is given by the type
We formally define the property of being a one-to-one correspondence or an equivalence of types as the type:
We define the type of equivalences from to as
There is a function
which is inductively defined on reflexivity to be the identity function on
The univalence axiom then states that is an equivalence for all external natural numbers and types and :
See also
References