CSC 165 H1F Tutorial # 8 — Sample Solutions Fall 2011 1. Prove or disprove that the set S0 = {f : Z → Z} is countable. Intuitively, each element of S0 consists of an infinite amount of information, so we expect that S0 is not countable. To show this by diagonalization involves the following steps: (a) Describe a representation for every element of S0 that is unique to each element (i.e., different representations correspond to different elements). How should we represent a function f : Z → Z? By listing its values: f (z0 ), f (z1 ), f (z2 ), . . . Different functions correspond to different lists of values, and every list of values is a function. But what are z0 , z1 , z2 , . . . in this list above? Any complete list of Z will do, e.g., the one from class: z0 = 0, z1 = −1, z2 = 1, z3 = −2, z4 = 2, . . . (b) Assume (for a contradiction) that there is a list of every element of S0 . In other words, there is a list f0 , f1 , f2 , . . . , fk , . . . that contains every function in S0 . Then we can describe this list as follows, based on the representation for each function we’ve chosen above: z0 z1 z2 ... zk ... f0 f0 (z0 ) f0 (z1 ) f0 (z2 ) . . . f0 (zk ) . . . f1 f1 (z0 ) f1 (z1 ) f1 (z2 ) . . . f1 (zk ) . . . f2 f2 (z0 ) f2 (z1 ) f2 (z2 ) . . . f2 (zk ) . . . .. .. .. .. .. .. . . . . . . ··· fk .. . fk (z0 ) fk (z1 ) fk (z2 ) . . . fk (zk ) . . . .. .. .. .. .. .. . . . . . . (c) Describe how to construct a new representation for an element of S0 by “diagonalizing” over the list. Consider the function f represented by the following list of values: f0 (z0 ) + 1, f1 (z1 ) + 1, f2 (z2 ) + 1, . . . In other words, ∀i ∈ N, f (zi ) = fi (zi ) + 1. (Our choice of “fi (zi ) + 1” is arbitrary, and many other choices would work just as well. The important thing is to guarantee that the values of f are different from every function in the list for at least one argument.) (d) Show that this representation cannot belong to the list. Then f : Z → Z, so f ∈ S0 . This means ∃k ∈ N, f = fk , i.e., f (z0 ) = fk (z0 ), f (z1 ) = fk (z1 ), . . . In particular, f (zk ) = fk (zk ). But f (zk ) = fk (zk ) + 1 (by definition), so fk (zk ) = fk (zk ) + 1, i.e., 0 = 1 (subtracting fk (zk ) from both sides). Hence, by contradiction, S0 is not countable. Dept. of Computer Science, University of Toronto, St. George Campus Page 1 of 4 CSC 165 H1F Tutorial # 8 — Sample Solutions Fall 2011 2. Prove or disprove that the set S1 = {S ⊆ N : size(S) is finite} is countable. Intuitively, each element of S1 consists of a finite amount of information, so we expect that S1 is countable. To show this, we must come up with a way to list every element of S1 systematically, i.e., according to some clear pattern that does not miss any element. There is a “trick” involved in this one, i.e., a single idea you must have to make it easier. • sub-list 0: start with ∅, • sub-list 1: add 0 to every subset generated so far (in sub-list 0): {0}, • sub-list 2: add 1 to every subset generated so far (in sub-lists 0–1): {1}, {0, 1}, • sub-list 3: add 2 to every subset generated so far (in sub-lists 0–2): {2}, {0, 2}, {1, 2}, {0, 1, 2}, • sub-list 4: add 3 to every subset generated so far (in sub-lists 0–3): {3}, {0, 3}, {1, 3}, {0, 1, 3}, {2, 3}, {0, 2, 3}, {1, 2, 3}, {0, 1, 2, 3}, • ... The final list consists of all the sub-lists one after the other. Clearly, every set in this list is a finite subset of N. But how do we argue that every finite subset of N must appear somewhere in the list? The answer hinges on one fact (to be proven further below): (∗) ∀i ∈ Z+ , sub-list i contains every subset of N whose maximum element is i − 1. Consider an arbitrary subset S ⊆ N. Let x be the maximum element in S — since S is finite, it contains some maximum element. Then, S appears in sub-list x + 1 (by (∗)). Hence, every finite subset of N appears somewhere in the list. Now, we argue that (∗) is true. Technically, this must be done by induction. We show the result below for your reference — you are not expected to know the structure of inductive proofs, but this is a good example of a proof by “complete induction”. Assume i ∈ Z+ and assume sub-list j contains every subset of N whose maximum element is j − 1, for j = 0, 1, . . . , i − 1. Assume S ⊆ N and the maximum element in S is i − 1. Then either S − {i − 1} is empty or it is not. Case 1: If S − {i − 1} is empty, then S = {i − 1} belongs to sub-list i (by adding i − 1 to ∅ from sub-list 0). Case 2: If S − {i − 1} is not empty, then let k be the maximum element in S − {i − 1}. Then k < i − 1 and, by the inductive hypothesis (the very first assumption at the top of the proof), S − {i − 1} belongs to sub-list k + 1. But then, S belongs to sub-list i (by adding i − 1 to S − {i − 1} from sub-list k + 1). In either case, S belongs to sub-list i. Hence, sub-list i contains every subset of N whose maximum element is i − 1. Then, (∗) is true by induction. There was another way to show S1 is countable, by providing a one-to-one function from S1 to N — see the last question in this tutorial for a hint about how to do this. Dept. of Computer Science, University of Toronto, St. George Campus Page 2 of 4 CSC 165 H1F Tutorial # 8 — Sample Solutions Fall 2011 3. Prove or disprove that the set S2 = {S ⊆ N : size(S) is infinite} is countable. Point-form argument (only the main idea with none of the structure written down explicitly): • • • • • In class, we showed that P(N) = {S ⊆ N} is uncountable. In the previous question, we showed that S1 = {S ⊆ N : size(S) is finite} is countable. If S2 were countable, then so would S1 ∪ S2 . (This needs to be proven!) But S1 ∪ S2 = P(N), so it is uncountable. Hence, S2 is uncountable. Proof that A countable and B countable implies A ∪ B countable? Exercise!. . . Hint: Think about the countability of Z. Dept. of Computer Science, University of Toronto, St. George Campus Page 3 of 4 CSC 165 H1F Fall 2011 Tutorial # 8 — Sample Solutions 4. Prove or disprove that the set S3 = {(a, b) : a ∈ N, b ∈ N} is countable. (This is basically just a review of the argument used to show that Q is countable, which was done in class.) Intuitively, each element of the set is a pair of integers, i.e., a finite amount of information, so the set should be countable. Come up with a systematic way to list every element in S3 . An idea similar to the counting of Q+ will work. First, write down every pair (a, b) in a 2-dimensional table: a\b 0 1 2 3 .. . k .. . 0 (0, 0) (1, 0) (2, 0) (3, 0) .. . 1 (0, 1) (1, 1) (2, 1) (3, 1) .. . 2 (0, 2) (1, 2) (2, 2) (3, 2) .. . 3 (0, 3) (1, 3) (2, 3) (3, 3) .. . ... ... ... ... ... .. . k (0, k) (1, k) (2, k) (3, k) .. . ... ... ... ... ... ··· (k, 0) (k, 1) (k, 2) (k, 3) . . . (k, k) . . . .. .. .. .. .. .. .. . . . . . . . Next, start at the upper-left corner and list elements in an increasing “triangle” pattern, as follows (using extra spaces between the “bands” of the triangle pattern): (0, 0), (1, 0), (0, 1), (2, 0), (1, 1), (0, 2), (3, 0), (2, 1), (1, 2), (0, 3), ... This is equivalent to organizing the list into sub-lists, where each sub-list has a constant value of a + b and elements within a sublist are ordered by increasing value of b: • • • • • sub-list sub-list sub-list sub-list ... 0: 1: 2: 3: (0, 0) (1, 0), (0, 1) (2, 0), (1, 1), (0, 2) (3, 0), (2, 1), (1, 2), (0, 3) (Note: we could have ordered sub-lists by increasing value of a instead; this was an arbitrary choice and both possibilities are fine.) The list above defines a function f1 : N → S3 that is onto: ∀a ∈ N, ∀b ∈ N, the element (a, b) ∈ S3 appears in sub-list number a + b, at position number b (counting from 0 in both cases), i.e., there is some n ∈ N such that f1 (n) = (a, b). Alternatively, we could also try to define a function f10 : S3 → N that is one-to-one. We do not need to do both! The argument above is sufficient to show that S3 is countable. We show the alternative argument here only for your reference. One possibility would be f10 ((a, b)) = 2a 3b . Clearly, f10 ((a, b)) ∈ N for all (a, b) ∈ S3 . Moreover, f10 is one-to-one — though proving this requires the use of the Fundamental Theorem of Arithmetic (that every natural number can be decomposed into a product of prime factors in a unique way). For your reference, here is the argument. Assume (a1 , b1 ) ∈ S3 , (a2 , b2 ) ∈ S3 . Assume f10 ((a1 , b1 )) = f10 ((a2 , b2 )). Then 2a1 3b1 = 2a2 3b2 . Then a1 = a2 and b1 = b2 . # by the Fundamental Theorem of Arithmetic Then f10 ((a1 , b1 )) = f10 ((a2 , b2 )) ⇒ (a1 , b1 ) = (a2 , b2 ). Then f10 is one-to-one. Dept. of Computer Science, University of Toronto, St. George Campus Page 4 of 4
© Copyright 2024