
Cantor diagonalisation - Pishky
https://www.cs.virginia.edu/~lat7h/blog/posts/124.html
======
Smaug123
Cantor's theorem is better stated as "Let X be infinite. If f: powerset(X) to
X, then f is not injective.". This is completely uncontroversial, and its
proof is by diagonalisation in a context where it really does intuitively
"just work". Set X to the naturals, and prove that the reals are equipotent
with the powerset of N, to obtain "the reals are uncountable".

~~~
_rpd
> This is completely uncontroversial

I think it is still intuitively surprising that some infinite sets somehow
have more elements than other infinite sets. The powerset operator is very
special because it can create this difference.

~~~
Smaug123
I suppose I really meant "why should one expect that f might be injective
anyway?" Once you're no longer in the context of a set like N which is very
familiar, there's just no obvious reason for the theorem to be false.

------
bladecatcher
A most merry and illustrated explanation of the diagonal argument:
[http://www.coopertoons.com/education/diagonal/diagonalargume...](http://www.coopertoons.com/education/diagonal/diagonalargument.html)

------
joveian
I've long had a question that might be a variation of the third concern
listed: couldn't diagonalisation just show that considering all real numbers
to be an infinite sequence of digits is a flawed representation? Not
necessarily that they don't exist somehow or that they are necessarily
countable, just the diagonalization argument seems flawed to me.

Edit: Actually maybe this is just the first concern mentioned :/.

Edit2: Maybe clearer explanation: you can produce an infinite sequence of
digits from many real numbers, but it doesn't seem to me to be valid to
consider that infinite sequence to actually be the real number.

~~~
btilly
You are looking in the wrong place for the key philosophical issue, but didn't
land on it.

When we talk about "an infinite sequence of digits", what are we talking
about? Are we talking about ACTUALLY having an infinite sequence of digits in
front of us? Or are we talking about having a RULE that will in theory produce
them?

Platonists believe that they actually exist in a reality beyond human
conceptual limits. (Maybe in the mind of God?) Formalists side step the
question by making everything an abstract symbol manipulation game. (Though
the rules of the game are chosen to result in something matching platonic
intuition.) And Constructivists take the rule approach, and not just that, but
a rule that we can write down and actually evaluate.

Cantor's diagonalization argument obviously works according to Platonists.
Formalists choose their rules to make it work as well. But Constructivists,
well, it doesn't work there!

Why not? Well when you get down to it, how do you define a rule and how do you
prove that it works? Well, a "rule" can be thought of as just a computer
program. And now we have the problem that, thanks to the Halting Problem, it
is impossible in general for one computer program to predict what another
program will do!

You can, of course, attempt to write Cantor's number down. You can implement
the rule that he describes using a theorem prover to filter a list of all
programs to just the ones that we can prove are numbers. We can write a
perfectly well-defined program that produces Cantor's number. BUT THERE IS NO
CONTRADICTION?

Why not?

Because THAT program is one that the theorem prover CAN'T prove works! (In
fact the theorem prover will prove what it is doing, and prove that if it
always works, then its set of axioms is consistent. And now you're up against
Gödel's Incompleteness Theorem!)

The result is that in the two most popular philosophies of math, Cantor's
argument works. But in the third, it doesn't, it can't, and the reals are
countable. There the complications of diagonalization are simply another
illustrations of the challenges of self-reference, and not the assertion that
more numbers exist than can be written down!

~~~
mabbo
> But in the third, it doesn't, it can't, and the reals are countable

Isn't that a bit of an overreach? It seems that in Constructivism, Cantor's
diagonalization doesn't work as a proof. But that doesn't mean that the reals
_are_ countable, just that this proof isn't valid.

~~~
btilly
Well, you have to be careful about what countable means.

If countable means "put into a one to one correspondence with" then the reals
are not countable because there are pairs of reals that can be proven to be
real whose equality or inequality can't be proven. So in such cases you can
overcount, or undercount, but you can never exactly pick each real only once.

But the set of possible constructions can be enumerated. We may not know which
actually are real numbers, and which pairs are equal. But we can list all of
the possibilities. So there is a countable list of things that contains them
all..multiple times..along with other stuff.

------
kmill
Here's an argument I've found sometimes works better for people who can't see
what the diagonal from the list is supposed to do, or if they think it's
rather arbitrary. It's essentially the same argument, just written
differently.

Definitions: 2 is the set {0,1}. N is the set of natural numbers {0,1,2,...}.
An infinite sequence of 0's and 1's c_0,c_1,c_2,... can be thought of as a
function c : N -> 2 (that is, the values in a sequence are a function of their
position: c_i = c(i)). A set X is countably infinite if there is an invertible
function f : N -> X (which, in other words, is a sequence f_0,f_1,f_2,...
where each element of X appears exactly once). Let's write A -> B for the set
of functions from A to B, rather than the usual B^A.

Suppose for sake of contradiction (N -> 2) is countably infinite, so there is
an invertible function f : N -> (N -> 2). Let F : (N -> 2) -> N be the
inverse, so I can save having to type f^-1. Let g : N -> 2 be defined by g(n)
= 1 - f(n)(n). Then, g(F(g)) = 1 - f(F(g))(F(g)) = 1 - g(F(g)), so g(F(g))
must be 1/2, contradicting the fact that it ought to be 0 or 1 instead.

------
MichaelBurge
Sure, that's the story the government tells everyone. It sounds plausible
enough, but is it the whole story?

* Apply Downward Lowenheim-Skolem to get a countable model of set theory

* Construct the reals using whichever technique you want.

* Since the base set theory is countable, so is the set of constructed reals.

The same technique can give you countably many groups, countably many rings,
countably many points in the plane, etc. Everything is countable.

~~~
wayn3
it is very much not possible to construct the real numbers in such a way that
they are countable. (the set of real numbers is the object that "happens" when
you fill the "holes" in the set of rational numbers).

cantors diagonalization argument is proof of that. you can't pull some silly
trick to make them countable. there are many properties of R that are
countable, but that doesn't make R itself countable.

~~~
btilly
The truth of your statement depends on what philosophy of mathematics you
accept. Which itself is not something that can ever be settled by pure reason.

Here is a definition of the reals to consider. A real number is a computer
program which implements a function f from positive integers N to the
rationals such that |f(n) - f(m)| < 1/n + 1/m. This is a reasonable definition
of real numbers, and all real numbers that you're likely to hear of are real
numbers under this definition.

But now consider. There are a finite number of symbols that we build programs
out of. Therefore for every N, there are a finite number of possible computer
programs of length N. Only some of which represent real numbers under this
definition. Therefore there is a countable sequence which contains all real
numbers in it!

What is the key philosophical difference between this system of mathematics
and the usual one? Quite simply this. Classical mathematics asserts the
existence of things that cannot be written down or calculated by humans. This
system of mathematics denies the existence of things which we cannot write
down.

Now about a hundred years ago there was a major debate between these two
philosophical camps. In the end the classical school won simply because most
mathematicians don't care about philosophy, and classical mathematics is
easier to work with. But the purportedly inescapable logical conclusions that
you're taught about are not actually as inescapable as you've been lead to
believe.

~~~
powera
I haven't the slightest idea what "n" and "m" are supposed to be, so I can't
make any sense of your definition.

Beyond that, you say: "all real numbers that you're likely to hear of" \- this
is a fallacy twice over.

First, since my lifetime is finite, it's easy to count all the real numbers
that I will hear in my life. But I don't think that's the argument you want to
make.

Second, there are people who professionally construct unlikely real numbers;
just because you choose to ignore those numbers doesn't mean that your
countable sequence of all real numbers can. There's a difference between
"things that cannot be written down" and "things _you_ can't write down".

~~~
btilly
The statement "you are likely to hear of" is a concession that I know of
numbers which can't fit that definition. Their key characteristic being that
they cannot be calculated by humans, because evaluating them requires
operations that are not actually possible for us.

Whether or not such numbers are well-defined at all is a point of philosophy.
What does it mean to declare the truth of statements that cannot be verified
either way?

------
danharaj
I think this blog post will delight anyone who liked this submission:
[http://math.andrej.com/2007/04/08/on-a-proof-of-cantors-
theo...](http://math.andrej.com/2007/04/08/on-a-proof-of-cantors-theorem/)

~~~
danbruc
I am already struggling right at the beginning.

 _If we open a book on set theory, we will find a proof of Cantor’s theorem
which shows explicitly that for every map e : A → P(A) there is a subset of A
outside its image, namely S = { x ∈ A ∣ x ∉ e(x) }_

What about e(x) = { x }? In that case S would be the empty set, wouldn't it?
Does map imply some additional properties in this case? Am I misunderstanding
the statement and it does not try to imply that S is non-empty for every e?

~~~
danharaj
Yes, in that case S is {}. {} ∈ P(A) but is not in the image of e.

~~~
danbruc
Thanks, now it clicked. I misinterpreted the image as the image of x instead
of as the image of e. And then did something weired that now makes no longer
any sense at all.

------
alok-g
Genuinely asking:

Consider decimal numbers between 0 and 1 in binary.

Here's how I am going to synthesize this set.

Step 1: Take non-decimal binary numbers and consider them to be padded with an
infinite of zeros at the left.

...0000000

...0000001

...0000010

...0000011

...0000100

...0000101

...0000110

..........

Do we agree that this will contain _all_ the non-decimal non-negative binary
numbers?

In particular, is the following number in the above set? ...111111 (all ones,
not zero-padding on the left). If not, why not. And if not, this seems to be a
matter of definition to me. If yes, move on.

Step 2: Place a decimal at the end of each line above and flip left and right.

0.0000000...

0.1000000...

0.0100000...

0.1100000...

0.0010000...

............

Do we agree that this contains _all_ the decimal positive binary numbers
between zero and one: [0, 1).

Let's now apply diagonalisation on this.

It says that the number 0.11111111... will not be present in the above set.

Perhaps someone can see my confusion and enlighten me. :-) Thanks!

~~~
wayn3
The confusion in your argument is rather simple. You construct the set of
INTEGERS in a binary representation.

Then you flip them over to the other side,in an operation that you yourself do
not fully understand.

The first number that you flip (0.1) turns into 0.5 decimal

The second number that you flip (0.01) turns into 0.25 decimal

The third is 0.75

0.125

and so on. You are creating a subset of the rational numbers, which is
obviously countable. It is countable because you constructed it to be
countable. You constructed something that was countable and then tried to
prove that it is countable.

Happens all the time :)

