3.2  Countable Sets

Section 3.1 made “the same size” exact and settled the finite sets. It also showed that N is infinite, because it is equinumerous with its proper subset 2N (Example (Hilbert’s Hotel)). The next question is which sets can be put into a list indexed by N. Analysis on the Real Line, Chapter 1 already uses the word for these sets, countable, in its proof that the real numbers cannot be listed. This section defines it, proves three equivalent forms of it, shows that countable sets are closed under subsets, images, unions of two sets and finite products, and lists the integers and the rationals.

3.2.1. Lists

Can we list the rational numbers as q0,q1,q2,… so that every rational number appears somewhere? Density makes it look impossible. Between any two rationals p<q lies a third, (p+q)/2, so no rational has a next one, and a list in increasing order cannot even get from q0 to q1. And yet a list need not be in increasing order. It only has to reach every element at some finite position. The rationals can be listed in that sense, and so can many sets that look larger than N.

A list indexed by N is a function on N, its n-th entry being the value at n. Reaching every element is surjectivity.

Countable means listable, repetitions allowed.

Definition 3.2.1 (Countable Set)

A set A is countable if A=∅ or there exists a surjection f:N→A. In the second case A=f(N)={f(0),f(1),f(2),…}, that is, the elements of A can be listed as x0,x1,x2,…, with xn:=f(n), repetitions allowed. A set that is not countable is uncountable. In symbols, A is countable if and only if A=∅ ∨ ∃f∈AN  ∀a∈A  ∃n∈N  f(n)=a.

In words: a non-empty set is countable when some list x0,x1,x2,… reaches every one of its elements, each at a finite position n∈N. The list may repeat an element as often as it likes, and it need not follow any order. The first clause is there because there is no function at all from N to ∅ (Proposition 1.4.2 (b)), so the second clause can never hold for the empty set; without the first clause, ∅ would be uncountable. For a non-empty set the definition says that it is the image of some function from N, which is how Analysis on the Real Line, Chapter 1 states it.

Examples, starting from the smallest:

  • ∅ is countable, by the first clause.
  • A non-empty finite set is countable. For three different objects a,b,c, the list a,b,c,c,c,…, that is f(0):=a, f(1):=b and f(n):=c for n≥2, is a surjection N→{a,b,c}. Repetitions pad a short list out to the length of N.
  • N is countable: idN is a surjection.
  • The set of squares {n2:n∈N} is countable: it is the image of N under n↦n2, and a function is a surjection onto its image (Section 3.1, “Shrinking the codomain”). In the same way 2N is countable.

A non-example by a minimal change. The list n↦2n is a list of 2N. Read it as a list of N, keeping the rule and changing only the target set, and it fails: the clause “for every a∈N there is an n with 2n=a” fails at a=1. This shows that this list misses 1, not that N is uncountable; one map proves nothing about all maps (the warning after the non-example in Section 3.1). Sets that are genuinely uncountable appear in Section 3.4.

Why repetitions are allowed. Two reasons. First, finite sets are then countable with no special case: pad the list by repeating an element, as above. Second, the closure proofs below become short. A function applied to a list gives a list of the image, which may have repetitions even if the first list had none; interleaving lists of two overlapping sets repeats their common elements. If repetitions were forbidden, every such proof would need a step that deletes them. The definition puts that work in one place, the theorem on three ways to say countable below, and does it once.

Sometimes we need the stronger statement that a set has exactly the size of N.

Definition 3.2.2 (Countably Infinite Set)

A set A is countably infinite if |A|=|N|, that is, if there is a bijection A→N (equivalently, by Proposition 3.1.1 (b), a bijection N→A).

So N, 2N and Z>0 are countably infinite (Section 3.1), and a countably infinite set is countable, since a bijection is a surjection.

Warning. In this book “countable” includes the finite sets and ∅. Some books use “countable” to mean “countably infinite” and say “at most countable” for our “countable”. Before quoting a theorem about countable sets from elsewhere, check which convention it uses. Here, {0,1} is countable and is not countably infinite.

3.2.2. Subsets of the natural numbers

Every countable set will turn out to be finite or countably infinite, with nothing in between. The heart of that is a fact about subsets of N: an infinite one can be listed in increasing order without gaps.

Lemma 3.2.1 (Subsets of the Natural Numbers)

Every subset S⊆N is finite or countably infinite.

