nLab extensional type theory

Contents

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

Equality and Equivalence

Contents

Idea

Extensional type theory denotes the flavor of type theory in which identity types satisfy the reflection rule, saying that if two terms are typally equal then they are also judgmentally equal.

In particular, this implies that all identity types are propositions / of h-level 1, and thus equivalently that all types are required to be h-sets. Therefore, extensional type theory is a set-level type theory, and hence a form of set-level foundations. However, there are other set-level type theories, such as those obtained by adding UIP as an axiom.

Note: For a while, the nLab incorrectly used “extensional type theory” to refer to what we now call set-level type theory. If you encounter uses of this sort, please correct them.

Extensional type theory is poorly behaved metatheoretically, and very difficult to implement in a proof assistant. However, it is sometimes more convenient to work with informally, and there are conservativity theorems relating it to other set-level type theories that are better-behaved.

Type theory which is not extensional is called intensional type theory.

Remark

The word “extensional” in type theory (even when applied to identity types) sometimes refers instead to the axiom of function extensionality. In general this property is orthogonal to the one considered here: function extensionality can hold or fail in both extensional and intensional type theory.

In particular, homotopy type theory is intensional in that identity types are crucially not demanded to be propositions, but function extensionality is often assumed (in terms of these intensional identity types, of course) — in particular, it follows from the univalence axiom. Indeed, univalence itself is arguably an extensionality principle for the universe (Hofmann and Streicher originally introduced it under the name “universe extensionality”), but it is inconsistent with “extensional type theory” in the sense considered here.

Remark

The origin of the names “extensional” and “intensional” is somewhat confusing. In fact they refer to the behavior of the definitional equality. The idea is that the identity type is always an “extensional” notion of equality (although it can be more or less extensional, depending on whether further extensionality principles like function extensionality and univalence hold). Thus, if the definitional equality coincides with the identity type, as it does under the reflection rule, the former is also extensional, and so we call the type theory “extensional” — while if the two equalities do not coincide, then the definitional equality has room to be more intensional than the identity type, and so we call the type theory “intensional”.

Definition

The Martin-Lof definition of identity types as an inductive type family makes them intensional. To make the type theory extensional, we add a rule that any inhabitant of an identity type p:Id A(x,y)p:Id_A(x,y) induces a definitional equality between xx and yy. In other words, we have an “equality reflection rule” of the form

p:Id A(x,y)xy \frac{p:Id_A(x,y)}{x\equiv y}

At first, this may appear to be only a “skeletality” assumption, since it does not assert explicitly that pp is reflexivity rather than a nontrivial loop. However, we can derive this with the induction rule for identity types. Consider the dependent type

(x:A),(y:A),(p:Id A(x,y))Id Id A(x,y)(p,refl(x)). (x:A),(y:A),(p:Id_A(x,y)) \;\vdash\; Id_{Id_A(x,y)}(p,refl(x)).

This is well-typed because the reflection rule applied to pp yields a judgmental equality xyx\equiv y, so that we have refl(x):Id A(x,y)refl(x):Id_A(x,y). Moreover, substituting xx for yy and refl(x)refl(x) for pp yields the type Id Id A(x,x)(refl(x),refl(x))Id_{Id_A(x,x)}(refl(x),refl(x)), which is inhabited by refl(refl(x))refl(refl(x)).

Thus, by induction on identity, we have a term in the above type, witnessing a typal equality between pp and refl(x)refl(x). Finally, applying the equality reflection rule again, we get a definitional equality prefl(x)p\equiv refl(x).

Remark

On the other hand, if in addition to the equality reflection rule we postulate that all equality proofs are definitionally equal to reflexivity, then we can derive the induction rule for identity types. Extensional type theory is often presented in this form.

A different, also equivalent, way of presenting extensional type theory is with a definitional eta-conversion rule for the identity types; see here.

Using the interval type

If the dependent type theory has an interval type 𝕀\mathbb{I} with judgmental computation rules for the point constructors, it suffices for the two point constructors 0:𝕀0:\mathbb{I} and 1:𝕀1:\mathbb{I} to be definitionally equal:

ΓctxΓ01:𝕀\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash 0 \equiv 1:\mathbb{I}}

Proof

By the recursion principle of the interval type, for elements x:Ax:A, y:Ay:A, and p:Id A(x,y)p:\mathrm{Id}_A(x, y), we have a function rec 𝕀 A(x,y,p):𝕀A\mathrm{rec}_\mathbb{I}^A(x, y, p):\mathbb{I} \to A such that rec 𝕀 A(x,y,p,0)x\mathrm{rec}_\mathbb{I}^A(x, y, p, 0) \equiv x and rec 𝕀 A(x,y,p,1)y\mathrm{rec}_\mathbb{I}^A(x, y, p, 1) \equiv y. If we have 01:𝕀0 \equiv 1:\mathbb{I}, then by the congruence rules of definitional equality we have

xrec 𝕀 A(x,y,p,0)rec 𝕀 A(x,y,p,1)yx \equiv \mathrm{rec}_\mathbb{I}^A(x, y, p, 0) \equiv \mathrm{rec}_\mathbb{I}^A(x, y, p, 1) \equiv y

which is precisely equality reflection.

Alternatively, one can add inference rules for definitional 𝕀 \mathbb{I} -localization:

ΓAtypeΓ,p:𝕀Aconst A,𝕀 1(p):A\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, p:\mathbb{I} \to A \vdash \mathrm{const}_{A, \mathbb{I}}^{-1}(p):A}
ΓAtypeΓ,x:Aconst A,𝕀 1(λi:𝕀.x)x:A\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, x:A \vdash \mathrm{const}_{A, \mathbb{I}}^{-1}(\lambda i:\mathbb{I}.x) \equiv x:A}
ΓAtypeΓ,p:𝕀Aλi:𝕀.const A,𝕀 1(p)p:𝕀A\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, p:\mathbb{I} \to A \vdash \lambda i:\mathbb{I}.\mathrm{const}_{A, \mathbb{I}}^{-1}(p) \equiv p:\mathbb{I} \to A}

The usual notion of 𝕀 \mathbb{I} -localization, provable in any dependent type theory with an interval type, implies definitional 𝕀\mathbb{I}-localization in extensional type theory by equality reflection. On the other hand, one can prove equality reflection from definitional 𝕀\mathbb{I}-localization.

Theorem

Definitional 𝕀\mathbb{I}-localization implies equality reflection.

Proof

Given x:Ax:A, y:Ay:A, and p:x= Ayp:x =_A y, by the recursion principle of the interval type, we have a function rec 𝕀,A(x,y,p):𝕀A\mathrm{rec}_{\mathbb{I}, A}(x, y, p):\mathbb{I} \to A. By definitional 𝕀\mathbb{I}-localization and the recursion principle of the interval type, we have an element

const A,𝕀 1(rec 𝕀,A(x,y,p)):A\mathrm{const}_{A, \mathbb{I}}^{-1}(\mathrm{rec}_{\mathbb{I}, A}(x, y, p)):A

such that

const A,𝕀 1(rec 𝕀,A(x,y,p))const A,𝕀(const A,𝕀 1(rec 𝕀,A(x,y,p)),0)rec 𝕀,A(x,y,p,0)x\mathrm{const}_{A, \mathbb{I}}^{-1}(\mathrm{rec}_{\mathbb{I}, A}(x, y, p)) \equiv \mathrm{const}_{A, \mathbb{I}}(\mathrm{const}_{A, \mathbb{I}}^{-1}(\mathrm{rec}_{\mathbb{I}, A}(x, y, p)), 0) \equiv \mathrm{rec}_{\mathbb{I}, A}(x, y, p, 0) \equiv x
const A,𝕀 1(rec 𝕀,A(x,y,p))const A,𝕀(const A,𝕀 1(rec 𝕀,A(x,y,p)),1)rec 𝕀,A(x,y,p,1)y\mathrm{const}_{A, \mathbb{I}}^{-1}(\mathrm{rec}_{\mathbb{I}, A}(x, y, p)) \equiv \mathrm{const}_{A, \mathbb{I}}(\mathrm{const}_{A, \mathbb{I}}^{-1}(\mathrm{rec}_{\mathbb{I}, A}(x, y, p)), 1) \equiv \mathrm{rec}_{\mathbb{I}, A}(x, y, p, 1) \equiv y

