nLab fundamental theorem of identity types

This entry currently contains mistakes, see the discussion page here.


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
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




There are two different fundamental theorems of identity types, depending on whether identity types are defined with plain identity induction or with based identity induction.

With identity induction

The fundamental theorem of identity types states that given a type AA, a type family x:A,y:AB(x,y)x:A, y:A \vdash B(x, y) and a family of functions

x:A,y:Af(x,y):(x= Ay)B(x,y) x \colon A, y \colon A \;\vdash\; f(x, y) \,\colon\, (x =_A y) \to B(x, y)

the following conditions are equivalent:

  1. For each x:Ax:A the dependent sum type of the type family y:AB(x,y)y:A \vdash B(x, y) is a contractible type.

    x:Aftid(x):isContr( y:AB(x,y))x:A \vdash \mathrm{ftid}(x):\mathrm{isContr}\left(\sum_{y:A} B(x, y)\right)
  2. There is a family of equivalences

    x:A,y:Aftid(x,y):(x= Ay)B(x,y)x:A, y:A \vdash \mathrm{ftid}(x, y):(x =_A y) \simeq B(x, y)
  3. B(x,y)B(x, y) is an identity system.

  4. For each x:Ax:A and y:Ay:A, the function f(x,y)f(x, y) is an equivalence of types

    x:A,y:A,ftid(x,y):isEquiv(f(x,y))x:A, y:A, \vdash \mathrm{ftid}(x, y):\mathrm{isEquiv}(f(x, y))
  5. f(x,y)f(x, y) is a retraction

    x:A,y:Aftid(x,y):B(x,y)(x= Ay)x:A, y:A \vdash \mathrm{ftid}(x, y):B(x, y) \to (x =_A y)
    x:A,y:A,r:B(x,y)G(x,y):f(x,y,ftid(x,y,r))= B(x,y)rx:A, y:A, r:B(x, y) \vdash G(x, y):f(x, y, \mathrm{ftid}(x, y, r)) =_{B(x, y)} r
  6. R(x,y)R(x, y) with the function f(x,y)f(x, y) satisfies the universal property of the unary sum of x= Ayx =_A y.

With based identity induction

The fundamental theorem of identity types states that given a type AA, an element a:Aa:A, a type family x:AB(x)x:A \vdash B(x) and a family of functions

x:Af(x):(a= Ax)B(x)x:A \vdash f(x):(a =_A x) \to B(x)

the following conditions are equivalent:

  1. The dependent sum type of the type family x:AB(x)x:A \vdash B(x) is a contractible type.

    ftid:isContr( x:AB(x))\mathrm{ftid}:\mathrm{isContr}\left(\sum_{x:A} B(x)\right)
  2. There is a family of equivalences

    x:Aftid(x):(a= Ax)B(x)x:A \vdash \mathrm{ftid}(x):(a =_A x) \simeq B(x)
  3. B(x)B(x) equipped with f(refl A(a)):B(a)f(\mathrm{refl}_A(a)):B(a) is an identity system.

  4. For each x:Ax:A, the function f(x)f(x) is an equivalence of types

    x:Aftid(x):isEquiv(f(x))x:A \vdash \mathrm{ftid}(x):\mathrm{isEquiv}(f(x))
  5. For each x:Ax:A, f(x)f(x) is a retraction

    x:Aftid(x):B(x)(a= Ax)x:A \vdash \mathrm{ftid}(x):B(x) \to (a =_A x)
    x:A,b:B(x)G(x):f(x,ftid(x,r))= B(x)rx:A, b:B(x) \vdash G(x):f(x, \mathrm{ftid}(x, r)) =_{B(x)} r
  6. For each x:Ax:A, B(x)B(x) with the function f(x)f(x) satisfies the universal property of the unary sum of a= Axa =_A x.

Proofs that the conditions are the same

Proof that conditions 1 and 2 are the same

Suppose the equivalence type used in the second definition is a weak equivalence type. It is possible to show that definitions 1 and 2 are the same.

Definition 1 implies definition 2, because both x:A(a= Ax)\sum_{x:A} (a =_A x) and x:AB(x)\sum_{x:A} B(x) are contractible types, there is a weak equivalences of types

f(a):( x:A(a= Ax))( x:AB(x))f(a):\left(\sum_{x:A} (a =_A x)\right) \simeq \left(\sum_{x:A} B(x)\right)

Thus, there is a family of functions

g(a):( x:A(a= Ax))B(x)g(a):\left(\sum_{x:A} (a =_A x)\right) \to B(x)

indexed by a:Aa:A, defined by

