Skip to content
The Lumenary
Advanced undergraduateUndergraduate 120 min

Ordinals and cardinals

Two ways of counting past infinity — by position and by size — and why 1+ω=ω≠ω+11 + \omega = \omega \neq \omega + 1 while ℵ0+1=ℵ0\aleph_0 + 1 = \aleph_0.

Formally verified · 15 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review
MotivationH

Counting past infinity

"Three" answers two different questions. How many pebbles are in the bowl? Three. Which runner crossed the line after the second? The third. For finite collections the two answers always agree, so we rarely notice that they are different ideas. For infinite collections they come apart.

Line up the natural numbers as usual, 0,1,2,3,…0, 1, 2, 3, \dots, and then line them up again, but with 00 moved to the very end: 1,2,3,…,01, 2, 3, \dots, 0. How many numbers are there? The same set, so the same number. But the two arrangements have different shapes: in the second there is a last element, standing after infinitely many others. Georg Cantor met such arrangements in the 1870s and 1880s while studying the sets on which a trigonometric series may misbehave: taking limit points of limit points of limit points, he needed to keep counting after all the finite stages — "∞\infty, ∞+1\infty + 1, ∞+2\infty + 2, …" — and he invented the ordinal numbers to do it.

This lesson builds both kinds of infinite number inside ZFC. Ordinals measure the shapes of well-ordered sets; cardinals measure sizes. We prove the basic theorems about both — including the Schröder–Bernstein theorem and Hessenberg's theorem κ⋅κ=κ\kappa \cdot \kappa = \kappa — and meet the question about sizes that ZFC cannot answer, the continuum hypothesis. You should know well-orders and countability and Cantor's diagonal argument.

IntuitionH

Shapes of well-orders

A well-order is a linear order in which every non-empty subset has a least element. Every finite linear order is a well-order, and so is (N,≤)(\N, \le); the integers and the rationals are not. Well-orders are exactly the orders along which we can "count": after any set of positions that is not everything, there is a next position — the least one not yet used.

ωω + 11 + ωω · 2
Four well-orders on countably many points, drawn as tally marks that shrink towards a limit. The first is $\omega$, the shape of $0, 1, 2, \dots$. The second, $\omega + 1$, has one more point after all the others (gold). The third, $1 + \omega$, has one more point before them — and is the same shape as $\omega$. The last, $\omega \cdot 2 = \omega + \omega$, is two copies of $\omega$ one after the other.

The pictures already show the two main surprises. Adding a point at the end of ω\omega changes its shape — ω+1\omega + 1 has a largest element, ω\omega does not — but adding a point at the beginning does not: 1+ω1 + \omega is again "a first point, then a next, then a next, …", which is ω\omega. So ordinal addition will not be commutative. And yet all four orders have the same size: each is a countable set. Ordinals keep track of shape; cardinals forget everything except size.

DefinitionsH

Definitions

Definition— order isomorphism, initial segment

Linear orders (A,<)(A, <) and (B,≺)(B, \prec) are isomorphic if there is a bijection f:A→Bf : A \to B with a<a′  ⟺  f(a)≺f(a′)a < a' \iff f(a) \prec f(a'). The initial segment of a linear order WW below ww is Ww={x∈W∣x<w}W_w = \{x \in W \mid x < w\}.

Definition— ordinal

A set xx is transitive if every element of xx is also a subset of xx (if z∈y∈xz \in y \in x then z∈xz \in x). An ordinal is a transitive set that is well-ordered by ∈\in — that is, the relation {(y,z)∣y,z∈x, y∈z}\{(y, z) \mid y, z \in x,\ y \in z\} is a strict well-order of xx. We write α<β\alpha < \beta for α∈β\alpha \in \beta when α,β\alpha, \beta are ordinals, and Ord\mathrm{Ord} for the class of all ordinals.

The von Neumann natural numbers 0=∅0 = \varnothing, 1={0}1 = \{0\}, 2={0,1},…2 = \{0, 1\}, \dots are ordinals, and so is ω={0,1,2,… }\omega = \{0, 1, 2, \dots\}. Each ordinal is the set of the ordinals before it: α={β∈Ord∣β<α}\alpha = \{\beta \in \mathrm{Ord} \mid \beta < \alpha\}.

Definition— successor and limit ordinals

The successor of an ordinal α\alpha is α+1=α∪{α}\alpha + 1 = \alpha \cup \{\alpha\}. An ordinal is a successor ordinal if it is β+1\beta + 1 for some β\beta, and a limit ordinal if it is neither 00 nor a successor. The least limit ordinal is ω\omega.

Definition— comparing sizes

∣A∣≤∣B∣|A| \le |B| means there is an injection A→BA \to B; ∣A∣=∣B∣|A| = |B| means there is a bijection A→BA \to B; and ∣A∣<∣B∣|A| < |B| means ∣A∣≤∣B∣|A| \le |B| but not ∣A∣=∣B∣|A| = |B|.

Definition— cardinal

A cardinal is an ordinal that is not in bijection with any smaller ordinal. If AA can be well-ordered, its cardinality ∣A∣|A| is the least ordinal in bijection with AA, which is a cardinal. The infinite cardinals are listed by the alephs: ℵ0=ω\aleph_0 = \omega, ℵα+1\aleph_{\alpha + 1} is the least cardinal greater than ℵα\aleph_\alpha, and ℵλ=sup⁡β<λℵβ\aleph_\lambda = \sup_{\beta < \lambda} \aleph_\beta for limit λ\lambda. (When the ordinal rather than the size is meant, ℵα\aleph_\alpha is also written ωα\omega_\alpha.)

So ω\omega, ω+1\omega + 1 and ω+ω\omega + \omega are three different ordinals but only one cardinal, ℵ0=ω\aleph_0 = \omega: the others are in bijection with the smaller ordinal ω\omega. Every finite ordinal is a cardinal, and every infinite cardinal is a limit ordinal.

ProofH

The ordinals are well-ordered

Theorem— Lemma 1

Every element of an ordinal is an ordinal.

Proof

Let α\alpha be an ordinal and x∈αx \in \alpha. Since α\alpha is transitive, x⊆αx \subseteq \alpha, so ∈\in well-orders xx (a subset of a well-order is well-ordered). To see that xx is transitive, let z∈y∈xz \in y \in x. Then y∈αy \in \alpha and so z∈αz \in \alpha, by transitivity of α\alpha. Now z,y,xz, y, x are elements of α\alpha with z∈yz \in y and y∈xy \in x; since ∈\in is a transitive relation on α\alpha (it is an order), z∈xz \in x.

∎

Theorem— Lemma 2

If γ\gamma and β\beta are ordinals and γ⊊β\gamma \subsetneq \beta, then γ∈β\gamma \in \beta.

Proof

Let ξ\xi be the ∈\in-least element of the non-empty set β∖γ\beta \setminus \gamma. We show ξ=γ\xi = \gamma. If η∈ξ\eta \in \xi, then η∈β\eta \in \beta (transitivity of β\beta) and η∉β∖γ\eta \notin \beta \setminus \gamma by the minimality of ξ\xi; so η∈γ\eta \in \gamma. Conversely, let η∈γ\eta \in \gamma. Then η\eta and ξ\xi are elements of β\beta, which is linearly ordered by ∈\in: so η∈ξ\eta \in \xi, η=ξ\eta = \xi or ξ∈η\xi \in \eta. The middle case is impossible because ξ∉γ\xi \notin \gamma, and so is the last, since ξ∈η∈γ\xi \in \eta \in \gamma would give ξ∈γ\xi \in \gamma by transitivity of γ\gamma. Hence η∈ξ\eta \in \xi. So ξ=γ\xi = \gamma, and γ=ξ∈β\gamma = \xi \in \beta.

∎

Theorem— Theorem 3 (any two ordinals are comparable)

For ordinals α,β\alpha, \beta, exactly one of α∈β\alpha \in \beta, α=β\alpha = \beta, β∈α\beta \in \alpha holds.

Proof

The set δ=α∩β\delta = \alpha \cap \beta is transitive (an intersection of transitive sets) and well-ordered by ∈\in (a subset of α\alpha), so it is an ordinal. If δ≠α\delta \neq \alpha and δ≠β\delta \neq \beta, then Lemma 2 gives δ∈α\delta \in \alpha and δ∈β\delta \in \beta, so δ∈α∩β=δ\delta \in \alpha \cap \beta = \delta; but ∈\in is irreflexive on α\alpha, a contradiction. So δ=α\delta = \alpha, that is α⊆β\alpha \subseteq \beta, and then α=β\alpha = \beta or α∈β\alpha \in \beta by Lemma 2; or δ=β\delta = \beta and symmetrically β=α\beta = \alpha or β∈α\beta \in \alpha. At most one case holds: α∈β\alpha \in \beta together with α=β\alpha = \beta or with β∈α\beta \in \alpha would give α∈α\alpha \in \alpha (using transitivity of α\alpha in the second case), contradicting irreflexivity.

∎

Theorem— Theorem 4 (least elements and suprema)

