nLab book HoTT

Context

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Foundations

foundations

The basis of it all

 Set theory

set theory

Foundational axioms

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:

Formal presentation

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 AmetatypeA \; \mathrm{metatype}, where we judge AA to be a metatype, metatyping judgments, where we judge aa to be an element of AA, aAa \in A, and metacontext judgments, where we judge Ξ\Xi to be a metacontext, Ξmetactx\Xi \; \mathrm{metactx}. Metacontexts are lists of metatyping judgments aAa \in A, bBb \in B, cCc \in C, et cetera, and are formalized by the rules for the empty metacontext and extending the metacontext by a metatyping judgment

()metactxΞmetactxΞAmetatype(Ξ,aA)metactx\frac{}{() \; \mathrm{metactx}} \qquad \frac{\Xi \; \mathrm{metactx} \quad \Xi \vdash A \; \mathrm{metatype}}{(\Xi, a \in A) \; \mathrm{metactx}}

Structural rules

The three standard structural rules, the variable rule, the weakening rule, and the substitution rule, are also included in the theory. Let 𝒥\mathcal{J} be any arbitrary judgment. Then we have the following rules:

  • The variable rule:
Ξ,aA,ΩmetactxΞ,aA,ΩaA\frac{\Xi, a \in A, \Omega \; \mathrm{metactx}}{\vdash \Xi, a \in A, \Omega \vdash a \in A}
  • The weakening rule:
Ξ,Ω𝒥ΞAmetatypeΞ,aA,Ω𝒥\frac{\Xi, \Omega \vdash \mathcal{J} \quad \Xi \vdash A \; \mathrm{metatype}}{\Xi, a \in A, \Omega \vdash \mathcal{J}}
  • The substitution rule:
ΞaAΞ,bA,Ω𝒥Ξ,Ω[a/b]𝒥[a/b]\frac{\Xi \vdash a \in A \quad \Xi, b \in A, \Omega \vdash \mathcal{J}}{\Xi, \Omega[a/b] \vdash \mathcal{J}[a/b]}

Identity metatypes

In addition, there are identity metatypes: the natural deduction rules for identity metatypes are as follows

ΞAmetatypeΞ,aA,bAa= AbmetatypeΞAmetatypeΞ,aArefl A(a)a= Aa\frac{\Xi \vdash A \; \mathrm{metatype}}{\Xi, a \in A, b \in A \vdash a =_A b \; \mathrm{metatype}} \qquad \frac{\Xi \vdash A \; \mathrm{metatype}}{\Xi, a \in A \vdash \mathrm{refl}_A(a) \in a =_A a}
Ξ,xA,yA,px= AyCmetatypeΞ,zAtC[z/x,z/y,refl A(z)/p]ΞaAΞbAΞqa= AbΞJ(x.y.p.C,z.t,x,y,p)C[a/x,b/y,q/p]\frac{\Xi, x \in A, y \in A, p \in x =_A y \vdash C \; \mathrm{metatype} \quad \Xi, z \in A \vdash t \in C[z/x, z/y, \mathrm{refl}_A(z)/p] \quad \Xi \vdash a \in A \quad \Xi \vdash b \in A \quad \Xi \vdash q \in a =_A b}{\Xi \vdash J(x.y.p.C, z.t, x, y, p) \in C[a/x, b/y, q/p]}
Ξ,xA,yA,px= AyCmetatypeΞ,zAt:C[z/x,z/y,refl A(z)/p]Ξa:AΞβ = A(a)J(x.y.p.C,z.t,a,a,refl A(a))= C[a/x,a/y,refl A(a)/p]t[a/z]\frac{\Xi, x \in A, y \in A, p \in x =_A y \vdash C \; \mathrm{metatype} \quad \Xi, z \in A \vdash t:C[z/x, z/y, \mathrm{refl}_A(z)/p] \quad \Xi \vdash a:A}{\Xi \vdash \beta_{=_A}(a) \in J(x.y.p.C, z.t, a, a, \mathrm{refl}_A(a)) =_{C[a/x, a/y, \mathrm{refl}_A(a)/p]} t[a/z]}

Natural numbers primitive

Finally, we have the natural numbers primitive, given by the following natural deduction rules:

