BACK Mascot image.
← MA0 1 · Introduction to University Mathematics (Proofs)

Lesson 7

Infinite Sets

Taught

Finite Sets

To count a herd is to pair its animals off against 0,1,20, 1, 2 and so on, and to report the number we stopped at. Nothing in that procedure asks what the counting numbers are; it asks for a bijection between the herd and an opening stretch of them. Both are now built, so we can count, and the notion of the same size that counting rests on still makes sense for sets far too large to count.

Comparing Sets by Functions

Definition 7.1 (Equinumerous sets).

Sets AA and BB are equinumerous, written A≈BA \approx B, if there is a bijection f:A→Bf : A \to B. We also say that AA and BB have the same size.

The definition asks for one bijection and says nothing about how many there are; two sets of three elements are matched up in six different ways, and the definition is satisfied by any of them. It also does not mention counting, so it still makes sense for sets we cannot count.

Proposition 7.2 (Equinumerosity is reflexive, symmetric and transitive).

Let AA, BB and CC be sets.

  1. A≈AA \approx A.
  2. If A≈BA \approx B then B≈AB \approx A.
  3. If A≈BA \approx B and B≈CB \approx C then A≈CA \approx C.

Discussion.

Each part is an existence claim about bijections, so each is proved by producing one, and in every case the bijection we need has already been built. For the first, the identity map on AA is its own inverse, and a map with an inverse is a bijection by the theorem on invertibility. The second and third are conditionals, so we start from the bijections the hypothesis gives: from one bijection, the theorem that the inverse is a bijection; from two, the theorem that bijections compose. No part uses anything about the elements of the sets.

Proof.

For the first, idA∘idA=idA\mathrm{id}_A \circ \mathrm{id}_A = \mathrm{id}_A, so idA\mathrm{id}_A is invertible and hence a bijection from AA to AA.

For the second, let f:A→Bf : A \to B be a bijection. Its inverse f−1:B→Af^{-1} : B \to A is a bijection, so B≈AB \approx A.

For the third, let f:A→Bf : A \to B and g:B→Cg : B \to C be bijections. Then g∘f:A→Cg \circ f : A \to C is a bijection, so A≈CA \approx C.

Remark.

Those are the three properties of an equivalence relation, and yet ≈\approx is not one, because it is not a relation at all in our sense: a relation on SS is a subset of S×SS \times S, and there is no set of all sets for SS to be. Fix a set XX, however, and ≈\approx restricted to P(X)\mathcal{P}(X) is an honest equivalence relation on an honest set, so it partitions P(X)\mathcal{P}(X) into classes of subsets of the same size. That is how the notion is used in practice, and the general statement is a convenience of language rather than a claim about a set of pairs.

Example 7.3.

Write LnL_n for the cut {x∈N0∣x<n}\{x \in \mathbb{N}_0 \mid x < n\}, so that L3={0,1,2}L_3 = \{0, 1, 2\}. If aa, bb and cc are distinct then {a,b,c}≈L3\{a, b, c\} \approx L_3, witnessed by a↦0a \mapsto 0, b↦1b \mapsto 1, c↦2c \mapsto 2. Any other listing of the three letters gives another bijection, and the definition does not prefer one.

Problem 7.1.

Show that A×B≈B×AA \times B \approx B \times A for all sets AA and BB, and that (A×B)×C≈A×(B×C)(A \times B) \times C \approx A \times (B \times C).

Problem 7.2.

Show that A≈BA \approx B implies P(A)≈P(B)\mathcal{P}(A) \approx \mathcal{P}(B). Which of the theorems on images and preimages does your bijection rest on?

Counting

The cuts are the sets we count against: LnL_n collects the nn numbers below nn. First we record how they grow, which every induction below uses.

Proposition 7.4 (The cuts grow by one point).

L0=∅L_0 = \emptyset, and for every n∈N0n \in \mathbb{N}_0,

Ls(n)=Ln∪{n},n∉Ln.L_{s(n)} = L_n \cup \{n\}, \qquad n \notin L_n.

Discussion.

There are three assertions and each is a statement about which elements a cut holds, so each unfolds to a comparison with nn. That L0L_0 is empty is a negative claim, ruled out by the proposition that every natural number is at least zero together with trichotomy, which forbids x<0x < 0 once 0⩽x0 \leqslant x is known. The equation is an equality of sets, so it splits into two inclusions, and both come from asking where xx sits relative to nn: to the left, x<s(n)x < s(n) leaves the alternatives x<nx < n and x=nx = n once the proposition that nothing lies strictly between nn and s(n)s(n) has removed the third; to the right, x<nx < n or x=nx = n gives x<s(n)x < s(n) because n<s(n)n < s(n) and << is transitive. The last assertion is anti-reflexivity read off the definition of the cut.

Proof.

An x∈N0x \in \mathbb{N}_0 satisfies 0⩽x0 \leqslant x, so x<0x < 0 would violate trichotomy; hence L0=∅L_0 = \emptyset.

Let x<s(n)x < s(n). Trichotomy gives x<nx < n, x=nx = n or n<xn < x, and the last would place xx strictly between nn and s(n)s(n), which nothing does. So x∈Ln∪{n}x \in L_n \cup \{n\}. Conversely n<s(n)n < s(n) by the corollary that adding a positive element moves you up, so x=nx = n gives x<s(n)x < s(n), and x<nx < n gives x<s(n)x < s(n) by transitivity. Hence Ls(n)=Ln∪{n}L_{s(n)} = L_n \cup \{n\}.

Finally ¬(n<n)\neg(n < n), so n∉Lnn \notin L_n.

Definition 7.5 (Finite and infinite sets).

A set AA is finite if A≈LnA \approx L_n for some n∈N0n \in \mathbb{N}_0, and infinite otherwise.

So ∅\emptyset is finite, since L0=∅L_0 = \emptyset, and each LnL_n is finite by way of its identity map. The definition offers some nn, and to speak of the number of elements we must know that no two cuts are matched by a bijection. The next few results prove this. The main tool is the simplest rearrangement: a map exchanging two points and leaving the rest alone.

Definition 7.6 (Transposition).

Let SS be a set and let a,b∈Sa, b \in S. The transposition τa,b:S→S\tau_{a,b} : S \to S is the function given by

τa,b(a)=defb,τa,b(b)=defa,τa,b(x)=defx  for every other x∈S.\tau_{a,b}(a) \defeq b, \qquad \tau_{a,b}(b) \defeq a, \qquad \tau_{a,b}(x) \defeq x \ \text{ for every other } x \in S.

When a=ba = b the three clauses agree and τa,b\tau_{a,b} is the identity map on SS.

Proposition 7.7 (A transposition is its own inverse).

Let SS be a set and let a,b∈Sa, b \in S. Then τa,b∘τa,b=idS\tau_{a,b} \circ \tau_{a,b} = \mathrm{id}_S, and τa,b\tau_{a,b} is a bijection.

Discussion.

Two assertions, the second following from the first. The first is an equality of functions, so by equality of functions we compare values at an arbitrary point of SS, and the definition splits the points into three cases, each settled by reading the definition twice. The second is then the theorem on invertibility, which makes a map with a two-sided inverse a bijection; the first assertion offers τa,b\tau_{a,b} itself as that inverse, so nothing further need be built.

Proof.

Write τ=defτa,b\tau \defeq \tau_{a,b} and let x∈Sx \in S. If x=ax = a then τ(τ(a))=τ(b)=a\tau(\tau(a)) = \tau(b) = a; if x=bx = b then τ(τ(b))=τ(a)=b\tau(\tau(b)) = \tau(a) = b; and otherwise τ(τ(x))=τ(x)=x\tau(\tau(x)) = \tau(x) = x. So τ∘τ=idS\tau \circ \tau = \mathrm{id}_S, and τ\tau is invertible, hence a bijection from SS to SS.

Proposition 7.8 (Bijections remove points).

Let f:A→Bf : A \to B be a bijection and let a∈Aa \in A. Then A∖{a}≈B∖{f(a)}A \setminus \{a\} \approx B \setminus \{f(a)\}.

Discussion.

We need a bijection between the two smaller sets, and the only map we have is ff, so we restrict it and check the two halves of bijectivity. Injectivity is inherited, since a restriction of an injective map is injective. For the values, injectivity is again what we use: a point other than aa cannot be sent to f(a)f(a), so the restriction does land in B∖{f(a)}B \setminus \{f(a)\}; and surjectivity of ff supplies, for each yy in that set, a preimage, which cannot be aa because y≠f(a)y \neq f(a).

Proof.

Let gg be the restriction of ff to A∖{a}A \setminus \{a\}. If x≠ax \neq a then f(x)≠f(a)f(x) \neq f(a) by injectivity, so gg takes its values in B∖{f(a)}B \setminus \{f(a)\}, and gg is injective because ff is.

Let y∈B∖{f(a)}y \in B \setminus \{f(a)\}. By surjectivity y=f(x)y = f(x) for some x∈Ax \in A, and x≠ax \neq a since y≠f(a)y \neq f(a). So y=g(x)y = g(x), and gg is a bijection onto B∖{f(a)}B \setminus \{f(a)\}.

Proposition 7.9 (Removing a point from a cut).

Let n∈N0n \in \mathbb{N}_0 and let k∈Ls(n)k \in L_{s(n)}. Then Ls(n)∖{k}≈LnL_{s(n)} \setminus \{k\} \approx L_n.

Discussion.

The previous proposition removes a point and its image under a bijection, so the plan is to build a bijection of Ls(n)L_{s(n)} with itself that carries kk to nn and then remove nn, where the result is the cut LnL_n by the proposition on how cuts grow. The transposition of kk and nn does exactly that, and it is a bijection by the proposition just proved, so nothing needs checking. The case k=nk = n is the growth proposition on its own, the transposition there being the identity.

Proof.

If k=nk = n then Ls(n)∖{n}=LnL_{s(n)} \setminus \{n\} = L_n by the proposition on how cuts grow, and a set is equinumerous with itself.

Suppose k≠nk \neq n and let τ=defτk,n\tau \defeq \tau_{k,n} be the transposition of kk and nn on Ls(n)L_{s(n)}, which is a bijection by the proposition above. Since τ(k)=n\tau(k) = n, the proposition on removing points gives

Ls(n)∖{k}≈Ls(n)∖{n}=Ln.L_{s(n)} \setminus \{k\} \approx L_{s(n)} \setminus \{n\} = L_n.

Theorem 7.10 (No cut injects into a shorter one).

For every n∈N0n \in \mathbb{N}_0 there is no injection f:Ls(n)→Lnf : L_{s(n)} \to L_n.

Discussion.

The claim is a universally quantified non-existence statement, so we induct on nn and argue each case by contradiction. At n=0n = 0 the target is empty while the source is not, and a function must name a value at every point of its domain, so there is no such function. For the step we assume no injection Ls(n)→LnL_{s(n)} \to L_n and suppose one is given from Ls(s(n))L_{s(s(n))} to Ls(n)L_{s(n)}. The extra point of the source is s(n)s(n), and by injectivity no other point is sent to its value cc, so removing both leaves an injection from Ls(n)L_{s(n)} into Ls(n)∖{c}L_{s(n)} \setminus \{c\}. The previous proposition says that set is a copy of LnL_n, and composing with a bijection onto LnL_n gives an injection the inductive hypothesis forbids.

Proof.

We induct on nn. For n=0n = 0 the cut L1L_1 is {0}\{0\} and L0L_0 is empty, so a function L1→L0L_1 \to L_0 would have to give a value f(0)∈∅f(0) \in \emptyset. There is none.

Suppose there is no injection Ls(n)→LnL_{s(n)} \to L_n, and let f:Ls(s(n))→Ls(n)f : L_{s(s(n))} \to L_{s(n)} be injective. Since s(n)<s(s(n))s(n) < s(s(n)), the value c=deff(s(n))c \defeq f(s(n)) is defined. If x<s(n)x < s(n) then x≠s(n)x \neq s(n), so f(x)≠cf(x) \neq c by injectivity; hence the restriction of ff to Ls(n)L_{s(n)} is an injection taking its values in Ls(n)∖{c}L_{s(n)} \setminus \{c\}. Composing it with a bijection from Ls(n)∖{c}L_{s(n)} \setminus \{c\} onto LnL_n, which the previous proposition supplies, yields an injection Ls(n)→LnL_{s(n)} \to L_n, contrary to the hypothesis. So no such ff exists, and induction completes the proof.

Corollary 7.11 (Cuts of different length are not equinumerous).

If Lm≈LnL_m \approx L_n then m=nm = n.

Proof.

Suppose m<nm < n. Then Lm⊂LnL_m \subset L_n by transitivity, and m∈Lnm \in L_n, so Ls(m)=Lm∪{m}⊂LnL_{s(m)} = L_m \cup \{m\} \subset L_n. A bijection Ln→LmL_n \to L_m restricted to Ls(m)L_{s(m)} is then an injection Ls(m)→LmL_{s(m)} \to L_m, which the theorem forbids. The same argument with mm and nn exchanged rules out n<mn < m, so trichotomy leaves m=nm = n.

Definition 7.12 (Cardinality of a finite set).

Let AA be finite. The unique n∈N0n \in \mathbb{N}_0 with A≈LnA \approx L_n is the cardinality of AA, written #A\#A, and we say AA has nn elements.

Uniqueness is the corollary, and without it the notation would not be well defined. Some authors write ∣A∣|A| for the same number.

Corollary 7.13 (Cardinality classifies finite sets).

Let AA and BB be finite. Then A≈BA \approx B if and only if #A=#B\#A = \#B.

Proof.

Write m=def#Am \defeq \#A and n=def#Bn \defeq \#B, so A≈LmA \approx L_m and B≈LnB \approx L_n. If A≈BA \approx B then Lm≈A≈B≈LnL_m \approx A \approx B \approx L_n by symmetry and transitivity, so m=nm = n by the previous corollary. Conversely if m=nm = n then A≈Lm=Ln≈BA \approx L_m = L_n \approx B.