Every non-empty set SS of ordinals has a least element, which equals ⋂S\bigcap S, and a least upper bound, namely ⋃S\bigcup S, which is an ordinal.

Proof

Pick α∈S\alpha \in S. If no element of SS is below α\alpha, then by Theorem 3 α\alpha is least. Otherwise α∩S\alpha \cap S is a non-empty subset of the well-ordered set α\alpha and has a least element, which is then least in SS (anything below it would also be in α∩S\alpha \cap S). The least element α0\alpha_0 is a subset of every member of SS (for ordinals, α0≤β\alpha_0 \le \beta gives α0⊆β\alpha_0 \subseteq \beta by transitivity) and is itself a member, so α0=⋂S\alpha_0 = \bigcap S. For the supremum: ⋃S\bigcup S is a union of transitive sets, hence transitive; its elements are ordinals by Lemma 1; by Theorem 3 and the first part, ∈\in is a well-order on it. So ⋃S\bigcup S is an ordinal. It contains every β∈S\beta \in S as a subset, so it is an upper bound (Lemma 2); and if γ\gamma is any upper bound, every β∈S\beta \in S is a subset of γ\gamma, so ⋃S⊆γ\bigcup S \subseteq \gamma, which by Lemma 2 means ⋃S≤γ\bigcup S \le \gamma.

∎

Theorem— Theorem 5 (Burali-Forti)

There is no set of all ordinals.

Proof

If Ω\Omega were the set of all ordinals, it would be transitive (Lemma 1) and well-ordered by ∈\in (Theorems 3 and 4), hence an ordinal; so Ω∈Ω\Omega \in \Omega, contradicting the irreflexivity of ∈\in on the ordinal Ω\Omega.

∎

Theorem— Theorem 6 (transfinite induction)

Let φ\varphi be a property of ordinals. If, for every ordinal α\alpha, "φ(β)\varphi(\beta) for all β<α\beta < \alpha" implies φ(α)\varphi(\alpha), then φ(α)\varphi(\alpha) holds for every ordinal α\alpha. Equivalently: if φ(0)\varphi(0); φ(α)⇒φ(α+1)\varphi(\alpha) \Rightarrow \varphi(\alpha + 1); and for limit λ\lambda, "φ(β)\varphi(\beta) for all β<λ\beta < \lambda" implies φ(λ)\varphi(\lambda) — then φ\varphi holds for all ordinals.

Proof

If φ(α)\varphi(\alpha) failed, the set {β≤α∣¬φ(β)}\{\beta \le \alpha \mid \neg\varphi(\beta)\} would be a non-empty set of ordinals with a least element β0\beta_0 (Theorem 4). Every β<β0\beta < \beta_0 satisfies φ\varphi, so the hypothesis gives φ(β0)\varphi(\beta_0), a contradiction. The second form follows because every ordinal is 00, a successor or a limit, and in each case its hypothesis supplies the induction step.

∎

Theorem— Theorem 7 (transfinite recursion)

Let GG be a class function (given by a formula) defined on all sets. Then there is a unique class function FF on the ordinals with F(α)=G(F↾α)F(\alpha) = G(F \restriction \alpha) for every α\alpha, where F↾αF \restriction \alpha is the set {(β,F(β))∣β<α}\{(\beta, F(\beta)) \mid \beta < \alpha\}.

Proof

(Sketch.) Call a function ff with domain an ordinal δ\delta an attempt if f(β)=G(f↾β)f(\beta) = G(f \restriction \beta) for all β<δ\beta < \delta. By transfinite induction, two attempts agree where both are defined. Again by transfinite induction, for every α\alpha there is an attempt with domain α+1\alpha + 1: at a limit stage, Replacement collects the attempts on the smaller ordinals into a set, and their union is an attempt to which one more value can be added. Define F(α)F(\alpha) as the value at α\alpha of any attempt defined there. Uniqueness is one more transfinite induction. (Full details: Enderton 1977, chapter 7; Kunen 1980, chapter I.)

∎

Recursion is how the transfinite is used in practice: the stages VαV_\alpha of the cumulative hierarchy, ordinal arithmetic, the aleph function and the iterated derived sets P(α)P^{(\alpha)} of analysis are all defined by it.

ProofH

Every well-order is an ordinal

Theorem— Lemma 8 (well-orders are rigid)

Let (W,<)(W, <) be a well-order and f:W→Wf : W \to W strictly increasing. Then x≤f(x)x \le f(x) for every x∈Wx \in W.

Proof

Otherwise the set {x∣f(x)<x}\{x \mid f(x) < x\} is non-empty; let mm be its least element. Then f(m)<mf(m) < m, and since ff is strictly increasing, f(f(m))<f(m)f(f(m)) < f(m). So f(m)f(m) also belongs to the set, and it is smaller than mm — a contradiction.

∎

Theorem— Corollary 9

(a) A well-order is not isomorphic to any proper initial segment of itself. (b) Between two well-orders there is at most one isomorphism. (c) Distinct ordinals are not isomorphic.

Proof

(a) An isomorphism f:W→Wwf : W \to W_w would be strictly increasing with f(w)<wf(w) < w, contradicting Lemma 8. (b) If f,g:W→Vf, g : W \to V are isomorphisms, then g−1∘fg^{-1} \circ f and f−1∘gf^{-1} \circ g are strictly increasing maps W→WW \to W, so x≤g−1(f(x))x \le g^{-1}(f(x)) and x≤f−1(g(x))x \le f^{-1}(g(x)); applying gg and ff gives g(x)≤f(x)≤g(x)g(x) \le f(x) \le g(x). (c) If α<β\alpha < \beta, then α=βα\alpha = \beta_\alpha is a proper initial segment of β\beta, so (a) applies.

∎

Theorem— Theorem 10 (order types)

Every well-ordered set (W,<)(W, <) is isomorphic to exactly one ordinal, its order type type(W)\mathrm{type}(W).

Proof

Uniqueness is Corollary 9(c). For existence, let W′W' be the set of w∈Ww \in W such that the initial segment WwW_w is isomorphic to some ordinal; that ordinal is unique, call it F(w)F(w). By Replacement, A={F(w)∣w∈W′}A = \{F(w) \mid w \in W'\} is a set.

  • W′W' is closed downwards, and FF is strictly increasing. If w∈W′w \in W' via h:Ww≅F(w)h : W_w \cong F(w) and v<wv < w, then hh restricts to an isomorphism Wv≅h(v)W_v \cong h(v), where h(v)∈F(w)h(v) \in F(w) is an ordinal (Lemma 1); so v∈W′v \in W' and F(v)=h(v)∈F(w)F(v) = h(v) \in F(w).
  • AA is an ordinal. It is a set of ordinals, and it is transitive: if β∈F(w)\beta \in F(w), then β=h(v)\beta = h(v) for some v<wv < w, and β=F(v)∈A\beta = F(v) \in A by the previous point. By Theorems 3 and 4, a transitive set of ordinals is an ordinal.
  • F:W′→AF : W' \to A is an isomorphism, by the first point.
  • W′=WW' = W. Otherwise let ww be the least element of W∖W′W \setminus W'. Since W′W' is closed downwards, W′=WwW' = W_w, and FF shows that WwW_w is isomorphic to the ordinal AA; so w∈W′w \in W', a contradiction.

Hence W=W′≅AW = W' \cong A.

∎

The proof needs Replacement, and this is no accident: in Zermelo's system without Replacement one cannot prove that the ordinal ω+ω\omega + \omega exists, although the well-order "two copies of N\N" obviously does.

ExplanationH

Ordinal arithmetic

Ordinal arithmetic can be defined in two equivalent ways. By order types: α+β\alpha + \beta is the type of a copy of α\alpha followed by a copy of β\beta, and α⋅β\alpha \cdot \beta is the type of β\beta copies of α\alpha — the set α×β\alpha \times \beta ordered by comparing second coordinates first. Or by transfinite recursion on the second argument:

α+0=α,α+(β+1)=(α+β)+1,α+λ=sup⁡β<λ(α+β),α⋅0=0,α⋅(β+1)=α⋅β+α,α⋅λ=sup⁡β<λα⋅β,α0=1,αβ+1=αβ⋅α,αλ=sup⁡β<λαβ(α≥1),\begin{aligned} \alpha + 0 &= \alpha, & \alpha + (\beta + 1) &= (\alpha + \beta) + 1, & \alpha + \lambda &= \textstyle\sup_{\beta < \lambda} (\alpha + \beta), \\ \alpha \cdot 0 &= 0, & \alpha \cdot (\beta + 1) &= \alpha \cdot \beta + \alpha, & \alpha \cdot \lambda &= \textstyle\sup_{\beta < \lambda} \alpha \cdot \beta, \\ \alpha^0 &= 1, & \alpha^{\beta + 1} &= \alpha^\beta \cdot \alpha, & \alpha^\lambda &= \textstyle\sup_{\beta < \lambda} \alpha^\beta \quad (\alpha \ge 1), \end{aligned}

for limit ordinals λ\lambda. On the natural numbers these are the usual operations.