ΞmetactxΞ𝒩metatypeΞmetactxΞ0 𝒩𝒩Ξn𝒩Ξs 𝒩(n)𝒩\frac{\Xi \; \mathrm{metactx}}{\Xi \vdash \mathcal{N} \; \mathrm{metatype}} \qquad \frac{\Xi \; \mathrm{metactx}}{\Xi \vdash 0_{\mathcal{N}} \in \mathcal{N}} \qquad \frac{\Xi \vdash n \in \mathcal{N}}{\Xi \vdash s_\mathcal{N}(n) \in \mathcal{N}}
Ξ,x𝒩CmetatypeΞc 0 𝒩C[0 𝒩/x]Ξ,x𝒩,cCc s 𝒩C[s 𝒩(x)/x]ΞnΓind 𝒩 C(n,c 0 𝒩,c s 𝒩)C[n/x]\frac{\Xi, x \in \mathcal{N} \vdash C \; \mathrm{metatype} \quad \Xi \vdash c_{0_\mathcal{N}} \in C[0_\mathcal{N}/x] \quad \Xi, x \in \mathcal{N}, c \in C \vdash c_{s_\mathcal{N}} \in C[s_\mathcal{N}(x)/x] \quad \Xi \vdash n \in \mathbb{N}}{\Gamma \vdash \mathrm{ind}_\mathcal{N}^C(n, c_{0_\mathcal{N}}, c_{s_\mathcal{N}}) \in C[n/x]}
Ξ,x𝒩CmetatypeΞc 0 𝒩C[0 𝒩/x]Ξ,x𝒩,cCc s 𝒩C[s 𝒩(x)/x]Ξβ 𝒩 0 𝒩ind 𝒩 C(0 𝒩,c 0 𝒩,c s 𝒩)= C[0 𝒩/x]c 0 𝒩\frac{\Xi, x \in \mathcal{N} \vdash C \; \mathrm{metatype} \quad \Xi \vdash c_{0_\mathcal{N}} \in C[0_\mathcal{N}/x] \quad \Xi, x \in \mathcal{N}, c \in C \vdash c_{s_\mathcal{N}} \in C[s_\mathcal{N}(x)/x]}{\Xi \vdash \beta_\mathcal{N}^{0_\mathcal{N}} \in \mathrm{ind}_\mathcal{N}^C(0_\mathcal{N}, c_{0_\mathcal{N}}, c_{s_\mathcal{N}}) =_{C[0_\mathcal{N}/x]} c_{0_\mathcal{N}}}
Ξ,x𝒩CmetatypeΞc 0 𝒩C[0 𝒩/x]Ξ,x𝒩,cCc s 𝒩C[s 𝒩(x)/x]Γβ 𝒩 s 𝒩(n)ind 𝒩 C(s 𝒩(n),c 0 𝒩,c s 𝒩)= C[s 𝒩(n)/x]c s 𝒩(n,ind 𝒩 C(n,c 0 𝒩,c s 𝒩))\frac{\Xi, x \in \mathcal{N} \vdash C \; \mathrm{metatype} \quad \Xi \vdash c_{0_\mathcal{N}} \in C[0_\mathcal{N}/x] \quad \Xi, x \in \mathcal{N}, c \in C \vdash c_{s_\mathcal{N}} \in C[s_\mathcal{N}(x)/x]}{\Gamma \vdash \beta_\mathcal{N}^{s_\mathcal{N}(n)} \in \mathrm{ind}_\mathcal{N}^C(s_\mathcal{N}(n), c_{0_\mathcal{N}}, c_{s_\mathcal{N}}) =_{C[s_\mathcal{N}(n)/x]} c_{s_\mathcal{N}}(n, \mathrm{ind}_\mathcal{N}^C(n, c_{0_\mathcal{N}}, c_{s_\mathcal{N}}))}

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 a:Aa:A, which says that aa is a term of the type AA, and judgmental equality aa:Aa \equiv a':A, which says that aa and aa' are judgmentally equal terms of the type AA. 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:

Ξi𝒩ΞU i:U s 𝒩(i)Ξi𝒩ΞA:U iΞA:U s 𝒩(i)\frac{\Xi \vdash i \in \mathcal{N}}{\Xi \vdash U_i:U_{s_\mathcal{N}(i)}} \quad \frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vdash A:U_i}{\Xi \vdash A:U_{s_\mathcal{N}(i)}}