Example 7.14.

#∅=0\#\emptyset = 0 and #Ln=n\#L_n = n. A finite set has cardinality 00 exactly when it is empty, since a bijection onto L0=∅L_0 = \emptyset from a non-empty set would have to name an element of ∅\emptyset. If a≠ba \neq b then #{a}=1\#\{a\} = 1 and #{a,b}=2\#\{a, b\} = 2, since L1={0}L_1 = \{0\} and L2={0,1}L_2 = \{0, 1\}.

Proposition 7.15 (Adjoining a point).

Let AA be finite and let b∉Ab \notin A. Then A∪{b}A \cup \{b\} is finite and #(A∪{b})=s(#A)\#(A \cup \{b\}) = s(\#A).

Discussion.

Both assertions come from one bijection, which we build and check. We hold a bijection gg from AA onto LnL_n, and the set to be counted has exactly one extra point, while the cut Ls(n)L_{s(n)} has exactly one point more than LnL_n, namely nn itself. So we extend gg by sending bb to nn. That the extension is a function uses b∉Ab \notin A, which stops the two clauses from disagreeing anywhere; that it is injective uses n∉Lnn \notin L_n, which stops the new value from repeating an old one; and that it is surjective is the growth proposition, which says Ls(n)L_{s(n)} holds nothing beyond LnL_n and nn.

Proof.

Put n=def#An \defeq \#A and let g:A→Lng : A \to L_n be a bijection. Define g′:A∪{b}→Ls(n)g' : A \cup \{b\} \to L_{s(n)} by g′(x)=defg(x)g'(x) \defeq g(x) for x∈Ax \in A and g′(b)=defng'(b) \defeq n. Since b∉Ab \notin A, every point of the domain falls under exactly one clause, so g′g' is a function, and its values lie in Ls(n)=Ln∪{n}L_{s(n)} = L_n \cup \{n\}.

For injectivity, two points of AA are separated by gg, and a point of AA is separated from bb because g(x)∈Lng(x) \in L_n while n∉Lnn \notin L_n. For surjectivity, an element of Ls(n)L_{s(n)} is either nn, which is g′(b)g'(b), or an element of LnL_n, which is g(x)g(x) for some x∈Ax \in A by surjectivity of gg. So A∪{b}≈Ls(n)A \cup \{b\} \approx L_{s(n)}.

Corollary 7.16 (Removing a point).

Let AA be finite and non-empty and let a∈Aa \in A. Then A∖{a}A \setminus \{a\} is finite and #A=s(#(A∖{a}))\#A = s\bigl(\#(A \setminus \{a\})\bigr).

Proof.

Let f:A→Lnf : A \to L_n be a bijection, where n=def#An \defeq \#A. Since AA is non-empty, n≠0n \neq 0, so the theorem on predecessors gives n=s(k)n = s(k) for some kk. The proposition on removing points from bijections gives A∖{a}≈Ls(k)∖{f(a)}A \setminus \{a\} \approx L_{s(k)} \setminus \{f(a)\}, and the proposition on removing a point from a cut gives Ls(k)∖{f(a)}≈LkL_{s(k)} \setminus \{f(a)\} \approx L_k. So A∖{a}A \setminus \{a\} is finite with cardinality kk, and #A=s(k)\#A = s(k).

Subsets and Images

Theorem 7.17 (Subsets of a finite set).

Let AA be finite and let B⊂AB \subset A. Then BB is finite and #B⩽#A\#B \leqslant \#A. If moreover B⊊AB \subsetneq A then #B<#A\#B < \#A.

Discussion.

The first sentence quantifies over all subsets of all finite sets, so we induct on the cardinality, taking for the predicate at nn the statement that every subset of every set with nn elements is finite with cardinality at most nn. At n=0n = 0 the ambient set is empty and so is the subset. For the step we peel off a point aa of the ambient set, leaving a set the hypothesis governs, and split on whether aa belongs to the subset: if not, the subset is already inside the smaller set; if so, we apply the hypothesis to the subset with aa removed and put aa back, which raises both cardinalities by one successor.

