Univalent Foundations and the

UniMath Library

The Architecture of Mathematics

Anthony Bordg

1 2

We give a concise presentation of the Univalent Foundations of mathematics outlining

the main ideas, followed by a discussion of the UniMath library of formalized mathemat-

ics implementing the ideas of the Univalent Foundations (section 1), and the challenges

one faces in attempting to design a large-scale library of formalized mathematics (sec-

tion 2). This leads us to a general discussion about the links between architecture and

mathematics where a meeting of minds is revealed between architects and mathemati-

cians (section 3). On the way our odyssey from the foundations to the “horizon” of

mathematics will lead us to meet the mathematicians David Hilbert and Nicolas Bour-

baki as well as the architect Christopher Alexander.

1 The Univalent Foundations and the UniMath

Library

1.1 The Univalent Foundations of Mathematics

The Univalent Foundations[1] of mathematics designed by Vladimir Voevodsky builds

upon Martin-Löf type theory[2], a logical system for constructive mathematics with

nice computational properties that makes mathematics amenable to proof-checking by

computers (i.e. by a piece of software called a proof assistant). Certiﬁed or type-checked

proofs should not be mistaken for automated proofs. Even if proof assistants come with

various levels of automation, either built-in for elementary steps or user-deﬁned via the

1

University of Cambridge, Department of Computer Science and Technology, 15 JJ Thomson Avenue,

Cambridge CB3 0FD, UK. website : https://sites.google.com/site/anthonybordg/home

2

Work on this paper was supported by grant GA CR P201/12/G028

1

so-called tactics for less basic steps, the proof assistant only checks that man-made proofs

written with it are correct.

1.1.1 The Univalence Axiom

The main characters in Martin-Löf type theory (MLTT for short) are types and elements

of these types. If T is a type, then the expression t : T denotes that t is an element of

T . In particular, if T is a type and t, t

0

are elements of T there is a new type called

the identity type of t and t

0

denoted t =

T

t

0

. Sometimes for convenience we will omit

the type information and we will simply write t = t

0

. When one considers only a single

element t, i.e. t

0

is deﬁnitionaly equal to t, the identity type t =

T

t has always at

least one element denoted idpath t, i.e. the expression idpath t: t =

T

t is well-formed.

This term idpath is called a constructor and the identity types belong to a particular

class of types called inductive types. Indeed, besides its constructors (an inductive type

can have either a single constructor or many constructors), a family of types deﬁned

inductively (like the identity types are when introduced formally) obeys an induction

principle. In the case of identity types, this induction principle states that given a type

T , an element t : T , a family F of types indexed by an element t

0

: T and an element

p

0

: t =

T

t

0

, if there is an element f : F t (idpath t) (the family F instantiated with the

terms t and idpath t), then for any elements t

0

: T , p : t =

T

t

0

there is an element of the

type F t

0

p, and moreover this element is f itself when t

0

and p are deﬁnitionaly equal to

t and idpath t, respectively. Of course, one can iterate the process of building identity

types, namely given p and q two elements of the identity type t =

T

t

0

, one can form the

identity type p =

t=

T

t

0

q and so on. As it happens, these identity types lead to a very rich

mathematical structure and there is a surprising connection between homotopy theory

and MLTT (the latter being also coined Martin-Löf dependent type theory in reference

to these dependent types, i.e. dependent on previous types for their deﬁnition which

may be inductive, like in the case of identity types, or not). Roughly, one can think of

T as a space, two elements t and t

0

of T as points of this space, two elements p and q

of the type t =

T

t

0

as paths from t to t

0

in the space T , and the elements of p =

t=

T

t

0

q

as homotopies between the paths p and q and so on (the elements of the successive

iterated identity types being higher homotopies). Under this correspondence idpath t

is the identity path between a point t and itself in the given space. Each type bearing

the structure of a weak ∞-groupoid obtained from the tower of iterated identity types

over that type. Moreover, given two types A and B there is also a new type denoted

A → B for the type of functions between A and B. Among these functions some of them

have a distinctive property, namely their homotopy ﬁbers

3

are contractible

4

, and they

are called weak equivalences. Again, one forms a new type for the weak equivalences