Idea. If S is infinite, list it in increasing order: s0 is the least element of S, and sn+1 is the least element of S above sn. Well-ordering supplies each least element, provided the set is non-empty, and it is non-empty because S has elements beyond any bound, being infinite. Recursion turns the rule into a function. The list misses nothing: if t∈S were skipped, it would lie strictly between two consecutive entries sn−1<t<sn, and then sn would not be the least element of S above sn−1.

Proof. If S is finite there is nothing to prove, so let S be infinite. In particular S≠∅.

Every x∈N has an element of S above it. Let x∈N, and suppose that no s∈S has s>x. Then S⊆{0,…,x}, a set with x+1 elements (the third example after Definition 3.1.2), so S is finite by Proposition 3.1.6, a contradiction. Hence Tx:={s∈S:s>x} is non-empty, and by Theorem 2.1.3 it has a least element.

The list. Define g:N×N→N by g(n,x):=minTx; by the previous paragraph this is defined for every x∈N. By Theorem 2.3.1, with X:=N and a:=minS (which exists by Theorem 2.1.3), there is a function n↦sn from N to N with s0=minS,sn+1=min{s∈S:s>sn}(n∈N). Every sn lies in S: s0∈S, and sn+1∈Tsn⊆S.

Increasing. By construction sn+1>sn for every n. Hence sm<sn whenever m<n, by induction on n: there is no m<0 (Lemma 2.1.1 (a)), and if m<n+1, then m≤n (Lemma 2.1.1 (e)), so sm≤sn<sn+1, using the hypothesis when m<n. In particular n↦sn is injective, since m≠n gives m<n or n<m. Also sn≥n for every n: s0≥0 (Lemma 2.1.1 (a)), and if sn≥n, then sn+1>sn≥n, so sn+1≥n+1 (Lemma 2.1.1 (e)).

Onto S. Let t∈S. The set {n∈N:sn≥t} is non-empty, since st≥t, so it has a least element n by Theorem 2.1.3. If n=0, then s0=minS≤t and s0≥t, so s0=t. If n≠0, then n−1∈N (Lemma 2.1.1 (c)), and sn−1<t by the minimality of n. So t∈Tsn−1, and sn=minTsn−1≤t. With sn≥t this gives sn=t.

So n↦sn, with codomain S, is a bijection N→S, and S is countably infinite.

3.2.3. Three ways to say countable

Being countable (empty or listable by N), having an injection into N, and being finite or the size of N all describe the same sets. Having the three forms side by side is what makes countability easy to prove: we may use whichever is cheapest for the set in hand.

Theorem 3.2.2 (Characterizations of Countable Sets)

For every set A, the following are equivalent.

  • (i) A is countable.
  • (ii) There is an injection A→N.
  • (iii) A is finite or countably infinite.

Idea. From a list to an injection: send each element to the first position at which it appears. From an injection to (iii): the injection makes A equinumerous with a subset of N, and Lemma 3.2.1 sorts those. From (iii) back to a list: pad a finite list by repetition, as in the examples above.

