Connecting Constructive Notions of Ordinals in Homotopy Type Theory

04/06/2021 ∙ by Nicolai Kraus, et al. ∙ 0

In classical set theory, there are many equivalent ways to introduce ordinals. In a constructive setting, however, the different notions split apart, with different advantages and disadvantages for each. We consider three different notions of ordinals in homotopy type theory, and show how they relate to each other: A notation system based on Cantor normal forms, a refined notion of Brouwer trees (inductively generated by zero, successor and countable limits), and wellfounded extensional orders. For Cantor normal forms, most properties are decidable, whereas for wellfounded extensional transitive orders, most are undecidable. Formulations for Brouwer trees are usually partially decidable. We demonstrate that all three notions have properties expected of ordinals: their order relations, although defined differently in each case, are all extensional and wellfounded, and the usual ordinal arithmetic operations can be defined in each case. We connect these notions by constructing structure preserving embeddings of Cantor normal forms into Brouwer trees, and of these in turn into wellfounded extensional orders. We have formalised most of our results in cubical Agda.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1. Introduction

Ordinals are numbers that, although possibly infinite, share an important property with the natural numbers: every decreasing sequence necessarily terminates. This makes them a powerful tool when proving that processes terminate, or justifying induction and recursion [12, 15]. There is also a rich theory of arithmetic on ordinals, generalising the usual theory of arithmetic on the natural numbers.

Unfortunately, the standard definition of ordinals is not very well-behaved constructively, and the notion fragments into a number of inequivalent definitions, each with pros and cons. For example, “syntactic” ordinal notation systems [6, 26, 28] are popular with proof theorists, as their concrete character typically mean that equality and the order relation on ordinals are decidable. However, truly infinitary operations such as taking the limit of a countable sequence of ordinals are usually not constructible. We will consider a simple ordinal notation system based on Cantor normal forms [25], designed in such a way that there are no “junk” terms not denoting real ordinals.

Another alternative (based on notation systems by Kleene [21]), popular in the functional programming community, is to consider “Brouwer ordinal trees” inductively generated by zero, successor and a “supremum” constructor which forms a new tree for every countable sequence of trees [5, 9, 16]. By the inductive nature of the definition, constructions on trees can be carried out by giving one case for zero, one for successors, and one for suprema, just as in the classical theorem of transfinite induction. However calling the constructor is wishful thinking; does not faithfully represent the suprema of the sequence , since we do not have that e.g.  — each sequence gives rise to a new tree, rather than identifying trees representing the same suprema. We use the notion of higher inductive types [10, 24] from homotopy type theory [30]

to remedy the situation and make a type of Brouwer trees which faithfully represents ordinals. Since our ordinals now can be infinitary, we lose decidability of equality and order relations, but we retain the possibility of classifying an ordinal as a zero, a successor or a limit.

One can also consider variations on the classical set-theoretical axioms more suitable for a constructive treatment [29], transferred to the setting of homotopy type theory in the HoTT book [30, Chapter 10], and significantly extended by Escardó [14]. One is then forced to give up most notions of decidability, e.g. equality and the order are certainly not decidable, and it is not even possible to decide if a given ordinal is zero, a successor or a limit. However many operations can still be defined on such ordinals, and properties such as wellfoundedness can still be proven. This is also the notion of ordinal most closely related to the traditional notion, and thus the most obviously “correct” notion in a classical setting.

All in all, each of these approaches gives quite a different feel to the ordinals they represent: Cantor normal forms emphasise syntactic manipulations, Brouwer trees how every ordinal can be classified as a zero, successor or limit, and extensional wellfounded orders the set theoretic properties of ordinals. As a consequence, each notion of ordinals is typically used in isolation, with no interaction or opportunities to transfer constructions and ideas from one setting to another — e.g., do the arithmetic operations defined on Cantor normal forms obey the same rules as the arithmetic operations defined on Brouwer trees? The goal of this paper is to answer such questions by connecting together the different notions of ordinals. We do this firstly by introducing an abstract axiomatic framework of what we expect of any notion of ordinal, and explore to what extent the notions above satisfy these axioms, and secondly by constructing faithful embeddings between the notions, which shows that they all represent a correct notion of ordinal from the point of view of classical set theory.


  • We identify axioms for ordinals and ordinal arithmetic that are general enough to be applicable in all situations above, but can still be used to define and derive basic properties such as arithmetic operations being unique (Section 4).

  • We define arithmetic operations on Cantor normal forms [25] and prove them uniquely correct with respect to our abstract axiomatisation (Sections 5 and 3.1).

  • We construct a higher inductive-inductive type of Brouwer trees and their order relation. We prove that this order is both wellfounded and extensional, properties which do not hold simultaneously for previous definitions of ordinals based on Brouwer trees (as far as we are aware). Further, we define arithmetic operations on Brouwer trees, and show that they are uniquely correct (Sections 6 and 3.2).

  • We prove that also the “set-theoretic” notion of ordinals [30, Section 10.3] satisfies our axiomatisation of addition and multiplication, and give constructive “taboos”, showing that many operations on these ordinals are not possible constructively (Sections 7 and 3.3).

  • We relate and connect these different notions of ordinals by constructing order preserving embeddings from more decidable notions into less decidable ones (Section 8).


