Mathematical Tools & Proof Techniques

countable versus uncountable sets

Not all infinities are the same size — that is the startling truth at the heart of this idea. A set is countable if you can put its members into a single waiting line numbered 1, 2, 3, ..., so that everything eventually gets a turn, even if the line never ends. The whole numbers are countable, and so, surprisingly, are the fractions. A set is uncountable if no such line can ever reach everything: no matter how you try to list its members, something is always left out.

The precise tool is a bijection, a perfect one-to-one pairing. A set is countable when there is a bijection between it and (a subset of) the natural numbers 1, 2, 3, ...; intuitively, you can enumerate it. The set of all finite strings over a finite alphabet is countable: list them by length, and within each length in dictionary order, and every string appears at some finite position. So is the set of all computer programs, since each program is just a finite string of symbols. Cardinality is the name for 'how big' a set is in this sense, and countable infinity is the smallest infinite size.

Here is the punchline that opens the door to undecidability. The set of all programs (or machines) is countable, but the set of all languages over even a one-symbol alphabet is uncountable — it is the power set of a countably infinite set, which Cantor's diagonal argument shows is strictly bigger. A countable set of programs cannot possibly pair up one-to-one with an uncountable set of languages. Therefore there must exist languages that no program recognizes — proven to exist before we ever construct one. This is the first honest whiff that some problems are beyond all machines.

The strings over {a} are a, aa, aaa, ... — countable, listable by length. But the languages over {a} are subsets of that list, and there are uncountably many subsets (2 to the power of a countable infinity). Programs are countable, languages are not, so some language has no program.

Countably many programs cannot cover uncountably many languages — so some language is unrecognizable.

'Countable' allows infinite sets, as long as they can be enumerated; it does not mean finite. The rationals are infinite yet countable. 'Uncountable' means strictly larger than this smallest infinity.

Also called
cardinality, sizes of infinity基數無限的大小可列與不可列