hence, we can derive by the inference rules for judgmental equality that xyx \equiv y, which is precisely equality reflection.

Theorem

In the presence of the large recursion principle of the interval type, definitional isomorphism types imply equality reflection.

Proof

In the presence of definitional isomorphism types and the inductively defined identity types, transport can be defined as definitional isomorphism via the J-rule, since the identity function or identity equivalence is a definitional isomorphism and thus one can apply the J-rule to reflexivity to get the identity as a definitional isomorphism:

x:A,y:A,p:x= Ayind Id A,B(x)B(y)(p):B(x)B(y)x:A, y:A, p:x =_A y \vdash \mathrm{ind}_{\mathrm{Id}}^{A, B(x) \cong B(y)}(p):B(x) \cong B(y)
x:Aind Id A,B(x)B(x)(refl A(x))toDefIso(χ:A.χ,χ:A.χ):B(x)B(x)x:A \vdash \mathrm{ind}_{\mathrm{Id}}^{A, B(x) \cong B(x)}(\mathrm{refl}_A(x)) \equiv \mathrm{toDefIso}(\chi:A.\chi, \chi:A.\chi):B(x) \cong B(x)

By large recursion of the interval, given two types AA and BB and an equivalence of types e:ABe:A \simeq B, one can construct an interval-indexed type family (rec 𝕀 A,B,e(x)) x:𝕀(\mathrm{rec}_{\mathbb{I}}^{A, B, e}(x))_{x:\mathbb{I}} such that rec 𝕀 A,B,e(0)A\mathrm{rec}_{\mathbb{I}}^{A, B, e}(0) \equiv A, rec 𝕀 A,B,e(1)B\mathrm{rec}_{\mathbb{I}}^{A, B, e}(1) \equiv B, and q:tr rec 𝕀 A,B,e(p)= ABeq:\mathrm{tr}_{\mathrm{rec}_{\mathbb{I}}^{A, B, e}}(p) =_{A \simeq B} e. With definitional isomorphism types, the equivalences can be strictified to definitional isomorphisms by

ind Id 𝕀,rec 𝕀 A,B,e(0)rec 𝕀 A,B,e(1)(p):AB\mathrm{ind}_{\mathrm{Id}}^{\mathbb{I}, \mathrm{rec}_{\mathbb{I}}^{A, B, e}(0) \cong \mathrm{rec}_{\mathbb{I}}^{A, B, e}(1)}(p):A \cong B

This implies that for all types AA, the equivalence

const 𝕀,Aλx:A.λi:𝕀.x:A(𝕀A)\mathrm{const}_{\mathbb{I}, A} \coloneqq \lambda x:A.\lambda i:\mathbb{I}.x:A \simeq (\mathbb{I} \to A)

in 𝕀 \mathbb{I} -localization can be turned into the definitional isomorphism

ind Id 𝕀,rec 𝕀 A,𝕀A,const 𝕀,A(0)rec 𝕀 A,𝕀A,const 𝕀,A(1)(p):A(𝕀A)\mathrm{ind}_{\mathrm{Id}}^{\mathbb{I}, \mathrm{rec}_{\mathbb{I}}^{A, \mathbb{I} \to A, \mathrm{const}_{\mathbb{I}, A}}(0) \cong \mathrm{rec}_{\mathbb{I}}^{A, \mathbb{I} \to A, \mathrm{const}_{\mathbb{I}, A}}(1)}(p):A \cong (\mathbb{I} \to A)

which is definitional 𝕀 \mathbb{I} -localization, and definitional 𝕀\mathbb{I}-localization implies equality reflection as proven in the definitional 𝕀 \mathbb{I} -localization and extensional type theory articles.

Using dependent sum types of identity types

In extensional type theory, there are ways of defining certain dependent sum types of identity type as a negative type, which all result in equality reflection.