We have formalised the material in Sections 8, 6, 5, 4 and 3 in cubical Agda [32], and we refer to Escardó’s formalisation [14] of most of the results of Section 7. The formalisation is available

Our formalisation uses the {-# TERMINATING #-} pragma to work around one known bug (issue #4725) and one limitation of the termination checker of Agda: recursive calls hidden under a propositional truncation are not seen to be structurally smaller. Such recursive calls when proving a proposition are justified by the eliminator presentation of [13] (although it would be non-trivial to reduce our mutual definitions to eliminators).

2. Underlying Theory and Notation

We work in and assume basic familarity with homotopy type theory (HoTT), i.e. Martin-Löf type theory extended with higher inductive types and the univalence axiom [30]. The central concept of HoTT is the Martin-Löf identity type, which we write as — we write for definitional equality. We use Agda notation for the type of dependent functions. If the type in the domain can be inferred from context, we may simply write for . Freely occurring variables are assumed to be -quantified.

We denote the type of dependent pairs by , and its projections by and respectively. We write if does not depend on . We write for a universe of types; we assume that we have a cumulative hierarchy of such universes closed under all type formers, but we will leave universe levels typically ambiguous.

We call a type a proposition if all elements of are equal, i.e. if is provable. We write for the type of propositions, and we implicitly insert a first projection if necessary, e.g. for , we may write rather than . A type is a set, , if for every .

By , we mean the propositional truncation of , and if then . The elimination rule of only allows to define functions into propositions. By convention, we write for . Finally, we write for the sum type, for the empty type, for the type with exactly one element , for the type with two elements and , and for .

The law of excluded middle says that, for every proposition , we have . Since we explicitly work with constructive notions of ordinals, we do not assume , but rather use it as a taboo: We say that a statement is not provable constructively if the statement implies .

3. Three Constructions of Types of Ordinals

We consider three concrete notions of ordinals in this paper, together with their order relations and .

The first notion is the one of Cantor normal forms, written , whose order is decidable. The second, written , are Brouwer Trees, implemented as a higher inductive-inductive type. Finally, we consider the type of ordinals that were studied in the HoTT book [30], whose order is undecidable, in general.

In the current section, we briefly give the three definitions and leave the discussion of results for afterwards.

3.1. Cantor Normal Forms as Subsets of Binary Trees

In classical set theory, it is well known that every ordinal can be written uniquely in Cantor normal form


for some natural number and ordinals . This representation is especially appealing for ordinals below , where Cantor normal form correspond to finite binary trees (with a condition). A standard way to represent them is to use binary trees as follows.

Let be the type of unlabeled binary trees, i.e. the inductive type with constructors and . Let the relation be the lexicographical order, generated by the following cases with implicitly quantified :


Let be the reflexive closure of defined by


We have the map defined by and which gives us the left subtree (if it exists) of a tree.

A tree is a Cantor normal form (CNF) if, for every that the tree contains, we have . Formally, the predicate is defined inductively by


We write for the type of Cantor normal forms. Keeping in mind that binary trees represent ordinals, we use the following notation. Instead of , we will from now on write , and instead of , we will write . Thus, e.g. the tree is written as . Further, we write (i.e. ) as . We hope this improves readability. The above conditions (2) then become


We often omit the proof of and call the tree a CNF if no confusion is caused.

3.2. Brouwer Trees as a Quotient Inductive-Inductive Type

As discussed in the introduction, Brouwer ordinal trees (or simply Brouwer trees) are in functional programming often inductively generated by the usual constructors of natural numbers (zero and successor) and a constructor that gives a Brouwer tree for every sequence of Brouwer trees. To state a refined (correct in a sense that we will make precise and prove) version, we need the following notions:

Let be a type and be a binary relation. If