~~~
alok-g
This was helpful. Thanks.

I did understand before how flipping changed the numbers into 0.5, 0.25, etc.,
but had missed that this process would only create rational, thereby missing
the irrationals altogether. There's enough food for thought for me now. :-)

~~~
wayn3
What you really want to understand is "where's pi", right?

Pi looks somewhat like this: 3.1415... "and so on". Let's ditch the 3.

0.1415... and so on. flipped over equals:

...5141

Easy enough, right? But pi had infinite decimals. Infinite decimals on the
left side means what? You tell me :)

Infinity is not an element in the real numbers. All the irrationals, when
flipped over, get absorbed into infinity - and infinity itself has no decimal
representation. For people who are not in math, saying "and so on" is fine.
But you can't do math on "and so on". "And so on" is a handwaving way of
saying that you lack the mathematical language to describe whats going on.
Which is fine, for casuals.

~~~
alok-g
You have gotten to exactly what my confusion has been!

I had assumed from the middle school itself that the set {1, 2, 3, ...}
includes infinity, and I still am questioning if this not being is just a
matter of definition or it has to be that way. More below:

We say that the size of the set {1, 2, 3, 4} is 4, in which scenario, the
number 4 happens to be an element in the set. Likewise for {1, 2, 3, 4, ...,
100000}. Now we say that the size of the set {1, 2, 3, 4, ...} is infinity,
but infinity is not an element of that set.