The second sentence uses properness. A point aa of AA outside BB can be adjoined to BB without leaving AA, so the first sentence applies to B∪{a}B \cup \{a\} and yields s(#B)⩽#As(\#B) \leqslant \#A; and s(m)⩽ns(m) \leqslant n forces m<nm < n, since s(m)+b=m+s(b)s(m) + b = m + s(b) and s(b)s(b) is positive.

Proof.

We first record two small facts about successors, both read off the clauses for addition. If m⩽nm \leqslant n then n=m+bn = m + b for some b∈N0b \in \mathbb{N}_0, so s(n)=s(m+b)=s(m)+bs(n) = s(m + b) = s(m) + b by addition from the left, and hence s(m)⩽s(n)s(m) \leqslant s(n). If s(m)⩽ns(m) \leqslant n then n=s(m)+b=s(m+b)=m+s(b)n = s(m) + b = s(m + b) = m + s(b), and s(b)s(b) is positive, so m<nm < n.

For the first assertion we induct on nn, proving that every subset of every set of cardinality nn is finite with cardinality at most nn. If n=0n = 0 then the ambient set is empty, so B=∅B = \emptyset and #B=0\#B = 0.

Suppose the claim holds at nn, let #A=s(n)\#A = s(n) and let B⊂AB \subset A. Since s(n)≠0s(n) \neq 0, the set AA is non-empty; choose a∈Aa \in A and put A′=defA∖{a}A' \defeq A \setminus \{a\}, which has cardinality nn by the corollary on removing a point. If a∉Ba \notin B then B⊂A′B \subset A', so the hypothesis makes BB finite with #B⩽n⩽s(n)\#B \leqslant n \leqslant s(n). If a∈Ba \in B then B∖{a}⊂A′B \setminus \{a\} \subset A', so B∖{a}B \setminus \{a\} is finite with cardinality m⩽nm \leqslant n; adjoining aa makes BB finite with #B=s(m)⩽s(n)\#B = s(m) \leqslant s(n).

For the second assertion, let B⊊AB \subsetneq A and choose a∈A∖Ba \in A \setminus B. Then B∪{a}⊂AB \cup \{a\} \subset A, so the first assertion gives s(#B)=#(B∪{a})⩽#As(\#B) = \#(B \cup \{a\}) \leqslant \#A, and therefore #B<#A\#B < \#A.

Corollary 7.18 (No finite set is equinumerous with a proper subset).

Let AA be finite and B⊊AB \subsetneq A. Then A≉BA \not\approx B.

Proof.

The theorem gives #B<#A\#B < \#A, so #B≠#A\#B \neq \#A by anti-reflexivity, and finite sets of different cardinality are not equinumerous.

Proposition 7.19 (Images of a finite set).

Let AA be finite and let f:A→Bf : A \to B be a function. Then the image f(A)f(A) is finite with #f(A)⩽#A\#f(A) \leqslant \#A, and #f(A)=#A\#f(A) = \#A if and only if ff is injective.

Discussion.

The inequality is proved by induction on #A\#A: remove a point aa from AA, apply the hypothesis to what remains, and observe that the image gains at most the single value f(a)f(a), so it grows by at most one successor.

The biconditional needs no second induction, because each direction is already available. If ff is injective it is a bijection onto its range, so the two cardinalities agree. If ff is not injective, two distinct points share a value, so deleting one of them changes nothing about the image; the inequality applied to the smaller set then gives a strict drop, since a proper subset of a finite set is strictly smaller. Those two together are the biconditional, the second read contrapositively.

Proof.

For the inequality we induct on n=#An = \#A. If n=0n = 0 then A=∅A = \emptyset and f(A)=∅f(A) = \emptyset.

Suppose the claim holds for sets of cardinality nn and let #A=s(n)\#A = s(n). Choose a∈Aa \in A and put A′=defA∖{a}A' \defeq A \setminus \{a\}, of cardinality nn. Since A=A′∪{a}A = A' \cup \{a\} we have f(A)=f(A′)∪{f(a)}f(A) = f(A') \cup \{f(a)\}, and f(A′)f(A') is finite with #f(A′)⩽n\#f(A') \leqslant n by hypothesis. If f(a)∈f(A′)f(a) \in f(A') then f(A)=f(A′)f(A) = f(A') and #f(A)⩽n⩽s(n)\#f(A) \leqslant n \leqslant s(n). Otherwise adjoining the point gives #f(A)=s(#f(A′))⩽s(n)\#f(A) = s(\#f(A')) \leqslant s(n).

If ff is injective then ff is a bijection from AA onto f(A)f(A), so #f(A)=#A\#f(A) = \#A. If ff is not injective, choose x≠yx \neq y in AA with f(x)=f(y)f(x) = f(y). Every value of ff is then already taken on A∖{x}A \setminus \{x\}, since f(x)=f(y)f(x) = f(y) and y≠xy \neq x, so f(A)=f(A∖{x})f(A) = f(A \setminus \{x\}) and

#f(A)⩽#(A∖{x})<#A,\#f(A) \leqslant \#(A \setminus \{x\}) < \#A,

the second inequality because A∖{x}A \setminus \{x\} is a proper subset. So equality holds exactly when ff is injective.

The Pigeonhole Principle

Theorem 7.20 (Injections, surjections and size).

Let AA and BB be finite.

  1. If there is an injection f:A→Bf : A \to B then #A⩽#B\#A \leqslant \#B.
  2. If there is a surjection f:A→Bf : A \to B then #B⩽#A\#B \leqslant \#A.

Discussion.

Both parts turn the given function into a statement about the image, and then apply the two results just proved. An injection is a bijection onto its range, so AA and f(A)f(A) have the same cardinality, and f(A)f(A) is a subset of BB, which the theorem on subsets bounds by #B\#B. A surjection has range all of BB, so #B\#B is the cardinality of an image, which the proposition on images bounds by #A\#A. Notice that no choice of preimages is made anywhere, so neither part appeals to the axiom of choice.

Proof.

For the first, ff is a bijection from AA onto f(A)f(A), so #A=#f(A)\#A = \#f(A); and f(A)⊂Bf(A) \subset B, so #f(A)⩽#B\#f(A) \leqslant \#B by the theorem on subsets.

For the second, surjectivity gives f(A)=Bf(A) = B, so #B=#f(A)⩽#A\#B = \#f(A) \leqslant \#A by the proposition on images.

Corollary 7.21 (Pigeonhole principle).

Let AA and BB be finite with #B<#A\#B < \#A. Then no function A→BA \to B is injective, and no function B→AB \to A is surjective.

Proof.

An injection A→BA \to B would give #A⩽#B\#A \leqslant \#B, and a surjection B→AB \to A would give #A⩽#B\#A \leqslant \#B as well; either contradicts #B<#A\#B < \#A by trichotomy.

Example 7.22.

Among thirteen people, two were born in the same month: the map sending each person to the month of their birth goes from a set of thirteen elements to one of twelve, so it cannot be injective, and two people share a value. The principle says the pair exists but gives no way to find it.

Theorem 7.23 (Injective, surjective and bijective agree on a finite set).

Let AA be finite and let f:A→Af : A \to A. Then ff is injective if and only if it is surjective, and either condition makes ff a bijection.

Discussion.

The statement is a biconditional between two conditions on the same map, so we prove each direction, and the last clause follows: a bijection is by definition an injection that is also a surjection, so once the two conditions are equivalent, each one gives both.

Going forwards, injectivity makes the image as large as the whole, and a subset of a finite set with the full cardinality cannot be proper, so the image is everything. Going backwards we argue by contradiction, because failure of injectivity is what we can compute with: a repeated value lets us delete a point without shrinking the image, so the image of a proper subset would have to be all of AA, and the proposition on images bounds it by something strictly smaller.

Proof.

Suppose ff is injective. Then #f(A)=#A\#f(A) = \#A by the proposition on images, and f(A)⊂Af(A) \subset A, so f(A)=Af(A) = A by the theorem on subsets, since a proper subset would have strictly smaller cardinality. Hence ff is surjective.

Suppose ff is surjective and not injective, so f(x)=f(y)f(x) = f(y) for some x≠yx \neq y. Then f(A)=f(A∖{x})f(A) = f(A \setminus \{x\}), and surjectivity makes this all of AA, so

#A=#f(A∖{x})⩽#(A∖{x})<#A,\#A = \#f(A \setminus \{x\}) \leqslant \#(A \setminus \{x\}) < \#A,

which anti-reflexivity forbids. So ff is injective.

In either case ff is both injective and surjective, hence a bijection.

Remark.

Finiteness is needed. The successor map s:N0→N0s : \mathbb{N}_0 \to \mathbb{N}_0 is injective by the third Peano condition and is not surjective, since 00 is not a successor. So on N0\mathbb{N}_0 the two conditions come apart, and the theorem cannot be extended by weakening its hypothesis.

Problem 7.3.

Let AA and BB be finite with #A=#B\#A = \#B and let f:A→Bf : A \to B be injective. Show that ff is a bijection.

Problem 7.4.

Let AA be finite and let f:A→Af : A \to A satisfy f∘f=ff \circ f = f. Show that f=idAf = \mathrm{id}_A if ff is injective, and describe what ff can be otherwise.

Sums and Products

Counting a union means laying one cut after another, so we first say how a cut breaks into an opening piece and a shifted one.

Proposition 7.24 (Splitting a cut).

Let m,n∈N0m, n \in \mathbb{N}_0 and put S=def{m+i∣i∈Ln}S \defeq \{m + i \mid i \in L_n\}. Then

Lm+n=Lm∪S,Lm∩S=∅,L_{m+n} = L_m \cup S, \qquad L_m \cap S = \emptyset,

and i↦m+ii \mapsto m + i is a bijection from LnL_n onto SS.

Discussion.

Three assertions, each about the position of a number relative to mm. The equality is a set equality, hence two inclusions. From left to right, trichotomy puts xx either below mm, which is the first part, or at or above it, in which case x=m+ix = m + i for a difference ii, and the difference is below nn because subtracting mm from both sides of x<m+nx < m + n leaves i<ni < n. From right to left, both parts are checked against m+nm + n directly, using that adding a positive element moves you up. Disjointness is trichotomy once more, since the members of SS are at least mm and the members of LmL_m are strictly below it. The last assertion is uniqueness of differences, which says m+i=m+i′m + i = m + i' can happen only for i=i′i = i'; surjectivity holds because SS was defined as the set of such values.

Proof.

Let x<m+nx < m + n. If x<mx < m then x∈Lmx \in L_m. Otherwise m⩽xm \leqslant x, so x=m+ix = m + i for some i∈N0i \in \mathbb{N}_0 by the description of the associated order. From m+i<m+nm + i < m + n we get m+n=(m+i)+b=m+(i+b)m + n = (m + i) + b = m + (i + b) for some positive bb, by the laws of addition, so n=i+bn = i + b by uniqueness of differences and hence i<ni < n. Thus x∈Sx \in S.

Conversely, m⩽m+nm \leqslant m + n, so x<mx < m gives x<m+nx < m + n by mixed transitivity. And if i<ni < n then n=i+bn = i + b with bb positive, so m+n=(m+i)+bm + n = (m + i) + b and m+i<m+nm + i < m + n.

If x∈Lm∩Sx \in L_m \cap S then x<mx < m and m⩽xm \leqslant x, which trichotomy forbids, so the intersection is empty.

Finally, i↦m+ii \mapsto m + i is injective by uniqueness of differences and surjective onto SS by the definition of SS.

Theorem 7.25 (Cardinality of a disjoint union).

Let AA and BB be finite and disjoint. Then A∪BA \cup B is finite and

#(A∪B)=#A+#B.\#(A \cup B) = \#A + \#B.

Discussion.

We must exhibit a bijection from A∪BA \cup B onto the cut Lm+nL_{m+n}, and the splitting proposition cuts that target into the two pieces we need. So we define the map in two clauses, counting the points of AA by their own bijection and the points of BB by theirs, shifted up by mm so as to land in the second piece. Disjointness of AA and BB means each point falls under exactly one clause, so we have a function. Injectivity then has three cases, two inside a piece, which the two bijections handle, and one across the pieces, which the disjointness of the split handles. Surjectivity is the other half of the split.

Proof.

Put m=def#Am \defeq \#A and n=def#Bn \defeq \#B, and let g:A→Lmg : A \to L_m and h:B→Lnh : B \to L_n be bijections. Define

k:A∪B→Lm+n,k(x)=def{g(x)if x∈A,m+h(x)if x∈B.k : A \cup B \to L_{m+n}, \qquad k(x) \defeq \begin{cases} g(x) & \text{if } x \in A, \\ m + h(x) & \text{if } x \in B. \end{cases}

Since A∩B=∅A \cap B = \emptyset, each point of the domain falls under exactly one clause, so kk is a function, and its values lie in Lm+nL_{m+n} by the splitting proposition.

For injectivity, two points of AA are separated by gg; two points of BB are separated by hh together with the injectivity of i↦m+ii \mapsto m + i; and a point of AA cannot collide with a point of BB, since their values lie in the two disjoint pieces of the split. For surjectivity, an element of Lm+nL_{m+n} lies either in LmL_m, hence is g(x)g(x) for some x∈Ax \in A, or is m+im + i with i∈Lni \in L_n, hence is m+h(y)=k(y)m + h(y) = k(y) for some y∈By \in B.

So A∪B≈Lm+nA \cup B \approx L_{m+n}, which is the assertion.

Corollary 7.26 (Cardinality of a union).

Let AA and BB be finite. Then A∪BA \cup B is finite and

#(A∪B)+#(A∩B)=#A+#B.\#(A \cup B) + \#(A \cap B) = \#A + \#B.

Proof.

The sets B∖AB \setminus A and A∩BA \cap B are subsets of BB, hence finite. Now A∪B=A∪(B∖A)A \cup B = A \cup (B \setminus A) with the two parts disjoint, so #(A∪B)=#A+#(B∖A)\#(A \cup B) = \#A + \#(B \setminus A); and B=(B∖A)∪(A∩B)B = (B \setminus A) \cup (A \cap B) with the two parts disjoint, so #B=#(B∖A)+#(A∩B)\#B = \#(B \setminus A) + \#(A \cap B). Adding #(A∩B)\#(A \cap B) to the first equation and substituting the second gives

#(A∪B)+#(A∩B)=#A+#(B∖A)+#(A∩B)=#A+#B,\#(A \cup B) + \#(A \cap B) = \#A + \#(B \setminus A) + \#(A \cap B) = \#A + \#B,

by the laws of addition.

Remark.

The familiar form of that identity subtracts the overlap, and we have written it with everything on the right instead. Subtraction is available to us only when the answer stays in N0\mathbb{N}_0, which it does here, but stating the law as an equation between sums spares us from checking that each time.

Problem 7.5.

Let AA, BB and CC be finite. Show that

#(A∪B∪C)+#(A∩B)+#(A∩C)+#(B∩C)=#A+#B+#C+#(A∩B∩C).\#(A \cup B \cup C) + \#(A \cap B) + \#(A \cap C) + \#(B \cap C) = \#A + \#B + \#C + \#(A \cap B \cap C).

Theorem 7.27 (Cardinality of a product).

Let AA and BB be finite. Then A×BA \times B is finite and #(A×B)=#A⋅#B\#(A \times B) = \#A \cdot \#B, with multiplication as the problems of the natural-numbers chapter defined it.

Discussion.

Multiplication was defined by recursion on its second argument, with the clauses x⋅0=0x \cdot 0 = 0 and x⋅s(n)=x⋅n+xx \cdot s(n) = x \cdot n + x, so we induct on #B\#B following them. At 00 the set BB is empty and so is the product, since a pair needs a second coordinate. For the step we split BB into a smaller set and a single extra point bb, which splits A×BA \times B into two disjoint pieces, one governed by the inductive hypothesis and one a copy of AA. The theorem on disjoint unions adds the two cardinalities, and the resulting sum is the right-hand side of the second clause of the multiplication recursion.

Proof.

We induct on n=def#Bn \defeq \#B. If n=0n = 0 then B=∅B = \emptyset, so A×B=∅A \times B = \emptyset and #(A×B)=0=#A⋅0\#(A \times B) = 0 = \#A \cdot 0.

Suppose the claim holds for every BB of cardinality nn, and let #B=s(n)\#B = s(n). Choose b∈Bb \in B and put B′=defB∖{b}B' \defeq B \setminus \{b\}, of cardinality nn. A pair (x,y)(x, y) with y∈By \in B has either y∈B′y \in B' or y=by = b, and not both, so

A×B=(A×B′)∪(A×{b}),(A×B′)∩(A×{b})=∅,A \times B = (A \times B') \cup (A \times \{b\}), \qquad (A \times B') \cap (A \times \{b\}) = \emptyset,

using equality of ordered pairs to read off the second coordinate. The map x↦(x,b)x \mapsto (x, b) is a bijection from AA onto A×{b}A \times \{b\}, again by equality of ordered pairs, so that piece has cardinality #A\#A; and A×B′A \times B' has cardinality #A⋅n\#A \cdot n by hypothesis. The theorem on disjoint unions gives

#(A×B)=#A⋅n+#A=#A⋅s(n),\#(A \times B) = \#A \cdot n + \#A = \#A \cdot s(n),

the last step being the second clause of the definition of multiplication.

Problem 7.6.

Show that a union of finitely many finite sets is finite. State the claim carefully first: it is an assertion about an indexed family whose index set is a cut.

Problem 7.7.

Let AA be finite with #A=n\#A = n. Show that #P(A)=2n\#\mathcal{P}(A) = 2^n, with powers as the problems of the natural-numbers chapter defined them.

Problem 7.8.

Let AA and BB be finite. Show that the Cartesian power ABA^B, the set of functions from BB to AA, is finite with #(AB)=(#A)#B\#(A^B) = (\#A)^{\#B}.

Extrema of Finite Sets

Proposition 7.28 (Finite subsets of an ordered set have extrema).

Let MM be a totally ordered set and let S⊂MS \subset M be finite and non-empty. Then SS has a minimum and a maximum.

Discussion.

The hypothesis is about an arbitrary finite non-empty set, so the induction runs on the cardinality and starts at 11 rather than 00, which is allowed by induction from an arbitrary starting point. A set of cardinality 11 has a single element, which is both extrema by reflexivity of the order. For the step we remove a point aa, apply the hypothesis to what remains, which is still non-empty, and then compare aa with the maximum found there: the two are comparable because the order is total, and whichever of the two is the larger is the maximum of the whole. Minima are the same argument with the inequalities reversed, so we write only one of them out.

Proof.

We induct on n=#Sn = \#S, beginning at n=1n = 1. Then S≈L1={0}S \approx L_1 = \{0\}, so S={a}S = \{a\} for a single aa, and a⩽aa \leqslant a makes it both the minimum and the maximum.

Suppose every subset of cardinality n⩾1n \geqslant 1 has both extrema, and let #S=s(n)\#S = s(n). Choose a∈Sa \in S and put S′=defS∖{a}S' \defeq S \setminus \{a\}, which has cardinality n⩾1n \geqslant 1 and so is non-empty. Let M′M' be its maximum. Since MM is totally ordered, aa and M′M' are comparable. If a⩽M′a \leqslant M' then M′M' is an upper bound of SS lying in SS, hence its maximum; if M′⩽aM' \leqslant a then aa is such a bound, hence the maximum. The argument for the minimum reverses the inequalities.

Corollary 7.29 (The natural numbers are infinite).

N0\mathbb{N}_0 and N\mathbb{N} are infinite.

Proof.

The order on N0\mathbb{N}_0 is strict and linear, so the associated ⩽\leqslant is a total order. Were N0\mathbb{N}_0 finite, it would be non-empty and so would have a maximum MM; but s(M)∈N0s(M) \in \mathbb{N}_0 and M<s(M)M < s(M), contradicting that MM is an upper bound. The same argument applies to N\mathbb{N}, whose element s(M)s(M) is positive because it is a successor.

Problem 7.9.

Show that a set with an infinite subset is infinite, and that the image of a finite set under any function is finite.

Comparing Sets

For an infinite set there is no n∈N0n \in \mathbb{N}_0 counting it, so we cannot compare numbers. Injections and bijections still make sense, though, and for finite sets the next theorem matches each inequality with a condition on functions.

Comparing Finite Sets

Theorem 7.30 (Comparing finite sets).

Let AA and BB be finite sets. Then

  1. #A⩽#B\#A \leqslant \#B if and only if there is an injection A→BA \to B;
  2. #A=#B\#A = \#B if and only if A≈BA \approx B;
  3. #A<#B\#A < \#B if and only if there is an injection A→BA \to B but no bijection A→BA \to B.

Discussion.

Write m=def#Am \defeq \#A and n=def#Bn \defeq \#B and fix bijections f:Lm→Af : L_m \to A and g:Ln→Bg : L_n \to B; every part is then a matter of conjugating a map between the cuts into a map between the sets, or the other way about.

For the first part, one direction is already the theorem on injections and size. The other builds the injection: m⩽nm \leqslant n gives Lm⊂LnL_m \subset L_n, whose inclusion map is injective, and g∘ι∘f−1g \circ \iota \circ f^{-1} is then an injection A→BA \to B, being a composite of injections. The second part is the corollary that cardinality classifies finite sets, read in both directions.

The third is the first two put together. If m<nm < n then the first part supplies an injection, and a bijection would force m=nm = n by the second, which trichotomy forbids. Conversely an injection gives m⩽nm \leqslant n and the absence of a bijection gives m≠nm \neq n, and those two are what m<nm < n abbreviates.

Proof.

Write m=def#Am \defeq \#A and n=def#Bn \defeq \#B, and fix bijections f:Lm→Af : L_m \to A and g:Ln→Bg : L_n \to B.

For the first part, suppose m⩽nm \leqslant n. Then Lm⊂LnL_m \subset L_n, since x<m⩽nx < m \leqslant n gives x<nx < n, and the inclusion ι:Lm→Ln\iota : L_m \to L_n is injective. So g∘ι∘f−1:A→Bg \circ \iota \circ f^{-1} : A \to B is an injection. Conversely an injection A→BA \to B gives #A⩽#B\#A \leqslant \#B by the theorem on injections and size.

The second part is the corollary that cardinality classifies finite sets.

For the third, let m<nm < n. The first part gives an injection A→BA \to B, and a bijection would give m=nm = n by the second part, contradicting trichotomy. Conversely, an injection gives m⩽nm \leqslant n by the first part and the absence of a bijection gives m≠nm \neq n by the second, so m<nm < n.

The three right-hand sides make sense whether or not the sets are finite, so they may be taken as definitions in general. By the theorem, the new definitions agree with the old ones for finite sets.

Definition 7.31 (Comparing sizes).

Let AA and BB be sets, finite or not. We write

  1. #A⩽#B\#A \leqslant \#B if there is an injection A→BA \to B;
  2. #A=#B\#A = \#B if A≈BA \approx B;
  3. #A<#B\#A < \#B if there is an injection A→BA \to B but no bijection A→BA \to B.

For finite sets these agree with the numerical readings, by the theorem. The symbol #A\#A still names a natural number only when AA is finite; in general the three displays above are single assertions about functions, and it is the assertion, not the symbol #A\#A standing alone, that has been defined. What #A\#A may be taken to name in general is settled at the end of the chapter.

Read informally, #A<#B\#A < \#B says that BB is roomy enough to hold an injective copy of AA and still has something left over, in the strong sense that every injection misses something.

Proposition 7.32 (Reflexivity and transitivity).

For all sets AA, BB, CC:

  1. #A⩽#A\#A \leqslant \#A;
  2. if #A⩽#B\#A \leqslant \#B and #B⩽#C\#B \leqslant \#C then #A⩽#C\#A \leqslant \#C.

Discussion.

Both parts unfold to claims about injections, and both follow from basic facts about injections. Reflexivity needs an injection A→AA \to A, and the identity map is one. Transitivity needs an injection A→CA \to C out of injections A→BA \to B and B→CB \to C, and their composite is injective: if the composite identifies two points, the outer map identifies their images and the inner map identifies them.

Proof.

The identity idA\mathrm{id}_A is injective, so #A⩽#A\#A \leqslant \#A.

Let f:A→Bf : A \to B and g:B→Cg : B \to C be injections. If g(f(x))=g(f(y))g(f(x)) = g(f(y)) then f(x)=f(y)f(x) = f(y) by injectivity of gg, and x=yx = y by injectivity of ff. So g∘fg \circ f is an injection A→CA \to C and #A⩽#C\#A \leqslant \#C.

Problem 7.10.

Prove or refute each of the following, for arbitrary sets AA, BB and CC.

  1. If #A⩽#B\#A \leqslant \#B then #(A×C)⩽#(B×C)\#(A \times C) \leqslant \#(B \times C).
  2. #(A∖B)⩽#B\#(A \setminus B) \leqslant \#B.

Problem 7.11.

Let BB be non-empty. Show that #A⩽#(A×B)\#A \leqslant \#(A \times B) for every set AA.

The Schröder–Bernstein Theorem

The last proposition does not give antisymmetry. For finite sets it is immediate, since m⩽n⩽mm \leqslant n \leqslant m forces m=nm = n; in general it is a harder theorem.

Theorem 7.33 (Schröder–Bernstein).

Let AA and BB be sets with #A⩽#B\#A \leqslant \#B and #B⩽#A\#B \leqslant \#A. Then A≈BA \approx B.

Discussion.

We are given injections f:A→Bf : A \to B and g:B→Ag : B \to A and must build a bijection out of them. Neither alone will do: ff may miss part of BB and gg may miss part of AA. The idea is to use ff on some of AA and the inverse of gg on the rest, and the problem is to decide where the boundary falls. The points where we have no choice are those of A∖g(B)A \setminus g(B), which have no gg-preimage at all, so ff must be used there; and then ff must be used at g(f(x))g(f(x)) for each such xx, since otherwise that point would be sent back to f(x)f(x), which is already taken. Iterating gives a family A0,A1,A2,…A_0, A_1, A_2, \ldots built by the recursion theorem, and their union CC is the region where ff is used.

With the boundary fixed, three checks remain. The map is defined everywhere, because a point outside CC is in particular outside A0A_0, hence has a gg-preimage, unique by injectivity. It is injective on each of the two regions separately, and the two cannot collide, because a collision would carry a point of CC one step further along the chain and so put an element of CC outside CC. It is surjective by chasing a given bb backwards: if g(b)g(b) lies outside CC it is where bb comes from, and if it lies inside CC it lies in some AnA_n with nn a successor, which exhibits bb as a value of ff.

Proof.

Let f:A→Bf : A \to B and g:B→Ag : B \to A be injections. The recursion theorem, applied in P(A)\mathcal{P}(A) with the map X↦g(f(X))X \mapsto g(f(X)), gives exactly one family {An}n∈N0\{A_n\}_{n \in \mathbb{N}_0} with

A0=defA∖g(B),As(n)=defg(f(An)),A_0 \defeq A \setminus g(B), \qquad A_{s(n)} \defeq g\bigl(f(A_n)\bigr),

and we put C=def⋃n∈N0AnC \defeq \bigcup_{n \in \mathbb{N}_0} A_n. The two injections run the pieces alternately into one another,

A:A0A1A2⋯↓f↗g↓f↗g↓fB:f(A0)f(A1)f(A2)⋯\begin{array}{ccccccc} A: & A_0 & & A_1 & & A_2 & \cdots \\ & \big\downarrow {\scriptstyle f} & \nearrow {\scriptstyle g} & \big\downarrow {\scriptstyle f} & \nearrow {\scriptstyle g} & \big\downarrow {\scriptstyle f} & \\ B: & f(A_0) & & f(A_1) & & f(A_2) & \cdots \end{array}

and CC is the whole of the top row. On it the bijection will follow the downward arrows; off it every point has a gg-preimage, and the bijection will run back up them. Define

h:A→B,h(x)=def{f(x)if x∈C,the unique b with g(b)=xif x∉C.h : A \to B, \qquad h(x) \defeq \begin{cases} f(x) & \text{if } x \in C, \\ \text{the unique } b \text{ with } g(b) = x & \text{if } x \notin C. \end{cases}

The second clause makes sense: x∉Cx \notin C gives x∉A0x \notin A_0, so x∈g(B)x \in g(B), and the preimage is unique because gg is injective. So hh is a function.

For injectivity, suppose h(x)=h(y)h(x) = h(y). If both points lie in CC then f(x)=f(y)f(x) = f(y) gives x=yx = y; if neither does then applying gg to both sides gives x=yx = y. Suppose then x∈Cx \in C and y∉Cy \notin C, so f(x)=h(y)f(x) = h(y) and hence y=g(f(x))y = g(f(x)). Since x∈Cx \in C we have x∈Anx \in A_n for some nn, so y∈g(f(An))=As(n)⊂Cy \in g(f(A_n)) = A_{s(n)} \subset C, contradicting y∉Cy \notin C.

For surjectivity, let b∈Bb \in B and put x=defg(b)x \defeq g(b). If x∉Cx \notin C then h(x)=bh(x) = b by the second clause. If x∈Cx \in C then x∈Anx \in A_n for some nn, and n≠0n \neq 0 because x∈g(B)x \in g(B); so n=s(k)n = s(k) by the theorem on predecessors, and x∈g(f(Ak))x \in g(f(A_k)) gives x=g(f(z))x = g(f(z)) for some z∈Akz \in A_k. Injectivity of gg gives b=f(z)b = f(z), and z∈Cz \in C, so b=h(z)b = h(z).

Hence hh is a bijection and A≈BA \approx B.

The proof gives the bijection in two pieces, one for the chained points and one for the rest, rather than as a single formula. What the applications use is only that it exists.

Example 7.34 (Informal).

Assuming you know the real numbers, write RR for them and consider the closed interval [0,1][0,1] and the open interval (0,1)(0,1). The inclusion of (0,1)(0,1) in [0,1][0,1] is an injection one way. In the other direction x↦x2+14x \mapsto \tfrac{x}{2} + \tfrac{1}{4} is injective and carries [0,1][0,1] into (0,1)(0,1), since 00 goes to 14\tfrac14 and 11 to 34\tfrac34. Schröder–Bernstein therefore supplies a bijection between the two intervals, although neither of the injections we wrote is surjective.

Problem 7.12.

Schröder–Bernstein is sometimes read as saying that injections f:A→Bf : A \to B and g:B→Ag : B \to A are each bijections. Exhibit sets AA and BB with injections both ways, neither of which is surjective.

Theorem 7.35 (Transitivity for strict comparison).

Let AA, BB and CC be sets.

  1. If #A<#B\#A < \#B and #B<#C\#B < \#C then #A<#C\#A < \#C.
  2. If #A<#B\#A < \#B and #B⩽#C\#B \leqslant \#C then #A<#C\#A < \#C.
  3. If #A⩽#B\#A \leqslant \#B and #B<#C\#B < \#C then #A<#C\#A < \#C.

Discussion.

Each part asserts the existence of an injection and the non-existence of a bijection, so each splits in two, and the first half is the previous proposition in every case, since a strict comparison contains a weak one. The second half is where Schröder–Bernstein is needed, and it is used contrapositively: a bijection A→CA \to C would let us pull an injection B→CB \to C back to an injection B→AB \to A, and with the injection A→BA \to B already in hand the theorem would return A≈BA \approx B, which the strict hypothesis forbids. We write out the first part and leave the other two, which run the same way, to the problems.

Proof.

For the first part, the two hypotheses supply injections A→BA \to B and B→CB \to C, so #A⩽#C\#A \leqslant \#C by the previous proposition.

Suppose A≈CA \approx C and let φ:C→A\varphi : C \to A be a bijection. Composing φ\varphi with an injection B→CB \to C gives an injection B→AB \to A, so #B⩽#A\#B \leqslant \#A. Since #A<#B\#A < \#B gives #A⩽#B\#A \leqslant \#B, Schröder–Bernstein yields A≈BA \approx B, contradicting #A<#B\#A < \#B. So no bijection A→CA \to C exists and #A<#C\#A < \#C.

Comparability

Reflexive, transitive, antisymmetric: the comparison behaves like an order. What an order on the natural numbers also had was trichotomy, and for sizes that is a separate matter, since nothing so far rules out two sets neither of which injects into the other.

Theorem 7.36 (Comparability).

Let AA and BB be sets. Then #A⩽#B\#A \leqslant \#B or #B⩽#A\#B \leqslant \#A.

Discussion.

An injection defined on all of AA is what we want and cannot build directly, so we build the largest injection defined on part of AA and show that largest one leaves nothing out. The candidates are the injective functions whose domain is a subset of AA and whose values lie in BB; each is a subset of A×BA \times B, so comprehension collects them into a set, which inclusion orders.

To apply Zorn’s lemma we must show every chain has an upper bound, and we take the union of the chain: it is a function because two pairs with the same first coordinate lie in a common member of the chain, since members of a chain are comparable, and it is injective for the same reason with the coordinates exchanged. The empty chain is covered by the empty function. Zorn then supplies a maximal element pp, and maximality is used contrapositively: if pp missed a point of AA and also missed a point of BB, the pair of them could be added to pp, giving a strictly larger candidate. So one of the two is not missed, and the two cases give the two halves of the conclusion, the second by inverting pp.

Proof.

Let MM be the set of p∈P(A×B)p \in \mathcal{P}(A \times B) that are injective functions whose domain is a subset of AA, ordered by inclusion. The empty function belongs to MM, and inclusion is a partial order.

Let K⊂MK \subset M be a chain and put q=def⋃Kq \defeq \bigcup K, a subset of A×BA \times B. If (x,b)(x, b) and (x,b′)(x, b') lie in qq, they lie in members pp and p′p' of KK, which are comparable, so both pairs lie in the larger one; that member is a function, so b=b′b = b'. Hence qq is a function, with domain the union of the domains. The same argument with the coordinates exchanged shows qq is injective. So q∈Mq \in M and qq is an upper bound of KK, and MM is inductively ordered.

Zorn’s lemma gives a maximal p∈Mp \in M. Suppose dom⁡p≠A\operatorname{dom} p \neq A and im⁡p≠B\operatorname{im} p \neq B, and choose a∈A∖dom⁡pa \in A \setminus \operatorname{dom} p and b∈B∖im⁡pb \in B \setminus \operatorname{im} p. Then p∪{(a,b)}p \cup \{(a, b)\} is again an injective function with domain inside AA, and it properly contains pp, contradicting maximality.

So dom⁡p=A\operatorname{dom} p = A, in which case pp is an injection A→BA \to B; or im⁡p=B\operatorname{im} p = B, in which case the inverse of pp on its range is an injection B→AB \to A.

Corollary 7.37 (Trichotomy for sizes).

For any sets AA and BB, exactly one of #A<#B\#A < \#B, #A=#B\#A = \#B, #B<#A\#B < \#A holds.

Proof.

Comparability gives #A⩽#B\#A \leqslant \#B or #B⩽#A\#B \leqslant \#A. If both hold then A≈BA \approx B by Schröder–Bernstein; if only the first holds then #A<#B\#A < \#B, and if only the second then #B<#A\#B < \#A. So at least one of the three holds. No two hold together: A≈BA \approx B makes both strict comparisons fail by definition, and #A<#B\#A < \#B together with #B<#A\#B < \#A would give A≈BA \approx B by Schröder–Bernstein, contradicting either.

Remark.

Comparability was proved from Zorn’s lemma, and it is in fact equivalent to the axiom of choice, so it is not a free consequence of the other axioms. Schröder–Bernstein, by contrast, used nothing but the recursion theorem. So comparability needs the axiom of choice, while Schröder–Bernstein does not.

Cantor’s Theorem

Theorem 7.38 (Cantor's theorem).

For every set SS we have #S<#P(S)\#S < \#\mathcal{P}(S).

Discussion.

By the definition the claim splits in two: an injection S→P(S)S \to \mathcal{P}(S), and no bijection. The injection is the map sending a point to the set holding just that point, and it is injective because a singleton determines its element.

For the second half we take an arbitrary f:S→P(S)f : S \to \mathcal{P}(S) and produce a subset that is not one of its values, which denies surjectivity and so denies bijectivity. A set differs from f(x)f(x) as soon as it disagrees with it at one element, and the element we use is xx itself, so we build the subset that disagrees with f(x)f(x) at xx for every xx at once: take those xx that are outside their own value. Comprehension makes that a set and it is a subset of SS, so it is eligible to be a value. Supposing it is the value at aa, the question whether aa belongs to it has a membership criterion that turns each answer into the other, which is Russell’s argument again.

Proof.

The map x↦{x}x \mapsto \{x\} sends SS into P(S)\mathcal{P}(S), and {x}={y}\{x\} = \{y\} gives x=yx = y, so it is injective and #S⩽#P(S)\#S \leqslant \#\mathcal{P}(S).

Let f:S→P(S)f : S \to \mathcal{P}(S) be any function and put

D=def{x∈S∣x∉f(x)},D \defeq \{x \in S \mid x \notin f(x)\},

a set by comprehension and a subset of SS, so D∈P(S)D \in \mathcal{P}(S). Suppose D=f(a)D = f(a) for some a∈Sa \in S. If a∈Da \in D then the criterion gives a∉f(a)=Da \notin f(a) = D. If a∉Da \notin D then, aa being an element of SS, the criterion gives a∈f(a)=Da \in f(a) = D. Both are contradictions, so DD is not a value of ff and ff is not surjective.

In particular no bijection S→P(S)S \to \mathcal{P}(S) exists, so #S<#P(S)\#S < \#\mathcal{P}(S).

Remark.

The diagonal set is the construction that showed there is no set of all sets, used for a different purpose. There it produced a contradiction from an assumption we then dropped; here it produces one from the assumption that DD is a value, and what we drop is surjectivity. Nothing about SS was used, so the theorem applies to every set: iterating it gives

#S<#P(S)<#P(P(S))<⋯ ,\#S < \#\mathcal{P}(S) < \#\mathcal{P}(\mathcal{P}(S)) < \cdots,

a strictly increasing chain with no top, by transitivity for strict comparison.

Problem 7.13.

Show that if #A⩽#B\#A \leqslant \#B and A≈A′A \approx A' and B≈B′B \approx B', then #A′⩽#B′\#A' \leqslant \#B'. Transport the injection along the two bijections.

Problem 7.14.

Prove parts 2 and 3 of the theorem on transitivity for strict comparison.

Problem 7.15.

Use Schröder–Bernstein, rather than an explicit pairing, to show that #N0=#(N0×N0)\#\mathbb{N}_0 = \#(\mathbb{N}_0 \times \mathbb{N}_0) once you have an injection each way.

Problem 7.16.

Show that #A⩽#B\#A \leqslant \#B implies #P(A)⩽#P(B)\#\mathcal{P}(A) \leqslant \#\mathcal{P}(B).

Problem 7.17.

Deduce from Cantor’s theorem that n<2nn < 2^n for every n∈N0n \in \mathbb{N}_0.

Infinite Sets

A set is infinite when it is not finite, which is a purely negative description: no cut matches it. Cantor found that infinite sets come in different sizes, and Cantor’s theorem above already gives a strictly increasing chain of them. We start with the smallest.

Countable Sets

Definition 7.39 (Countable and uncountable).

A set AA is countably infinite if A≈N0A \approx \mathbb{N}_0, countable if it is finite or countably infinite, and uncountable otherwise.

A bijection f:N0→Af : \mathbb{N}_0 \to A is an infinite sequence in AA, so a countably infinite set is one whose elements can be written as a list

(a0,a1,a2,…)(a_0, a_1, a_2, \ldots)

in which every element appears exactly once. Such an ff is an enumeration of AA. The list is not part of the set, and a set usually admits many.

That the two cases of countability do not overlap is the corollary that N0\mathbb{N}_0 is infinite, since otherwise a finite set could be equinumerous with N0\mathbb{N}_0.

Proposition 7.40 (Dropping zero).

N≈N0\mathbb{N} \approx \mathbb{N}_0, so N\mathbb{N} is countably infinite.

Discussion.

We must produce a bijection, and we use the successor map, checking three things against the Peano conditions. Its values are positive, since a successor is never 00, so it does map into N\mathbb{N}. It is injective, which is the third condition verbatim. It is surjective onto N\mathbb{N}, which is the theorem on predecessors: every element other than 00 is a successor.

Proof.

Consider s:N0→Ns : \mathbb{N}_0 \to \mathbb{N}. Its values lie in N\mathbb{N}, since s(n)≠0s(n) \neq 0 by the fourth Peano condition. It is injective by the third. It is surjective, since an element of N\mathbb{N} is not 00 and is therefore s(n)s(n) for some nn by the theorem on predecessors. So ss is a bijection and N0≈N\mathbb{N}_0 \approx \mathbb{N}.

Remark.

Since N⊊N0\mathbb{N} \subsetneq \mathbb{N}_0, an infinite set can be equinumerous with a proper subset of itself, which the corollary of the last chapter shows no finite set can do. Dedekind turned the observation round and took it as the definition of infinite, and we prove below that his definition agrees with ours.

Subsets of the Natural Numbers

Theorem 7.41 (Infinite subsets of the natural numbers).

Every infinite subset M⊂N0M \subset \mathbb{N}_0 is countably infinite.

Discussion.

We must produce an enumeration of MM, and there is an obvious rule for one: list the smallest element first, then the smallest of those left, and so on. Two things must be checked before this is a definition. The rule at stage nn refers to everything listed before nn, not merely to the previous entry, so it is the general recursion theorem rather than the plain one that builds the function, taking for its rule the map sending a finite list to the least element of MM not on it. And that least element must exist: the elements listed so far form the image of a cut, hence a finite set, so they cannot exhaust the infinite MM, and well-ordering then supplies the minimum.

What remains is to check that the enumeration works. It is strictly increasing, because each entry is chosen from a smaller pool than the one before and differs from the entry just removed, and a strictly increasing map is injective by trichotomy. Surjectivity is a least-counterexample argument: if some m∈Mm \in M never appears, look at the first stage whose entry overshoots mm. Everything listed before that stage is below mm, so mm was still in the pool at that stage, and the minimum chosen there cannot have exceeded it.

Proof.

For a finite sequence tt in N0\mathbb{N}_0, the range im⁡t\operatorname{im} t is finite, being the image of a cut. So M∖im⁡tM \setminus \operatorname{im} t is non-empty: otherwise M⊂im⁡tM \subset \operatorname{im} t would make MM finite. Define

g:Seq⁡(N0)→N0,g(t)=defmin⁡(M∖im⁡t),g : \operatorname{Seq}(\mathbb{N}_0) \to \mathbb{N}_0, \qquad g(t) \defeq \min\bigl(M \setminus \operatorname{im} t\bigr),

which exists by well-ordering. The general recursion theorem gives exactly one f:N0→N0f : \mathbb{N}_0 \to \mathbb{N}_0 with f(n)=g(f∣Ln)f(n) = g(f|_{L_n}) for every nn, that is,

f(n)=min⁡(M∖{f(i)∣i<n}).f(n) = \min\bigl(M \setminus \{f(i) \mid i < n\}\bigr).

Every value of ff lies in MM. The map is strictly increasing: the set from which f(s(n))f(s(n)) is chosen is contained in the set from which f(n)f(n) is chosen, so f(n)⩽f(s(n))f(n) \leqslant f(s(n)) by minimality, and f(s(n))≠f(n)f(s(n)) \neq f(n) because f(n)f(n) was removed at the later stage. Induction then gives f(m)<f(n)f(m) < f(n) whenever m<nm < n, and trichotomy makes ff injective.

Induction also gives n⩽f(n)n \leqslant f(n): this holds at 00, and if n⩽f(n)n \leqslant f(n) then n<f(s(n))n < f(s(n)), so f(s(n))<s(n)f(s(n)) < s(n) would place f(s(n))f(s(n)) strictly between nn and s(n)s(n), which nothing does; hence s(n)⩽f(s(n))s(n) \leqslant f(s(n)).

Suppose some m∈Mm \in M is not a value of ff. Since m<s(m)⩽f(s(m))m < s(m) \leqslant f(s(m)), the set of nn with m<f(n)m < f(n) is non-empty, so well-ordering gives a least such kk. Every i<ki < k has f(i)⩽mf(i) \leqslant m and f(i)≠mf(i) \neq m, so f(i)<mf(i) < m; hence mm belongs to M∖{f(i)∣i<k}M \setminus \{f(i) \mid i < k\}, and minimality of f(k)f(k) in that set gives f(k)⩽mf(k) \leqslant m, contradicting m<f(k)m < f(k).

So ff is a bijection from N0\mathbb{N}_0 onto MM.

Characterising At Most Countable Sets

Theorem 7.42 (Characterising countable sets).

Let MM be a non-empty set. The following are equivalent.

  1. MM is countable.
  2. There is an injection M→N0M \to \mathbb{N}_0.
  3. There is a surjection N0→M\mathbb{N}_0 \to M.

Discussion.

We prove the three conditions equivalent by a cycle of implications.

From the first to the third: a countably infinite MM has a bijection from N0\mathbb{N}_0, which is a surjection; a finite non-empty MM has a bijection from a cut, which we extend to all of N0\mathbb{N}_0 by parking every later index on one fixed point, and parking spoils nothing because surjectivity asks only that every point be hit.

From the third to the second: a surjection has an injective right inverse, and here we can name one without appealing to choice. Each point of MM has a non-empty set of preimages inside N0\mathbb{N}_0, so well-ordering picks out its least preimage, and a right inverse is injective because applying the surjection recovers the point.

From the second to the first: an injection makes MM equinumerous with its image, a subset of N0\mathbb{N}_0, and a subset of N0\mathbb{N}_0 is finite or infinite; in the first case MM is finite, and in the second the theorem just proved makes it countably infinite.

Proof.

Suppose MM is countable. If M≈N0M \approx \mathbb{N}_0, a bijection is a surjection. If MM is finite and non-empty, let f:Ln→Mf : L_n \to M be a bijection with n≠0n \neq 0, and define β:N0→M\beta : \mathbb{N}_0 \to M by β(k)=deff(k)\beta(k) \defeq f(k) for k<nk < n and β(k)=deff(0)\beta(k) \defeq f(0) for k⩾nk \geqslant n. Every point of MM is f(k)f(k) for some k<nk < n, so β\beta is surjective.

Suppose β:N0→M\beta : \mathbb{N}_0 \to M is surjective. For x∈Mx \in M the preimage β−1({x})\beta^{-1}(\{x\}) is a non-empty subset of N0\mathbb{N}_0, so it has a least element; let α(x)\alpha(x) be that element. Then β(α(x))=x\beta(\alpha(x)) = x for every xx, so α(x)=α(y)\alpha(x) = \alpha(y) gives x=yx = y, and α:M→N0\alpha : M \to \mathbb{N}_0 is injective.

Suppose α:M→N0\alpha : M \to \mathbb{N}_0 is injective. Then M≈α(M)⊂N0M \approx \alpha(M) \subset \mathbb{N}_0. If α(M)\alpha(M) is finite then so is MM. If α(M)\alpha(M) is infinite then α(M)≈N0\alpha(M) \approx \mathbb{N}_0 by the theorem on infinite subsets, so M≈N0M \approx \mathbb{N}_0 by transitivity. Either way MM is countable.

Corollary 7.43 (Subsets of countable sets).

Every subset of a countable set is countable.

Proof.

Let B⊂AB \subset A with AA countable. If BB is empty it is finite. Otherwise AA is non-empty, so there is an injection A→N0A \to \mathbb{N}_0 by the theorem, and its restriction to BB is injective, so BB is countable by the theorem again.

Products and Unions

Theorem 7.44 (Pairs of natural numbers).

N0×N0\mathbb{N}_0 \times \mathbb{N}_0 is countably infinite.

Discussion.

By the characterisation it is enough to find one injection into N0\mathbb{N}_0, and then to observe that the set is not finite. For the injection we enumerate the pairs in diagonals: all pairs with m+n=0m + n = 0, then those with m+n=1m + n = 1, and so on. The kkth diagonal has s(k)s(k) entries, so a pair (m,n)(m, n) on the diagonal k=m+nk = m + n should be given the position

j(m,n)=defT(k)+m,T(k)=def∑i=1ki,j(m, n) \defeq T(k) + m, \qquad T(k) \defeq \sum_{i=1}^{k} i,

where the summation symbol is the one built by recursion in the last chapter but one. Injectivity then rests on the diagonals not overlapping, which is the inequality T(k)+m<T(k′)T(k) + m < T(k') whenever k<k′k < k' and m⩽km \leqslant k; it follows from the recursion clause T(s(k))=T(k)+s(k)T(s(k)) = T(k) + s(k). Once the diagonal is known, mm and then nn are determined by uniqueness of differences. Infinitude is easy: the pairs (n,0)(n, 0) form a copy of N0\mathbb{N}_0 inside, and a set with an infinite subset is infinite.

Proof.

Write T(k)=def∑i=1kiT(k) \defeq \sum_{i=1}^{k} i, so that T(0)=0T(0) = 0 and T(s(k))=T(k)+s(k)T(s(k)) = T(k) + s(k).

We first record that TT is non-decreasing: if k⩽lk \leqslant l then l=k+bl = k + b, and induction on bb gives the claim, since T(k+s(b))=T(s(k+b))=T(k+b)+s(k+b)T(k + s(b)) = T(s(k+b)) = T(k+b) + s(k+b) is at least T(k+b)T(k + b), which is at least T(k)T(k) by the inductive hypothesis.

Define j(m,n)=defT(m+n)+mj(m, n) \defeq T(m + n) + m. Laid out with mm down the side and nn across, the values run

0123⋯00136⋯124725839⋮⋮⋱\begin{array}{c|ccccc} & 0 & 1 & 2 & 3 & \cdots \\ \hline 0 & 0 & 1 & 3 & \boxed{6} & \cdots \\ 1 & 2 & 4 & \boxed{7} & & \\ 2 & 5 & \boxed{8} & & & \\ 3 & \boxed{9} & & & & \\ \vdots & \vdots & & & & \ddots \end{array}

The boxed entries are the pairs with m+n=3m + n = 3, and they fill the consecutive block from T(3)=6T(3) = 6 to T(3)+3=9T(3) + 3 = 9. What follows is that observation for a general diagonal.

Suppose j(m,n)=j(m′,n′)j(m, n) = j(m', n') and put k=defm+nk \defeq m + n, k′=defm′+n′k' \defeq m' + n'. If k<k′k < k' then k′=k+s(c)k' = k + s(c) for some cc, so

T(k′)=T(s(k+c))=T(k+c)+k′⩾T(k)+k′.T(k') = T(s(k + c)) = T(k + c) + k' \geqslant T(k) + k'.

Also m⩽k<k′m \leqslant k < k', so k′=m+bk' = m + b for a positive bb and T(k)+k′=(T(k)+m)+bT(k) + k' = (T(k) + m) + b, giving T(k)+m<T(k)+k′⩽T(k′)T(k) + m < T(k) + k' \leqslant T(k'); and T(k′)⩽T(k′)+m′T(k') \leqslant T(k') + m'. Together these give j(m,n)<j(m′,n′)j(m, n) < j(m', n'), against the supposition. The same argument rules out k′<kk' < k, so k=k′k = k' by trichotomy. Then T(k)+m=T(k)+m′T(k) + m = T(k) + m' gives m=m′m = m' by uniqueness of differences, and m+n=m+n′m + n = m + n' gives n=n′n = n' likewise. So jj is injective and N0×N0\mathbb{N}_0 \times \mathbb{N}_0 is countable.

Finally n↦(n,0)n \mapsto (n, 0) is injective, so N0×N0\mathbb{N}_0 \times \mathbb{N}_0 has an infinite subset and is therefore infinite.

Corollary 7.45 (Products of countable sets).

If AA and BB are countable then so is A×BA \times B.

Proof.

If either set is empty the product is empty. Otherwise let u:A→N0u : A \to \mathbb{N}_0 and v:B→N0v : B \to \mathbb{N}_0 be injections. Then (x,y)↦(u(x),v(y))(x, y) \mapsto (u(x), v(y)) is injective, by equality of ordered pairs, and composing it with the injection jj of the theorem gives an injection A×B→N0A \times B \to \mathbb{N}_0.

Theorem 7.46 (Countable unions of countable sets).

Let II be countable and let {Ai}i∈I\{A_i\}_{i \in I} be an indexed family of countable sets. Then ⋃i∈IAi\bigcup_{i \in I} A_i is countable.

Discussion.

The characterisation lets us argue with surjections rather than injections, and a surjection onto the union is easy to describe: run over the indices with one surjection and over each set with another, so that the pair (m,n)(m, n) names the nnth element of the mmth set. Two points need care. Countability of AiA_i says only that a surjection onto it exists, and we need one for every ii at once, and this needs the axiom of choice. And the domain of the resulting map is N0×N0\mathbb{N}_0 \times \mathbb{N}_0 rather than N0\mathbb{N}_0, which the previous theorem fixes, since a countably infinite set admits a bijection from N0\mathbb{N}_0. Composing the two gives a surjection from N0\mathbb{N}_0 onto the union, which is then countable by the characterisation.

Proof.

Discard the indices with Ai=∅A_i = \emptyset; the union is unchanged and the smaller index set is still countable. If nothing is left the union is empty, hence countable, so suppose I≠∅I \neq \emptyset and every Ai≠∅A_i \neq \emptyset.

By the characterisation there is a surjection γ:N0→I\gamma : \mathbb{N}_0 \to I. For each ii the set SiS_i of surjections N0→Ai\mathbb{N}_0 \to A_i is a non-empty subset of P(N0×Ai)\mathcal{P}(\mathbb{N}_0 \times A_i), again by the characterisation, so the axiom of choice applied to {Si}i∈I\{S_i\}_{i \in I} gives a function i↦βii \mapsto \beta_i with βi∈Si\beta_i \in S_i for every ii.

The map (m,n)↦βγ(m)(n)(m, n) \mapsto \beta_{\gamma(m)}(n) is a surjection from N0×N0\mathbb{N}_0 \times \mathbb{N}_0 onto ⋃i∈IAi\bigcup_{i \in I} A_i: a point xx of the union lies in some AiA_i, and i=γ(m)i = \gamma(m) for some mm while x=βi(n)x = \beta_i(n) for some nn. Composing with a bijection N0→N0×N0\mathbb{N}_0 \to \mathbb{N}_0 \times \mathbb{N}_0, which the previous theorem supplies, gives a surjection from N0\mathbb{N}_0 onto the union, which is therefore countable.

Remark (Hilbert's hotel).

A hotel with a room for every natural number, all of them occupied, can still take in a new guest: move the occupant of room nn to room s(n)s(n) and give the newcomer room 00. It can take in countably many new guests at once: move the occupant of room nn to room 2⋅n2 \cdot n and use the odd rooms, which the remainder classes say are exactly the rooms left free. It can even take in countably many coaches each carrying countably many guests, by the theorem on countable unions. Infinite sizes do not behave like finite ones, and here we have to rely on the propositions above rather than on intuition.

Remark (Informal).

Assuming you know the whole numbers and the fractions: the whole numbers are the union of the natural numbers, their negatives and zero, so the theorem on countable unions makes them countable. Every fraction is determined by a pair of whole numbers, so the corollary on products makes the fractions countable as well. Both arguments go through as soon as those systems are built.

Problem 7.18.

Let A1,…,AnA_1, \ldots, A_n be countable. Show that A1×⋯×AnA_1 \times \cdots \times A_n is countable, by induction on nn.

Problem 7.19.

Let AA be countable. Show that the set Seq⁡(A)\operatorname{Seq}(A) of finite sequences in AA is countable, and that the set of finite subsets of AA is countable.

Problem 7.20.

Show that the map jj of the theorem on pairs is a bijection onto N0\mathbb{N}_0, not merely an injection. Well-ordering applied to the set of kk with x<T(s(k))x < T(s(k)) will locate the diagonal on which xx sits.

Problem 7.21.

Let AA be countably infinite and let BB be finite and non-empty. Show that A∪BA \cup B and A×BA \times B are countably infinite.

Problem 7.22.

Write N0×N0\mathbb{N}_0 \times \mathbb{N}_0 as the union of a countably infinite family of pairwise disjoint countably infinite sets.

Finite and Infinite

One question is still open. We defined infinite negatively, as the failure of finiteness, and observed that N0\mathbb{N}_0 has a proper subset of its own size. Whether every infinite set does is still open, and the answer needs the axiom of choice.

Theorem 7.47 (Every infinite set has a countably infinite subset).

Let AA be infinite. Then some subset E⊂AE \subset A is countably infinite.

Discussion.

The plan copies the enumeration of an infinite subset of N0\mathbb{N}_0: pick an element, then an element not yet picked, and so on. Two things we had there are missing here. There is no order on AA, so nothing selects an element for us, and the axiom of choice gives a rule that selects one from every non-empty subset at once. And the rule at each stage refers to all the earlier picks, so it is the general recursion theorem that turns the rule into a function. The recursion never stalls, because the elements picked so far form a finite set and AA is infinite, so something is always left. Injectivity is immediate from the construction, since each value is chosen outside the earlier ones, and an injective map from N0\mathbb{N}_0 has range a countably infinite subset.

Proof.

Since AA is infinite it is non-empty. Apply the axiom of choice to the family of non-empty subsets of AA, indexed by itself, to obtain a function cc with c(X)∈Xc(X) \in X for every non-empty X⊂AX \subset A.

For a finite sequence tt in AA the range im⁡t\operatorname{im} t is finite, so A∖im⁡tA \setminus \operatorname{im} t is non-empty, since otherwise AA would be a subset of a finite set. Define

g:Seq⁡(A)→A,g(t)=defc(A∖im⁡t),g : \operatorname{Seq}(A) \to A, \qquad g(t) \defeq c\bigl(A \setminus \operatorname{im} t\bigr),

and let f:N0→Af : \mathbb{N}_0 \to A be the map the general recursion theorem produces, so that

f(n)=c(A∖{f(i)∣i<n})f(n) = c\bigl(A \setminus \{f(i) \mid i < n\}\bigr)

for every nn. If m<nm < n then f(m)f(m) is one of the elements excluded at stage nn, so f(n)≠f(m)f(n) \neq f(m); with trichotomy this makes ff injective. Hence E=defim⁡fE \defeq \operatorname{im} f satisfies N0≈E\mathbb{N}_0 \approx E and E⊂AE \subset A.

Theorem 7.48 (Characterising finite sets).

Let MM be a non-empty set. The following are equivalent.

  1. MM is finite.
  2. There is a surjection Ln→ML_n \to M for some n∈Nn \in \mathbb{N}.
  3. There is an injection M→LnM \to L_n for some n∈Nn \in \mathbb{N}.
  4. There is no injection N0→M\mathbb{N}_0 \to M.

When they hold, #M\#M is the least nn of the second kind and equally the least nn of the third.

Discussion.

We run a cycle again. From the first to the second, a counting of MM is itself a surjection from a cut. From the second to the third, a surjection has an injective right inverse, obtained as before by sending each point to its least preimage, which well-ordering supplies inside the cut. From the third to the fourth, an injection N0→M\mathbb{N}_0 \to M followed by an injection M→LnM \to L_n would inject N0\mathbb{N}_0 into LnL_n, and restricting to Ls(n)L_{s(n)} would inject a cut into a shorter one. The last step is the theorem just proved, read contrapositively: an infinite MM carries a copy of N0\mathbb{N}_0, hence an injection N0→M\mathbb{N}_0 \to M.

The minimality clause is the two size theorems. A surjection Ln→ML_n \to M gives #M⩽n\#M \leqslant n by the proposition on images, an injection M→LnM \to L_n gives #M⩽n\#M \leqslant n by the theorem on injections and size, and n=#Mn = \#M is achieved in both cases by a counting of MM and its inverse.

Proof.

Suppose MM is finite. Being non-empty, #M=n\#M = n for some n∈Nn \in \mathbb{N}, and a bijection Ln→ML_n \to M is a surjection.

Suppose σ:Ln→M\sigma : L_n \to M is surjective. For x∈Mx \in M the preimage σ−1({x})\sigma^{-1}(\{x\}) is a non-empty subset of N0\mathbb{N}_0, so it has a least element; sending xx to it defines ι:M→Ln\iota : M \to L_n with σ∘ι=idM\sigma \circ \iota = \mathrm{id}_M, and ι\iota is injective.

Suppose ι:M→Ln\iota : M \to L_n is injective and let γ:N0→M\gamma : \mathbb{N}_0 \to M be injective. Then ι∘γ:N0→Ln\iota \circ \gamma : \mathbb{N}_0 \to L_n is injective, and its restriction to Ls(n)L_{s(n)} is an injection Ls(n)→LnL_{s(n)} \to L_n, which no cut admits. So no such γ\gamma exists.

Suppose finally that MM is not finite. The previous theorem gives a subset E⊂ME \subset M equinumerous with N0\mathbb{N}_0, hence a bijection N0→E\mathbb{N}_0 \to E, which composed with the inclusion of EE in MM is an injection N0→M\mathbb{N}_0 \to M. That is the fourth condition denied, which completes the cycle.

For the last claim, a surjection Ln→ML_n \to M gives #M=#σ(Ln)⩽#Ln=n\#M = \#\sigma(L_n) \leqslant \#L_n = n, and an injection M→LnM \to L_n gives #M⩽n\#M \leqslant n; both bounds are attained by a counting of MM, which is a surjection L#M→ML_{\#M} \to M, and by its inverse.

Theorem 7.49 (Dedekind's characterisation of finiteness).

A set is finite if and only if it is not equinumerous with any proper subset of itself.

Discussion.

One direction is much easier than the other. One of them is the corollary of the first chapter, which said that a finite set is strictly larger than each of its proper subsets, so no bijection is available.

The other is best proved contrapositively: given an infinite AA, we produce a proper subset equinumerous with it. The theorem above puts a copy of N0\mathbb{N}_0 inside AA, and inside it we can shift along successors, as in N0\mathbb{N}_0. So we shift inside the copy and do nothing outside it: the points of AA off the copy are left where they are, and the nnth point of the copy is sent to the s(n)s(n)th. The result misses the initial point of the copy and nothing else, which is the proper subset we wanted.

Proof.

If AA is finite and B⊊AB \subsetneq A then A≉BA \not\approx B, by the corollary on proper subsets.

Suppose AA is infinite. The theorem on countably infinite subsets gives an injection f:N0→Af : \mathbb{N}_0 \to A; write E=defim⁡fE \defeq \operatorname{im} f and define

h:A→A∖{f(0)},h(x)=def{f(s(n))if x=f(n),xif x∉E.h : A \to A \setminus \{f(0)\}, \qquad h(x) \defeq \begin{cases} f(s(n)) & \text{if } x = f(n), \\ x & \text{if } x \notin E. \end{cases}

Each x∈Ex \in E is f(n)f(n) for exactly one nn, since ff is injective, so hh is a function; and its values avoid f(0)f(0), since f(s(n))≠f(0)f(s(n)) \neq f(0) by injectivity and x∉Ex \notin E gives x≠f(0)x \neq f(0).

For injectivity, two points of EE are separated because ff and ss are injective, two points outside EE are unchanged, and a point of EE cannot collide with one outside EE because its value lies in EE. For surjectivity, a point x∈A∖{f(0)}x \in A \setminus \{f(0)\} outside EE is h(x)h(x); and a point f(m)f(m) with m≠0m \neq 0 is f(s(k))f(s(k)) for the predecessor kk of mm, hence h(f(k))h(f(k)).

So A≈A∖{f(0)}A \approx A \setminus \{f(0)\}, a proper subset of AA.

Corollary 7.50 (Finiteness by self-maps).

A set MM is finite if and only if every injection M→MM \to M is surjective, and if and only if every surjection M→MM \to M is injective.

Proof.

If MM is finite, the theorem on finite self-maps gives both conditions. If MM is infinite, the map hh built in the last proof is an injection M→MM \to M whose range omits f(0)f(0), so it is injective and not surjective; and its inverse on that range, extended by sending f(0)f(0) to itself, is a surjection M→MM \to M that is not injective.

Remark.

Only the second direction of the theorem used the axiom of choice, and used it twice, once to select elements and once through the recursion that strung the selections together. Dedekind took the property in the theorem as his definition of infinite, and without choice his definition and ours are not known to agree: there is no contradiction in a set that is infinite in our sense and yet admits no bijection with a proper subset. We accept choice, so for us the two notions are one.

Problem 7.23.

Show that a set AA is infinite if and only if for every n∈N0n \in \mathbb{N}_0 there is an injection Ln→AL_n \to A.

Problem 7.24.

Let AA be infinite and BB countable. Show that A∪B≈AA \cup B \approx A.

Uncountable Sets

Every infinite set met so far has turned out to be countable, and the closure properties above keep it that way: subsets, products and countable unions of countable sets are all countable. Cantor’s theorem already gives sets that are not, and the same diagonal argument gives an explicit one.

Theorem 7.51 (Cantor's diagonal argument).

Let AA be a set with at least two elements. Then the Cartesian power AN0A^{\mathbb{N}_0}, the set of infinite sequences in AA, is uncountable.

Discussion.

Uncountable means neither finite nor countably infinite, and the characterisation of countable sets turns that into one statement: no surjection N0→AN0\mathbb{N}_0 \to A^{\mathbb{N}_0} exists. So we assume a surjection, write a(j)a^{(j)} for the sequence it puts at jj, and build a sequence it has missed.

The sequences are laid out as an infinite array whose jjth row is a(j)a^{(j)}, and a sequence differs from the jjth row as soon as it differs from it in one place. The place we can always name is the jjth, on the diagonal of the array, so we build α\alpha by walking down the diagonal and disagreeing at every step. Disagreement is possible because AA has a second element, and we fix two elements of AA once and for all rather than choosing at each step, so the axiom of choice is not needed. Then α\alpha differs from every row, so it is not a value of the surjection.

Proof.

Fix p,q∈Ap, q \in A with p≠qp \neq q, and suppose β:N0→AN0\beta : \mathbb{N}_0 \to A^{\mathbb{N}_0} is a surjection. Write a(j)=defβ(j)a^{(j)} \defeq \beta(j) and ai(j)=defa(j)(i)a^{(j)}_i \defeq a^{(j)}(i), so the values are laid out as

012⋯a(0)a0(0)a1(0)a2(0)⋯a(1)a0(1)a1(1)a2(1)⋯a(2)a0(2)a1(2)a2(2)⋯⋮⋮⋮⋮⋱\begin{array}{c|cccc} & 0 & 1 & 2 & \cdots \\ \hline a^{(0)} & \boxed{a^{(0)}_0} & a^{(0)}_1 & a^{(0)}_2 & \cdots \\ a^{(1)} & a^{(1)}_0 & \boxed{a^{(1)}_1} & a^{(1)}_2 & \cdots \\ a^{(2)} & a^{(2)}_0 & a^{(2)}_1 & \boxed{a^{(2)}_2} & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \end{array}

Define α:N0→A\alpha : \mathbb{N}_0 \to A by α(j)=defp\alpha(j) \defeq p if aj(j)≠pa^{(j)}_j \neq p, and α(j)=defq\alpha(j) \defeq q otherwise. Then α(j)≠aj(j)\alpha(j) \neq a^{(j)}_j for every jj, since in the second case aj(j)=p≠qa^{(j)}_j = p \neq q.

Now α∈AN0\alpha \in A^{\mathbb{N}_0}, so surjectivity gives α=a(j)\alpha = a^{(j)} for some jj, and reading both sides at jj gives α(j)=aj(j)\alpha(j) = a^{(j)}_j, which is false. So no surjection exists, and AN0A^{\mathbb{N}_0} is neither finite nor countably infinite by the characterisation of countable sets.

The same diagonal argument works for an arbitrary index set.

Theorem 7.52 (A set is smaller than its sequences).

Let MM be non-empty and let AA have at least two elements. Then #M<#(AM)\#M < \#(A^M).

Discussion.

The claim splits into an injection M→AMM \to A^M and the absence of a bijection. For the injection we must attach to each point of MM a function on MM, and we use the point itself: send mm to the function that takes one fixed value at mm and the other everywhere else. Two distinct points give functions that disagree at either of them, so the assignment is injective.

For the second half the diagonal argument runs verbatim, with MM in place of N0\mathbb{N}_0: given f:M→AMf : M \to A^M, the function that disagrees with f(m)f(m) at mm, for every mm, cannot be a value of ff. Nothing in that used the order or the countability of the index set, so only the two fixed elements of AA are needed.

Proof.

Fix p,q∈Ap, q \in A with p≠qp \neq q. For m∈Mm \in M let χm:M→A\chi_m : M \to A take the value pp at mm and qq elsewhere. If m1≠m2m_1 \neq m_2 then χm1(m1)=p\chi_{m_1}(m_1) = p while χm2(m1)=q\chi_{m_2}(m_1) = q, so χm1≠χm2\chi_{m_1} \neq \chi_{m_2}; hence m↦χmm \mapsto \chi_m is an injection M→AMM \to A^M and #M⩽#(AM)\#M \leqslant \#(A^M).

Let f:M→AMf : M \to A^M be any function and define φ:M→A\varphi : M \to A by φ(m)=defp\varphi(m) \defeq p if f(m)(m)≠pf(m)(m) \neq p, and φ(m)=defq\varphi(m) \defeq q otherwise, so that φ(m)≠f(m)(m)\varphi(m) \neq f(m)(m) for every mm. If φ=f(m)\varphi = f(m) for some mm, reading both sides at mm gives φ(m)=f(m)(m)\varphi(m) = f(m)(m), which is false. So φ\varphi is not a value of ff, no ff is surjective, and no bijection exists.

Corollary 7.53 (Power sets as sequences).

For every set MM we have P(M)≈L2 M\mathcal{P}(M) \approx L_2^{\,M}.

Proof.

Send S⊂MS \subset M to its characteristic function χS:M→L2\chi_S : M \to L_2, taking the value 11 on SS and 00 off it. Distinct subsets differ at some point, where their characteristic functions differ, so the map is injective; and any φ:M→L2\varphi : M \to L_2 is the characteristic function of {x∈M∣φ(x)=1}\{x \in M \mid \varphi(x) = 1\}, so it is surjective.

So Cantor’s theorem is the previous theorem read at A=L2A = L_2, and the diagonal argument that rules out surjections onto L2 ML_2^{\,M} is the one that rules out surjections onto P(M)\mathcal{P}(M).

Corollary 7.54 (An uncountable set).

P(N0)\mathcal{P}(\mathbb{N}_0) is uncountable, and so is L2 N0L_2^{\,\mathbb{N}_0}.

Proof.

L2L_2 has two elements, so L2 N0L_2^{\,\mathbb{N}_0} is uncountable by the diagonal argument, and P(N0)\mathcal{P}(\mathbb{N}_0) is equinumerous with it by the corollary above; a set equinumerous with an uncountable set is uncountable, since countability is defined by the existence of a bijection.

Remark (Informal).

Assuming you know the real numbers, the same argument shows there are uncountably many. List candidate decimal expansions of the numbers between 00 and 11 and build a new expansion differing from the jjth in its jjth digit, avoiding the digit 99 so as not to fall foul of the two expansions some numbers have; the number it names is missing from the list. Since the fractions are countable, the numbers that are not fractions must be uncountable, for otherwise the reals would be a union of two countable sets.

The same counting argument shows something less expected. The polynomials with fractional coefficients are countable, being determined by finite lists of fractions, and each has finitely many roots, so the numbers that are roots of such a polynomial form a countable set. Uncountably many real numbers are therefore roots of no such polynomial at all, although exhibiting even one takes real work.

Problem 7.25.

Let AA be uncountable and let B⊂AB \subset A be countable. Show that A∖BA \setminus B is uncountable.

Problem 7.26.

Deduce from Cantor’s theorem that there is no surjection M→P(M)M \to \mathcal{P}(M), for any set MM.

Cardinal Numbers

We have been writing #A⩽#B\#A \leqslant \#B for arbitrary sets without saying what #A\#A names when AA is infinite, and so far we have not needed to: the three relations were defined as statements about functions, and the symbol never occurred alone. It can be given a meaning, using the equivalence classes from the remark of the first section.

Definition 7.55 (Cardinal number).

Fix a set XX. The cardinal number of a subset A⊂XA \subset X is its equivalence class #A∈P(X)/≈\#A \in \mathcal{P}(X)/{\approx} under equinumerosity. Two subsets of XX have the same cardinal number exactly when they are equinumerous.

Remark.

The restriction to a fixed XX is needed, since the sets equinumerous with a given one do not form a set. For finite AA nothing is lost by reading #A\#A as the natural number counting it, because the cardinal numbers of finite subsets of XX correspond to the cuts, one class for each nn with Ln⊂XL_n \subset X. A definition free of the ambient XX needs the ordinal numbers, which we have not built.

The order has the properties the notation suggests. Reflexivity and transitivity were proved directly, Schröder–Bernstein gives antisymmetry, since two subsets each injecting into the other are equinumerous and so name one class, and comparability makes any two classes comparable. So on P(X)/≈\mathcal{P}(X)/{\approx} the relation ⩽\leqslant is a total order, with the strict comparison as its strict part.

Definition 7.56 (Arithmetic of cardinal numbers).

For sets AA and BB define

#A+#B=def#((A×{0})∪(B×{1})),#A⋅#B=def#(A×B),\#A + \#B \defeq \#\bigl((A \times \{0\}) \cup (B \times \{1\})\bigr), \qquad \#A \cdot \#B \defeq \#(A \times B),(#A)#B=def#(AB).(\#A)^{\#B} \defeq \#(A^B).

The tagged copies in the sum are there because AA and BB may share elements, and tagging makes disjoint copies of both without disturbing their sizes. That the three operations depend only on the classes and not on the sets chosen to represent them is the transport problem set above. On finite sets they agree with the arithmetic of the first chapter, by the theorems on disjoint unions and products and by the problem on ABA^B.

Since P(M)≈L2 M\mathcal{P}(M) \approx L_2^{\,M} and #L2=2\#L_2 = 2, the power set records an exponential:

2#M=#P(M),2^{\#M} = \#\mathcal{P}(M),

and Cantor’s theorem reads #M<2#M\#M < 2^{\#M}. Writing ℵ0=def#N0\aleph_0 \defeq \#\mathbb{N}_0 for the smallest infinite cardinal number, the chain

ℵ0<2ℵ0<22ℵ0<⋯\aleph_0 < 2^{\aleph_0} < 2^{2^{\aleph_0}} < \cdots

climbs for ever, so there is no largest size.

Remark (The continuum hypothesis).

Nothing proved here says whether anything sits between two consecutive terms of that chain. The continuum hypothesis asserts that nothing sits between the first two: there is no set MM with ℵ0<#M<2ℵ0\aleph_0 < \#M < 2^{\aleph_0}. Gödel showed in 1938 that it cannot be refuted from the axioms we have listed, choice included, and Cohen showed in 1963 that it cannot be proved from them either, so long as those axioms are consistent at all. It is independent, in the sense the axiom of choice was said to be independent, and one may add it or its negation without introducing a contradiction that was not already there.

Remark.

Cantor’s theorem also settles again a question from the naive chapter. Were there a set M\mathfrak{M} holding every set, then P(M)\mathcal{P}(\mathfrak{M}) would be one of its subsets, so

#P(M)⩽#M<#P(M),\#\mathcal{P}(\mathfrak{M}) \leqslant \#\mathfrak{M} < \#\mathcal{P}(\mathfrak{M}),

which trichotomy forbids. That is Cantor’s own argument, and it reaches the conclusion of the proposition on no set of all sets by counting rather than by self-membership.

Problem 7.27.

Show that cardinal addition and multiplication are commutative and associative, and that #A⋅(#B+#C)=#A⋅#B+#A⋅#C\#A \cdot (\#B + \#C) = \#A \cdot \#B + \#A \cdot \#C. Each identity is a bijection between the sets involved.

Problem 7.28.

Show that ℵ0+ℵ0=ℵ0\aleph_0 + \aleph_0 = \aleph_0 and ℵ0⋅ℵ0=ℵ0\aleph_0 \cdot \aleph_0 = \aleph_0, and explain which theorems of this chapter each one is.

Problem 7.29.

Show that A≈BA \approx B and C≈DC \approx D imply AC≈BDA^C \approx B^D.

Problem 7.30.

Show that (A×B)C≈AC×BC(A \times B)^C \approx A^C \times B^C for all sets AA, BB and CC.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 7.1.

Let A=def{1,2,3,4}A \defeq \{1, 2, 3, 4\} and B=def{3,4,5}B \defeq \{3, 4, 5\}.

#(A∪B)\#(A \cup B) is:

answer one of these

#(A∖B)\#(A \setminus B) is:

answer one of these

#(A×B)\#(A \times B) is:

answer one of these

#P(B)\#\mathcal{P}(B) is:

answer one of these

The sum #A+#B\#A + \#B equals:

answer one of these

Exercise 7.2.

Each part asks for a bijection between two subsets of N0\mathbb{N}_0.

A bijection from N0\mathbb{N}_0 onto {m∈N0∣m=5⋅k+2 for some k∈N0}\{m \in \mathbb{N}_0 \mid m = 5 \cdot k + 2 \text{ for some } k \in \mathbb{N}_0\} is:

answer one of these

Its inverse is:

answer one of these

A bijection from N0\mathbb{N}_0 onto the even elements of N0\mathbb{N}_0 is:

answer one of these

A bijection from N0\mathbb{N}_0 onto N0∖{0,1}\mathbb{N}_0 \setminus \{0, 1\} is:

answer one of these

Exercise 7.3.

There are seven days in a week.

Among any fifteen people, the largest number that must share a day of the week is:

answer one of these

Among any twenty-two people, that number is:

answer one of these

The least nn for which any nn people must include three born on the same day of the week is:

answer one of these

For a function from a set of m⋅n+1m \cdot n + 1 elements to a set of mm elements, some value is taken at least this many times:

answer one of these

Of the functions L4→L3L_4 \to L_3, the injective ones are:

answer one of these

Exercise 7.4.

A study of 115115 breakfast eaters finds that 8585 also eat lunch, 5858 floss regularly and 2727 take a morning paper. Among the lunch eaters, 5252 floss and 1515 take the paper, and 1010 do both. Four flossers neither eat lunch nor take the paper.

The number who floss and take the paper is:

answer one of these

The number who take the paper but neither floss nor eat lunch is:

answer one of these

The number who do none of the three is:

answer one of these

Exercise 7.5.

Classify each set as finite, countably infinite or uncountable.

P(L3)\mathcal{P}(L_3).

answer one of these

The multiples of 33 in N0\mathbb{N}_0.

answer one of these

N0×N0×N0\mathbb{N}_0 \times \mathbb{N}_0 \times \mathbb{N}_0.

answer one of these

L2 N0L_2^{\,\mathbb{N}_0}.

answer one of these

The finite subsets of N0\mathbb{N}_0.

answer one of these

The subsets of N0\mathbb{N}_0 that are infinite.

answer one of these

Exercise 7.6.

On the comparison of sizes.

Someone reads Schröder–Bernstein as saying that injections f:A→Bf : A \to B and g:B→Ag : B \to A are each bijections. Is that right?

answer one of these

Comparability of any two sets was proved from:

answer one of these

Schröder–Bernstein was proved from:

answer one of these

Suppose there is an injection A→BA \to B and no injection B→AB \to A. Then:

answer one of these

Exercise 7.7.

The pairing j(m,n)=T(m+n)+mj(m, n) = T(m + n) + m of the theorem on pairs of natural numbers, where T(k)=∑i=1kiT(k) = \sum_{i=1}^{k} i.

j(1,3)j(1, 3) is:

answer one of these

j(0,4)j(0, 4) is:

answer one of these

The pair sent to 1212 is:

answer one of these

The number of pairs (m,n)(m, n) with m+n=km + n = k is:

answer one of these

Exercise 7.8.

Finiteness by self-maps and by proper subsets.

A set MM is finite exactly when every injection M→MM \to M is:

answer one of these

The sets equinumerous with a proper subset of themselves are:

answer one of these

The successor s:N0→N0s : \mathbb{N}_0 \to \mathbb{N}_0 is injective and not surjective. That shows:

answer one of these

The theorem that every infinite set has a countably infinite subset rests on:

answer one of these

Exercise 7.9.

Cardinal numbers.

The cardinal 2ℵ02^{\aleph_0} names:

answer one of these

Is there a largest cardinal number?

answer one of these

The continuum hypothesis is:

answer one of these

Why is the cardinal number of AA defined only for subsets of a fixed set XX?

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave the checker the order on the carrier and the sets separation carves out. This chapter counts, and counting needs two things the checker has not had: a map read between two sets rather than across the whole universe, and the natural numbers as objects of that universe, so that the cuts have something to hold.

Maps between two sets

A map has so far been an arrow f : Obj → Obj on everything at once, and Injective f and Surjective f asked their conditions everywhere. A map of this chapter has a domain and a codomain, so the same conditions are written on the sets they are asserted of, and each is the statement the definitions of a surjection and an injection make it:

MapsTo f A B   is   ∀ x, x ∈ A → f x ∈ B
InjOn f A      is   ∀ x y, x ∈ A → y ∈ A → f x = f y → x = y
SurjOn f A B   is   ∀ y, y ∈ B → ∃ x, x ∈ A ∧ f x = y
BijOn f A B    is   MapsTo f A B ∧ InjOn f A ∧ SurjOn f A B

Being those statements and not merely equivalent to them, they are opened with intro and used by applying them, in the way A ⊆ B has been since the sets sheet. A BijOn splits three ways at once, so obtain ⟨hm, hi, hs⟩ takes one apart and refine ⟨?_, ?_, ?_⟩ puts one together.

Example.

A map injective everywhere is injective on any set. The converse fails, which is why the two conditions are kept apart.

lean worked
1example (f : Obj → Obj) (A : Obj) (h : Injective f) : InjOn f A := by
verified
goalGoals accomplished.

Example.

The values of ff on AA lie in BB, which is where gg is known to do its work.

lean worked
1example (f g : Obj → Obj) (A B C : Obj) (hf : MapsTo f A B) (hg : MapsTo g B C) :2    MapsTo (g ∘ f) A C := by
verified
goalGoals accomplished.

Exercise 7.10.

A restriction of an injection is an injection.

lean proof
1example (f : Obj → Obj) (A B : Obj) (h : InjOn f A) (hb : B ⊆ A) : InjOn f B := by
goalf : Obj → Obj A B : Obj h : InjOn f A hb : B ⊆ A ⊢ InjOn f B

Exercise 7.11.

The codomain may be enlarged freely.

lean proof
1example (f : Obj → Obj) (A B C : Obj) (h : MapsTo f A B) (hbc : B ⊆ C) : MapsTo f A C := by
goalf : Obj → Obj A B C : Obj h : MapsTo f A B hbc : B ⊆ C ⊢ MapsTo f A C

Exercise 7.12.

The first part of the theorem that bijections compose, read on two sets.

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : MapsTo f A B) (hfi : InjOn f A)2    (hgi : InjOn g B) : InjOn (g ∘ f) A := by
goalf g : Obj → Obj A B : Obj hf : MapsTo f A B hfi : InjOn f A hgi : InjOn g B ⊢ InjOn (g ∘ f) A

Exercise 7.13.

Its second part.

lean proof
1example (f g : Obj → Obj) (A B C : Obj) (hfs : SurjOn f A B) (hgs : SurjOn g B C) :2    SurjOn (g ∘ f) A C := by
goalf g : Obj → Obj A B C : Obj hfs : SurjOn f A B hgs : SurjOn g B C ⊢ SurjOn (g ∘ f) A C

Exercise 7.14.

Only the first map need be injective for the composite to be.

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : MapsTo f A B) (h : InjOn (g ∘ f) A) :2    InjOn f A := by
goalf g : Obj → Obj A B : Obj hf : MapsTo f A B h : InjOn (g ∘ f) A ⊢ InjOn f A

Exercise 7.15.

The inverse of a bijection is a bijection. The checker cannot choose preimages, so the inverse arrives as a hypothesis rather than being built; what is left is the second part of Proposition 7.2 .

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : BijOn f A B) (hg : MapsTo g B A)2    (h : ∀ y : Obj, y ∈ B → f (g y) = y) : BijOn g B A := by
goalf g : Obj → Obj A B : Obj hf : BijOn f A B hg : MapsTo g B A h : ∀ (y : Obj), y ∈ B → f (g y) = y ⊢ BijOn g B A

Comparing sizes

Two sets are compared by the functions running between them, which is what Definition 7.1 and Definition 7.31 say, so the two comparisons are typed as the existence statements they are:

A ≈ B   is   ∃ f : Obj → Obj, BijOn f A B
A ≼ B   is   ∃ f : Obj → Obj, MapsTo f A B ∧ InjOn f A

typed \approx and \preceq. The second is #A⩽#B\#A \leqslant \#B; the strict comparison is not notation of its own, being the second together with the denial of the first. A witness is supplied by use or as the first component of refine ⟨_, ?_, ?_⟩, and it is written as a function, fun x => x for the identity.

Example.

The first part of Proposition 7.2 . Each of the three conditions is read at a point, and the identity satisfies all three without any work.

lean worked
1example (A : Obj) : A ≈ A := by
verified
goalGoals accomplished.

Exercise 7.16.

The empty function.

lean proof
1example (A : Obj) : ∅ ≼ A := by
goalA : Obj ⊢ ∅ ≼ A

Exercise 7.17.

A subset is no larger than the set it sits in.

lean proof
1example (A B : Obj) (h : A ⊆ B) : A ≼ B := by
goalA B : Obj h : A ⊆ B ⊢ A ≼ B

Exercise 7.18.

A bijection is in particular an injection.

lean proof
1example (A B : Obj) (h : A ≈ B) : A ≼ B := by
goalA B : Obj h : A ≈ B ⊢ A ≼ B

Exercise 7.19.

The second part of Proposition 7.32 .

lean proof
1example (A B C : Obj) (hab : A ≼ B) (hbc : B ≼ C) : A ≼ C := by
goalA B C : Obj hab : A ≼ B hbc : B ≼ C ⊢ A ≼ C

Exercise 7.20.

The third part of Proposition 7.2 .

lean proof
1example (A B C : Obj) (hab : A ≈ B) (hbc : B ≈ C) : A ≈ C := by
goalA B C : Obj hab : A ≈ B hbc : B ≈ C ⊢ A ≈ C

Exercise 7.21.

Problem 7.13 : a comparison transported along two bijections.

lean proof
1example (A A' B B' : Obj) (h1 : A' ≈ A) (h2 : A ≼ B) (h3 : B ≈ B') : A' ≼ B' := by
goalA A' B B' : Obj h1 : A' ≈ A h2 : A ≼ B h3 : B ≈ B' ⊢ A' ≼ B'

Exercise 7.22.

Proposition 7.8 .

lean proof
1example (f : Obj → Obj) (A B a : Obj) (hf : BijOn f A B) (ha : a ∈ A) :2    A \ {a} ≈ B \ {f a} := by
goalf : Obj → Obj A B a : Obj hf : BijOn f A B ha : a ∈ A ⊢ A \ {a} ≈ B \ {f a}

Exercise 7.23.

Problem 7.16 . The map sends a subset of AA to its image. (Harder.)

lean proof
1example (A B : Obj) (h : A ≼ B) : 𝒫 A ≼ 𝒫 B := by
goalA B : Obj h : A ≼ B ⊢ 𝒫 A ≼ 𝒫 B

Cantor’s theorem

Exercise 7.24.

The first half of Cantor’s theorem.

lean proof
1example (S : Obj) : S ≼ 𝒫 S := by
goalS : Obj ⊢ S ≼ 𝒫 S

Exercise 7.25.

And the second, which is Problem 7.26 . The diagonal set is {x ∈ S | x ∉ f x}, and it is a subset of SS before it is anything else.

lean proof
1example (f : Obj → Obj) (S : Obj) : ¬SurjOn f S (𝒫 S) := by
goalf : Obj → Obj S : Obj ⊢ ¬SurjOn f S (𝒫 S)

The natural numbers as objects

The carrier ℕ of the Peano sheet is a type of its own, and the cuts are sets, so the two have to be brought together before a cut can be written down. ↑n, typed \up, is the object the number n names; ω is the set of all of them, which is N0\mathbb{N}_0; and L n is the cut. Their criteria are the definitions:

x ∈ ω     is   ∃ k : ℕ, x = ↑k
x ∈ L n   is   ∃ k : ℕ, k < n ∧ x = ↑k

so a membership is built with use or ⟨_, _, _⟩ and taken apart with obtain ⟨k, hk, he⟩. That distinct numbers name distinct objects is Num.inj, and Finite A is ∃ n : ℕ, A ≈ L n, which is Definition 7.5 verbatim.

Example.

The witness is the number itself, and the equation it has to satisfy is an identity.

lean worked
1example (m n : ℕ) (h : m < n) : ↑m ∈ L n := by
verified
goalGoals accomplished.

Example.

A strict inequality is a positive difference, and no positive difference reaches 00. It is listed below as Nat.not_lt_zero, so the exercises may lean on it.

lean worked
1example (n : ℕ) : ¬(n < 0) := by
verified
goalGoals accomplished.

Exercise 7.26.

The first part of Proposition 7.4 .

lean proof
1example : L 0 = ∅ := by
goal⊢ L 0 = ∅

Exercise 7.27.

Its last part.

lean proof
1example (n : ℕ) : ↑n ∉ L n := by
goaln : ℕ ⊢ ¬↑n ∈ L n

Exercise 7.28.

Every cut sits inside N0\mathbb{N}_0.

lean proof
1example (n : ℕ) : L n ⊆ ω := by
goaln : ℕ ⊢ L n ⊆ ω

Exercise 7.29.

And the cuts grow with their index.

lean proof
1example (m n : ℕ) (h : m < n) : L m ⊆ L n := by
goalm n : ℕ h : m < n ⊢ L m ⊆ L n

Exercise 7.30.

The middle part of Proposition 7.4 , which every induction of this chapter turns on.

lean proof
1example (n : ℕ) : L (succ n) = L n ∪ {↑n} := by
goaln : ℕ ⊢ L (succ n) = L n ∪ {↑n}

Exercise 7.31.

A cut counts itself.

lean proof
1example (n : ℕ) : Finite (L n) := by
goaln : ℕ ⊢ Finite (L n)

Exercise 7.32.

And the empty set is counted by the cut that holds nothing.

lean proof
1example : Finite ∅ := by
goal⊢ Finite ∅

Exercise 7.33.

A set with one point in it. (Harder.)

lean proof
1example (a : Obj) : Finite {a} := by
goala : Obj ⊢ Finite {a}

Exercise 7.34.

A finite set injects into N0\mathbb{N}_0, which is the easy half of the characterisation of countability.

lean proof
1example (A : Obj) (h : Finite A) : A ≼ ω := by
goalA : Obj h : Finite A ⊢ A ≼ ω
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered
Nat.lt_irrefl ∀ (n : ℕ), ¬(n < n) — anti-reflexivity, from the last sheet
Nat.lt_trans ∀ {m n p : ℕ}, m < n → n < p → m < p — transitivity of the strict order, from the last sheet
Nat.lt_succ_self ∀ (n : ℕ), n < succ n — every number is below its successor, from the last sheet
Nat.not_lt_zero ∀ {n : ℕ}, ¬(n < 0) — nothing lies below zero
Nat.lt_succ_iff ∀ {m n : ℕ}, m < succ n ↔ m < n ∨ m = n — nothing lies strictly between n and succ n
Num.inj ∀ {m n : ℕ}, ↑m = ↑n → m = n — distinct numbers name distinct objects of ω

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b