Contexts are defined as a metacontext with a list of typing judgments, with the metacontext always preceding the list of typing judgments:

ΞmetactxΞ|()ctxΞi𝒩Ξ|ΓA:U iΞ|(Γ,a:A)ctx\frac{\Xi \; \mathrm{metactx}}{\Xi \vert () \; \mathrm{ctx}} \qquad \frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i}{\Xi \vert (\Gamma, a:A) \; \mathrm{ctx}}

The general rules for Russell universes then follows:

Ξi𝒩Ξ|ΓctxΞ|ΓU i:U s 𝒩(i)Ξi𝒩Ξ|ΓA:U iΞ|ΓA:U s 𝒩(i)\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \; \mathrm{ctx}}{\Xi \vert \Gamma \vdash U_i:U_{s_\mathcal{N}(i)}} \quad \frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i}{\Xi \vert \Gamma \vdash A:U_{s_\mathcal{N}(i)}}

In addition, if there is a term a:Aa:A of a type AA, then the type AA is a term of some Russell universe U iU_i.

Ξi𝒩Ξ|Γa:AΞ|ΓA:U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash A:U_{i}}

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:

Ξ|Γ,a:A,ΔctxΞ|Γ,a:A,Δa:A\frac{\Xi \vert \Gamma, a:A, \Delta \; \mathrm{ctx}}{\Xi \vert \Gamma, a:A, \Delta \vdash a:A}

Let 𝒥\mathcal{J} be any arbitrary judgment. Then we have the following rules:

The weakening rule:

Ξi𝒩Ξ|ΓA:U iΞ|Γ,Δ𝒥Ξ|Γ,a:A,Δ𝒥\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma, \Delta \vdash \mathcal{J}}{\Xi \vert \Gamma, a:A, \Delta \vdash \mathcal{J}}

The substitution rule:

Ξ|Γa:AΞ|Γ,b:A,Δ𝒥Ξ|Γ,Δ[a/b]𝒥[a/b]\frac{\Xi \vert \Gamma \vdash a:A \quad \Xi \vert \Gamma, b:A, \Delta \vdash \mathcal{J}}{\Xi \vert \Gamma, \Delta[a/b] \vdash \mathcal{J}[a/b]}

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

    Ξi𝒩Ξ|ΓA:U iΞ|Γab:AΞ|Γa:A\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a \equiv b:A}{\Xi \vert \Gamma \vdash a:A}
    Ξi𝒩Ξ|ΓA:U iΞ|Γab:AΞ|Γb:A\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a \equiv b:A}{\Xi \vert \Gamma \vdash b:A}
  • Reflexivity of judgmental equality

    Ξi𝒩Ξ|ΓA:U iΞ|Γa:AΞ|Γaa:A\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash a \equiv a:A}
  • Symmetry of judgmental equality

    Ξi𝒩Ξ|ΓA:U iΞ|Γab:AΞ|Γba:A\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a \equiv b:A}{\Xi \vert \Gamma \vdash b \equiv a:A}
  • Transitivity of judgmental equality

    Ξi𝒩Ξ|ΓA:U iΞ|Γab:AΞ|Γbc:AΞ|Γac:A\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a \equiv b:A \quad \Xi \vert \Gamma \vdash b \equiv c:A}{\Xi \vert \Gamma \vdash a \equiv c:A}
  • Principle of substitution:

    Ξi𝒩Ξ|ΓA:U iΞ|Γab:AΞ|Γ,x:A,Δc:BΞ|Γ,Δ[b/x]c[a/x]c[b/x]:B[b/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a \equiv b : A \quad \Xi \vert \Gamma, x:A, \Delta \vdash c:B}{\Xi \vert \Gamma, \Delta[b/x] \vdash c[a/x] \equiv c[b/x]: B[b/x]}
  • Variable conversion rule:

    Ξi𝒩Ξ|ΓAB:U iΞ|Γ,x:A,Δ𝒥Ξ|Γ,x:B,Δ𝒥\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A \equiv B:U_i \quad \Xi \vert \Gamma, x:A, \Delta \vdash \mathcal{J}}{\Xi \vert \Gamma, x:B, \Delta \vdash \mathcal{J}}