The idea is that using the inference rules for dependent sum types, the standard J-rule states that the dependent sum type x:A y:Ax= Ay\sum_{x:A} \sum_{y:A} x =_A y is a positive copy of AA with respect to the diagonal function

Δ A(x)(x,(x,refl A(x))): x:A y:Ax= Ay\Delta_{A}(x) \coloneqq (x, (x, \mathrm{refl}_A(x))):\sum_{x:A} \sum_{y:A} x =_A y

However, there is also a negative version of copy types, whose elimination, computation, and uniqueness rules state that the diagonal function is a definitional isomorphism:

  • Elimination rules for negative identity types:
ΓAtypeΓ,z: x:A y:Ax= AyΔ A 1(z):A\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, z:\sum_{x:A} \sum_{y:A} x =_A y \vdash \Delta_A^{-1}(z):A}
  • Computation rules for negative identity types:
ΓAtypeΓ,x:AΔ A 1(Δ A(x))x:A\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, x:A \vdash \Delta_A^{-1}(\Delta_{A}(x)) \equiv x:A}
  • Uniqueness rules for negative identity types:
ΓAtypeΓ,z: x:A y:Ax= AyΔ A(Δ A 1(z))z: x:A y:Ax= Ay\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, z:\sum_{x:A} \sum_{y:A} x =_A y \vdash \Delta_{A}(\Delta_A^{-1}(z)) \equiv z:\sum_{x:A} \sum_{y:A} x =_A y}

The uniqueness rules yield equality reflection. By the properties of judgmental equality and dependent sum types, from

(Δ A 1(x,y,p),Δ A 1(x,y,p),refl A(Δ A 1(x,y,p)))(x,y,p)(\Delta_A^{-1}(x, y, p), \Delta_A^{-1}(x, y, p), \mathrm{refl}_A(\Delta_A^{-1}(x, y, p))) \equiv (x, y, p)

one can derive xΔ A 1(x,y,p)x \equiv \Delta_A^{-1}(x, y, p) and yΔ A 1(x,y,p)y \equiv \Delta_A^{-1}(x, y, p) and thus xyx \equiv y.

Similarly, the Paulin-Mohring J-rule states that given x:Ax:A, the dependent sum type y:Ax= Ay\sum_{y:A} x =_A y is a positive unit type of AA with specified element

(x,refl A(x)): y:Ax= Ay(x, \mathrm{refl}_A(x)):\sum_{y:A} x =_A y

However, there are also negative unit types, which states that y:Ax= Ay\sum_{y:A} x =_A y is a definitional singleton with judgmental center of contraction (x,refl A(x))(x, \mathrm{refl}_A(x))

  • Uniqueness rules for negative identity types:
ΓAtypeΓ,x:A,z: y:Ax= Ay(x,refl A(x))z: y:Ax= Ay\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, x:A, z:\sum_{y:A} x =_A y \vdash (x, \mathrm{refl}_A(x)) \equiv z:\sum_{y:A} x =_A y}

Similarly to the case for the standard Martin-Lof identity types, the uniqueness rule yields equality reflection, because by the properties of judgmental equality and dependent sum types, one can derive xyx \equiv y from (x,refl A(x))(y,p)(x, \mathrm{refl}_A(x)) \equiv (y, p).

Properties

Decidability

Extensional Martin-Löf type theory does not have decidable type checking. See intensional type theory for more on this.

Theorem

In addition, extensional type theory does not have decidable judgmental equality.

Proof

Already, the equality reflection rule for the natural numbers type implies undecidability of judgmental equality in the dependent type theory.

Γp:Id (x,y)Γxy\frac{\Gamma \vdash p:\mathrm{Id}_\mathbb{N}(x,y)}{\Gamma \vdash x \equiv y}

In order to show that, in an arbitrary context Γ\Gamma, 010 \equiv 1 in \mathbb{N}, we need to determine whether the empty type is a pointed type in Γ\Gamma, which is undecidable in general.

Examples

References

Extensional type theory is discussed in chapter 2 of:

Last revised on July 5, 2025 at 17:56:48. See the history of this page for a list of all contributions to it.