Example— Order matters

  • 1+ω=sup⁡n(1+n)=ω1 + \omega = \sup_n (1 + n) = \omega, but ω+1>ω\omega + 1 > \omega (it has a largest element).
  • 2⋅ω=sup⁡n2n=ω2 \cdot \omega = \sup_n 2n = \omega ("ω\omega copies of 22": ∙∙ ∙∙ ∙∙⋯\bullet\bullet\ \bullet\bullet\ \bullet\bullet \cdots is just ω\omega), but ω⋅2=ω+ω>ω\omega \cdot 2 = \omega + \omega > \omega.
  • (ω+1)⋅2=(ω+1)+(ω+1)=ω+(1+ω)+1=ω⋅2+1(\omega + 1) \cdot 2 = (\omega + 1) + (\omega + 1) = \omega + (1 + \omega) + 1 = \omega \cdot 2 + 1, whereas 2⋅(ω+1)=2⋅ω+2=ω+22 \cdot (\omega + 1) = 2 \cdot \omega + 2 = \omega + 2.
  • (1+1)⋅ω=2⋅ω=ω(1 + 1) \cdot \omega = 2 \cdot \omega = \omega, but 1⋅ω+1⋅ω=ω⋅21 \cdot \omega + 1 \cdot \omega = \omega \cdot 2: the right distributive law fails.

Some laws do survive, each proved by transfinite induction on the last variable: addition and multiplication are associative; the left distributive law α⋅(β+γ)=α⋅β+α⋅γ\alpha \cdot (\beta + \gamma) = \alpha \cdot \beta + \alpha \cdot \gamma holds; and β<γ\beta < \gamma implies α+β<α+γ\alpha + \beta < \alpha + \gamma, while only β+α≤γ+α\beta + \alpha \le \gamma + \alpha holds on the other side (1<21 < 2 but 1+ω=2+ω1 + \omega = 2 + \omega).

Cantor normal form. Every ordinal α>0\alpha > 0 can be written uniquely as α=ωβ1c1+ωβ2c2+⋯+ωβkck\alpha = \omega^{\beta_1} c_1 + \omega^{\beta_2} c_2 + \cdots + \omega^{\beta_k} c_k with α≥β1>β2>⋯>βk\alpha \ge \beta_1 > \beta_2 > \cdots > \beta_k and positive integers cic_i — a "base-ω\omega expansion". The ordinals ω,ωω,ωωω,…\omega, \omega^\omega, \omega^{\omega^\omega}, \dots have supremum ε0\varepsilon_0, the least ordinal with ωε0=ε0\omega^{\varepsilon_0} = \varepsilon_0; below ε0\varepsilon_0 the exponents βi\beta_i are themselves smaller than α\alpha, so normal forms can be written out completely. The computation section implements this arithmetic.

ProofH

Comparing sizes

Theorem— Theorem 11 (Cantor)

For every set AA, there is no surjection A→P(A)A \to \mathcal P(A). Hence ∣A∣<∣P(A)∣|A| < |\mathcal P(A)|.

Proof

Let f:A→P(A)f : A \to \mathcal P(A) and put D={x∈A∣x∉f(x)}D = \{x \in A \mid x \notin f(x)\}. If D=f(a)D = f(a) for some aa, then a∈D  ⟺  a∉f(a)  ⟺  a∉Da \in D \iff a \notin f(a) \iff a \notin D, which is impossible. So DD is not a value of ff. Since a↦{a}a \mapsto \{a\} is an injection A→P(A)A \to \mathcal P(A), we get ∣A∣≤∣P(A)∣|A| \le |\mathcal P(A)| but not ∣A∣=∣P(A)∣|A| = |\mathcal P(A)|.

∎

Theorem— Theorem 12 (Schröder–Bernstein, provable in ZF)

If ∣A∣≤∣B∣|A| \le |B| and ∣B∣≤∣A∣|B| \le |A|, then ∣A∣=∣B∣|A| = |B|.

Proof

Let f:A→Bf : A \to B and g:B→Ag : B \to A be injections. For S⊆AS \subseteq A put

F(S)=A∖g[ B∖f[S] ].F(S) = A \setminus g\big[\, B \setminus f[S] \,\big].

If S⊆TS \subseteq T then f[S]⊆f[T]f[S] \subseteq f[T], so B∖f[S]⊇B∖f[T]B \setminus f[S] \supseteq B \setminus f[T], and therefore F(S)⊆F(T)F(S) \subseteq F(T): FF is monotone.

A fixed point (Knaster–Tarski). Let S=⋂{T⊆A∣F(T)⊆T}S = \bigcap \{T \subseteq A \mid F(T) \subseteq T\} (the family contains AA, so the intersection makes sense). For each such TT, S⊆TS \subseteq T gives F(S)⊆F(T)⊆TF(S) \subseteq F(T) \subseteq T; hence F(S)⊆SF(S) \subseteq S. Then F(F(S))⊆F(S)F(F(S)) \subseteq F(S), so F(S)F(S) is one of the TT's and S⊆F(S)S \subseteq F(S). Thus F(S)=SF(S) = S, which says exactly that

A∖S=g[ B∖f[S] ].A \setminus S = g\big[\, B \setminus f[S] \,\big].

