Just like so many mathematical cranks, the diagonal argument has always fascinated me. But unlike the cranks, it’s not the argument itself that fascinates me, but the sociological phenomenon of it: Cantor’s theorem is without a doubt the single result in mathematics which generates the most crankery.

What has fascinated me is the mystery of *why*. Why is this result so hard to stomach for so many? Some have suggested that the answer has to do with intuitionism, which I have argued is not the case. The issue seems to be with the notions of “infinity” and “size”: the usual presentation of the diagonal argument seems to make use of infinitely many choices, and the result (as usually presented) says that the set of reals is “bigger” than the set of naturals, which is repugnant to people who don’t accept the notion of “completed infinity”.

My goal here is not to argue against finitists (I haven’t the patience), or to try to justify the idea that there are more reals than naturals (I have no interest in flogging a horse which died over a century ago). Rather, I want to argue that Cantor’s theorem (rather, the spacial case dealing with the naturals) makes sense without talking about infinite sets, and without talking about size.

To do this, we need to talk about sets without them being extensional (that is, without them being determined by their elements) and to talk about functions in a slightly different way than we normally do when presenting the diagonal argument. We do this by dealing with types.

Types are determined not by their members, but by *introduction and elimination rules*. Most types of interest are “inductive types”, where the introduction rules give us “canonical elements”, and the elimination rule says that to define a function *out of* the type, it suffices to say what happens on the canonical elements. Often, the canonical elements are generated according to some recursive rule: If is the type we are defining, we may define *new* members of by reference to *old* members of (and possibly by reference to members of other types).

The classical example is the type of natural numbers; the type of natural numbers is determined by the following rules:

- Introduction rule: There is a member .
- Introduction rule: For any , there is a member . That is, we can always take the “successor” of a natural number.
- Elimination rule: If we have a type , a member and a function , there is a function such that and for an arbitrary we have . Here, is shorthand for —since is a function from to , and has type C (by the “inductive hypothesis”), we may apply to .

We say that is *inductively generated* by and .

The point is that we don’t need to be some “completed collection”—we only need to be able to *recognize* when something is a natural number, and once we’ve recognized something to be a natural number, to be able to perform the sorts of manipulations we expect to be able to perform on natural numbers.

Another classical example is the type of Booleans, which we call . It is “inductively” generated by members we call and . That is,

- ;
- ;
- Given a type and members and , there is a function such that and .

An example of a function constructed using the elimination rule for is the negation, , which we define as follows: We define and . Then the elimination rule says that we have a function (which we denote ) from to such that and .

An important fact about inductive types is that *canonical elements which take different forms are never equal*. For example, is not equal to , and .

The elimination rules actually generalize from functions to a type, to *dependent* functions on a type *family*. For , this becomes:

Given a type family indexed by , and members and , there is a dependent function such that and .

Recall that in type theory, equality is a type family, double-indexed by members of a fixed type. In particular, we have a type family indexed by defined as . Going a step farther: the claim is to be regarded as a type (for and fixed), so we may define the type family indexed by as . Combined with the elimination rule for , the fact above that gives us

*Lemma*. For an arbitrary , we have . That is, there is a dependent function .

*Proof*. We remarked above that we have . That is, we have some . By symmetry, we also have some . Since is and is , we have that and . Setting and , we may apply the elimination rule for to get the desired . .

We cannot interact with members of these types any way we want—we can only interact with them using the rules of type theory, or by choosing an arbitrary member (which we have no information about, other than its type). In particular, to define a function from to another type we may either:

- Use the elimination rule, provided we have the necessary information (the type , the member and the function .)
- Use the introduction rule for function types: If, given an arbitrary member of we may construct a member of , then there is a function .

The take away is that we cannot define a function out of by saying “Do this to 0, this to 1, this to 2, and so on.” We must give an explicit rule which does not directly refer to the members, except in an arbitrary way, or according the “inductive structure” of .

Now, we need to interpret Cantor’s diagonal in this context. Rather than using real numbers, or defining a powerset, we will simply use function . We also must forego any mention of “size” or “cardinality” So our theorem becomes

**Theorem**. There is no surjective function from to .

*Proof*. Let be an *arbitrary* function . Note that we know nothing about other than its type. That is, we may only interact with it using the introduction and elimination rules for function types.

We define a function by function introduction (“lambda abstraction”): . That is, takes a natural number , a negates the value of applying to .

*Claim*. is not in the range of . That is, there is no such that .

*Proof (of claim)*. Let be arbitrary. By the lemma, we know that . Since is , we have that . But then and differ in some argument, namely , so . Since was arbitrary, there is no such that . This proves the claim.

In other words, is not surjective. Since was arbitrary, we must have that no function is surjective.

And there we have it. The point is that we needn’t think of sets as “completed collection”, but merely “things generated by rules”, and we needn’t introduce the notion of “size” into the discussion at all: I don’t know what “the set of natural numbers” is (I just know I have a way of generating *some* natural numbers, and a way to construct a new object when I am given an arbitrary natural number) and I don’t know what “size” is (I just know what a surjective function is), and I still have a way to make sense of Cantor’s theorem.

Someone intent on arguing with my may suggest that I’ve moved the goalposts—after all, the real numbers aren’t *really* functions from . However, this misses the point: the argument can be reformulated only slightly to work for the Dedekind or Cauchy construction of the reals; both constructions are given in a style like this one—without appeal to infinity or choice or any other controversial infinitary principle—in Chapter 11 of the HoTT book.

The next post will be on a topic less mundane and tired.