g(a)λz: x:A(a= Ax).π 2(f(a)(z))g(a) \coloneqq \lambda z:\sum_{x:A} (a =_A x).\pi_2(f(a)(z))

and by currying this is the same as the function

g(a): x:A(a= Ax)B(x)g'(a):\prod_{x:A} (a =_A x) \to B(x)

defined by

g(a)λx:A.λp:a= Ax.π 2(f(a)(x,p))g'(a) \coloneqq \lambda x:A.\lambda p:a =_A x.\pi_2(f(a)(x, p))

Then by theorem 11.1.3 of Rijke22, since f(a)f(a) is an equivalence of types, then each g(a)(x)g'(a)(x) is an equivalence of types for all x:Ax:A. Thus we define ftid(x)\mathrm{ftid}(x) to be g(a)(x)g'(a)(x).

Definition 2 implies definition 1, as we begin with a family of weak equivalences

x:Aftid(x):(a= Ax)B(x)x:A \vdash \mathrm{ftid}(x):(a =_A x) \simeq B(x)

or equivalently

ftid: x:A(a= Ax)B(x)\mathrm{ftid}:\prod_{x:A} (a =_A x) \simeq B(x)

We can get a weak equivalences

f:( x:A(a= Ax))( x:AB(x))f':\left(\sum_{x:A} (a =_A x)\right) \simeq \left(\sum_{x:A} B(x)\right)

by defining

ftot 1(ftid)f' \coloneqq \mathrm{tot}^{-1}(\mathrm{ftid})

The type x:A(a= Ax)\sum_{x:A} (a =_A x) is always contractible; this means the type x:AB(x)\sum_{x:A} B(x) is contractible as well, since the two types are equivalent to each other. Thus, one could construct a witnesses

ftid:isContr( x:AB(x))\mathrm{ftid}':\mathrm{isContr}\left(\sum_{x:A} B(x)\right)

Proof that conditions 2 and 4 are the same

Suppose the equivalence type used in the second definition is a weak equivalence type. Then definitions 2 and 3 are the same because given any type AA and BB, there is a equivalence

δ (A,B):(AB) f:ABisEquiv(f)\delta_\simeq(A, B):(A \simeq B) \simeq \prod_{f:A \to B} \mathrm{isEquiv}(f)

Thus, in one direction, we define

ftid(x)δ (a= Ax,B(x)) 1(f(x))\mathrm{ftid}'(x) \coloneqq \delta_\simeq(a =_A x, B(x))^{-1}(f(x))

and in the other direction, we inductively define ftid(x)\mathrm{ftid}'(x) by induction on reflexivity

ftid(a,refl A(a))δ (a= Aa,B(a))(ftid(a))(refl A(a))\mathrm{ftid}'(a, \mathrm{refl}_A(a)) \coloneqq \delta_\simeq(a =_A a, B(a))(\mathrm{ftid}(a))(\mathrm{refl}_A(a))

Proof that condition 4 implies condition 5

Suppose that for every x:Ax:A we have a witness that the function f(x)f(x) is an equivalence of types

x:A,ftid(x,y):isEquiv(f(x,x))x:A, \vdash \mathrm{ftid}(x, y):\mathrm{isEquiv}(f(x, x))

For every type AA and BB, there is a family of functions

f:ABisEquivtoQInv(f):isEquiv(f)QInv(f)f:A \to B \vdash \mathrm{isEquivtoQInv}(f):\mathrm{isEquiv}(f) \to \mathrm{QInv}(f)

which takes a witness that ff is an equivalence to a quasi-inverse function of ff. The retraction of f(x)f(x) is represented by


Proof that condition 5 implies condition 1

This proof is adapted from Dan Licata in Licata 16:

Suppose that for every x:Ax:A we have a function

ftid(x):B(x)(a= Ax)\mathrm{ftid}(x):B(x) \to (a =_A x)

and a family of homotopies

G(x):f(x)(ftid(x)(r)= B(x)rG(x):f(x)(\mathrm{ftid}(x)(r) =_{B(x)} r

This exhibits B(x)B(x) as a retract of a= Axa =_A x, hence x:AB(x)\sum_{x:A} B(x) as a retract of the contractible type x:Aa= Ax\sum_{x:A} a =_A x, so there is an element

ftid:isContr( x:AB(x))\mathrm{ftid}:\mathrm{isContr}\left(\sum_{x:A} B(x)\right)

See also


The fundamental theorem of identity types appears in section 11.2 of

Definition 5 arises as a generalization of this proof by Dan Licata for univalent universes:

  • Dan Licata, weak univalence with “beta” implies full univalence (web)

Last revised on December 20, 2023 at 14:46:09. See the history of this page for a list of all contributions to it.