It seems what I am missing is the _formal_ definition of this "..." or "and so
on". If these two were not allowed in any of the proofs, how would you word
Cantor's Diagonalisation and other theorems in mathematics that currently
involve these. (Or alternatively, what is the formal definition of "...")

PS: I do understand limits and calculus but perhaps from an engineering
perspective, not for pure mathematics where I have these confusions.

Thanks! :-)

~~~
wayn3
The problem that people who don't REALLY learn mathematics is that they dont
understand that EVERYTHING has to be defined in a way that makes it an
absolute truth.

The definition of the number 2 is by axiom. The peano axioms state this:

1\. There is a number. We call it 0

2\. For every number n, there is a successor S(n). The successor of 0 is
called 1

3\. Let m and n be numbers. m=n is equivalent to S(n)=S(m). This means that if
two numbers are the same, they have the same successor

4\. For every number n, S(n) is not 0. This means that 0 is the first such
number

This completely describes the natural numbers. If you want to say that 0 is
not part of the natural numbers, just write down the same things and say that
1 is the first number, and construct 0 later. For some funky reason, this
doesn't actually matter. Although you'd think that difference between 0 and 1
is pretty big.

Nowhere in this does infinity appear. Infinity does, in fact, not belong to
the natural numbers. Infinity as a NUMBER is only defined much later in
mathematical literature. As a concept, it just means "big". When we talk about
infinity in terms of the reals it just means "if we construct a series of
numbers that get succeedingly bigger and they are not bounded, then they 'tend
toward infinity'". But infinity is not a thing. Its just a name for "this shit
gets big brutha".

