Skip to main content

Foundations

Cantor's Theorem and Uncountability

Cantor's diagonal argument proves the reals are uncountable. The power set of any set has strictly greater cardinality. These results are the origin of the distinction between countable and uncountable infinity.

CoreTier 2StableSupporting~45 min

Learning position

Place this page in a reading path.

foundations | layer 0A | tier 2. This page has 1 direct prerequisite and 0 published dependents.

What next

Zermelo-Fraenkel Set Theory

This is the first curated or graph-derived continuation from the current page.

Evidence badge

Claim status

This page has no public Lean mapping yet. Use the evidence page to inspect how claim status labels work.

Show the backing system

Why This Matters

Not all infinite sets are the same size. The natural numbers, the integers, and the rationals are all countable: you can list them. The real numbers are not. This distinction is not a curiosity. It is the reason that complexity measures like VC dimension exist.

The set of all computer programs is countable (they are finite strings over a finite alphabet). The set of all functions from R\mathbb{R} to {0,1}\{0, 1\} is uncountable. So most functions cannot be computed by any program. In ML terms: the hypothesis class of all possible classifiers is uncountably infinite, which is why you must restrict to a learnable subclass and measure its complexity.

Core Definitions

Definition

Countable Set

A set AA is countable if there exists an injection f:A→Nf: A \to \mathbb{N}. Equivalently, AA is countable if it is finite or if there exists a bijection f:A→Nf: A \to \mathbb{N} (countably infinite).

Definition

Uncountable Set

A set AA is uncountable if it is infinite and there is no bijection between AA and N\mathbb{N}. No listing a1,a2,a3,…a_1, a_2, a_3, \ldots can exhaust AA.

Definition

Cardinality

Two sets AA and BB have the same cardinality, written ∣A∣=∣B∣|A| = |B|, if there exists a bijection f:A→Bf: A \to B. We write ∣A∣≤∣B∣|A| \leq |B| if there exists an injection from AA to BB. The Cantor-Bernstein theorem says: if ∣A∣≤∣B∣|A| \leq |B| and ∣B∣≤∣A∣|B| \leq |A|, then ∣A∣=∣B∣|A| = |B|.

Definition

Power Set

The power set of AA, written P(A)\mathcal{P}(A), is the set of all subsets of AA:

P(A)={B:B⊆A}\mathcal{P}(A) = \{B : B \subseteq A\}

For finite AA with ∣A∣=n|A| = n, we have ∣P(A)∣=2n|\mathcal{P}(A)| = 2^n.

Main Theorems

Theorem

Uncountability of the Reals

Statement

The set R\mathbb{R} of real numbers is uncountable. More precisely, the interval [0,1][0, 1] is uncountable.

Intuition

No matter how you try to list the reals in [0,1][0, 1] as a sequence r1,r2,r3,…r_1, r_2, r_3, \ldots, there is always a real number your list misses. The diagonal argument constructs this missing number explicitly.

Proof Sketch

Assume for contradiction that [0,1][0, 1] is countable. List all elements as r1,r2,r3,…r_1, r_2, r_3, \ldots, writing each in decimal as ri=0.di1di2di3…r_i = 0.d_{i1}d_{i2}d_{i3}\ldots. Construct a new number x=0.x1x2x3…x = 0.x_1 x_2 x_3 \ldots where xi≠diix_i \neq d_{ii} (and xi∉{0,9}x_i \notin \{0, 9\} to avoid issues with non-unique representations). Then x∈[0,1]x \in [0, 1] but x≠rix \neq r_i for every ii, since xx and rir_i differ in the ii-th decimal digit. This contradicts the assumption that the list contains all of [0,1][0, 1].

Why It Matters

This is the first proof that infinity is not a single concept. There are strictly more real numbers than natural numbers. The argument pattern (diagonalization) reappears throughout mathematics and computer science: the halting problem, Godel's incompleteness theorems, and the existence of non-computable functions all use variants of it.

Failure Mode

The proof does not work for the rationals. Every rational has a terminating or repeating decimal, and the number constructed by the diagonal argument is generically irrational. The rationals are countable despite being dense in R\mathbb{R}.

Theorem

Cantor's Theorem

Statement

For any set AA, there is no surjection from AA onto P(A)\mathcal{P}(A). Therefore ∣A∣<∣P(A)∣|A| < |\mathcal{P}(A)|: the power set is strictly larger.

Intuition

You cannot pair up elements of AA with subsets of AA so that every subset gets paired. There are always leftover subsets. The proof constructs one such leftover subset explicitly using diagonalization.

Proof Sketch

Let f:A→P(A)f: A \to \mathcal{P}(A) be any function. Define D={a∈A:a∉f(a)}D = \{a \in A : a \notin f(a)\}. Claim: DD is not in the range of ff. If D=f(b)D = f(b) for some bb, then b∈D  ⟺  b∉f(b)=Db \in D \iff b \notin f(b) = D, a contradiction. So ff is not surjective. Since the injection a↦{a}a \mapsto \{a\} shows ∣A∣≤∣P(A)∣|A| \leq |\mathcal{P}(A)|, we conclude ∣A∣<∣P(A)∣|A| < |\mathcal{P}(A)|.

Why It Matters

Cantor's theorem guarantees an infinite hierarchy of infinite cardinalities: ∣N∣<∣P(N)∣<∣P(P(N))∣<⋯|\mathbb{N}| < |\mathcal{P}(\mathbb{N})| < |\mathcal{P}(\mathcal{P}(\mathbb{N}))| < \cdots. There is no largest infinity. This is also the template for Russell's paradox (consider the set of all sets that do not contain themselves), which motivated axiomatic set theory.

