zball

Typesetter 文档

Introduction

Homotopy type theory is a new branch of mathematics that combines aspects of several different fields in a surprising way. It is based on a recently discovered connection between homotopy theory and type theory. Homotopy theory is an outgrowth of algebraic topology and homological algebra, with relationships to higher category theory; while type theory is a branch of mathematical logic and theoretical computer science. Although the connections between the two are currently the focus of intense investigation, it is increasingly clear that they are just the beginning of a subject that will take more time and more hard work to fully understand. It touches on topics as seemingly distant as the homotopy groups of spheres, the algorithms for type checking, and the definition of weak $oo$-groupoids.

Homotopy type theory also brings new ideas into the very foundation of mathematics. On the one hand, there is Voevodsky's subtle and beautiful univalence axiom. The univalence axiom implies, in particular, that isomorphic structures can be identified, a principle that mathematicians have been happily using on workdays, despite its incompatibility with the “official” doctrines of conventional foundations. On the other hand, we have higher inductive types, which provide direct, logical descriptions of some of the basic spaces and constructions of homotopy theory: spheres, cylinders, truncations, localizations, etc. Both ideas are impossible to capture directly in classical set-theoretic foundations, but when combined in homotopy type theory, they permit an entirely new kind of “logic of homotopy types”.

This suggests a new conception of foundations of mathematics, with intrinsic homotopical content, an “invariant” conception of the objects of mathematics — and convenient machine implementations, which can serve as a practical aid to the working mathematician. This is the Univalent Foundations program. The present book is intended as a first systematic exposition of the basics of univalent foundations, and a collection of examples of this new style of reasoning — but without requiring the reader to know or learn any formal logic, or to use any computer proof assistant.

We emphasize that homotopy type theory is a young field, and univalent foundations is very much a work in progress. This book should be regarded as a “snapshot” of just one portion of the field, taken at the time it was written, rather than a polished exposition of a completed edifice. As we will discuss briefly later, there are many aspects of homotopy type theory that are not yet fully understood — and some that are not even touched upon here. The ultimate theory will almost certainly not look exactly like the one described in this book, but it will surely be at least as capable and powerful; we therefore believe that univalent foundations will eventually become a viable alternative to set theory as the “implicit foundation” for the unformalized mathematics done by most mathematicians.

Type theory

Type theory was originally invented by Bertrand Russell [1], as a device for blocking the paradoxes in the logical foundations of mathematics that were under investigation at the time. It was developed further by many people over the next few decades, particularly Church [2, 3] who combined it with his $lambda$-calculus. Although it is not generally regarded as the foundation for classical mathematics, set theory being more customary, type theory still has numerous applications, especially in computer science and the theory of programming languages [4]. Per Martin-L"of [5, 6, 7, 8], among others, developed a “predicative” modification of Church's type system, which is now usually called dependent, constructive, intuitionistic, or simply Martin–L"of type theory. This is the basis of the system that we consider here; it was originally intended as a rigorous framework for the formalization of constructive mathematics. In what follows, we will often use “type theory” to refer specifically to this system and similar ones, although type theory as a subject is much broader (see [9, 10] for the history of type theory).