Dependent product types

  • Formation rules for dependent product types:
Ξi𝒩Ξ|ΓA:U iΞ|Γ,x:AB:U iΞ|Γ x:AB(x):U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma, x:A \vdash B:U_i}{\Xi \vert \Gamma \vdash \prod_{x:A} B(x):U_i}
  • Introduction rules for dependent product types:
Ξ|Γ,x:Ab:BΞ|Γλ(x:A).b(x): x:AB(x)\frac{\Xi \vert \Gamma, x:A \vdash b:B}{\Xi \vert \Gamma \vdash \lambda(x:A).b(x):\prod_{x:A} B(x)}
  • Elimination rules for dependent product types:
Ξ|Γf: x:AB(x)Ξ|Γa:AΞ|Γf[a/x]:B[a/x]\frac{\Xi \vert \Gamma \vdash f:\prod_{x:A} B(x) \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash f[a/x]:B[a/x]}
  • Computation rules for dependent product types:
Ξ|Γ,x:Ab:BΞ|Γa:AΞ|Γλ(x:A).b(x)[a/x]b[a/x]:B[a/x]\frac{\Xi \vert \Gamma, x:A \vdash b:B \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash \lambda(x:A).b(x)[a/x] \equiv b[a/x]:B[a/x]}
  • Uniqueness rules for dependent product types:
Ξ|Γf: x:AB(x)Ξ|Γfλ(x).f(x): x:AB(x)\frac{\Xi \vert \Gamma \vdash f:\prod_{x:A} B(x)}{\Xi \vert \Gamma \vdash f \equiv \lambda(x).f(x):\prod_{x:A} B(x)}

Dependent sum types

  • Formation rules for dependent sum types:
Ξi𝒩Ξ|ΓA:U iΓ,x:AB:U iΞ|Γ x:AB(x):U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Gamma, x:A \vdash B:U_i}{\Xi \vert \Gamma \vdash \sum_{x:A} B(x):U_i}
  • Introduction rules for dependent sum types:
Ξ|Γ,x:Ab:BΞ|Γa:AΞ|Γb:B[a/x]Ξ|Γ(a,b): x:AB(x)\frac{\Xi \vert \Gamma, x:A \vdash b:B \quad \Xi \vert \Gamma \vdash a:A \quad \Xi \vert \Gamma \vdash b:B[a/x]}{\Xi \vert \Gamma \vdash (a, b):\sum_{x:A} B(x)}
  • Elimination rules for dependent sum types:
Ξ|Γz: x:AB(x)Ξ|Γπ 1(z):AΞ|Γz: x:AB(x)Ξ|Γπ 2(z):B[π 1(z)/x]\frac{\Xi \vert \Gamma \vdash z:\sum_{x:A} B(x)}{\Xi \vert \Gamma \vdash \pi_1(z):A} \qquad \frac{\Xi \vert \Gamma \vdash z:\sum_{x:A} B(x)}{\Xi \vert \Gamma \vdash \pi_2(z):B[\pi_1(z)/x]}
  • Computation rules for dependent sum types:
Ξ|Γ,x:Ab:BΞ|Γa:AΞ|Γπ 1(a,b)a:AΞ|Γ,x:Ab:BΞ|Γa:AΞ|Γπ 2(a,b)b:B[π 1(a,b)/x]\frac{\Xi \vert \Gamma, x:A \vdash b:B \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash \pi_1(a, b) \equiv a:A} \qquad \frac{\Xi \vert \Gamma, x:A \vdash b:B \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash \pi_2(a, b) \equiv b:B[\pi_1(a, b)/x]}
  • Uniqueness rules for dependent sum types:
Ξ|Γz: x:AB(x)Ξ|Γz(π 1(z),π 2(z)): x:AB(x)\frac{\Xi \vert \Gamma \vdash z:\sum_{x:A} B(x)}{\Xi \vert \Gamma \vdash z \equiv (\pi_1(z), \pi_2(z)):\sum_{x:A} B(x)}

Sum types

  • Formation rules for sum types:
Ξi𝒩Ξ|ΓA:U iΞ|ΓB:U iΞ|ΓA+B:U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash B:U_i}{\Xi \vert \Gamma \vdash A + B:U_i}
  • Introduction rules for sum types:
Ξ|Γa:AΞ|Γinl(a):A+BΞ|Γb:BΞ|Γinr(b):A+B\frac{\Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash \mathrm{inl}(a):A + B} \qquad \frac{\Xi \vert \Gamma \vdash b:B}{\Xi \vert \Gamma \vdash \mathrm{inr}(b):A + B}
  • Elimination rules for sum types:
Ξi𝒩Ξ|Γ,z:A+BC:U iΞ|Γ,x:Ac:C[inl(x)/z]Ξ|Γ,y:Bd:C[inr(y)/z]Ξ|Γe:A+BΞ|Γind A+B(z.C,x.c,y.d,e):C[e/z]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, z:A + B \vdash C:U_i \quad \Xi \vert \Gamma, x:A \vdash c:C[\mathrm{inl}(x)/z] \quad \Xi \vert \Gamma, y:B \vdash d:C[\mathrm{inr}(y)/z] \quad \Xi \vert \Gamma \vdash e:A + B}{\Xi \vert \Gamma \vdash \mathrm{ind}_{A + B}(z.C, x.c, y.d, e):C[e/z]}
  • Computation rules for sum types:
Ξi𝒩Ξ|Γ,z:A+BC:U iΞ|Γ,x:Ac:C[inl(x)/z]Ξ|Γ,y:Bd:C[inr(y)/z]Ξ|Γa:AΞ|Γind A+B(z.C,x.c,y.d,inl(a))c[a/x]:C[inl(a)/z]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, z:A + B \vdash C:U_i \quad \Xi \vert \Gamma, x:A \vdash c:C[\mathrm{inl}(x)/z] \quad \Xi \vert \Gamma, y:B \vdash d:C[\mathrm{inr}(y)/z] \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash \mathrm{ind}_{A + B}(z.C, x.c, y.d, \mathrm{inl}(a)) \equiv c[a/x]:C[\mathrm{inl}(a)/z]}
Ξi𝒩Ξ|Γ,z:A+BC:U iΞ|Γ,x:Ac:C[inl(x)/z]Ξ|Γ,y:Bd:C[inr(y)/z]Ξ|Γb:AΞ|Γind A+B(z.C,x.c,y.d,inr(b))d[b/x]:C[inr(b)/z]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, z:A + B \vdash C:U_i \quad \Xi \vert \Gamma, x:A \vdash c:C[\mathrm{inl}(x)/z] \quad \Xi \vert \Gamma, y:B \vdash d:C[\mathrm{inr}(y)/z] \quad \Xi \vert \Gamma \vdash b:A}{\Xi \vert \Gamma \vdash \mathrm{ind}_{A + B}(z.C, x.c, y.d, \mathrm{inr}(b)) \equiv d[b/x]:C[\mathrm{inr}(b)/z]}

Empty type

  • Formation rules for the empty type:
Ξi𝒩Ξ|ΓctxΞ|Γ𝟘:U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \; \mathrm{ctx}}{\Xi \vert \Gamma \vdash \mathbb{0}:U_i}
  • Elimination rules for the empty type:
Ξi𝒩Ξ|Γ,x:𝟘C:U iΓp:𝟘Γind 𝟘(x.C,p):C[p/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:\mathbb{0} \vdash C:U_i \quad \Gamma \vdash p:\mathbb{0}}{\Gamma \vdash \mathrm{ind}_\mathbb{0}(x.C, p):C[p/x]}

Unit type

  • Formation rules for the unit type:
Ξi𝒩Ξ|ΓctxΞ|Γ𝟙type\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \; \mathrm{ctx}}{\Xi \vert \Gamma \vdash \mathbb{1} \; \mathrm{type}}
  • Introduction rules for the unit type:
Ξ|ΓctxΞ|Γ*:𝟙\frac{\Xi \vert \Gamma \; \mathrm{ctx}}{\Xi \vert \Gamma \vdash *:\mathbb{1}}
  • Elimination rules for the unit type:
Ξi𝒩Ξ|Γ,x:𝟙C:U iΓ,y:𝟙c[y/x]:C[y/x]Γp:𝟙Γind 𝟙(x.C,y.c,p):C[p/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:\mathbb{1} \vdash C:U_i \quad \Gamma, y:\mathbb{1} \vdash c[y/x]:C[y/x] \quad \Gamma \vdash p:\mathbb{1}}{\Gamma \vdash \mathrm{ind}_\mathbb{1}(x.C, y.c, p):C[p/x]}
  • Computation rules for the unit type:
Ξi𝒩Ξ|Γ,x:𝟙C:U iΓ,y:𝟙c[y/x]:C[y/x]Γind 𝟙(x.C,y.c,*)c[*/x]:C[*/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:\mathbb{1} \vdash C:U_i \quad \Gamma, y:\mathbb{1} \vdash c[y/x]:C[y/x]}{\Gamma \vdash \mathrm{ind}_\mathbb{1}(x.C, y.c, *) \equiv c[*/x]:C[*/x]}

Natural numbers

  • Formation rules for the natural numbers:

    Ξi𝒩Ξ|ΓctxΞ|Γ:U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \; \mathrm{ctx}}{\Xi \vert \Gamma \vdash \mathbb{N}:U_i}
  • Introduction rules for the natural numbers:

    Ξ|ΓctxΞ|Γ0:Ξ|Γn:Ξ|Γs(n):\frac{\Xi \vert \Gamma \; \mathrm{ctx}}{\Xi \vert \Gamma \vdash 0:\mathbb{N}} \qquad \frac{\Xi \vert \Gamma \vdash n:\mathbb{N}}{\Xi \vert \Gamma \vdash s(n):\mathbb{N}}
  • Elimination rules for the natural numbers:

    Ξi𝒩Ξ|Γ,x:C:U iΞ|Γc 0:C[0/x]Ξ|Γ,x:,y:Cc s:C[s(x)/x]Ξ|Γn:Ξ|Γind (x.C,c 0,x.y.c s,n):C[n/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:\mathbb{N} \vdash C:U_i \quad \Xi \vert \Gamma \vdash c_0:C[0/x] \quad \Xi \vert \Gamma, x:\mathbb{N}, y:C \vdash c_s:C[s(x)/x] \quad \Xi \vert \Gamma \vdash n:\mathbb{N}}{\Xi \vert \Gamma \vdash \mathrm{ind}_\mathbb{N}(x.C, c_0, x.y.c_s, n):C[n/x]}
  • Computation rules for the natural numbers:

    Ξi𝒩Ξ|Γ,x:C:U iΞ|Γc 0:C[0/x]Ξ|Γ,x:,y:Cc s:C[s(x)/x]Ξ|Γind (x.C,c 0,x.y.c s,0)c 0:C[0/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:\mathbb{N} \vdash C:U_i \quad \Xi \vert \Gamma \vdash c_0:C[0/x] \quad \Xi \vert \Gamma, x:\mathbb{N}, y:C \vdash c_s:C[s(x)/x]}{\Xi \vert \Gamma \vdash \mathrm{ind}_\mathbb{N}(x.C, c_0, x.y.c_s, 0) \equiv c_0:C[0/x]}