Failure Mode

The theorem requires the axioms of separation (to form the set DD) and power set (for P(A)\mathcal{P}(A) to exist). In weaker set theories or constructive settings, the precise formulation matters.

Connection to Computability

The set of all Turing machines (equivalently, all programs) is countable: each program is a finite string, and the set of finite strings over any finite alphabet is countable. But the set of all functions f:N→{0,1}f: \mathbb{N} \to \{0, 1\} has cardinality 2∣N∣=∣P(N)∣2^{|\mathbb{N}|} = |\mathcal{P}(\mathbb{N})|, which by Cantor's theorem is uncountable.

Therefore: most functions from N\mathbb{N} to {0,1}\{0, 1\} are not computable. No program computes them. This is not a conjecture; it follows directly from a counting argument.

Connection to ML

The hypothesis class of all binary classifiers on Rd\mathbb{R}^d (all functions h:Rd→{0,1}h: \mathbb{R}^d \to \{0, 1\}) has cardinality 2∣Rd∣2^{|\mathbb{R}^d|}, which is uncountably infinite. The ERM generalization bound for finite hypothesis classes gives a gap of log⁡∣H∣/n\sqrt{\log|\mathcal{H}| / n}, which is undefined when ∣H∣|\mathcal{H}| is an infinite cardinal (a cardinal does not have a real-valued logarithm), so the finite-class bound simply does not apply.

This is why complexity measures exist. VC dimension, Rademacher complexity, and covering numbers are all ways to assign a finite "effective size" to an infinite hypothesis class, making generalization bounds non-vacuous.

Common Confusions

Watch Out

The rationals are dense but countable

Density and countability are independent properties. The rationals are dense in R\mathbb{R} (between any two reals there is a rational), yet Q\mathbb{Q} is countable. Density is a topological property; countability is a set-theoretic one.

Watch Out

Cantor's theorem does not say which cardinality the reals have

Cantor proved ∣R∣>∣N∣|\mathbb{R}| > |\mathbb{N}|, but did not determine whether ∣R∣=ℵ1|\mathbb{R}| = \aleph_1 (the next cardinal after ℵ0=∣N∣\aleph_0 = |\mathbb{N}|). The claim ∣R∣=ℵ1|\mathbb{R}| = \aleph_1 is the Continuum Hypothesis, which is independent of ZFC. It can be neither proved nor disproved from the standard axioms.

Exercises

ExerciseCore

Problem

Prove that the set of all finite binary strings {0,1}∗\{0, 1\}^* is countable.

ExerciseCore

Problem

Using Cantor's theorem, prove that there exists a function f:N→{0,1}f: \mathbb{N} \to \{0, 1\} that is not computable by any Turing machine.

ExerciseAdvanced

Problem

Let H\mathcal{H} be the set of all binary classifiers on [0,1][0,1]. Show that ∣H∣|\mathcal{H}| is uncountable and explain why the finite-class ERM bound does not apply.

References

Canonical:

  • Halmos, Naive Set Theory (1960), Sections 1-4 and 25
  • Enderton, Elements of Set Theory (1977), Chapter 6

Connection to CS:

  • Sipser, Introduction to the Theory of Computation (2013), Section 4.2

Connection to ML:

  • Shalev-Shwartz & Ben-David, Understanding Machine Learning (2014), Chapter 2

  • Munkres, Topology (2000), Chapter 1 (set theory review)

Next Topics

Continue on ComputationPath

Last reviewed: April 13, 2026

Cite this page

Sneiderman, Robby. "Cantor's Theorem and Uncountability." TheoremPath, reviewed 2026-04-13. https://theorempath.com/topics/cantors-theorem-and-uncountability

Canonical URL
https://theorempath.com/topics/cantors-theorem-and-uncountability
Author
Robby Sneiderman, TheoremPath
Last reviewed
2026-04-13
What this is
A reference page on TheoremPath. Written and maintained by the named author. Not peer reviewed and not refereed by any venue. Each claim below carries its own verification status.
Terms
All rights reserved. Non-commercial quotation with attribution permitted.

Citing one claim

2 statements on this page are separately addressable. Each carries an identifier of the form claim:<topic>::<statement> printed beside it, and resolves to that identifier's anchor on this URL. Quote the statement, its assumptions, and its failure modes together.

Recorded verification on this page: 2 informal_only.

  • This page is a secondary source. Where a claim cites literature, the result is due to that source and not to this site.
  • 2 of 2 claims on this page name no source. Their attribution to the literature is not recorded here, whatever their verification status says.
  • 2 of 2 carry neither a source nor a proof check. Their provenance is the author's reading of the literature; check them against a primary source before relying on them.
  • Statements are given in LaTeX exactly as authored. The rendered page passes the same LaTeX through KaTeX, so text scraped from the HTML repeats expressions and drops radicals; quote from statementTex.

/claims.json lists 1,178 of the 1,231 statements this site records, with the anchor and the recorded verification of each. What earns a place in it: a theorem, lemma, corollary, or proposition block on a published topic page. Definitions are not listed, and neither are the 27 statements on comparison pages. A missing entry means the rule above did not select the statement, not that this site is silent on the result.

Canonical graph

Required before and derived from this topic

These links come from prerequisite edges in the curriculum graph. Editorial suggestions are shown here only when the target page also cites this page as a prerequisite.

Required prerequisites

1

Derived topics

0

No published topic currently declares this as a prerequisite.