between two types A and B, denoted A ' B. Voevodsky found an interpretation of

the rules of MLTT using Kan simplicial sets where an additional axiom, the so-called

Univalence Axiom, is satisﬁed. The Univalence Axiom (UA for short) states a property

3

The deﬁnition of the homotopy ﬁbers of a map is given later in 1.2.1.

4

The fundamental concept of contractibility is deﬁned later in 1.1.2.

2

of a universe type U (interpreted as the base of a universal Kan ﬁbration), a type whose

elements are themselves types called "small" types. More speciﬁcally, ﬁrst note that

given two small types A and B, by applying the induction principle of identity types

(take T := U, t := A, and the family F such that F B p

0

is A ' B in the statement

of the induction principle above) one deﬁnes a function eqweqmap A B, from A =

U

B to

A ' B, that maps the identity path to the identity equivalence when B is deﬁnitionally

equal to A. The Univalence Axiom states that for any two small types A and B the

function (eqweqmap A B) is a weak equivalence, giving the correct notion of equality (or

path under the connection alluded to above) in the universe.

1.1.2 The Homotopy Levels

Note that in the function type A → B introduced above the type B does not depend

on the type A. Now, we can replace the type B by a family of (small) types indexed

by the type A, namely an element F of type A → U (where U is a universe), in

this case we get a new type, the cartesian product of the family of types F , denoted

Y

x:A

F x. Given two elements f, g :

Y

x:A

F x, we could also ask if there is an equivalence

between the identity type f = g and the dependent product

Y

x:A

(f(x) = g(x)). This

equivalence (or rather the non-obvious implication) is known as function extensionality

and it does not hold in MLTT. Fortunately, UA does imply function extensionality, i.e.

given A : U , F : A → U and f, g :

Y

x:A

F x, using UA one produces a term of the type

(

Y

x:A

f(x) = g(x)) ' (f = g). Thus, the Univalence Axiom can be seen as a strong

form of extensionality and the Univalent Foundations are a powerful and elegant way to

achieve extensional concepts in Martin-Löf dependent type theory.

Without surprise another very important type is the type of natural numbers denoted

nat. This is a second example of an inductive type. The type nat has two constructors,

0 of type nat and s of type nat → nat that corresponds to the successor function. The

induction principle of nat is what one expects, namely an element of the type

Y

P :nat→U

P 0 → (

Y

n:nat

P n → P (s n)) → (

Y

n:nat

P n) .

Finally, we would like to introduce an additional dependent type called the dependent

sum type. Given a type A and an element B : A → U, we form the type of dependent

pairs (x, y) with x : A and y : B x, denoted

X

x:A

B x. Given a small type A, the type A

might have the property that it has an element cntr : A together with for every element

x: A a path from x to cntr, i.e. an element of

Y

x:A

x =

A

cntr. The dependent sum allows

us to form the type of such elements, namely

X

cntr:A

Y

x:A

(x =

A

cntr), shortened to iscontr A,

3

that corresponds to the type of proofs that A seen as a space is contractible. If this last

type is inhabited, i.e. if it has an element, the type A is said to be contractible and

cntr is called a center of contraction. We are now equipped with all the tools we need

to introduce the very important concept of homotopy levels, the so-called h-levels, that

intuitively capture the fact that at some point in the tower connected with a type the

iterated identity types might be contractible. First, we need to know that one is allowed

to deﬁne functions over inductive types, in particular over the type of natural numbers

nat. Hence, we will deﬁne an element denoted isofhlevel of type nat → U → U. To

achieve this, it is enough to deﬁne isofhlevel 0 X to be iscontr X and isofhlevel (s n) X

to be

Y

x:X

Y

y:X

isofhlevel n (x =

X

y), where X is a small type. Given a small type X and

a natural number n, if the type isofhlevel n X is inhabited, then one says that X is of

h-level n. The type of all types of h-level n is

X

X:U

isofhlevel n X

5

. The types of h-level

1 are called propositions, they are the types in which any two elements are equal. The

types of h-level 2 are called sets. For n ≥ 3 the types of h-level n are higher analogs

of sets