Proof.

  • (i) ⇒ (ii). If A=∅, the empty function ∅→N is injective, vacuously. Otherwise let g:N→A be a surjection. For a∈A, the preimage g−1({a})⊆N is non-empty, since g is onto, so it has a least element by Theorem 2.1.3. Define h:A→N by h(a):=ming−1({a}). Then g(h(a))=a for every a∈A, that is, g∘h=idA, so h is injective by Theorem 1.5.1 (a).

  • (ii) ⇒ (iii). Let h:A→N be injective. With its codomain shrunk to h(A), it is a bijection A→h(A) (Section 3.1), so |A|=|h(A)|. By Lemma 3.2.1, h(A)⊆N is finite or countably infinite. If h(A) has n elements, there is a bijection {1,…,n}→h(A), and following it by the inverse of A→h(A) gives a bijection {1,…,n}→A (Proposition 3.1.1 (b) for the inverse, Theorem 1.4.4 (c)); so A has n elements. If |h(A)|=|N|, then |A|=|N| by Proposition 3.1.1 (c).

  • (iii) ⇒ (i). If A is countably infinite, a bijection N→A is a surjection. Let A be finite with n elements. If n=0, then A=∅, which is countable. If n≥1, let φ:{1,…,n}→A be a bijection and define f:N→A by f(k):={φ(k)if 1≤k≤n,φ(1)if k=0 or k>n. Every a∈A is φ(k)=f(k) for some k∈{1,…,n}, so f is a surjection. This proves the theorem.

The step (i) ⇒ (ii) picks one element h(a) of g−1({a}) for every a∈A at once, and it needs no new principle for that, because there is a rule that names the element: the least one. That works because the preimages are subsets of N, which is well-ordered. Section 3.3 meets a step that looks the same and has no such rule, and it is the point at which the book adds the axiom of choice.

In practice, (ii) is often the cheapest test. An injection into N only has to keep different elements apart, while a surjection has to reach every element, and (iii) asks for a bijection, which must do both.

3.2.4. Closure properties

Three closure properties follow at once, each from the form of countability that suits it.

Proposition 3.2.3 (Subsets of Countable Sets)

Every subset of a countable set is countable.

Proof. Let B be countable and A⊆B. By Theorem 3.2.2, (i) ⇒ (ii), there is an injection h:B→N. Its restriction h|A:A→N is injective, since it has the same values. By (ii) ⇒ (i), A is countable.

Proposition 3.2.4 (Images of Countable Sets)

Let A be countable and f:A→B a function. Then f(A) is countable. In particular, if f is surjective, then B is countable.

Proof. If A=∅, then f(A)=∅, which is countable. Otherwise let g:N→A be a surjection. The function f with codomain f(A) is surjective (Section 3.1), so its composite with g is a surjection N→f(A) by Theorem 1.4.4 (b). If f is surjective, then f(A)=B.

For unions we interleave two lists, taking the entries of the first list at the even positions and those of the second at the odd positions. That needs the fact that every natural number is even or odd, in exactly one way.

Proposition 3.2.5 (Union of Two Countable Sets)

If A and B are countable, then A∪B is countable.

Idea. Two lists a0,a1,… and b0,b1,… merge into one, a0,b0,a1,b1,…: the entry at position 2q comes from the first list and the entry at position 2q+1 from the second. For this to define a function, every position must be even or odd, and not both.

Proof. If A=∅, then A∪B=B, and if B=∅, then A∪B=A; both are countable. So let g:N→A and h:N→B be surjections.

Claim. Every a∈N can be written as a=2q+r with q∈N and r∈{0,1}, and the pair (q,r) is unique. In particular, no natural number is both of the form 2q and of the form 2q′+1 with q,q′∈N.

Proof. By Theorem 2.2.3 with divisor 2, there are unique integers q,r with a=2q+r and 0≤r<2. Then r∈N by Proposition 2.1.2 (b), and r≤1 by Lemma 2.1.1 (e), so r∈{0,1}. If q<0, then q+1≤0 by the discreteness clause Proposition 2.1.2 (c), so q≤−1 and a=2q+r≤−2+1<0, which contradicts a≥0 (Lemma 2.1.1 (a)). So q≥0, and q∈N by Proposition 2.1.2 (b). Uniqueness among pairs with q∈N follows from uniqueness among all integer pairs. The last sentence is the uniqueness of r.

Define k:N→A∪B by k(2q):=g(q),k(2q+1):=h(q)(q∈N). By the claim, each a∈N falls under exactly one of the two clauses, with exactly one q, so k is a function. It is onto: an element of A is g(q)=k(2q) for some q, and an element of B is h(q)=k(2q+1) for some q, where 2q and 2q+1 lie in N by Lemma 2.1.1 (b). So A∪B is countable.

If A and B overlap, the interleaved list repeats their common elements, and the definition does not mind. By induction on the number of sets, a union of finitely many countable sets is countable. A union of infinitely many is a different matter, and Section 3.3 is about it.

3.2.5. Pairs of natural numbers

The set N×N looks two-dimensional, and a first attempt to list it shows where the difficulty lies.

Example (Listing the rows one after another)

Arrange N×N in rows, the m-th row being (m,0),(m,1),(m,2),…. Consider the “list” (0,0),(0,1),(0,2),…, then (1,0),(1,1),…, then (2,0),… Is it a surjection N→N×N?

Solution. No. A list indexed by N gives each entry a position n∈N. Here position n holds (0,n), for every n∈N: that already defines a function f(n):=(0,n) on all of N. No position is left for (1,0): there is no n∈N with f(n)=(1,0), since the first coordinate of every value is 0. The word “then” asks for positions after all the natural numbers, and there are none. So the claim that this is a list of N×N is false. It is a list of the first row only.

Warning. A list must give every entry a finite position. “First all of row 0, then all of row 1” never reaches row 1, because row 0 uses up every position. The same mistake hides in any listing that runs through an infinite block before starting the next one.

The conclusion that N×N is countable is nevertheless true.

Theorem 3.2.6 (The Plane of Natural Numbers Is Countable)

The map p:N×N→N, p(m,n):=2m3n, is injective. Hence N×N is countable.

Try it first (ten minutes): list N×N, or inject it into N. Which is less work to write down and check?

Idea. The rows-first list fails, as we saw. A list that works runs along the diagonals m+n=0,1,2,…, each of which is finite; but writing a formula for the position of (m,n) and checking that every position is used takes real work. By Theorem 3.2.2 it is enough to inject N×N into N, and an injection only has to be a code from which m and n can be read back. In 2m3n, the power of 2 records m and the power of 3 records n. To read them back we do not cite unique factorization into primes, which we have not proved. Parity does the job: cancel the smaller power of 2; if any factor 2 is left on one side, that side is even and the other is odd.

Proof. First, p(m,n)∈N by Proposition 2.3.4 (d) and Lemma 2.1.1 (b). Next, every power 3k with k∈N is odd, that is, 3k=2j+1 for some j∈N: by Logic and Proof, Axiom 4.2.1, 30=1=2⋅0+1, and if 3k=2j+1, then 3k+1=3k⋅3=2(3j+1)+1 (Definition 2.3.2).

Let (m,n),(m′,n′)∈N×N with 2m3n=2m′3n′. Suppose m≠m′. The hypothesis is symmetric in the two pairs, so we may assume m>m′. Then m−m′∈N and m−m′≥1 (Lemma 2.1.1 (d), (e)), and 2m=2m′2m−m′ by Proposition 2.3.4 (a). Canceling 2m′, which is positive by Proposition 2.3.4 (e), gives 2m−m′3n=3n′. The left side is even: 2m−m′=2m−m′−1⋅2 by Definition 2.3.2, where m−m′−1∈N by Lemma 2.1.1 (c), so the left side is 2 times the natural number 2m−m′−13n. The right side is odd, as shown above. No natural number is both even and odd, by the uniqueness of the remainder in Theorem 2.2.3 with divisor 2 (the claim in the proof of Proposition 3.2.5). This contradiction shows m=m′.

Canceling 2m now gives 3n=3n′. By Proposition 2.3.4 (e) with u=3>1, n<n′ would give 3n<3n′, and n′<n would give 3n′<3n; so n=n′. Hence (m,n)=(m′,n′), and p is injective. By Theorem 3.2.2, (ii) ⇒ (i), N×N is countable.

Alternatively, one can list N×N along its diagonals: first the one pair with m+n=0, then the two pairs with m+n=1, then the three with m+n=2, and so on. Each diagonal is finite, so every pair is reached after finitely many steps, and the list never stalls on an infinite block. Some readers find this picture more convincing than the code 2m3n. The injection is shorter to write out and to check, which is why the proof uses it.

The theorem passes to products of any countable sets. Chapter 1 defines Xn for one set X; for several sets we first say what the product is. For an integer k≥2 and sets A1,…,Ak, let U:=⋃i∈{1,…,k}Ai and A1×⋯×Ak:={x∈Uk:x=(x1,…,xk) with xi∈Ai for every i}, the k-tuples whose i-th coordinate lies in Ai. It is a set by (W3), (W5) and (W1) of Section 1.1. For k=2 it is A1×A2 of Definition 1.3.2, a pair being a 2-tuple, and if every Ai is the same set X, it is Xk.

Corollary 3.2.7 (Products of Countable Sets)
  • (a) If A and B are countable, then A×B is countable.
  • (b) Let k≥2 be an integer. If A1,…,Ak are countable, then A1×⋯×Ak is countable.

Idea. For two factors, injections A→N and B→N turn A×B into a subset of N×N, and the code 2m3n does the rest. More factors are added one at a time: a (k+1)-tuple is a k-tuple followed by one more coordinate.

Proof. (a) By Theorem 3.2.2, (i) ⇒ (ii), there are injections i:A→N and j:B→N. The map A×B→N×N, (a,b)↦(i(a),j(b)), is injective: if (i(a),j(b))=(i(a′),j(b′)), then i(a)=i(a′) and j(b)=j(b′) by Definition 1.3.1, so a=a′ and b=b′. Following it by the injection p of Theorem 3.2.6 gives an injection A×B→N (Theorem 1.4.4 (a)), and (ii) ⇒ (i) concludes. No case split is needed: if A=∅ or B=∅, then A×B=∅ (Proposition 1.3.1), so the map (a,b)↦(i(a),j(b)) and its composite with p are empty functions (Proposition 1.4.2 (a)), which are injective vacuously.

(b) We use Theorem 2.2.1 with n0=2 on the statement “for all countable sets A1,…,Ak, the set A1×⋯×Ak is countable”. Base case k=2. This is (a). Step. Let k≥2, suppose the statement for k, and let A1,…,Ak+1 be countable. The map ((a1,…,ak),ak+1)↦(a1,…,ak+1) is a function, since a k-tuple determines its coordinates (Section 1.3), and it sends (A1×⋯×Ak)×Ak+1 onto A1×⋯×Ak+1: a (k+1)-tuple with xi∈Ai is the image of ((x1,…,xk),xk+1). By the hypothesis, A1×⋯×Ak is countable, so the domain is countable by (a), and the (k+1)-fold product is countable by Proposition 3.2.4. By Theorem 2.2.1 the statement holds for every k≥2.

The map in the step is in fact a bijection, by the characteristic property of tuples (Section 1.3). The proof uses that property only to see that the map is well defined, and of the map it uses only that it is onto; injectivity is never needed. Tuples of different lengths are different objects, and the book has no 1-tuples, so the corollary starts at k=2; a single countable set needs no corollary.

Quick check. Let L be the set of the 26 letters a–z. Is the set of all strings of exactly 5 letters, that is L5, countable? Which results do you use?

Solution. Yes. The set L is finite, so it is countable by Theorem 3.2.2, (iii) ⇒ (i). The strings of length 5 are the 5-tuples of letters, L5=L×L×L×L×L, which is countable by Corollary 3.2.7 (b) with k=5. (It is in fact finite, with 265 elements: the map in the step of the proof of Corollary 3.2.7 (b) is a bijection Lk×L→Lk+1 (the remark above), so Exercise C2 (a) of Section 3.1, applied for k=2,3,4 after L2=L×L, counts it. Countability needs less than the count.)

All strings of every finite length together form the union of the sets Lk over k, a union of infinitely many countable sets. Section 3.3 takes up such unions.

3.2.6. The integers and the rationals

Here is the answer to the question that opened the section. Recall from Section 2.1 that Z:=N∪{−n:n∈N}, Z>0:={n∈N:n≠0} and Q:={m/n:m∈Z, n∈Z>0}.

Theorem 3.2.8 (The Integers and the Rationals Are Countable)

N, Z and Q are countable. Each of them is countably infinite.

Idea. For Z, interleave the non-negative and the negative integers, as in Proposition 3.2.5, but with explicit lists, so that the result is a bijection: 0,−1,1,−2,2,−3,…. For Q, do not try to list the fractions directly. Every rational is m/n for some pair (m,n)∈Z×Z>0, and that set of pairs is countable, so Q is the image of a countable set.

Proof. N. The identity idN is a bijection N→N.

Z. By the claim in the proof of Proposition 3.2.5, every n∈N is 2k or 2k+1 for exactly one k∈N, and not both. So we may define z:N→Z by z(2k):=k,z(2k+1):=−(k+1)(k∈N), which begins z(0)=0, z(1)=−1, z(2)=1, z(3)=−2, z(4)=2. It is injective: z(2k)=k≥0, while z(2k+1)=−(k+1)≤−1<0 (Lemma 2.1.1 (a)), so an even and an odd input never share a value; and k=k′ or −(k+1)=−(k′+1) gives k=k′. It is surjective: let m∈Z. If m∈N, then m=z(2m). Otherwise m=−n with n∈N, and n≠0, since −0=0∈N; so n−1∈N by Lemma 2.1.1 (c), and m=−((n−1)+1)=z(2(n−1)+1). So z is a bijection.

Q. The set Z>0⊆N is countable by Proposition 3.2.3, and Z is countable, so Z×Z>0 is countable by Corollary 3.2.7 (a). The map (m,n)↦m/n from Z×Z>0 to Q is defined, since n≥1 is not 0, and it is surjective by the definition of Q. By Proposition 3.2.4, Q is countable. It is infinite: N⊆Q, since n=n/1, and N is infinite (Example (Hilbert’s Hotel)), so Q is not finite by Proposition 3.1.6. By Theorem 3.2.2, (i) ⇒ (iii), Q is countably infinite.

The list of Q that the proof produces repeats every rational infinitely often: 1/1, 2/2, 3/3, … are all 1. The definition allows it, and that is what made the proof three lines. No line of the proof, or of the results it cites, uses the axiom of choice of Section 3.3: each surjection or injection it relies on is either given by a formula or named by a single ∃E, and the only selections made for many elements at once are least elements (Theorem 2.1.3). That Q can be listed is the fact Analysis on the Real Line, Chapter 1 quotes when it compares Q with R: the rationals, dense as they are, can be listed, while Analysis on the Real Line, Chapter 1 shows that the reals cannot.

3.2.7. Exercises

A. Check your understanding

Exercise (A1)
  • (a) Define “A is countable”, and say why the empty set is mentioned separately in the definition.
  • (b) True or false, with a reason: every infinite subset of Q is countably infinite; every countable set is finite or equinumerous with N.
  • (c) Which of the three forms (i)–(iii) of Theorem 3.2.2 is quickest to check for {n2:n∈N}, and why?
  • (d) Where does the proof of (i) ⇒ (ii) in Theorem 3.2.2 use Theorem 2.1.3, and to which set is it applied?

Solution.

  • (a) A is countable if A=∅ or there is a surjection N→A (Definition 3.2.1). The empty set is mentioned separately because there is no function N→∅ at all (Proposition 1.4.2 (b)), so the surjection clause never holds for ∅.

  • (b) Both are true. An infinite A⊆Q is countable by Proposition 3.2.3 and Theorem 3.2.8; by Theorem 3.2.2, (i) ⇒ (iii), it is finite or countably infinite, and it is not finite. The second statement is (i) ⇒ (iii) itself, with “countably infinite” unfolded by Definition 3.2.2.

  • (c) Form (i): the set is given as the image of N under n↦n2, and a function is a surjection onto its image, so nothing is left to check. Form (ii) is almost as quick: the inclusion into N is injective. Form (iii) needs a bijection with N, which costs a proof that n↦n2 is injective on N.

  • (d) In defining h(a):=ming−1({a}): well-ordering is applied to the preimage g−1({a})⊆N, which is non-empty because g is onto. It gives every a a definite position, the first one at which a appears in the list, so no choice is needed.

B. Practice

Exercise (B1)

Prove that each of the following sets is countable.

  • (a) 2N×Z.
  • (b) {(m,n)∈N×N:m<n}.
  • (c) Q×Q, the points of the plane with rational coordinates.
  • (d) The set of open intervals with rational endpoints, that is, of the sets {x∈R:a<x<b} with a,b∈Q and a<b.

Solution.

Exercise (B2: Putting a proof in order)

The lines (i)–(ix) below include the seven lines of a proof that 2m3n=2m′3n′ implies m=m′ and n=n′, for m,n,m′,n′∈N, shuffled, together with two lines that do not belong. Write the seven lines in an order that makes a correct proof, and say why each of the other two lines fails.

  • (i) The left side is even, because m−m′≥1 by the supposition; the right side is odd; no natural number is both (Theorem 2.2.3, uniqueness of the remainder for divisor 2). This is a contradiction.
  • (ii) Suppose 2m3n=2m′3n′.
  • (iii) The left side is odd and the right side is even, a contradiction.
  • (iv) Canceling 2m gives 3n=3n′.
  • (v) Suppose m≠m′; by symmetry, say m>m′.
  • (vi) Since k↦3k is strictly increasing on N, n=n′.
  • (vii) Since 2 and 3 are prime, unique factorization gives m=m′ and n=n′.
  • (viii) Canceling 2m′ gives 2m−m′3n=3n′.
  • (ix) So m=m′.

Solution. The order is (ii), (v), (viii), (i), (ix), (iv), (vi). No other order is admissible. Line (ii) introduces the four numbers and the equation. Lines (v), (viii) and (i) are one proof by contradiction: (v) opens it, (viii) uses the supposition m>m′ to cancel, and (i) closes it with a contradiction, so (ix), its conclusion, must come right after (i). Line (iv) cancels 2m on both sides, which needs m=m′, so it follows (ix); and (vi) uses the equation of (iv).

Line (iii) reverses the parities. The left side 2m−m′3n has a factor 2 because m−m′≥1, so it is even; the right side 3n′ is odd. A line asserting the opposite is false: for m=1, m′=0, n=n′=0, the left side is 2 and the right side is 1.

Line (vii) would end the proof at once, but it cites unique factorization into primes, which the book has neither proved nor taken as a school fact: Section 2.2 sets it aside as a fact it does not prove or use (after Definition 2.2.2), and the idea before Theorem 3.2.6 declines to cite it. So (vii) cites a line that is not available, (N9) of Logic and Proof, Example (What is not allowed). The theorem is true, and the conclusion of (vii) is true; the error is in the citation, which is exactly why the proof in the text goes through parity instead.

Exercise (B3: A surjection by formula)

Give an explicit surjection N→N×{0,1} and prove that it is one. List the properties that any correct answer must have, so that a different answer can be checked against them.

Solution. By the claim in the proof of Proposition 3.2.5, every a∈N is 2q+r for exactly one pair (q,r) with q∈N and r∈{0,1}. Define s:N→N×{0,1} by s(2q+r):=(q,r): so s(0)=(0,0), s(1)=(0,1), s(2)=(1,0), s(3)=(1,1). The uniqueness of the pair makes s a function. It is surjective: given (q,r)∈N×{0,1}, the number a:=2q+r lies in N (Lemma 2.1.1 (b)), and s(a)=(q,r). (It is even a bijection, by the uniqueness of the pair.)

A correct answer must:

  • assign to every a∈N exactly one value, so that it is a function on all of N;
  • take its values in N×{0,1};
  • reach every pair (q,0) and every pair (q,1), for every q∈N, each at a finite position.

For instance s′(2q):=(q,1), s′(2q+1):=(q,0) also qualifies. The rows-first attempt a↦(a,0), “then” the pairs (q,1), fails the third property (Example (Listing the rows one after another)).

C. Going deeper

Exercise (C1: Finite subsets of the natural numbers)

Let F be the set of all finite subsets of N. Prove that F is countable, without using any result about unions of infinitely many sets.

Solution (Hint 1). Inject F into N by sending F to SN(F):=∑k=0N1F(k)2k, for any N with F⊆{0,…,N} (the value does not depend on N): the number whose binary digits are the indicator of F.

Solution (Hint 2). To prove injectivity, let m be the largest element at which two different sets F≠G differ (the largest element of (F∖G)∪(G∖F), a non-empty finite subset of N). The terms above m are the same for F and G. Then use ∑k=0m−12k=2m−1<2m.

Solution. The set F⊆P(N) exists by specification. We build an injection σ:F→N in four steps. For N∈N and F⊆{0,…,N} let SN(F):=∑k=0N1F(k)2k, a finite sum as in Definition 2.3.1 (indexed from 0), where 1F:N→{0,1} is the indicator function of F. Each term is 0 or 2k, and 2k∈N by Proposition 2.3.4 (d). So SN(F)∈N, by induction on N through the recursive clause of Definition 2.3.1, using Lemma 2.1.1 (b) at each step.

Step 1: a bound. Each term is at most 2k, so 0≤SN(F)≤∑k=0N2k=2N+1−1, by Proposition 2.3.6 with r=2 (shifting the index by one).

Step 2: one more term. Splitting off the last term (Section 2.3), for F⊆{0,…,N+1}, SN+1(F)=SN(F∩{0,…,N})+1F(N+1)2N+1. In particular, if F⊆{0,…,N}, then SN+1(F)=SN(F). By induction on N′≥N, SN′(F)=SN(F) for every N′≥N: the value does not depend on which bound N we use.

Step 3: injective for a fixed N. We prove by Logic and Proof, Axiom 4.2.1 on N: if F,G⊆{0,…,N} and SN(F)=SN(G), then F=G. For N=0, F and G are ∅ or {0}, with values 0 and 1. For the step, let F,G⊆{0,…,N+1} with SN+1(F)=SN+1(G), and write F′:=F∩{0,…,N}, G′:=G∩{0,…,N}. If N+1∈F and N+1∉G, then Steps 2 and 1 give SN+1(F)≥2N+1>2N+1−1≥SN(G′)=SN+1(G), a contradiction; the case N+1∈G∖F is the same with F and G exchanged. So N+1 lies in both or in neither, the last terms in Step 2 agree, and SN(F′)=SN(G′). By the hypothesis, F′=G′. Since {0,…,N+1}={0,…,N}∪{N+1}, it follows that F=G.

Step 4: the injection. Every F∈F lies in some {0,…,N}: if F=∅, take N=0; otherwise F is a non-empty finite set of real numbers, so it has a maximum M∈F⊆N (Proposition 2.3.8, as in the remark at the end of Section 3.1), and F⊆{0,…,M}. Define σ(F):=SN(F) for any such N; by Step 2 this does not depend on N. If σ(F)=σ(G), take N at least as large as a bound for F and a bound for G; then SN(F)=SN(G), and Step 3 gives F=G. So σ is injective, and F is countable by Theorem 3.2.2, (ii) ⇒ (i).

For example σ(∅)=0 (the empty set contributes no terms), σ({0,2})=1+4=5 and σ({1,3})=2+8=10: σ(F) is the number whose binary numeral has a 1 exactly in the places listed in F. Step 3 is the uniqueness of binary numerals, and Step 4 uses no principle of choice: every value is given by a formula.

Marking scheme. (10 points) - 2: defines a map from the finite subsets to N explicitly, including the value at ∅, and checks that its values are natural numbers. - 2: makes the map well defined, either by a bound-independent definition (as in Step 2) or by summing over the elements of F listed in increasing order. - 4: proves injectivity, either by comparing the terms at the largest element at which F and G differ, using ∑k=0m−12k<2m, or by an induction on the bound as in Step 3, or by an equivalent proved uniqueness argument for binary numerals. - 2: concludes with Theorem 3.2.2, (ii) ⇒ (i). - Route by surjection: an explicit map N→F that reads off binary digits (for example, D(n) is the set of k≤n for which the quotient of n by 2k in Theorem 2.2.3 is odd) earns the same points: 2 for defining the map, 2 for checking that each value is a finite subset of N, 4 for a proof that every F∈F is a value, and 2 for concluding by Definition 3.2.1. Fatal errors (0 for the step): writing F as the union over n of the sets of n-element subsets and citing a result on countable unions (the task excludes it); asserting injectivity, or surjectivity on the second route, “by uniqueness of binary expansions” with no proof.

Exercise (C2: Find the error)

Here is a “proof” that every subset of a countable set is countable.

Let B be countable and A⊆B. (1) If A=∅, then A is countable by definition. (2) Otherwise B≠∅, so there is a surjection g:N→B. (3) Define h:N→A by h(n):=g(n). (4) Let a∈A. Then a∈B, so a=g(n) for some n∈N, and h(n)=a. (5) Hence h is a surjection onto A, and A is countable.

Is the conclusion true? Does the argument prove it? If not, name the line that fails, the rule it breaks, and give a counterexample to that line. Then repair the proof.

Solution. The conclusion is true: it is Proposition 3.2.3. The argument does not prove it.

Line (3) fails. It does not define a function from N to A: Definition 1.4.1 requires, for every n∈N, exactly one value in A, and when g(n)∉A the formula offers no value in A at all. Counterexample to line (3): B=N, g=idN, A={1}. Then “h(2)=g(2)=2”, and 2∉A, so h is not a function into A. Lines (1), (2) and (4) are correct, and (5) would follow if h were a function N→A.

Repair. In the case A≠∅, fix one element a0∈A (one ∃E) and define h(n):={g(n)if g(n)∈A,a0if g(n)∉A. Now h is a function N→A, and line (4) shows that it is onto: for a∈A, some n has g(n)=a∈A, and then h(n)=g(n)=a. The repaired proof uses that A is non-empty, which line (1) had already split off; the flawed line ignored the elements of B∖A, and the default value a0 is where they go. The proof in the text avoids the issue by restricting an injection instead, since a restriction of a function is always a function.

Marking scheme. (10 points) - 2: says the conclusion is true, citing Proposition 3.2.3 or an equivalent proof. - 3: names line (3) and the broken requirement: a function into A needs a value in A at every n (Definition 1.4.1). - 2: gives a concrete instance of the failure of line (3), with a specific n whose value leaves A. - 3: repairs the proof with a default value in A (or by restricting an injection), and checks surjectivity. Fatal errors (0 for the step): calling the conclusion false; blaming line (4) or (5); a “counterexample” that shows a subset that is not countable.