问题
There are infinitely many counting numbers and infinitely many infinite 0–1 sequences. Are these two infinities the same size?
先动手做实验,再往下读。探索没有错误的方式。
实验
对角线机器
这里有一列无穷的 0–1 序列(我们只能显示开头部分)。金色序列 d 把对角线上的数字翻转。
| s1 | … | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| s2 | … | ||||||||||
| s3 | … | ||||||||||
| s4 | … | ||||||||||
| s5 | … | ||||||||||
| s6 | … | ||||||||||
| d | 1 | 0 | 1 | 0 | 0 | 1 | ? | ? | ? | ? | … |
将指针移到某一行(或用 Tab 键切换到该行),看看 d 在哪里与它不同。点击任意数字可以修改列表。
把 d 加入列表,就会出现一个新的 d,它又与列表中的每一项都不同。任何列表——无论多长——都不可能包含所有序列。
提示(如果你需要)
这是怎么回事
这是怎么回事
Two sets have the same size — the same cardinality — when their elements can be paired off one-to-one, by a bijection. For finite sets this is just counting. For infinite sets it gives surprises: the even numbers can be paired with all counting numbers by , so there are "as many" even numbers as counting numbers. A set that can be listed as is called countable.
Are all infinite sets countable? In 1891 Georg Cantor gave a famous argument that the answer is no.
Suppose someone hands us a list of infinite 0–1 sequences. Build a new sequence by flipping the diagonal: let the -th digit of be the opposite of the -th digit of . Then differs from in position , from in position , and in general from in position . So is not anywhere on the list.
Since every list misses some sequence, the set of all infinite 0–1 sequences is uncountable: it is a strictly bigger infinity than the counting numbers.
注
The experiment shows the mechanism on a finite part of a list. It illustrates the idea; the argument above — which works for any list whatsoever — is the proof.
The same diagonal idea reappears across mathematics and computer science: in showing that the real numbers are uncountable, in Gödel's incompleteness theorems, and in Turing's proof that no program can decide whether every program halts.