6

. It is possible to prove for instance that given a type X and an element n : nat

the type isofhlevel n X is a proposition, that the type nat is a set, or that the type

X

X:U

isofhlevel n X is of h-level n + 1. Moreover, the Univalence Axiom is consistent with

respect to the Law of Excluded Middle for propositions and the Axiom of Choice for sets,

hence not diminishing our ability to reason about propositions or sets but increasing our

ability to work with higher analogs of sets.

Informed by homotopy theory, the main merits of the Univalent Foundations are the

realization that types in MLTT are interpreted by homotopy types (topological spaces

up to weak homotopy equivalences), their corresponding stratiﬁcation according to the

h-levels, and the ability that types give us to build weak higher groupoids through the

tower of their iterated identity types. Moreover, the Univalence Axiom gives us the

ability to reason formally about structures on these higher groupoids by enforcing an

equivalence principle that makes two equivalent types indistinguishable in the Univalent

Foundations. Indeed, let U

0

, U

1

be two universes with U

0

: U

1

and U

0

being univalent.

Given any family P : X → U

1

, there exists two terms transportf

P

: (x =

X

y) → P x →

P y and transportb

P

: (x =

X

y) → P y → P x. In particular, if one takes U

0

for X, then

using the univalence axiom for U

0

one derives two terms of types (A ' B) → P A → P B

and (A ' B) → P B → P A, respectively.

The Univalent Foundations realizes the following vision of Voevodsky:

First note that we can stratify mathematical constructions by their “level”.

There is element-level mathematics - the study of element-level objects such

as numbers, polynomials or various series. Then one has set level mathemat-

ics - the study of sets with structures such as groups, rings etc. which are

5

This type is small with respect to a higher universe. This technical detail is unimportant for people

unfamiliar with type theory.

6

This analogy is explained in the quote from Voevodsky that ends the current section 1.1.2.

4

invariant under isomorphisms. The next level is traditionally called category-

level, but this is misleading. A collection of set-level objects naturally forms

a groupoid since only isomorphisms are intrinsic to the objects one considers,

while more general morphisms can often be deﬁned in a variety of ways. Thus

the next level after the set-level is the groupoid-level - the study of properties

of groupoids with structures which are invariant under the equivalences of

groupoids. From this perspective a category is an example of a groupoid with

structure which is rather similar to a partial ordering on a set. Extending

this stratiﬁcation we may further consider 2-groupoids with structures, n-

groupoids with structures and ∞-groupoids with structures. Thus a proper

language for formalization of mathematics should allow one to directly build

and study groupoids of various levels and structures on them. A major ad-

vantage of this point of view is that unlike ∞-categories, which can be deﬁned

in many substantially diﬀerent ways the world of ∞-groupoids is determined

by Grothendieck correspondence, which asserts that ∞-groupoids are “the

same” as homotopy types. Combining this correspondence with the previous

considerations we come to the view that not only homotopy theory but the

whole of mathematics is the study of structures on homotopy types.[3].

1.2 The UniMath Library

Nowadays a fraction of the community working on the Univalent Foundations is in-

volved in the design of a library of mathematics based on the Univalent Foundations,

the UniMath[4] project, using the Coq proof assistant.

The UniMath library was born in 2014 by merging three previous repositories, the repos-

itory Foundations written by Vladimir Voevodsky, the repository rezk_completion of

Ahrens, Kapulkin and Shulman, and the repository Ktheory by Daniel Grayson. As

of 6 September 2018, the library has the following packages (arranged in alphabetical

order): Algebra, CategoryTheory, Combinatorics, Folds, Foundations, HomologicalAl-

gebra, Induction, Ktheory, MoreFoundations, NumberSystems, PAdics, RealNumbers,

SubstitutionSystems, Tactics, Topology.

I will brieﬂy focus on the three packages that implement the main ideas of the Univalent

Foundations as outlined in the ﬁrst section1.1, namely the Foundations package, the

MoreFoundations package, and the CategoryTheory package. The latter grew out of

the rezk_completion repository, hence our choice of packages covers two of the three

original repositories. However, we underline that we do not do justice to the contents of

the library.

5