# Contents

## Idea

Extensional type theory denotes the flavor of type theory in which identity types are demanded to be propositions / of h-level 1. In other words, they are determined by their extensions — the collection of pairs of points which are equal. 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.

## Definition

The basic definition of identity types as an inductive type family makes them intensional. There are two sorts of ways to make them extensional: definitionally or propositionally.

### Definitional extensionality

In a definitionally extensional type theory, any inhabitant of an identity type $p:{\mathrm{Id}}_{A}\left(x,y\right)$ induces a definitional equality between $x$ and $y$. In other words, we have an “equality reflection rule” of the form

$\frac{p:{\mathrm{Id}}_{A}\left(x,y\right)}{x\equiv y}$\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 $p$ is reflexivity rather than a nontrivial loop. However, we can derive this with the induction rule for identity types. Consider the dependent type

$\left(x:A\right),\left(y:A\right),\left(p:{\mathrm{Id}}_{A}\left(x,y\right)\right)\phantom{\rule{thickmathspace}{0ex}}⊢\phantom{\rule{thickmathspace}{0ex}}{\mathrm{Id}}_{{\mathrm{Id}}_{A}\left(x,y\right)}\left(p,\mathrm{refl}\left(x\right)\right).$(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 $p$ yields a definitional equality $x\equiv y$, so that we have $\mathrm{refl}\left(x\right):{\mathrm{Id}}_{A}\left(x,y\right)$. Moreover, substituting $x$ for $y$ and $\mathrm{refl}\left(x\right)$ for $p$ yields the type ${\mathrm{Id}}_{{\mathrm{Id}}_{A}\left(x,x\right)}\left(\mathrm{refl}\left(x\right),\mathrm{refl}\left(x\right)\right)$, which is inhabited by $\mathrm{refl}\left(\mathrm{refl}\left(x\right)\right)$.

Thus, by induction on identity, we have a term in the above type, witnessing a propositional equality between $p$ and $\mathrm{refl}\left(x\right)$. Finally, applying the equality reflection rule again, we get a definitional equality $p\equiv \mathrm{refl}\left(x\right)$.

###### 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. Definitionally extensional type theory is often presented in this form.

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

### Propositional extensionality

In a propositionally extensional type theory, we still distinguish definitional and propositional equality, but no two terms can be propositionally equal in more than one way (up to propositional equality). In the language of homotopy type theory, this means that all types are h-sets. There are a number of equivalent ways to force this to be true by adding axioms to type theory.

1. We can add as an axiom the “uniqueness of identity proofs” (axiom UIP) property that any two inhabitants of the same identity type ${\mathrm{Id}}_{A}\left(x,y\right)$ are themselves equal (in the corresponding higher identity type).

2. We can add Streicher’s axiom K which says that any inhabitant of a self-equality type ${\mathrm{Id}}_{A}\left(x,x\right)$ is (propositionally) equal to the identity/reflexivity equality ${1}_{x}$. (Axiom K is so named because $K$ comes after $J$, and $J$ usually denotes the eliminator for identity types.)

3. In the presence of dependent sum types, we can add an axiom saying that if $\left(a,{b}_{1}\right)$ and $\left(a,{b}_{2}\right)$ are pairs in a dependent sum ${\sum }_{x:A}B\left(x\right)$ with the same first component, and the identity type ${\mathrm{Id}}_{{\sum }_{x:A}B\left(x\right)}\left(\left(a,{b}_{1}\right),\left(a,{b}_{2}\right)\right)$ is inhabited, then so is ${\mathrm{Id}}_{a}\left({b}_{1},{b}_{2}\right)$.

4. We can allow definition of functions by a strong form of pattern matching, as in unmodified Agda. The relevant “extra strength” is to allow output types of a pattern match which are only well-defined after the pattern has been matched.

Propositionally extensional type theory has some of the attributes of intensional type theory, and many type theorists use “extensional type theory” to refer only to the definitional version.

I don’t want to unilaterally edit this page, but #3 above is fairly different than any of the others (except maybe #2), and it is pretty much the only one that I’ve ever heard type theorists talking about when they say “extensional type theory.” It is the difference between Martin-Löf’s intensional and extensional type theory. Intensional has the J eliminator, and extensional has the inference rule from propositional equality to judgmental equality.

Dependent pattern matching, K, uniqueness of identity proofs and the like don’t get you the equivalent of reflecting the propositions back into the judgments, and that is what makes extensional type theory in the eyes of type theorists (as far as I’ve encountered), not the dimension of the identity types. For instance, Agda is considered intensional despite having K, and even Observational Type Theory ala Conor McBride, which adds lots of extensionality axioms for various types, and eta-ish rules when possible, is still arguably intensional in this sense. And that is the whole point in OTT’s case, because the decidability issues (mentioned below) are tied to extensionality in the inference rule sense, not any homotopy sense.’

Also, I expect the bit about functional extensionality came from a discussion with me on n-cafe. But, it’s not really true that type theorists use ‘extensional type theory’ to refer to theories in which functional extensionality holds. I believe my point in that discussion was that ‘extensional equality type’ (or similar) suggested to me a type that reified the extensional equivalence (equality) relation of the type it was defined for (so, Eq A a b would have an inhabitant if a is extensionally equal to b of type A), and didn’t immediately suggest an identity type that was a homotopy proposition. For instance, the identity types in OTT reify extensional equality in this sense. And extensional type theories (for instance, NuPRL) typically incorporate this, because they can, whereas Agda (for instance) does not. HTT identity types are reifying extensional equality of functions, as well, and perhaps would work for coinductive types as well (whenever those get worked out).

But that is about my impression of “(extensional identity) type” not “extensional (identity type),” the latter of which might be an identity type in extensional type theory, which has little to do with what sort of relations it’s reifying.

— Dan Doel

Thanks for your suggestions; I’ve tried to incorporate some of them. If you want to discuss this more, I suggest opening a post at the nForum (and copying this query box there). You could join this discussion for instance.

– Mike Shulman

## Properties

### Decidability

Only the intensional, but not the extensional, Martin-Löf type theory is decidable. See intensional type theory for more on this.

## References

Among the most thorough recent treatments of extensional type theory are

• Ieke Moerdijk, E. Palmgren, Wellfounded trees in categories. Ann. Pure Appl. Logic, 104:189-218 (2000)

• Ieke Moerdijk, E. Palmgren, Type theories, toposes and constructive set theory: predicative aspects of AST, Ann. Pure Appl. Logic, 114:155-201, (2002)

Revised on November 30, 2012 00:58:53 by Urs Schreiber (82.169.65.155)