The bijection. Define h:A→Bh : A \to B by h(a)=f(a)h(a) = f(a) for a∈Sa \in S and h(a)=g−1(a)h(a) = g^{-1}(a) for a∉Sa \notin S; the second case makes sense because every a∉Sa \notin S is g(b)g(b) for a unique b∈B∖f[S]b \in B \setminus f[S].

  • hh is injective: on SS it is ff, on A∖SA \setminus S it is g−1g^{-1}, both injective; and a value f(a)f(a) with a∈Sa \in S lies in f[S]f[S], while a value g−1(a′)g^{-1}(a') with a′∉Sa' \notin S lies in B∖f[S]B \setminus f[S].
  • hh is surjective: a point b∈f[S]b \in f[S] is h(a)h(a) for its preimage a∈Sa \in S; a point b∉f[S]b \notin f[S] has g(b)∈g[B∖f[S]]=A∖Sg(b) \in g[B \setminus f[S]] = A \setminus S, so h(g(b))=g−1(g(b))=bh(g(b)) = g^{-1}(g(b)) = b.

∎

The proof uses no choice. The set SS has a concrete description: follow a point of AA backwards through g−1g^{-1}, f−1f^{-1}, g−1,…g^{-1}, \dots for as long as possible; SS consists of the points whose backward chain stops in AA. The computation section builds hh this way.

Theorem— Theorem 13 (Hartogs, provable in ZF)

For every set AA there is an ordinal α\alpha with no injection α→A\alpha \to A. Consequently, for every ordinal α\alpha there is a cardinal greater than α\alpha, and the alephs are defined for every ordinal index.

Proof

Every well-order of a subset of AA is a subset of A×AA \times A, so these well-orders form a set (by Separation from P(A×A)\mathcal P(A \times A)), and by Replacement their order types form a set HH. If β∈H\beta \in H and γ<β\gamma < \beta, then γ\gamma is the type of an initial segment, so γ∈H\gamma \in H: HH is a transitive set of ordinals, hence an ordinal. An ordinal injects into AA if and only if it is the order type of a well-order of a subset of AA, i.e. if and only if it belongs to HH. Since H∉HH \notin H, the ordinal α=H\alpha = H does not inject into AA. For the second statement apply this to A=αA = \alpha: the least ordinal that does not inject into α\alpha is a cardinal greater than α\alpha.

∎

Theorem— Theorem 14 (Hessenberg)

For every infinite cardinal κ\kappa:  κ⋅κ=κ\ \kappa \cdot \kappa = \kappa, that is, ∣κ×κ∣=κ|\kappa \times \kappa| = \kappa.

Proof

Order κ×κ\kappa \times \kappa by Gödel's ordering: (α,β)⊲(γ,δ)(\alpha, \beta) \lhd (\gamma, \delta) if max⁡(α,β)<max⁡(γ,δ)\max(\alpha, \beta) < \max(\gamma, \delta), or the maxima are equal and (α,β)(\alpha, \beta) precedes (γ,δ)(\gamma, \delta) lexicographically. This is a well-order (a least element of a non-empty set is found by minimising the maximum first, then lexicographically). We prove the theorem by transfinite induction on infinite cardinals κ\kappa, assuming it for all smaller infinite cardinals.

The initial segment below (α,β)(\alpha, \beta) is contained in μ×μ\mu \times \mu, where μ=max⁡(α,β)+1<κ\mu = \max(\alpha, \beta) + 1 < \kappa (since κ\kappa is a limit ordinal). If μ\mu is finite then μ×μ\mu \times \mu is finite; if μ\mu is infinite then ∣μ×μ∣=∣μ∣⋅∣μ∣=∣μ∣<κ|\mu \times \mu| = |\mu| \cdot |\mu| = |\mu| < \kappa by the induction hypothesis applied to the cardinal ∣μ∣<κ|\mu| < \kappa. So every proper initial segment of (κ×κ,⊲)(\kappa \times \kappa, \lhd) has cardinality less than κ\kappa. Let θ\theta be its order type. If θ>κ\theta > \kappa, then κ\kappa would be the order type of a proper initial segment, which has cardinality ∣κ∣=κ|\kappa| = \kappa — impossible. So θ≤κ\theta \le \kappa, and ∣κ×κ∣=∣θ∣≤κ|\kappa \times \kappa| = |\theta| \le \kappa. The reverse inequality κ≤∣κ×κ∣\kappa \le |\kappa \times \kappa| is clear, and Schröder–Bernstein finishes the proof.

∎

Cardinal arithmetic is defined by κ+λ=∣κ⊔λ∣\kappa + \lambda = |\kappa \sqcup \lambda| (disjoint union), κ⋅λ=∣κ×λ∣\kappa \cdot \lambda = |\kappa \times \lambda| and κλ=∣{functions λ→κ}∣\kappa^\lambda = |\{\text{functions } \lambda \to \kappa\}|.

Theorem— Corollary 15

If κ\kappa is infinite and λ≤κ\lambda \le \kappa, then κ+λ=κ\kappa + \lambda = \kappa; if moreover λ≠0\lambda \neq 0, then κ⋅λ=κ\kappa \cdot \lambda = \kappa.

Proof

κ≤κ+λ≤κ+κ=2⋅κ≤κ⋅κ=κ\kappa \le \kappa + \lambda \le \kappa + \kappa = 2 \cdot \kappa \le \kappa \cdot \kappa = \kappa, and κ≤κ⋅λ≤κ⋅κ=κ\kappa \le \kappa \cdot \lambda \le \kappa \cdot \kappa = \kappa; Schröder–Bernstein turns the chains of inequalities into equalities.

∎

Example— Cardinal computations

  • ℵ0+1=ℵ0+ℵ0=ℵ0⋅ℵ0=ℵ0\aleph_0 + 1 = \aleph_0 + \aleph_0 = \aleph_0 \cdot \aleph_0 = \aleph_0, while the ordinals ω\omega, ω+1\omega + 1, ω+ω\omega + \omega and ω⋅ω\omega \cdot \omega are all different.
  • ∣R∣=∣P(N)∣=2ℵ0|\R| = |\mathcal P(\N)| = 2^{\aleph_0} (from the countability lesson), and ∣R2∣=2ℵ0⋅2ℵ0=2ℵ0+ℵ0=2ℵ0|\R^2| = 2^{\aleph_0} \cdot 2^{\aleph_0} = 2^{\aleph_0 + \aleph_0} = 2^{\aleph_0}: the plane has as many points as the line. Cantor found this in 1877 and wrote to Dedekind, "I see it, but I don't believe it."
  • ∣NN∣=ℵ0ℵ0|\N^\N| = \aleph_0^{\aleph_0} satisfies 2ℵ0≤ℵ0ℵ0≤(2ℵ0)ℵ0=2ℵ0⋅ℵ0=2ℵ02^{\aleph_0} \le \aleph_0^{\aleph_0} \le (2^{\aleph_0})^{\aleph_0} = 2^{\aleph_0 \cdot \aleph_0} = 2^{\aleph_0}, so it equals 2ℵ02^{\aleph_0}.

The continuum hypothesis. Cantor's theorem gives 2ℵ0>ℵ02^{\aleph_0} > \aleph_0, so 2ℵ0≥ℵ12^{\aleph_0} \ge \aleph_1 (assuming R\R can be well-ordered, which follows from the axiom of choice). The continuum hypothesis (CH) is the statement 2ℵ0=ℵ12^{\aleph_0} = \aleph_1: every infinite set of reals is either countable or the same size as R\R. Cantor posed it in 1878, and Hilbert put it first on his list of problems in 1900. Gödel (1938) showed that ZFC does not refute CH, and Cohen (1963) that it does not prove it — if ZFC is consistent, so is ZFC + 2ℵ0=ℵ22^{\aleph_0} = \aleph_2. By later work of Robert Solovay, 2ℵ02^{\aleph_0} can consistently be any cardinal of uncountable cofinality (such as ℵ2\aleph_2 or ℵω+1\aleph_{\omega + 1}), but by a theorem of Julius König (1905) it can never be ℵω\aleph_\omega.

Formal mathematicsF

Ordinals and cardinals in Lean

Mathlib defines an ordinal as an isomorphism class of well-orders, and a cardinal as an equivalence class of types under bijection — the "order type" and "size" of the lesson, taken as primitive. The von Neumann picture is recovered inside Mathlib's model of ZFC: ordinals correspond exactly to the transitive sets well-ordered by ∈\in, which is Theorem 10 in Mathlib's language.

von_neumann_isoLean 4Applies a library theoremFormally verified
/-- **Every ordinal is represented by exactly one von Neumann ordinal.** Mathlib's ordinals
(isomorphism types of well-orders) are order-isomorphic to the transitive sets well-ordered by
`∈` inside its model of ZFC. This applies `Ordinal.toZFSetIso`. -/
theorem von_neumann_iso : Nonempty (Ordinal.{u} ≃o {x : ZFSet.{u} // x.IsOrdinal}) :=
  ⟨Ordinal.toZFSetIso⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

The engine of Theorem 10 is the rigidity of well-orders, Lemma 8 and Corollary 9, which we prove exactly as in the lesson — the least counterexample mm, and its image f(m)f(m) as a smaller one:

le_apply_of_strictMonoLean 4Proved here from basic factsFormally verified
/-- **In a well-order, a strictly increasing map never moves a point down:** `x ≤ f x`.
If not, take the *least* `m` with `f m < m`. Since `f` is strictly increasing, `f (f m) < f m`,
so `f m` is an even smaller counterexample — a contradiction.
(Mathlib: `StrictMono.le_apply`.) -/
theorem le_apply_of_strictMono {α : Type u} [LinearOrder α] [WellFoundedLT α] {f : α → α}
    (hf : StrictMono f) (x : α) : x ≤ f x := by
  by_contra hx
  have hne : ({y | f y < y} : Set α).Nonempty := ⟨x, lt_of_not_ge hx⟩
  obtain ⟨m, hm, hmin⟩ := WellFounded.has_min wellFounded_lt {y | f y < y} hne
  exact hmin (f m) (hf hm) hm
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
orderIso_uniqueLean 4Proved here from basic factsFormally verified
/-- **Two well-orders are isomorphic in at most one way.** If `f, g : α ≃o β`, then
`f⁻¹ ∘ g` and `g⁻¹ ∘ f` are strictly increasing self-maps of `α`, so
`x ≤ f⁻¹ (g x)` and `x ≤ g⁻¹ (f x)`; applying `f` and `g` gives `f x ≤ g x ≤ f x`. -/
theorem orderIso_unique {α : Type u} {β : Type v} [LinearOrder α] [WellFoundedLT α]
    [LinearOrder β] (f g : α ≃o β) : f = g := by
  ext x
  apply le_antisymm
  · have h1 := le_apply_of_strictMono (f := fun y => f.symm (g y))
      (f.symm.strictMono.comp g.strictMono) x
    have h2 := f.monotone h1
    simpa using h2
  · have h1 := le_apply_of_strictMono (f := fun y => g.symm (f y))
      (g.symm.strictMono.comp f.strictMono) x
    have h2 := g.monotone h1
    simpa using h2
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
no_embedding_into_initial_segmentLean 4Proved here from basic factsFormally verified
/-- **A well-order does not embed into a proper initial segment of itself.** A strictly increasing
`f : α → α` cannot map everything below a point `a`: we would get `f a < a`, contradicting
`le_apply_of_strictMono`. (For instance `ω` is not isomorphic to `{0, 1, …, n - 1}`, and no
ordinal is isomorphic to a smaller one.) -/
theorem no_embedding_into_initial_segment {α : Type u} [LinearOrder α] [WellFoundedLT α]
    (a : α) {f : α → α} (hf : StrictMono f) : ¬ ∀ x, f x < a :=
  fun h => absurd (h a) (not_lt.mpr (le_apply_of_strictMono hf a))
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

Transfinite induction in its zero / successor / limit form, from strong induction and the trichotomy "zero, successor or limit":

transfinite_inductionLean 4Proved here from basic factsFormally verified
/-- **Transfinite induction.** To prove `P o` for every ordinal it suffices to prove `P 0`, to
pass from `P o` to `P (o + 1)`, and to pass from "`P` holds below a limit `o`" to `P o`.
Proof: strong induction along the well-order of the ordinals (`WellFoundedLT.induction`),
then a case split: every ordinal is `0`, a successor or a limit
(`Ordinal.zero_or_succ_or_isSuccLimit`). -/
theorem transfinite_induction (P : Ordinal.{u} → Prop) (h0 : P 0)
    (hsucc : ∀ o, P o → P (Order.succ o))
    (hlim : ∀ o, Order.IsSuccLimit o → (∀ o' < o, P o') → P o) (o : Ordinal.{u}) : P o := by
  induction o using WellFoundedLT.induction with
  | _ o ih =>
    rcases Ordinal.zero_or_succ_or_isSuccLimit o with h | ⟨o', rfl⟩ | h
    · rw [h]; exact h0
    · exact hsucc o' (ih o' (Order.lt_succ o'))
    · exact hlim o h ih
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

Ordinal arithmetic is not commutative, while cardinality cannot see the difference between ω\omega and ω+1\omega + 1:

one_add_omegaLean 4Applies a library theoremFormally verified
/-- **`1 + ω = ω`**: one extra point *in front* of `0, 1, 2, …` is absorbed.
This applies Mathlib's `Ordinal.one_add_omega0`. -/
theorem one_add_omega : (1 : Ordinal.{u}) + ω = ω :=
  Ordinal.one_add_omega0
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
add_not_commLean 4Proved here from basic factsFormally verified
/-- **Ordinal addition is not commutative:** `1 + ω = ω`, but `ω < ω + 1` (an extra point *after*
all the natural numbers is a new largest element), so `1 + ω ≠ ω + 1`. -/
theorem add_not_comm : (1 : Ordinal.{u}) + ω ≠ ω + 1 := by
  rw [one_add_omega]
  exact ne_of_lt (lt_add_one ω)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
mul_not_commLean 4Proved here from basic factsFormally verified
/-- **Ordinal multiplication is not commutative:** `2 · ω` is `ω` copies of `2`, which is just
`ω` (`Ordinal.natCast_mul_omega0`), while `ω · 2 = ω + ω` (`Ordinal.mul_two`) is two copies of
`ω`, which is larger than `ω`. -/
theorem mul_not_comm : (2 : Ordinal.{u}) * ω ≠ ω * 2 := by
  have h2 : (2 : Ordinal.{u}) * ω = ω := Ordinal.natCast_mul_omega0 (n := 2) two_pos
  rw [h2, Ordinal.mul_two]
  exact ne_of_lt (lt_add_of_pos_right ω Ordinal.omega0_pos)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
card_omega_add_oneLean 4Proved here from basic factsFormally verified
/-- **Same size, different shape:** `ω + 1` is a different ordinal from `ω`, but it has the same
cardinality `ℵ₀`: the cardinality of a sum is the sum of the cardinalities
(`Ordinal.card_add`), and `ℵ₀ + 1 = ℵ₀` (`Cardinal.add_one_eq`). -/
theorem card_omega_add_one : (ω + 1 : Ordinal.{u}).card = ℵ₀ := by
  rw [Ordinal.card_add, Ordinal.card_omega0, Ordinal.card_one]
  exact Cardinal.add_one_eq le_rfl
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

Cantor's theorem, by the diagonal set, and its cardinal form from Mathlib:

cantor_no_surjectionLean 4Proved here from basic factsFormally verified
/-- **Cantor's theorem**, in its sharpest form: no function `f : α → Set α` is surjective.
The diagonal set `D = {x | x ∉ f x}` differs from every `f a` at the point `a`. -/
theorem cantor_no_surjection {α : Type u} (f : α → Set α) : ¬ Function.Surjective f := by
  intro hf
  obtain ⟨a, ha⟩ := hf {x | x ∉ f x}
  have key : a ∈ f a ↔ a ∉ f a := by
    constructor
    · intro h; rw [ha] at h; exact h
    · intro h; rw [ha]; exact h
  have hnot : a ∉ f a := fun h => key.mp h h
  exact hnot (key.mpr hnot)
Axioms used: No axiomsformal/Lumenary/Cardinals.leanTry it in the Lean web editor
cantor_cardLean 4Applies a library theoremFormally verified
/-- **Cantor's theorem for cardinals:** `κ < 2^κ` for every cardinal `κ`.
This applies Mathlib's `Cardinal.cantor`. -/
theorem cantor_card (κ : Cardinal.{u}) : κ < 2 ^ κ :=
  Cardinal.cantor κ
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

The Schröder–Bernstein theorem, following the Knaster–Tarski proof of Theorem 12 step by step (Mathlib's OrderHom.lfp supplies the fixed point; Lean's Function.invFun plays the role of g−1g^{-1}). Mathlib's own proof uses the same idea:

schroeder_bernsteinLean 4Proved here from basic factsFormally verified
/-- **The Schröder–Bernstein theorem**, by the proof in the lesson. Given injections
`f : α → β` and `g : β → α`, the map `F(S) = α \ g[β \ f[S]]` on subsets of `α` is monotone, so
it has a fixed point `S` (Knaster–Tarski: Mathlib's `OrderHom.lfp`). Then `α \ S = g[β \ f[S]]`,
and `h = f` on `S`, `h = g⁻¹` off `S` is a bijection `α → β`. -/
theorem schroeder_bernstein {α : Type u} {β : Type v} {f : α → β} {g : β → α}
    (hf : Function.Injective f) (hg : Function.Injective g) :
    ∃ h : α → β, Function.Bijective h := by
  classical
  rcases isEmpty_or_nonempty β with hβ | hβ
  · -- If `β` is empty, so is `α`, and the empty function is a bijection.
    have : IsEmpty α := Function.isEmpty f
    exact ⟨f, fun a => isEmptyElim a, fun b => isEmptyElim b⟩
  -- The monotone operator `F(S) = α \ g[β \ f[S]]`.
  let F : Set α →o Set α :=
    { toFun := fun S => (g '' (f '' S)ᶜ)ᶜ
      monotone' := fun S T hST =>
        Set.compl_subset_compl.mpr
          (Set.image_mono (Set.compl_subset_compl.mpr (Set.image_mono hST))) }
  -- Knaster–Tarski: a fixed point `S = F(S)`.
  set S : Set α := OrderHom.lfp F with hSdef
  have hS : (g '' (f '' S)ᶜ)ᶜ = S := OrderHom.map_lfp F
  -- Off `S`, every point is `g y` for some `y` outside `f[S]`.
  have hSc : g '' (f '' S)ᶜ = Sᶜ := (compl_compl _).symm.trans (congrArg compl hS)
  have off : ∀ a, a ∉ S → ∃ y, y ∉ f '' S ∧ g y = a := by
    intro a ha
    have : a ∈ g '' (f '' S)ᶜ := by rw [hSc]; exact ha
    obtain ⟨y, hy, rfl⟩ := this
    exact ⟨y, hy, rfl⟩
  -- `g'` undoes `g`.
  let g' : α → β := Function.invFun g
  have hg' : ∀ y, g' (g y) = y := Function.leftInverse_invFun hg
  let h : α → β := fun a => if a ∈ S then f a else g' a
  refine ⟨h, ?_, ?_⟩
  · -- `h` is injective.
    intro a b hab
    by_cases ha : a ∈ S <;> by_cases hb : b ∈ S
    · simp only [h, ha, hb, ↓reduceIte] at hab
      exact hf hab
    · simp only [h, ha, hb, ↓reduceIte] at hab
      obtain ⟨y, hy, rfl⟩ := off b hb
      rw [hg'] at hab
      exact absurd ⟨a, ha, hab⟩ hy
    · simp only [h, ha, hb, ↓reduceIte] at hab
      obtain ⟨y, hy, rfl⟩ := off a ha
      rw [hg'] at hab
      exact absurd ⟨b, hb, hab.symm⟩ hy
    · simp only [h, ha, hb, ↓reduceIte] at hab
      obtain ⟨y, -, rfl⟩ := off a ha
      obtain ⟨z, -, rfl⟩ := off b hb
      rw [hg', hg'] at hab
      rw [hab]
  · -- `h` is surjective.
    intro y
    by_cases hy : y ∈ f '' S
    · obtain ⟨a, ha, rfl⟩ := hy
      exact ⟨a, by simp only [h, ha, ↓reduceIte]⟩
    · have hgy : g y ∉ S := by
        have : g y ∈ g '' (f '' S)ᶜ := ⟨y, hy, rfl⟩
        rw [hSc] at this
        exact this
      exact ⟨g y, by simp only [h, hgy, ↓reduceIte, hg']⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
schroeder_bernstein_libraryLean 4Applies a library theoremFormally verified
/-- The same theorem from Mathlib: `Function.Embedding.schroeder_bernstein`. (Mathlib's proof
uses the same Knaster–Tarski fixed point.) -/
theorem schroeder_bernstein_library {α : Type u} {β : Type v} {f : α → β} {g : β → α}
    (hf : Function.Injective f) (hg : Function.Injective g) :
    ∃ h : α → β, Function.Bijective h :=
  Function.Embedding.schroeder_bernstein hf hg
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

Hessenberg's theorem is taken from Mathlib, and Corollary 15 is derived from it with the same chain of inequalities as in the lesson:

hessenbergLean 4Applies a library theoremFormally verified
/-- **Hessenberg's theorem:** `κ · κ = κ` for every infinite cardinal `κ`.
This applies Mathlib's `Cardinal.mul_eq_self`. -/
theorem hessenberg {κ : Cardinal.{u}} (h : ℵ₀ ≤ κ) : κ * κ = κ :=
  Cardinal.mul_eq_self h
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor
add_eq_maxLean 4Proved here from basic factsFormally verified
/-- **Infinite sums collapse:** if `κ` is infinite then `κ + λ = max κ λ`. Proof from
Hessenberg: with `μ = max κ λ` (infinite), `μ ≤ κ + λ ≤ μ + μ = 2 · μ ≤ μ · μ = μ`. -/
theorem add_eq_max {κ μ : Cardinal.{u}} (h : ℵ₀ ≤ κ) : κ + μ = max κ μ := by
  have hm : ℵ₀ ≤ max κ μ := le_trans h (le_max_left κ μ)
  apply le_antisymm
  · calc κ + μ ≤ max κ μ + max κ μ := add_le_add (le_max_left κ μ) (le_max_right κ μ)
      _ = 2 * max κ μ := (two_mul (max κ μ)).symm
      _ ≤ max κ μ * max κ μ :=
          mul_le_mul_left (le_trans Cardinal.ofNat_le_aleph0 hm) (max κ μ)
      _ = max κ μ := hessenberg hm
  · exact max_le le_self_add le_add_self
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Cardinals.leanTry it in the Lean web editor

What is and is not formalised. Proved here: rigidity of well-orders and its corollaries, transfinite induction, the non-commutativity examples, ∣ω+1∣=ℵ0|\omega + 1| = \aleph_0, Cantor's theorem, Schröder–Bernstein and Corollary 15. Taken from Mathlib: the correspondence with von Neumann ordinals, 1+ω=ω1 + \omega = \omega, κ<2κ\kappa < 2^\kappa and Hessenberg's theorem. Not formalised: Lemmas 1–2 and Theorems 3–5 for von Neumann ordinals (Mathlib has versions in Mathlib.SetTheory.ZFC.Ordinal), Hartogs' theorem, and anything about the independence of CH. Note also that Lean's logic includes choice, so the delicate "provable in ZF" claims of the lesson are not visible in these proofs (although #print axioms shows that our proof of Cantor's theorem uses no axioms at all).

ComputationC

Computing with infinite numbers

Ordinals below ε0\varepsilon_0 have finite names — their Cantor normal forms — so a computer can do exact arithmetic with them. The first experiment implements addition and multiplication from the recursive definitions, confirms the non-commutativity examples, tests the associative and distributive laws on random triples, and then follows Goodstein sequences: write nn in "hereditary base 22", replace every 22 by 33, subtract 11, write the result in hereditary base 33, replace every 33 by 44, subtract 11, and so on. The numbers grow explosively — but replacing the base by ω\omega turns each term into an ordinal, and these ordinals strictly decrease. Since there is no infinite decreasing sequence of ordinals, every Goodstein sequence reaches 00 (Goodstein, 1944).

Ordinal arithmetic in Cantor normal formPythonExact computationExperimental evidenceCounterexampleComputationally tested
"""Ordinal arithmetic below epsilon_0, and Goodstein sequences.

Every ordinal below epsilon_0 has a Cantor normal form
w^e1*c1 + ... + w^ek*ck with e1 > ... > ek (themselves such ordinals) and
positive integer coefficients. We represent these forms as nested tuples and
implement comparison, addition and multiplication exactly, following the
recursive definitions in the lesson. The program shows that addition and
multiplication are not commutative, tests the associative and distributive
laws on random triples (left distributivity holds, right distributivity
fails), and computes Goodstein sequences, whose terms are matched with a
strictly decreasing sequence of ordinals. Evidence: exact symbolic
computation; the random tests are experiments, not proofs.
"""

import random

ZERO = ()

def nat(n):
    """The finite ordinal n."""
    if n < 0:
        raise ValueError("ordinals are non-negative")
    return () if n == 0 else ((ZERO, n),)

ONE = nat(1)
OMEGA = ((ONE, 1),)

def cmp(a, b):
    """Return -1, 0 or 1 as a < b, a = b or a > b (lexicographic on terms)."""
    for (ea, ca), (eb, cb) in zip(a, b):
        c = cmp(ea, eb)
        if c:
            return c
        if ca != cb:
            return -1 if ca < cb else 1
    return (len(a) > len(b)) - (len(a) < len(b))

def add(a, b):
    """Ordinal sum a + b: terms of a below the leading exponent of b vanish."""
    if not b:
        return a
    e, c = b[0]
    higher = tuple(t for t in a if cmp(t[0], e) > 0)
    same = [t for t in a if cmp(t[0], e) == 0]
    if same:
        return higher + ((e, same[0][1] + c),) + b[1:]
    return higher + b

def mul(a, b):
    """Ordinal product a * b, term by term in b (left distributivity)."""
    if not a or not b:
        return ZERO
    lead_e, lead_c = a[0]
    result = ZERO
    for e, c in b:
        if e == ZERO:
            term = ((lead_e, lead_c * c),) + a[1:]
        else:
            term = ((add(lead_e, e), c),)
        result = add(result, term)
    return result

def fmt(a):
    """Write a Cantor normal form, e.g. w^2*3 + w + 5."""
    if not a:
        return "0"
    parts = []
    for e, c in a:
        if e == ZERO:
            parts.append(str(c))
            continue
        if e == ONE:
            base = "w"
        elif (len(e) == 1 and e[0][0] == ZERO) or e == OMEGA:
            base = f"w^{fmt(e)}"
        else:
            base = f"w^({fmt(e)})"
        parts.append(base if c == 1 else f"{base}*{c}")
    return " + ".join(parts)

def random_ordinal(rng, max_exp=2, max_coeff=3):
    """A random ordinal below w^(max_exp + 1) with small coefficients."""
    terms = []
    for e in range(max_exp, -1, -1):
        c = rng.randint(0, max_coeff)
        if c:
            terms.append((nat(e), c))
    return tuple(terms)

def law_failures(rng, trials, law):
    """Count random triples (a, b, c) for which ``law(a, b, c)`` is False."""
    bad = []
    for _ in range(trials):
        a, b, c = (random_ordinal(rng) for _ in range(3))
        if not law(a, b, c):
            bad.append((a, b, c))
    return bad

def hereditary(n, base):
    """The ordinal obtained from n in hereditary base `base` by base -> w."""
    terms, exp = [], 0
    while n:
        n, digit = divmod(n, base)
        if digit:
            terms.append((hereditary(exp, base), digit))
        exp += 1
    return tuple(reversed(terms))

def bump(n, base):
    """Replace the base by base + 1 everywhere in hereditary notation."""
    total, exp = 0, 0
    while n:
        n, digit = divmod(n, base)
        if digit:
            total += digit * (base + 1) ** bump(exp, base)
        exp += 1
    return total

def goodstein(n, steps):
    """First terms (base, value) of the Goodstein sequence starting at n."""
    out, base = [], 2
    for _ in range(steps):
        out.append((base, n))
        if n == 0:
            break
        n = bump(n, base) - 1
        base += 1
    return out

def main():
    w = OMEGA
    two = nat(2)
    print("1. Arithmetic in Cantor normal form (w = omega):")
    rows = [
        ("1 + w", add(ONE, w), "w + 1", add(w, ONE)),
        ("2 * w", mul(two, w), "w * 2", mul(w, two)),
        ("(w + 1) * 2", mul(add(w, ONE), two), "2 * (w + 1)", mul(two, add(w, ONE))),
        ("(1 + 1) * w", mul(add(ONE, ONE), w), "1*w + 1*w", add(w, w)),
    ]
    for left, x, right, y in rows:
        print(f"   {left} = {fmt(x):<11} {right} = {fmt(y):<11} equal: {x == y}")
    rng = random.Random(2024)
    laws = [
        ("(a + b) + c = a + (b + c)",
         lambda a, b, c: add(add(a, b), c) == add(a, add(b, c))),
        ("(ab)c = a(bc)", lambda a, b, c: mul(mul(a, b), c) == mul(a, mul(b, c))),
        ("a(b + c) = ab + ac",
         lambda a, b, c: mul(a, add(b, c)) == add(mul(a, b), mul(a, c))),
        ("(a + b)c = ac + bc",
         lambda a, b, c: mul(add(a, b), c) == add(mul(a, c), mul(b, c))),
        ("a + b = b + a", lambda a, b, c: add(a, b) == add(b, a)),
    ]
    print("2. 3000 random triples below w^3 for each law:")
    examples = []
    for name, law in laws:
        bad = law_failures(rng, 3000, law)
        print(f"   {name:<27}{len(bad):>5} failures")
        if bad:
            examples.append((name, bad[0]))
    name, (a, b, c) = examples[0]
    print(f"   e.g. {name} fails for a = {fmt(a)}, b = {fmt(b)}, c = {fmt(c)}:")
    print(f"   {fmt(mul(add(a, b), c))}  versus  {fmt(add(mul(a, c), mul(b, c)))}")
    print("3. Goodstein: write n in hereditary base b, change b to b + 1, subtract 1.")
    print("   n = 3:", [v for _, v in goodstein(3, 10)])
    print("   n = 4:  base  value  ordinal (base -> w)")
    seq = goodstein(4, 7)
    for base, value in seq:
        print(f"           {base:>3} {value:>6}  {fmt(hereditary(value, base))}")
    ords = [hereditary(v, b) for b, v in seq]
    falling = all(cmp(x, y) > 0 for x, y in zip(ords, ords[1:]))
    print(f"   ordinals strictly decreasing: {falling}")
    print()
    print("Epistemic status: the normal-form arithmetic is exact, and the")
    print("non-commutativity examples are genuine counterexamples. The 3000-triple")
    print("tests are only experimental evidence for associativity and left")
    print("distributivity, which are proved by transfinite induction. Goodstein's")
    print("theorem (every sequence reaches 0) follows because ordinals are")
    print("well-ordered; n = 4 takes more steps than any computer can follow.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The second experiment builds Schröder–Bernstein bijections by chasing chains: between [0,1][0, 1] and [0,1)[0, 1), with f(x)=x/2f(x) = x/2 and g(y)=yg(y) = y, it rediscovers the classical bijection that halves 1,12,14,…1, \tfrac12, \tfrac14, \dots and fixes every other point; and between N\N and Z\Z it produces an explicit bijection from two injections.

Schroeder-Bernstein bijections by chain-chasingPythonExact computationExhaustive finite checkComputationally tested
"""The Schroeder-Bernstein bijection, computed by following chains.

Given injections f : A -> B and g : B -> A, follow any a in A backwards:
a = g(b)?  b = f(a')?  a' = g(b')? ... The backward chain either stops in A
(at a point not of the form g(b)), stops in B (at a point not of the form
f(a)), or never stops. The proof in the lesson sets h(a) = f(a) when the chain
stops in A and h(a) = g^(-1)(a) otherwise; these are exactly the points of the
least fixed point S of the map S -> A minus g[B minus f[S]]. Here we compute h
for two examples: the closed and half-open unit intervals (on rational points,
with exact fractions), where h turns out to be the famous "halve the powers of
1/2" map, and the natural numbers and the integers. Evidence: exact
computation on finitely many points; bijectivity on the whole set is the
theorem.
"""

from fractions import Fraction

def chain_type(a, f_inv, g_inv, limit=200):
    """Follow a in A backwards; return 'A', 'B' (where it stops) or 'endless'."""
    seen = set()
    x, side = a, "A"
    for _ in range(limit):
        if (x, side) in seen:
            return "endless"
        seen.add((x, side))
        prev = g_inv(x) if side == "A" else f_inv(x)
        if prev is None:
            return side
        x, side = prev, ("B" if side == "A" else "A")
    return "endless"

def sb_map(a, f, f_inv, g_inv):
    """The Schroeder-Bernstein bijection: f on A-stopping chains, else g^-1."""
    if chain_type(a, f_inv, g_inv) == "A":
        return f(a)
    return g_inv(a)

# Example 1: A = [0, 1], B = [0, 1), f(x) = x/2 (into B), g(y) = y (into A).
def f1(x):
    return x / 2

def f1_inv(y):
    return 2 * y if y <= Fraction(1, 2) else None

def g1_inv(x):
    return x if x < 1 else None

# Example 2: A = N, B = Z, f(n) = n, g(z) = 3z (z >= 0), -3z - 1 (z < 0).
def f2(n):
    return n

def f2_inv(z):
    return z if z >= 0 else None

def g2_inv(n):
    if n % 3 == 0:
        return n // 3
    if n % 3 == 2:
        return -(n + 1) // 3
    return None

def rational_points(max_den):
    """All fractions p/q in [0, 1] with q <= max_den, sorted."""
    pts = {Fraction(p, q) for q in range(1, max_den + 1) for p in range(q + 1)}
    return sorted(pts)

def main():
    print("Example 1: A = [0, 1], B = [0, 1), f(x) = x/2, g(y) = y.")
    for x in [Fraction(1), Fraction(1, 2), Fraction(1, 8), Fraction(3, 4),
              Fraction(1, 3), Fraction(0)]:
        kind = chain_type(x, f1_inv, g1_inv)
        label = "never stops" if kind == "endless" else f"stops in {kind}"
        print(f"   x = {str(x):>4}: backward chain {label:<11}  h(x) = "
              f"{sb_map(x, f1, f1_inv, g1_inv)}")
    pts = rational_points(30)
    images = [sb_map(x, f1, f1_inv, g1_inv) for x in pts]
    in_b = all(0 <= y < 1 for y in images)
    moved = sorted(x for x, y in zip(pts, images) if y != x)
    print(f"   {len(pts)} rational points with denominator <= 30:")
    print(f"   images in [0, 1): {in_b}; injective: "
          f"{len(set(images)) == len(images)}")
    print(f"   points moved: {[str(x) for x in reversed(moved)]}")
    print("   h halves 1, 1/2, 1/4, ... and fixes everything else.")
    print()
    print("Example 2: A = N, B = Z, f(n) = n, g(z) = 3z or -3z - 1.")
    h = [sb_map(n, f2, f2_inv, g2_inv) for n in range(3000)]
    print("   h(0..14) =", h[:15])
    window = set(range(-200, 201))
    hit = window <= set(h)
    print(f"   h injective on 0..2999: {len(set(h)) == len(h)}; "
          f"hits every z in -200..200: {hit}")
    kinds = [chain_type(n, f2_inv, g2_inv) for n in range(30)]
    print("   chains of 0..29 stop in A / B / never:",
          [kinds.count(k) for k in ("A", "B", "endless")])
    print()
    print("Epistemic status: exact arithmetic, checked on finitely many points")
    print(f"({len(pts)} rationals; 3000 natural numbers). That h is a bijection of the")
    print("whole sets is the Schroeder-Bernstein theorem, proved in the lesson;")
    print("the chain classification uses no choice, so the theorem holds in ZF.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Both are exact computations on finitely many objects. The random tests are experimental evidence for laws that are proved by transfinite induction, and the chain-chasing checks injectivity and surjectivity only on finite windows; the theorems are what cover every ordinal and every point.

Explore

Explore: the diagonal behind Cantor's theorem

For A=NA = \N, a subset of N\N is an infinite sequence of 00s and 11s, and Cantor's diagonal set DD is obtained by flipping the diagonal of any proposed list.

The diagonal machine

Here is a list of infinite 0–1 sequences (we can only show the start). The gold sequence d flips the diagonal.

s1…
s2…
s3…
s4…
s5…
s6…
d101001????…

Point at (or tab to) a row to see where d differs from it. Click any digit to change the list.

Add d to the list and a new d appears that is different again. No list — however long — can contain every sequence.

Edit the list as you like and watch the flipped diagonal escape every row. Then reread the proof of Theorem 11: the set D={x∣x∉f(x)}D = \{x \mid x \notin f(x)\} is exactly "flip the diagonal" for an arbitrary set AA and an arbitrary f:A→P(A)f : A \to \mathcal P(A), with no list and no numbering needed.

Exercises

Exercises

1. Ordinals and cardinals

Warm-upHuman

Which of these ordinals are equal to ω\omega? Select all.

Choose all that apply

2. Ordinals and cardinals

CoreHuman

Write (ω+3)⋅2(\omega + 3) \cdot 2 in the form ω⋅2+k\omega \cdot 2 + k with kk a natural number. What is kk?

3. Ordinals and cardinals

CoreHuman

Write 2⋅(ω+3)2 \cdot (\omega + 3) in the form ω+k\omega + k with kk a natural number. What is kk?

4. Ordinals and cardinals

CoreHuman

In the proof that a strictly increasing f:W→Wf : W \to W on a well-order satisfies x≤f(x)x \le f(x), we take the least mm with f(m)<mf(m) < m. Why does this lead to a contradiction?

Choose one

5. Ordinals and cardinals

CoreHuman

Which of these statements are provable in ZF, without the axiom of choice? Select all.

Choose all that apply

6. Ordinals and cardinals

CoreHuman

What is the cardinality of R×N\R \times \N?

Choose one

7. Ordinals and cardinals

CoreFormal

Which Lean statement correctly formalises Cantor's theorem for a type α?

Choose one

8. Ordinals and cardinals

StretchHuman

Here is a faulty argument. “(1) The map n↦n+1n \mapsto n + 1 together with ω↦0\omega \mapsto 0 is a bijection from ω+1\omega + 1 to ω\omega. (2) So ω+1\omega + 1 and ω\omega have the same cardinality. (3) So ω+1\omega + 1 and ω\omega are isomorphic well-orders. (4) Hence ω+1=ω\omega + 1 = \omega by uniqueness of order types.” Which step is wrong?

Choose one

9. Ordinals and cardinals

StretchComputational

Represent an ordinal below ωω\omega^\omega by its list of coefficients, lowest power first: [c0, c1, ..., ck] stands for ωkck+⋯+ωc1+c0\omega^k c_k + \cdots + \omega c_1 + c_0 (so [3, 0, 2] is ω2⋅2+3\omega^2 \cdot 2 + 3, and [] is 00), with no trailing zeros. Write ord_add(a, b) computing the ordinal sum a+ba + b. Rule: the terms of aa below the leading power of bb are absorbed, the coefficients at the leading power of bb add up, and the higher terms of aa remain.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

Confusing ordinal and cardinal arithmetic. ω\omega and ω+1\omega + 1 are different ordinals with the same cardinality ℵ0\aleph_0; as cardinals, ℵ0+1=ℵ0\aleph_0 + 1 = \aleph_0, but as ordinals ω+1≠ω\omega + 1 \neq \omega. Always ask whether a "++" adds shapes or sizes.

Misconception

"Every set has an aleph as its cardinality." Without the axiom of choice this fails: in ZF, a set has an aleph as its cardinality exactly when it can be well-ordered, and ZF does not prove that R\R can be well-ordered. With choice, every set is well-orderable and the alephs list all infinite cardinalities.

Misconception

"2ℵ0=ℵ12^{\aleph_0} = \aleph_1 is a theorem." That is the continuum hypothesis, which ZFC neither proves nor refutes (if ZFC is consistent). What is a theorem is 2ℵ0>ℵ02^{\aleph_0} > \aleph_0.

Misconception

"Schröder–Bernstein needs the axiom of choice." It does not: the proof above defines the bijection explicitly from ff and gg. What does need choice is comparability — that for any two sets ∣A∣≤∣B∣|A| \le |B| or ∣B∣≤∣A∣|B| \le |A|; Hartogs showed in 1915 that this is equivalent to the axiom of choice.

Misconception

"There is a largest infinity." Cantor's theorem gives ∣A∣<∣P(A)∣|A| < |\mathcal P(A)| for every set, and Hartogs' theorem gives a larger cardinal than any ordinal. Like the ordinals, the cardinals do not form a set.

ViewpointsH

Many ways of seeing

Topology— Ordinals as spaces

Every ordinal carries the order topology, generated by open intervals, and these spaces are a standard source of counterexamples in point-set topology. An ordinal α\alpha is compact exactly when it is 00 or a successor, so ω1+1=[0,ω1]\omega_1 + 1 = [0, \omega_1] is a compact Hausdorff space. The space [0,ω1)[0, \omega_1) is sequentially compact — every sequence has a convergent subsequence, because a countable set of countable ordinals is bounded below ω1\omega_1 — but not compact: the open sets [0,α)[0, \alpha), α<ω1\alpha < \omega_1, cover it with no finite subcover. In [0,ω1][0, \omega_1] the point ω1\omega_1 lies in the closure of [0,ω1)[0, \omega_1) but is the limit of no sequence from it, so sequences cannot describe this topology. Gluing ω1\omega_1 copies of [0,1)[0, 1) end to end gives the long ray, a connected space in which every point except the initial one has a neighbourhood homeomorphic to an open interval, but which is not metrisable.

Analysis— Where ordinals were born: derived sets

For P⊆RP \subseteq \R, let P′P' be its set of limit points. Cantor proved in 1870 that a trigonometric series converging to 00 everywhere has all coefficients 00, and in 1872 that the same holds if convergence is only known off a set PP with P(n)=∅P^{(n)} = \varnothing for some finite nn. To go further he iterated the derivative transfinitely, P(α+1)=(P(α))′P^{(\alpha + 1)} = (P^{(\alpha)})' and P(λ)=⋂β<λP(β)P^{(\lambda)} = \bigcap_{\beta < \lambda} P^{(\beta)} — this is where the transfinite ordinals first appeared (1880). The process stabilises: the Cantor–Bendixson theorem says that for every closed P⊆RP \subseteq \R there is a countable ordinal α\alpha with P(α)=P(α+1)P^{(\alpha)} = P^{(\alpha + 1)}, and PP is the union of the perfect set P(α)P^{(\alpha)} and a countable set. In particular every uncountable closed set of reals contains a perfect set and so has cardinality 2ℵ02^{\aleph_0}: CH holds for closed sets.

Combinatorics— Goodstein, hydras and unprovability

Goodstein's theorem is a statement about natural numbers — every Goodstein sequence reaches 00 — whose natural proof assigns to each term an ordinal below ε0\varepsilon_0 and uses that these ordinals cannot decrease forever. Laurence Kirby and Jeff Paris (1982) showed that the detour through infinite ordinals is unavoidable in a precise sense: Goodstein's theorem cannot be proved in Peano arithmetic. They gave a second example in the same paper, the hydra game, in which Hercules chops heads off a finite rooted tree that regrows ever more copies; Hercules always wins, but proving it needs transfinite induction up to ε0\varepsilon_0. Ordinals thus measure the strength needed for finite combinatorial statements.

Algebra— Dimension is a cardinal

All bases of a vector space have the same cardinality, and for infinite dimensions the proof is cardinal arithmetic. If BB and B′B' are bases with BB infinite, each b∈Bb \in B is a combination of a finite set Fb⊆B′F_b \subseteq B' (its support), and these finite sets must cover B′B', since otherwise a vector of B′B' outside them would lie in their span. So ∣B′∣≤∣B∣⋅ℵ0=∣B∣|B'| \le |B| \cdot \aleph_0 = |B| by Corollary 15, and by symmetry and Schröder–Bernstein ∣B∣=∣B′∣|B| = |B'|. For example dim⁡QR=2ℵ0\dim_\Q \R = 2^{\aleph_0}, because a Q\Q-vector space with a basis of infinite size κ\kappa has exactly κ\kappa elements. A theorem of Paul Erdős and Irving Kaplansky computes the dimension of the dual space of an infinite-dimensional space: dim⁡V∗=∣K∣dim⁡V\dim V^* = |K|^{\dim V}, which is always strictly larger than dim⁡V\dim V.

Logic— Independence and proof-theoretic strength

To a logician, CH is the paradigm of a statement independent of ZFC: Gödel's constructible universe LL satisfies it, and Cohen's forcing builds models where it fails (see forcing). Ordinals also measure the strength of theories. Gerhard Gentzen (1936) proved the consistency of Peano arithmetic using transfinite induction up to ε0\varepsilon_0, and later (1943) showed that PA proves transfinite induction up to each smaller ordinal but not up to ε0\varepsilon_0 itself: ε0\varepsilon_0 is the proof-theoretic ordinal of PA. Larger ordinals calibrate stronger theories (proof theory), and larger cardinals calibrate stronger set theories (large cardinals).

Wonder Trails

Wonder Trails

History & global context

History and global context

  • Thinkers in many traditions puzzled over infinite collections. Some Jaina texts from India, of the last centuries BCE and the first centuries CE, classify numbers as enumerable, innumerable and infinite and distinguish several kinds of infinity, though not by one-to-one correspondence. Galileo Galilei (Two New Sciences, 1638) observed that the perfect squares can be paired with all the natural numbers and concluded that "equal", "greater" and "less" do not apply to infinite quantities; Bernard Bolzano's Paradoxes of the Infinite (1851) took the comparison of infinite sets further.
  • Georg Cantor introduced derived sets (1872), proved that R\R is uncountable (1874) and that R2\R^2 and R\R have the same cardinality (1877–78), introduced the transfinite ordinals (1880, systematically in his Grundlagen of 1883), and developed ordinal and cardinal arithmetic and the alephs in his Beiträge (1895–97). He formulated the continuum hypothesis in 1878.
  • The Schröder–Bernstein theorem was proved by Richard Dedekind in 1887 (unpublished), stated by Cantor, given a flawed proof by Ernst Schröder (1896) and proved by Felix Bernstein (1897), a student in Cantor's seminar; Émile Borel published Bernstein's proof in 1898. Cesare Burali-Forti published his paradox in 1897.
  • Gerhard Hessenberg proved κ⋅κ=κ\kappa \cdot \kappa = \kappa for alephs in 1906; Friedrich Hartogs' theorem dates from 1915; John von Neumann gave the definition of ordinals used today in 1923. Reuben Goodstein's theorem appeared in 1944, and Kirby and Paris proved its unprovability in Peano arithmetic in 1982.
  • David Hilbert made the continuum hypothesis the first of his 23 problems (Paris, 1900). Kurt Gödel (1938, published 1940) and Paul Cohen (1963) showed that ZFC neither refutes nor proves it.
Further reading

Further reading

  • Herbert B. Enderton, Elements of Set Theory (1977), chapters 6–8 — cardinals, orderings and ordinals at exactly this level.
  • Karel Hrbacek and Thomas Jech, Introduction to Set Theory (third edition, 1999).
  • Kenneth Kunen, Set Theory: An Introduction to Independence Proofs (1980), chapter I; and Thomas Jech, Set Theory (third millennium edition, 2003), chapters 2–5.
  • Yiannis Moschovakis, Notes on Set Theory (1994; second edition 2006) — fixed points, recursion and well-orders.
  • Georg Cantor, Contributions to the Founding of the Theory of Transfinite Numbers, translated by Philip Jourdain (1915) — Cantor's Beiträge in English.
  • Joseph W. Dauben, Georg Cantor: His Mathematics and Philosophy of the Infinite (1979) — the history.
  • Laurence Kirby and Jeff Paris, "Accessible independence results for Peano arithmetic", Bulletin of the London Mathematical Society (1982).