# 1.3 Universes and Families

So far, we have been using the expression$A$ is a type” informally. We are going to make this more precise by introducing . A universe is a type whose elements are types. As in naive set theory, we might wish for a universe of all types $\mathcal{U}_{\infty}$ including itself (that is, with $\mathcal{U}_{\infty}:\mathcal{U}_{\infty}$). However, as in set theory, this is unsound, i.e. we can deduce from it that every type, including the empty type representing the proposition False (see §1.7 (http://planetmath.org/17coproducttypes)), is inhabited. For instance, using a representation of sets as trees, we can directly encode Russell’s paradox [1].

To avoid the paradox we introduce a hierarchy of universes

 $\mathcal{U}_{0}:\mathcal{U}_{1}:\mathcal{U}_{2}:\cdots$

where every universe $\mathcal{U}_{i}$ is an element of the next universe $\mathcal{U}_{i+1}$. Moreover, we assume that our universes are cumulative, that is that all the elements of the $i^{\mathrm{th}}$ universe are also elements of the $(i+1)^{\mathrm{st}}$ universe, i.e. if $A:\mathcal{U}_{i}$ then also $A:\mathcal{U}_{i+1}$. This is convenient, but has the slightly unpleasant consequence that elements no longer have unique types, and is a bit tricky in other ways that need not concern us here; see the Notes.

When we say that $A$ is a type, we mean that it inhabits some universe $\mathcal{U}_{i}$. We usually want to avoid mentioning the level $i$ explicitly, and just assume that levels can be assigned in a consistent way; thus we may write $A:\mathcal{U}$ omitting the level. This way we can even write $\mathcal{U}:\mathcal{U}$, which can be read as $\mathcal{U}_{i}:\mathcal{U}_{i+1}$, having left the indices implicit. Writing universes in this style is referred to as typical ambiguity. It is convenient but a bit dangerous, since it allows us to write valid-looking proofs that reproduce the paradoxes of self-reference. If there is any doubt about whether an argument is correct, the way to check it is to try to assign levels consistently to all universes appearing in it. When some universe $\mathcal{U}$ is assumed, we may refer to types belonging to $\mathcal{U}$ as small types.

To model a collection of types varying over a given type $A$, we use functions $B:A\to\mathcal{U}$ whose codomain is a universe. These functions are called families of types (or sometimes dependent types); they correspond to families of sets as used in set theory.

An example of a type family is the family of finite sets $\mathsf{Fin}:\mathbb{N}\to\mathcal{U}$, where $\mathsf{Fin}(n)$ is a type with exactly $n$ elements. (We cannot define the family $\mathsf{Fin}$ yet — indeed, we have not even introduced its domain $\mathbb{N}$ yet — but we will be able to soon; see \autorefex:fin.) We may denote the elements of $\mathsf{Fin}(n)$ by $0_{n},1_{n},\dots,(n-1)_{n}$, with subscripts to emphasize that the elements of $\mathsf{Fin}(n)$ are different from those of $\mathsf{Fin}(m)$ if $n$ is different from $m$, and all are different from the ordinary natural numbers (which we will introduce in §1.9 (http://planetmath.org/19thenaturalnumbers)).

A more trivial (but very important) example of a type family is the constant type family at a type $B:\mathcal{U}$, which is of course the constant function $({\lambda}(x:A){.\,}B):A\to\mathcal{U}$.

As a non-example, in our version of type theory there is no type family “${\lambda}(i:\mathbb{N}){.\,}\mathcal{U}_{i}$”. Indeed, there is no universe large enough to be its codomain. Moreover, we do not even identify the indices $i$ of the universes $\mathcal{U}_{i}$ with the natural numbers $\mathbb{N}$ of type theory (the latter to be introduced in §1.9 (http://planetmath.org/19thenaturalnumbers)).

## References

• 1 Coquand,Thierry. The paradox of trees in type theory. BIT Numerical Mathematics, 32:10–14 1992
Title 1.3 Universes and Families 13UniversesAndFamilies 2013-11-12 21:01:43 2013-11-12 21:01:43 PMBookProject (1000683) rspuzio (6075) 11 PMBookProject (6075) Definition msc 03B15