In type theory, unlike set theory, objects are classified using a primitive notion of type, similar to the data-types used in programming languages. These elaborately structured types can be used to express detailed specifications of the objects classified, giving rise to principles of reasoning about these objects. To take a very simple example, the objects of a product type $A times B$ are known to be of the form $(a,b)$, and so one automatically knows how to construct them and how to decompose them. Similarly, an object of function type $A -> B$ can be acquired from an object of type $B$ parametrized by objects of type $A$, and can be evaluated at an argument of type $A$. This rigidly predictable behavior of all objects (as opposed to set theory's more liberal formation principles, allowing inhomogeneous sets) is one aspect of type theory that has led to its extensive use in verifying the correctness of computer programs. The clear reasoning principles associated with the construction of types also form the basis of modern computer proof assistants, which are used for formalizing mathematics and verifying the correctness of formalized proofs. We return to this aspect of type theory below.

One problem in understanding type theory from a mathematical point of view, however, has always been that the basic concept of type is unlike that of set in ways that have been hard to make precise. We believe that the new idea of regarding types, not as strange sets (perhaps constructed without using classical logic), but as spaces, viewed from the perspective of homotopy theory, is a significant step forward. In particular, it solves the problem of understanding how the notion of equality of elements of a type differs from that of elements of a set.

In homotopy theory one is concerned with spaces and continuous mappings between them, up to homotopy. A homotopy between a pair of continuous maps $f : X -> Y$ and $g : X -> Y$ is a continuous map $H : X times [0, 1] -> Y$ satisfying $H(x, 0) = f (x)$ and $H(x, 1) = g(x)$. The homotopy $H$ may be thought of as a “continuous deformation” of $f$ into $g$. The spaces $X$ and $Y$ are said to be homotopy equivalent, $X simeq Y$, if there are continuous maps going back and forth, the composites of which are homotopical to the respective identity mappings, i.e., if they are isomorphic “up to homotopy”. Homotopy equivalent spaces have the same algebraic invariants (e.g., homology, or the fundamental group), and are said to have the same homotopy type.

Homotopy type theory

Homotopy type theory (HoTT) interprets type theory from a homotopical perspective. In homotopy type theory, we regard the types as “spaces” (as studied in homotopy theory) or higher groupoids, and the logical constructions (such as the product $A times B$) as homotopy-invariant constructions on these spaces. In this way, we are able to manipulate spaces directly without first having to develop point-set topology (or any combinatorial replacement for it, such as the theory of simplicial sets). To briefly explain this perspective, consider first the basic concept of type theory, namely that the term $a$ is of type $A$, which is written:

$ a:A. $

This expression is traditionally thought of as akin to:

$a$ is an element of the set $A$”.

However, in homotopy type theory we think of it instead as:

$a$ is a point of the space $A$”.

Similarly, every function $f : A -> B$ in type theory is regarded as a continuous map from the space $A$ to the space $B$.

We should stress that these “spaces” are treated purely homotopically, not topologically. For instance, there is no notion of “open subset” of a type or of “convergence” of a sequence of elements of a type. We only have “homotopical” notions, such as paths between points and homotopies between paths, which also make sense in other models of homotopy theory (such as simplicial sets). Thus, it would be more accurate to say that we treat types as $oo$-groupoids; this is a name for the “invariant objects” of homotopy theory which can be presented by topological spaces, simplicial sets, or any other model for homotopy theory. However, it is convenient to sometimes use topological words such as “space” and “path”, as long as we remember that other topological concepts are not applicable.

(It is tempting to also use the phrase homotopy type for these objects, suggesting the dual interpretation of “a type (as in type theory) viewed homotopically” and “a space considered from the point of view of homotopy theory”. The latter is a bit different from the classical meaning of “homotopy type” as an equivalence class of spaces modulo homotopy equivalence, although it does preserve the meaning of phrases such as “these two spaces have the same homotopy type”.)

The idea of interpreting types as structured objects, rather than sets, has a long pedigree, and is known to clarify various mysterious aspects of type theory. For instance, interpreting types as sheaves helps explain the intuitionistic nature of type-theoretic logic, while interpreting them as partial equivalence relations or “domains” helps explain its computational aspects. It also implies that we can use type-theoretic reasoning to study the structured objects, leading to the rich field of categorical logic. The homotopical interpretation fits this same pattern: it clarifies the nature of identity (or equality) in type theory, and allows us to use type-theoretic reasoning in the study of homotopy theory.

The key new idea of the homotopy interpretation is that the logical notion of identity $a = b$ of two objects $a, b: A$ of the same type $A$ can be understood as the existence of a path $p : a -> b$ from point $a$ to point $b$ in the space $A$. This also means that two functions $f, g: A -> B$ can be identified if they are homotopic, since a homotopy is just a (continuous) family of paths $p_x: f(x) -> g(x)$ in $B$, one for each $x:A$. In type theory, for every type $A$ there is a (formerly somewhat mysterious) type $Id(v,a)rA$ of identifications of two objects of $A$; in homotopy type theory, this is just the path space $A^I$ of all continuous maps $I -> A$ from the unit interval. In this way, a term $p : Id_(A)(a,b)$ represents a path $p : a -> b$ in $A$.

The idea of homotopy type theory arose around 2006 in independent work by Awodey and Warren [11] and Voevodsky [12], but it was inspired by Hofmann and Streicher's earlier groupoid interpretation [13]. Indeed, higher-dimensional category theory (particularly the theory of weak $oo$-groupoids) is now known to be intimately connected to homotopy theory, as proposed by Grothendieck and now being studied intensely by mathematicians of both sorts. The original semantic models of Awodey–Warren and Voevodsky use well-known notions and techniques from homotopy theory which are now also in use in higher category theory, such as Quillen model categories and Kan simplicial sets.

In particular, Voevodsky constructed an interpretation of type theory in Kan simplicial sets, and recognized that this interpretation satisfied a further crucial property which he dubbed univalence. This had not previously been considered in type theory (although Church's principle of extensionality for propositions turns out to be a very special case of it, and Hofmann and Streicher had considered another special case under the name “universe extensionality”). Adding univalence to type theory in the form of a new axiom has far-reaching consequences, many of which are natural, simplifying and compelling. The univalence axiom also further strengthens the homotopical view of type theory, since it holds in the simplicial model and other related models, while failing under the view of types as sets.

Univalent foundations

Very briefly, the basic idea of the univalence axiom can be explained as follows. In type theory, one can have a type whose elements are themselves types; such a type is called a universe and is usually denoted by $U$. Those types that are terms of $U$ are commonly called small types. Like any type, $U$ has an identity type $Id(v,a)rU$, which expresses the identity relation $A = B$ between small types. Thinking of types as spaces, $U$ is a space, the points of which are spaces; to understand its identity type, we must ask, what is a path $p : A -> B$ between spaces in $U$? The univalence axiom says that such paths correspond to homotopy equivalences $A simeq B$, (roughly) as explained above. A bit more precisely, given any (small) types $A$ and $B$, in addition to the primitive type $Id_(U)(A,B)$ of identifications of $A$ with $B$, there is the defined type $Equiv(A,B)$ of equivalences from $A$ to $B$. Since the identity map on any object is an equivalence, there is a canonical map,

$ Id_(U)(A,B) -> Equiv(A,B). $

The univalence axiom states that this map is itself an equivalence. At the risk of oversimplifying, we can state this succinctly as follows:

  • Univalence Axiom: $(A = B) simeq (A simeq B)$.

In other words, identity is equivalent to equivalence. In particular, one may say that “equivalent types are identical”. However, this phrase is somewhat misleading, since it may sound like a sort of “skeletality” condition which collapses the notion of equivalence to coincide with identity, whereas in fact univalence is about expanding the notion of identity so as to coincide with the (unchanged) notion of equivalence.

From the homotopical point of view, univalence implies that spaces of the same homotopy type are connected by a path in the universe $U$, in accord with the intuition of a classifying space for (small) spaces. From the logical point of view, however, it is a radically new idea: it says that isomorphic things can be identified! Mathematicians are of course used to identifying isomorphic structures in practice, but they generally do so by “abuse of notation”, or some other informal device, knowing that the objects involved are not “really” identical. But in this new foundational scheme, such structures can be formally identified, in the logical sense that every property or construction involving one also applies to the other. Indeed, the identification is now made explicit, and properties and constructions can be systematically transported along it. Moreover, the different ways in which such identifications may be made themselves form a structure that one can (and should!) take into account.

Thus in sum, for points $A$ and $B$ of the universe $U$ (i.e., small types), the univalence axiom identifies the following three notions:

  • (logical) an identification $p:A=B$ of $A$ and $B$
  • (topological) a path $p:A -> B$ from $A$ to $B$ in $U$
  • (homotopical) an equivalence $p:A simeq B$ between $A$ and $B$.

Higher inductive types

One of the classical advantages of type theory is its simple and effective techniques for working with inductively defined structures. The simplest nontrivial inductively defined structure is the natural numbers, which is inductively generated by zero and the successor function. From this statement one can algorithmically extract the principle of mathematical induction, which characterizes the natural numbers. More general inductive definitions encompass lists and well-founded trees of all sorts, each of which is characterized by a corresponding “induction principle”. This includes most data structures used in certain programming languages; hence the usefulness of type theory in formal reasoning about the latter. If conceived in a very general sense, inductive definitions also include examples such as a disjoint union $A+B$, which may be regarded as “inductively” generated by the two injections $A -> A+B$ and $B -> A+B$. The “induction principle” in this case is “proof by case analysis”, which characterizes the disjoint union.

In homotopy theory, it is natural to consider also “inductively defined spaces” which are generated not merely by a collection of points, but also by collections of paths and higher paths. Classically, such spaces are called CW complexes. For instance, the circle $S^1$ is generated by a single point and a single path from that point to itself. Similarly, the 2-sphere $S^2$ is generated by a single point $b$ and a single two-dimensional path from the constant path at $b$ to itself, while the torus $T^2$ is generated by a single point, two paths $p$ and $q$ from that point to itself, and a two-dimensional path from $p dot q$ to $q dot p$.

By using the identification of paths with identities in homotopy type theory, these sort of “inductively defined spaces” can be characterized in type theory by “induction principles”, entirely analogously to classical examples such as the natural numbers and the disjoint union. The resulting higher inductive types give a direct “logical” way to reason about familiar spaces such as spheres, which (in combination with univalence) can be used to perform familiar arguments from homotopy theory, such as calculating homotopy groups of spheres, in a purely formal way. The resulting proofs are a marriage of classical homotopy-theoretic ideas with classical type-theoretic ones, yielding new insight into both disciplines.

Moreover, this is only the tip of the iceberg: many abstract constructions from homotopy theory, such as homotopy colimits, suspensions, Postnikov towers, localization, completion, and spectrification, can also be expressed as higher inductive types. Many of these are classically constructed using Quillen's “small object argument”, which can be regarded as a finite way of algorithmically describing an infinite CW complex presentation of a space, just as “zero and successor” is a finite algorithmic description of the infinite set of natural numbers. Spaces produced by the small object argument are infamously complicated and difficult to understand; the type-theoretic approach is potentially much simpler, bypassing the need for any explicit construction by giving direct access to the appropriate “induction principle”. Thus, the combination of univalence and higher inductive types suggests the possibility of a revolution, of sorts, in the practice of homotopy theory.

Sets in univalent foundations

We have claimed that univalent foundations can eventually serve as a foundation for “all” of mathematics, but so far we have discussed only homotopy theory. Of course, there are many specific examples of the use of type theory without the new homotopy type theory features to formalize mathematics, such as the recent formalization of the Feit–Thompson odd-order theorem in Coq [14].

But the traditional view is that mathematics is founded on set theory, in the sense that all mathematical objects and constructions can be coded into a theory such as Zermelo–Fraenkel set theory (ZF). However, it is well-established by now that for most mathematics outside of set theory proper, the intricate hierarchical membership structure of sets in ZF is really unnecessary: a more “structural” theory, such as Lawvere's Elementary Theory of the Category of Sets [15], suffices.

In univalent foundations, the basic objects are “homotopy types” rather than sets, but we can define a class of types which behave like sets. Homotopically, these can be thought of as spaces in which every connected component is contractible, i.e. those which are homotopy equivalent to a discrete space. It is a theorem that the category of such “sets” satisfies Lawvere's axioms (or related ones, depending on the details of the theory). Thus, any sort of mathematics that can be represented in an ETCS-like theory (which, experience suggests, is essentially all of mathematics) can equally well be represented in univalent foundations.

This supports the claim that univalent foundations is at least as good as existing foundations of mathematics. A mathematician working in univalent foundations can build structures out of sets in a familiar way, with more general homotopy types waiting in the foundational background until there is need of them. For this reason, most of the applications in this book have been chosen to be areas where univalent foundations has something new to contribute that distinguishes it from existing foundational systems.

Unsurprisingly, homotopy theory and category theory are two of these, but perhaps less obvious is that univalent foundations has something new and interesting to offer even in subjects such as set theory and real analysis. For instance, the univalence axiom allows us to identify isomorphic structures, while higher inductive types allow direct descriptions of objects by their universal properties. Thus we can generally avoid resorting to arbitrarily chosen representatives or transfinite iterative constructions. In fact, even the objects of study in ZF set theory can be characterized, inside the sets of univalent foundations, by such an inductive universal property.

Informal type theory

One difficulty often encountered by the classical mathematician when faced with learning about type theory is that it is usually presented as a fully or partially formalized deductive system. This style, which is very useful for proof-theoretic investigations, is not particularly convenient for use in applied, informal reasoning. Nor is it even familiar to most working mathematicians, even those who might be interested in foundations of mathematics. One objective of the present work is to develop an informal style of doing mathematics in univalent foundations that is at once rigorous and precise, but is also closer to the language and style of presentation of everyday mathematics.

In present-day mathematics, one usually constructs and reasons about mathematical objects in a way that could in principle, one presumes, be formalized in a system of elementary set theory, such as ZFC — at least given enough ingenuity and patience. For the most part, one does not even need to be aware of this possibility, since it largely coincides with the condition that a proof be “fully rigorous” (in the sense that all mathematicians have come to understand intuitively through education and experience). But one does need to learn to be careful about a few aspects of “informal set theory”: the use of collections too large or inchoate to be sets; the axiom of choice and its equivalents; even (for undergraduates) the method of proof by contradiction; and so on. Adopting a new foundational system such as homotopy type theory as the implicit formal basis of informal reasoning will require adjusting some of one's instincts and practices. The present text is intended to serve as an example of this “new kind of mathematics”, which is still informal, but could now in principle be formalized in homotopy type theory, rather than ZFC, again given enough ingenuity and patience.

It is worth emphasizing that, in this new system, such formalization can have real practical benefits. The formal system of type theory is suited to computer systems and has been implemented in existing proof assistants. A proof assistant is a computer program which guides the user in construction of a fully formal proof, only allowing valid steps of reasoning. It also provides some degree of automation, can search libraries for existing theorems, and can even extract numerical algorithms from the resulting (constructive) proofs.

We believe that this aspect of the univalent foundations program distinguishes it from other approaches to foundations, potentially providing a new practical utility for the working mathematician. Indeed, proof assistants based on older type theories have already been used to formalize substantial mathematical proofs, such as the four-color theorem and the Feit–Thompson theorem. Computer implementations of univalent foundations are presently works in progress (like the theory itself). However, even its currently available implementations (which are mostly small modifications to existing proof assistants such as Coq and Agda) have already demonstrated their worth, not only in the formalization of known proofs, but in the discovery of new ones. Indeed, many of the proofs described in this book were actually first done in a fully formalized form in a proof assistant, and are only now being “unformalized” for the first time — a reversal of the usual relation between formal and informal mathematics.

One can imagine a not-too-distant future when it will be possible for mathematicians to verify the correctness of their own papers by working within the system of univalent foundations, formalized in a proof assistant, and that doing so will become as natural as typesetting their own papers in ⟨TeX⟩.

In principle, this could be equally true for any other foundational system, but we believe it to be more practically attainable using univalent foundations, as witnessed by the present work and its formal counterpart.

Constructivity

One of the most striking differences between classical foundations and type theory is the idea of proof relevance, according to which mathematical statements, and even their proofs, become first-class mathematical objects. In type theory, we represent mathematical statements by types, which can be regarded simultaneously as both mathematical constructions and mathematical assertions, a conception also known as propositions as types. Accordingly, we can regard a term $a : A$ as both an element of the type $A$ (or in homotopy type theory, a point of the space $A$), and at the same time, a proof of the proposition $A$. To take an example, suppose we have sets $A$ and $B$ (discrete spaces), and consider the statement “$A$ is isomorphic to $B$”. In type theory, this can be rendered as:

$ Iso(A,B) := Sigma_((f : A -> B))g : B -> A((Pi_((x:A)) g(f(x)) = x) times (Pi_((y:B)) f(g(y)) = y)). $

Reading the type constructors $Sigma, Pi, times$ here as “there exists”, “for all”, and “and” respectively yields the usual formulation of “$A$ and $B$ are isomorphic”; on the other hand, reading them as sums and products yields the type of all isomorphisms between $A$ and $B$! To prove that $A$ and $B$ are isomorphic, one constructs a proof $p : Iso(A,B)$, which is therefore the same as constructing an isomorphism between $A$ and $B$, i.e., exhibiting a pair of functions $f, g$ together with proofs that their composites are the respective identity maps. The latter proofs, in turn, are nothing but homotopies of the appropriate sorts. In this way, proving a proposition is the same as constructing an element of some particular type. In particular, to prove a statement of the form “$A$ and $B$” is just to prove $A$ and to prove $B$, i.e., to give an element of the type $A times B$. And to prove that $A$ implies $B$ is just to find an element of $A -> B$, i.e. a function from $A$ to $B$ (determining a mapping of proofs of $A$ to proofs of $B$).

The logic of propositions-as-types is flexible and supports many variations, such as using only a subclass of types to represent propositions. In homotopy type theory, there are natural such subclasses arising from the fact that the system of all types, just like spaces in classical homotopy theory, is “stratified” according to the dimensions in which their higher homotopy structure exists or collapses. In particular, Voevodsky has found a purely type-theoretic definition of homotopy $n$-types, corresponding to spaces with no nontrivial homotopy information above dimension $n$. (The $0$-types are the “sets” mentioned previously as satisfying Lawvere's axioms.) Moreover, with higher inductive types, we can universally “truncate” a type into an $n$-type; in classical homotopy theory this would be its $n^(th)$ Postnikov section. Particularly important for logic is the case of homotopy $(-1)$-types, which we call mere propositions. Classically, every $(-1)$-type is empty or contractible; we interpret these possibilities as the truth values “false” and “true” respectively.

Using all types as propositions yields a very “constructive” conception of logic; for more on this, see [16, 17, 18]. For instance, every proof that something exists carries with it enough information to actually find such an object; and every proof that “$A$ or $B$” holds is either a proof that $A$ holds or a proof that $B$ holds. Thus, from every proof we can automatically extract an algorithm; this can be very useful in applications to computer programming.

On the other hand, however, this logic does diverge from the traditional understanding of existence proofs in mathematics. In particular, it does not faithfully represent certain important classical principles of reasoning, such as the axiom of choice and the law of excluded middle. For these we need to use the “$(-1)$-truncated” logic, in which only the homotopy $(-1)$-types represent propositions.

More specifically, consider on one hand the axiom of choice: “if for every $x: A$ there exists a $y:B$ such that $R(x,y)$, there is a function $f : A -> B$ such that for all $x:A$ we have $R(x, f(x))$.” The pure propositions-as-types notion of “there exists” is strong enough to make this statement simply provable — yet it does not have all the consequences of the usual axiom of choice. However, in $(-1)$-truncated logic, this statement is not automatically true, but is a strong assumption with the same sorts of consequences as its counterpart in classical set theory.

On the other hand, consider the law of excluded middle: “for all $A$, either $A$ or not $A$.” Interpreting this in the pure propositions-as-types logic yields a statement that is inconsistent with the univalence axiom. For since proving “$A$” means exhibiting an element of it, this assumption would give a uniform way of selecting an element from every nonempty type — a sort of Hilbertian choice operator. Univalence implies that the element of $A$ selected by such a choice operator must be invariant under all self-equivalences of $A$, since these are identified with self-identities and every operation must respect identity; but clearly some types have automorphisms with no fixed points, e.g. we can swap the elements of a two-element type. However, the “$(-1)$-truncated law of excluded middle”, though also not automatically true, may consistently be assumed with most of the same consequences as in classical mathematics.

In other words, while the pure propositions-as-types logic is “constructive” in the strong algorithmic sense mentioned above, the default $(-1)$-truncated logic is “constructive” in a different sense (namely, that of the logic formalized by Heyting under the name “intuitionistic”); and to the latter we may freely add the axioms of choice and excluded middle to obtain a logic that may be called “classical”. Thus, homotopy type theory is compatible with both constructive and classical conceptions of logic, and many more besides. Indeed, the homotopical perspective reveals that classical and constructive logic can coexist, as endpoints of a spectrum of different systems, with an infinite number of possibilities in between (the homotopy $n$-types for $-1 < n < oo$). We may speak of “⟨mathsf⟩LEMn” and “⟨mathsf⟩ACn”, with $AC_(oo)$ being provable and ⟨mathsf⟩LEM_⟨infty⟩ inconsistent with univalence, while $AC_(-1)$ and $LEM_(-1)$ are the versions familiar to classical mathematicians (hence in most cases it is appropriate to assume the subscript $(-1)$ when none is given). Indeed, one can even have useful systems in which only certain types satisfy such further “classical” principles, while types in general remain “constructive”.

It is worth emphasizing that univalent foundations does not require the use of constructive or intuitionistic logic. Most of classical mathematics which depends on the law of excluded middle and the axiom of choice can be performed in univalent foundations, simply by assuming that these two principles hold (in their proper, $(-1)$-truncated, form). However, type theory does encourage avoiding these principles when they are unnecessary, for several reasons.

First of all, every mathematician knows that a theorem is more powerful when proven using fewer assumptions, since it applies to more examples. The situation with ⟨mathsf⟩AC_ and ⟨mathsf⟩LEM_ is no different: type theory admits many interesting “nonstandard” models, such as in sheaf toposes, where classicality principles such as ⟨mathsf⟩AC_ and ⟨mathsf⟩LEM_ tend to fail. Homotopy type theory admits similar models in higher toposes, such as are studied in [19, 20, 21]. Thus, if we avoid using these principles, the theorems we prove will be valid internally to all such models.

Secondly, one of the additional virtues of type theory is its computable character. In addition to being a foundation for mathematics, type theory is a formal theory of computation, and can be treated as a powerful programming language. From this perspective, the rules of the system cannot be chosen arbitrarily the way set-theoretic axioms can: there must be a harmony between them which allows all proofs to be “executed” as programs. We do not yet fully understand the new principles introduced by homotopy type theory, such as univalence and higher inductive types, from this point of view, but the basic outlines are emerging; see, for example, [22]. It has been known for a long time, however, that principles such as ⟨mathsf⟩AC_ and ⟨mathsf⟩LEM_ are fundamentally antithetical to computability, since they assert baldly that certain things exist without giving any way to compute them. Thus, avoiding them is necessary to maintain the character of type theory as a theory of computation.

Fortunately, constructive reasoning is not as hard as it may seem. In some cases, simply by rephrasing some definitions, a theorem can be made constructive and its proof more elegant. Moreover, in univalent foundations this seems to happen more often. For instance:

  1. In set-theoretic foundations, at various points in homotopy theory and category theory one needs the axiom of choice to perform transfinite constructions. But with higher inductive types, we can encode these constructions directly and constructively. In particular, none of the “synthetic” homotopy theory in ?? requires ⟨mathsf⟩LEM_ or ⟨mathsf⟩AC_.
  2. In set-theoretic foundations, the statement “every fully faithful and essentially surjective functor is an equivalence of categories” is equiv-a-lent to the axiom of choice. But with the univalence axiom, it is just true; see ??.
  3. In set theory, various circumlocutions are required to obtain notions of “cardinal number” and “ordinal number” which canonically represent isomorphism classes of sets and well-ordered sets, respectively — possibly involving the axiom of choice or the axiom of foundation. But with univalence and higher inductive types, we can obtain such representatives directly by truncating the universe; see ??.
  4. In set-theoretic foundations, the definition of the real numbers as equivalence classes of Cauchy sequences requires either the law of excluded middle or the axiom of (countable) choice to be well-behaved. But with higher inductive types, we can give a version of this definition which is well-behaved and avoids any choice principles; see ??.

Of course, these simplifications could as well be taken as evidence that the new methods will not, ultimately, prove to be really constructive. However, we emphasize again that the reader does not have to care, or worry, about constructivity in order to read this book. The point is that in all of the above examples, the version of the theory we give has independent advantages, whether or not ⟨mathsf⟩LEM_ and ⟨mathsf⟩AC_ are assumed to be available. Constructivity, if attained, will be an added bonus.

Given this discussion of adding new principles such as univalence, higher inductive types, ⟨mathsf⟩AC, and ⟨mathsf⟩LEM, one may wonder whether the resulting system remains consistent. (One of the original virtues of type theory, relative to set theory, was that it can be seen to be consistent by proof-theoretic means). As with any foundational system, consistency is a relative question: “consistent with respect to what?” The short answer is that all of the constructions and axioms considered in this book have a model in the category of Kan complexes, due to Voevodsky [23] (see [24] for higher inductive types). Thus, they are known to be consistent relative to ZFC (with as many inaccessible cardinals

as we need nested univalent universes). Giving a more traditionally type-theoretic account of this consistency is work in progress (see, e.g., [22, 25]).

We summarize the different points of view of the type-theoretic operations in ??.

TypesLogicSetsHomotopy
$A$propositionsetspace
$a:A$proofelementpoint
$B(x)$predicatefamily of setsfibration
$b(x) : B(x)$conditional prooffamily of elementssection
$0, 1$$⊥, ⊤$$∅, { ∅ }$$∅, *$
$A + B$$A ∨ B$disjoint unioncoproduct
$A times B$$A ∧ B$set of pairsproduct space
$A -> B$$A ⇒ B$set of functionsfunction space
$Sigma_((x:A))B(x)$$exists_(x:A)B(x)$disjoint sumtotal space
$Pi_((x:A))B(x)$$forall_(x:A)B(x)$productspace of sections
$Id_(A)$equality $=$$(x,x) | x ∈ A$x ∈ A$| path space$

Comparing points of view on type-theoretic operations <tab-pov>

Open problems

For those interested in contributing to this new branch of mathematics, it may be encouraging to know that there are many interesting open questions.

Perhaps the most pressing of them is the “constructivity” of the Univalence Axiom, posed by Voevodsky in [26]. The basic system of type theory follows the structure of Gentzen's natural deduction. Logical connectives are defined by their introduction rules, and have elimination rules justified by computation rules. Following this pattern, and using Tait's computability method, originally designed to analyse G"odel's Dialectica interpretation, one can show the property of normalization for type theory. This in turn implies important properties such as decidability of type-checking (a crucial property since type-checking corresponds to proof-checking, and one can argue that we should be able to “recognize a proof when we see one”), and the so-called “canonicity property” that any closed term of the type of natural numbers reduces to a numeral. This last property, and the uniform structure of introduction/elimination rules, are lost when one extends type theory with an axiom, such as the axiom of function extensionality, or the univalence axiom. Voevodsky has formulated a precise mathematical conjecture connected to this question of canonicity for type theory extended with the axiom of Univalence: given a closed term of the type of natural numbers, is it always possible to find a numeral and a proof that this term is equal to this numeral, where this proof of equality may itself use the univalence axiom? More generally, an important issue is whether it is possible to provide a constructive justification of the univalence axiom. What about if one adds other homotopically motivated constructions, like higher inductive types? These questions remain open at the present time, although methods are currently being developed to try to find answers.

Another basic issue is the difficulty of working with types, such as the natural numbers, that are essentially sets (i.e., discrete spaces), containing only trivial paths. At present, homotopy type theory can really only characterize spaces up to homotopy equivalence, which means that these “discrete spaces” may only be homotopy equivalent to discrete spaces. Type-theoretically, this means there are many paths that are equal to reflexivity, but not judgmentally equal to it (see ?? for the meaning of “judgmentally”). While this homotopy-invariance has advantages, these “meaningless” identity terms do introduce needless complications into arguments and constructions, so it would be convenient to have a systematic way of eliminating or collapsing them.

A more specialized, but no less important, problem is the relation between homotopy type theory and the research on higher toposes currently happening at the intersection of higher category theory and homotopy theory. There is a growing conviction among those familiar with both subjects that they are intimately connected. For instance, the notion of a univalent universe should coincide with that of an object classifier, while higher inductive types should be an “elementary” reflection of local presentability. More generally, homotopy type theory should be the “internal language” of $(oo,1)$-toposes, just as intuitionistic higher-order logic is the internal language of ordinary 1-toposes. Despite this general consensus, however, details remain to be worked out — in particular, questions of coherence and strictness remain to be addressed — and doing so will undoubtedly lead to further insights into both concepts.

But by far the largest field of work to be done is in the ongoing formalization of everyday mathematics in this new system. Recent successes in formalizing some facts from basic homotopy theory and category theory have been encouraging; some of these are described in ??. Obviously, however, much work remains to be done.

The homotopy type theory community maintains a web site and group blog at http://homotopytypetheory.org, as well as a discussion email list. Newcomers are always welcome!

How to read this book

This book is divided into two parts. ??, “Foundations”, develops the fundamental concepts of homotopy type theory. This is the mathematical foundation on which the development of specific subjects is built, and which is required for the understanding of the univalent foundations approach. To a programmer, this is “library code”. Since univalent foundations is a new and different kind of mathematics, its basic notions take some getting used to; thus ?? is fairly extensive.

??, “Mathematics”, consists of four chapters that build on the basic notions of ?? to exhibit some of the new things we can do with univalent foundations in four different areas of mathematics: homotopy theory (??), category theory (??), set theory (??), and real analysis (??). The chapters in ?? are more or less independent of each other, although occasionally one will use a lemma proven in another.

A reader who wants to seriously understand univalent foundations, and be able to work in it, will eventually have to read and understand most of ??. However, a reader who just wants to get a taste of univalent foundations and what it can do may understandably balk at having to work through over 200 pages before getting to the “meat” in ??. Fortunately, not all of ?? is necessary in order to read the chapters in ??. Each chapter in ?? begins with a brief overview of its subject, what univalent foundations has to contribute to it, and the necessary background from ??, so the courageous reader can turn immediately to the appropriate chapter for their favorite subject. For those who want to understand one or more chapters in ?? more deeply than this, but are not ready to read all of ??, we provide here a brief summary of ??, with remarks about which parts are necessary for which chapters in ??.

?? is about the basic notions of type theory, prior to any homotopical interpretation. A reader who is familiar with Martin-L"of type theory can quickly skim it to pick up the particulars of the theory we are using. However, readers without experience in type theory will need to read ??, as there are many subtle differences between type theory and other foundations such as set theory.

?? introduces the homotopical viewpoint on type theory, along with the basic notions supporting this view, and describes the homotopical behavior of each component of the type theory from ??. It also introduces the univalence axiom (??) — the first of the two basic innovations of homotopy type theory. Thus, it is quite basic and we encourage everyone to read it, especially ⟨crefrange⟩sec:equalitysec:basics-equivalences.

?? describes how we represent logic in homotopy type theory, and its connection to classical logic as well as to constructive and intuitionistic logic. Here we define the law of excluded middle, the axiom of choice, and the axiom of propositional resizing (although, for the most part, we do not need to assume any of these in the rest of the book), as well as the propositional truncation which is essential for representing traditional logic. This chapter is essential background for ??, less important for ??, and not so necessary for ??.

?? study two special topics in detail: equivalences (and related notions) and generalized inductive definitions. While these are important subjects in their own rights and provide a deeper understanding of homotopy type theory, for the most part they are not necessary for ??. Only a few lemmas from ?? are used here and there, while the general discussions in ?? are helpful for providing the intuition required for ??. The generalized sorts of inductive definition discussed in ?? are also used in a few places in ??.

?? introduces the second basic innovation of homotopy type theory — higher inductive types — with many examples. Higher inductive types are the primary object of study in ??, and some particular ones play important roles in ??. They are not so necessary for ??, although one example is used in ??.

Finally, ?? discusses homotopy $n$-types and related notions such as $n$-connected types. These notions are important for ??, but not so important in the rest of ??, although the case $n=-1$ of some of the lemmas are used in ??.

This completes ??. As mentioned above, ?? consists of four largely unrelated chapters, each describing what univalent foundations has to offer to a particular subject.

Of the chapters in ??, ?? (Homotopy theory) is perhaps the most radical. Univalent foundations has a very different “synthetic” approach to homotopy theory in which homotopy types are the basic objects (namely, the types) rather than being constructed using topological spaces or some other set-theoretic model. This enables new styles of proof for classical theorems in algebraic topology, of which we present a sampling, from $pi_1(Sn^1)=Z$ to the Freudenthal suspension theorem.

In ?? (Category theory), we develop some basic (1-)category theory, adhering to the principle of the univalence axiom that equality is isomorphism. This has the pleasant effect of ensuring that all definitions and constructions are automatically invariant under equivalence of categories: indeed, equivalent categories are equal just as equivalent types are equal. (It also has connections to higher category theory and higher topos theory.)

?? (Set theory) studies sets in univalent foundations. The category of sets has its usual properties, hence provides a foundation for any mathematics that doesn't need homotopical or higher-categorical structures. We also observe that univalence makes cardinal and ordinal numbers a bit more pleasant, and that higher inductive types yield a cumulative hierarchy satisfying the usual axioms of Zermelo–Fraenkel set theory.

In ?? (Real numbers), we summarize the construction of Dedekind real numbers, and then observe that higher inductive types allow a definition of Cauchy real numbers that avoids some associated problems in constructive mathematics. Then we sketch a similar approach to Conway's surreal numbers.

Each chapter in this book ends with a Notes section, which collects historical comments, references to the literature, and attributions of results, to the extent possible. We have also included Exercises at the end of each chapter, to assist the reader in gaining familiarity with doing mathematics in univalent foundations.

Finally, recall that this book was written as a massively collaborative effort by a large number of people. We have done our best to achieve consistency in terminology and notation, and to put the mathematics in a linear sequence that flows logically, but it is very likely that some imperfections remain. We ask the reader's forgiveness for any such infelicities, and welcome suggestions for improvement of the next edition.


Source: "Homotopy Type Theory: Univalent Foundations of Mathematics", Introduction — github.com/HoTT/book, CC BY-SA 4.0. Converted to .tsm by tools/convert/tex2tsm.mjs to exercise the engine (math, citations, bibliography); cross-chapter references resolve to ?? on purpose. Report: docs/real-world-report.md.


[1] Bertand Russell. Mathematical logic based on the theory of types. American Journal of Mathematics 30, 222-262. 1908.

[2] Alonzo Church. A formulation of the simple theory of types. Journal of Symbolic Logic 5, 56-68. 1940.

[3] Alonzo Church. The Calculi of Lambda Conversion. Princeton University Press, 1941.

[4] Benjamin C. Pierce. Types and Programming Languages. MIT Press, 2002.

[5] Per Martin-L\"of. An intuitionistic theory of types. Twenty-five years of constructive type theory (Venice, 1995) 36, 127-172. Oxford University Press, 1998.

[6] Per Martin-L\"of. An intuitionistic theory of types: predicative part. Logic Colloquium '73, Proceedings of the Logic Colloquium 80, 73-118. North-Holland, 1975.

[7] Per Martin-L\"of. Constructive mathematics and computer programming. Logic, Methodology and Philosophy of Science VI, Proceedings of the Sixth International Congress of Logic, Methodology and Philosophy of Science, Hannover 1979 104, 153-175. North-Holland, 1982. doi:10.1016/S0049-237X(09)70189-2

[8] Per Martin-L\"of. Intuitionistic type theory. Bibliopolis, 1984.

[9] Giovanni Sommaruga. History and Philosophy of Constructive Type Theory. Kluwer, 2010.

[10] Fairouz Kamareddine, Twan Laan, and Rob Nederpelt. A Modern Perspective on Type Theory: From its Origins until Today. Kluwer, 2004.

[11] Steve Awodey and Michael A. Warren. Homotopy theoretic models of identity types. Mathematical Proceedings of the Cambridge Philosophical Society 146, 45-55. 2009.

[12] Vladimir Voevodsky. A very short note on the homotopy $\lambda$-calculus. 2006.

[13] Martin Hofmann and Thomas Streicher. The groupoid interpretation of type theory. Twenty-five years of constructive type theory (Venice, 1995) 36, 83-111. Oxford University Press, 1998.

[14] Georges Gonthier, Andrea Asperti, Jeremy Avigad, Yves Bertot, Cyril Cohen, Fran\c cois Garillot, St\'ephane Le Roux, Assia Mahboubi, Russell O'Connor, Sidi Ould Biha, Ioana Pasca, Laurence Rideau, Alexey Solovyev, Enrico Tassi, and Laurent Thery. A Machine-Checked Proof of the Odd Order Theorem. Interactive Theorem Proving. 2013.

[15] F. William Lawvere. An elementary theory of the category of sets (long version) with commentary. Reprints in Theory and Applications of Categories 11, 1-35. 2005.

[16] Andrey Kolmogorov. Zur Deutung der intuitionistischen Logik. Mathematische Zeitschrift 35, 58-65. 1932.

[17] Anne Sjerp Troelstra and Dirk van Dalen. Constructivism in mathematics. Vol. I. North-Holland Publishing Co., 1988.

[18] Anne Sjerp Troelstra and Dirk van Dalen. Constructivism in mathematics. Vol. II. North-Holland Publishing Co., 1988.

[19] Bertrand To\"en and Gabriele Vezzosi. Homotopical Algebraic Geometry I: Topos theory. 2002.

[20] Charles Rezk. Toposes and homotopy toposes. 2005. http://www.math.uiuc.edu/~rezk/homotopy-topos-sketch.pdf

[21] Jacob Lurie. Higher topos theory. Princeton University Press, 2009.

[22] Daniel R. Licata and Robert Harper. Canonicity for 2-dimensional type theory. Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, 337-348. ACM, 2012. doi:10.1145/2103656.2103697

[23] Chris Kapulkin, Peter LeFanu Lumsdaine, and Vladimir Voevodsky. The Simplicial Model of Univalent Foundations. 2012.

[24] Peter LeFanu Lumsdaine and Michael Shulman. Semantics of higher inductive types. 2017.

[25] Bruno Barras, Thierry Coquand, and Simon Huber. A Generalization of Takeuti-Gandy Interpretation. 2013.

[26] Vladimir Voevodsky. A universe polymorphic type system. 2012.