The problem is that I can't give you a formal definition for "and so on",
because it can mean many things.

I will give you a formal definition for a number instead.

Pretend again that we look at the number .111111111...

and now we flip it around. We look at the number ...111111.0

What this means is the following. This number is the sum over all the
exponents of 10. The number is obviously identical to 1 + 10 + 100 + ... =
10^0+10^1+10^2+...

We still get the and so on. Now we need to find language that seeks to
eliminate the notion of "and so on". Keep in mind that this number is not part
of the real numbers, because it would be identical to infinity.

We prove this in the following way:

Our number is obviously bigger than 1, because it is 1+10+...

It is obviously bigger than 10, because it is 1+10+...

Now, we perform something devious. An argument by induction. This happens in
the first week of math education and it is precisely when we leave the realm
of "all the things we can write down".

We prove that for every n, the number ...1111.0 is bigger than 10^n.

1\. We already know this for n=1, because 1+10+... is bigger than 10^1 = 10.

2\. For n>1, 10^(n-1)+10^(n) is clearly bigger than just 10^(n), and our
number contains all the exponents of 10.

(^Up there is a tautological proof. You already know this, I just write it
down "semi formally". Proving a fact about natural numbers by induction is
always somewhat tautological because the mechanism that makes induction
possible IS the natural numbers themselves.)

Now we know that for every exponent of ten, our number is bigger than that.
This means that for every natural number that we can possibly think of, our
number is bigger than that. Therefore, the number we are looking at is not
part of the natural numbers and by extension, not part of the real numbers.

This is because every natural number has a successor and by definition, the
successor is bigger than the number itself. But our number is bigger than all
the numbers already. In order for it to be a natural number, it would have to
have a successor, which would be bigger than itself. But our number is bigger
than all the numbers. This sounds a bit clunky. I could write it down
mathematically, but that would just confuse you, probably.

Now I'm just being wordy. The proof was over long ago.

edit: Writing this down mathematically goes like this: Let b=...1111 and n be
an arbitrary natural number. b>n => n is not successor of b => b is not in N.
(You see that I had to reduce the argument to something I already knew - the
successor axiom - in order to wrap it up).

I've shown that your number is bigger than all the possible number on the real
line and if its not on the real line, it is not part of the real numbers.

Now you would ordinarily say that it is infinite. And that's kind of true, but
you can only say that once you understand that infinity is just a concept, not
a number in the way you understand numbers.

tl;dr: Infinity is not part of any of the ordinary sets of numbers (natural
numbers N, integers Z, rationals Q, reals R, complex C, ... - yes, there are
more of these)

~~~
alok-g
Very helpful. Thanks! I can now see why infinity cannot be a natural number,
under Peano's axioms. I follow mathematical induction arguments also. Thanks a
lot! :-)

------
erodommoc
This seems to come up over and over again, and it always comes down to what
assumptions you start with. If you accept all of the axioms and methods, the
proof holds. If you don't, it doesn't. Articles like this one, aimed at an
audience that already assumes that its techniques are valid, are never going
to convince a non-mathematical audience that doesn't know what the basic
assumptions are, because that's not their goal.

------
t0mek
This theorem blew my mind on the Set Theory 101. A particularly interesting
implication is that we can't say anything about the vast majority of the real
numbers. Anything we say or write, all texts created by the humanity now and
in the future creates a countable set. Since the real numbers are not
countable, we can't assign them with the definitions.

~~~
sdenton4
For some added fun: algebraic numbers are the set of all numbers which are
roots of rational polynomials. You know, things like sqrt 2, along with all
the rationals themselves. Algebraic numbers comprise the vast majority of real
numbers we ever have a reason to actually use.

These are also merely countable...

~~~
petters
t0mek noted that all possible definitions of a number are countable. That
would include all algebraic numbers.