Ξi𝒩Ξ|Γ,x:C:U iΞ|Γc 0:C[0/x]Ξ|Γ,x:,y:Cc s:C[s(x)/x]Ξ|Γind (x.C,c 0,x.y.c s,s(n)c s(n,ind (x.C,c 0,x.y.c s,n)):C[s(n)/x]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:\mathbb{N} \vdash C:U_i \quad \Xi \vert \Gamma \vdash c_0:C[0/x] \quad \Xi \vert \Gamma, x:\mathbb{N}, y:C \vdash c_s:C[s(x)/x]}{\Xi \vert \Gamma \vdash \mathrm{ind}_\mathbb{N}(x.C, c_0, x.y.c_s, s(n) \equiv c_s(n, \mathrm{ind}_\mathbb{N}(x.C, c_0, x.y.c_s, n)):C[s(n)/x]}

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:

    Ξi𝒩Ξ|ΓA:U iΞ|Γa:AΞ|Γb:AΞ|Γa= Ab:U i\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a:A \quad \Xi \vert \Gamma \vdash b:A}{\Xi \vert \Gamma \vdash a =_A b:U_i}
  • Introduction rule for identity types:

    Ξi𝒩Ξ|ΓA:U iΞ|Γa:AΞ|Γrefl A(a):a= Aa\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash \mathrm{refl}_A(a) : a =_A a}
  • Elimination rule for identity types:

    Ξi𝒩Ξ|Γ,x:A,y:A,p:a= AbC:U iΞ|Γ,z:At:C[z/a,z/b,refl A(z)/p]Ξ|Γa:AΞ|Γb:AΞ|Γq:a= AbΞ|ΓJ(x,y,p.C,z.t,a,b,q):C[a,b,q/x,y,p]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:A, y:A, p:a =_A b \vdash C:U_i \quad \Xi \vert \Gamma, z:A \vdash t:C[z/a, z/b, \mathrm{refl}_A(z)/p] \quad \Xi \vert \Gamma \vdash a:A \quad \Xi \vert \Gamma \vdash b:A \quad \Xi \vert \Gamma \vdash q:a =_A b}{\Xi \vert \Gamma \vdash J(x,y,p.C, z.t, a, b, q):C[a, b, q/x, y, p]}
  • Computation rules for identity types:

    Ξi𝒩Ξ|Γ,x:A,y:A,p:a= AbC:U iΞ|Γ,z:At:C[z/a,z/b,refl A(z)/p]Ξ|Γa:AΞ|ΓJ(x.y.p.C,z.t,a,a,refl(a))t:C[a,a,refl A(a)/x,y,p]\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma, x:A, y:A, p:a =_A b \vdash C:U_i \quad \Xi \vert \Gamma, z:A \vdash t:C[z/a, z/b, \mathrm{refl}_A(z)/p] \quad \Xi \vert \Gamma \vdash a:A}{\Xi \vert \Gamma \vdash J(x.y.p.C, z.t, a, a, \mathrm{refl}(a)) \equiv t:C[a, a, \mathrm{refl}_A(a)/x, y, p]}

Univalence

Given types A:U iA:U_i and B:U iB:U_i, a function f:ABf:A \to B is an equivalence of types if the fiber of ff at each element of BB has exactly one element. The property of the type AA having exactly one element is represented by the isContr modality which states that the type AA is contractible. The fiber of ff at an element b:Bb:B is given by the type

b:Bf(a)= Bb\sum_{b:B} f(a) =_B b

We formally define the property of RR being a one-to-one correspondence or an equivalence of types as the type:

isEquiv A,B(f) b:BisContr( a:Af(a)= Bb)\mathrm{isEquiv}_{A, B}(f) \coloneqq \prod_{b:B} \mathrm{isContr}\left(\sum_{a:A} f(a) =_B b\right)

We define the type of equivalences from AA to BB as

AB f:ABisEquiv A,B(f)A \simeq B \coloneqq \sum_{f:A \to B} \mathrm{isEquiv}_{A, B}(f)

There is a function

idtoequiv A,B:(A= U iB)(AB)\mathrm{idtoequiv}_{A, B}:(A =_{U_i} B) \to (A \simeq B)

which is inductively defined on reflexivity to be the identity function on AA

idtoequiv A,A(refl U i(A))id A\mathrm{idtoequiv}_{A, A}(\mathrm{refl}_{U_i}(A)) \equiv id_A

The univalence axiom then states that idtoequiv A,B\mathrm{idtoequiv}_{A, B} is an equivalence for all external natural numbers i𝒩i \in \mathcal{N} and types A:U iA:U_i and B:U iB:U_i:

Ξi𝒩Ξ|ΓA:U iΞ|ΓB:U iΞ|Γua U i(A,B):isEquiv A= U iB,AB(idtoequiv A,B)\frac{\Xi \vdash i \in \mathcal{N} \quad \Xi \vert \Gamma \vdash A:U_i \quad \Xi \vert \Gamma \vdash B:U_i}{\Xi \vert \Gamma \vdash \mathrm{ua}_{U_i}(A, B):\mathrm{isEquiv}_{A =_{U_i} B, A \simeq B}(\mathrm{idtoequiv}_{A, B})}

See also

 References

Last revised on November 24, 2022 at 23:36:58. See the history of this page for a list of all contributions to it.