cs173 lecture b
TRANSCRIPT
![Page 1: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/1.jpg)
CS173 Lecture B
Tandy Warnow
December 1, 2015
![Page 2: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/2.jpg)
CS 173, Lecture BReview of Cardinality and CountabilityTandy Warnow
![Page 3: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/3.jpg)
Today
I The final exam
I Cardinality of infinite sets (review)
I Countability and how to prove that a set is countable (review)
I Uncountability, and how to prove that a set is not countable(review)
I ICES forms (need a student volunteer to collect and returnthem)
![Page 4: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/4.jpg)
What won’t be on the final exam
What won’t be on the exam:
I Dynamic programming
I The graph algorithm for 2-SAT
I Genome assembly and de Bruijn graphs
The final exam will contain problems on everything else.
I Some of the exam requires proofs (by induction, bycontradiction, etc.).
I Some of it will be multiple choice or True/False.
I You will need to know definitions.
I Nearly all the problems will be verbatim (or almost verbatim)from the exam review document.
So just make sure you can do what’s on the exam reviewdocument!
![Page 5: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/5.jpg)
Examlet on Thursday, December 3
It will have three problems:
1. One proof that a set is countable or perhaps uncountable
2. One problem involving proving a theorem about trees
3. One problem where you are given an adjacency matrix andasked to draw the graph it defines, and then find variousthings. Examples of those things might include:
I Breadth First Search tree starting at a particular nodeI minimum dominating setI minimum vertex coverI maximum matchingI maximum independent setI maximum cliqueI minimum vertex coloring,I Hamiltonian path (if it exists)I Eulerian circuit (if it exists)
![Page 6: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/6.jpg)
Material about Countability/Uncountability
Definitions:
I Countable and uncountable
I Finite and infinite
Techniques:
I Cantor’s diagonalization (proves uncountability)
I Zig-zag (proves countability)
Theorems:
I The countable union of countable sets is countable (zig-zagtechnique).
I The finite product of countable sets is countable (zig-zagtechnique for two sets, induction to generalize).
I Any subset of a countable set is countable.
I Any superset of an uncountable set is uncountable.
![Page 7: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/7.jpg)
Cardinality
The cardinality of a finite set X is the number of elements in X ,and is denoted |X |.Hence, |{1, 2, 3, 4, 5}| = |{2, 9, 12, 17, 18}|.A set X is finite if |X | = n for some n ∈ Z .A set X is infinite if there does not exist any n ∈ Z so that|X | = n.
Note, an alternative definition for infinite is that ∃Y ⊂ X and abijection f : X → Y .How do we talk about cardinality of infinite sets?When can we say that |X | = |Y | for infinite sets |X | and |Y |?
![Page 8: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/8.jpg)
Cardinality of infinite sets
We will say that |X | = |Y | if ∃f : X → Y where f is a bijection.
A set X is countably infinite if there is a bijection from X to N.
Using the prior notation, we say X is countably infinite if |X | = |N|.
In the textbook, the definition of countable is given as “finite orcountably infinite.”
But some authors use countable only for countably infinite... beaware of this.
![Page 9: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/9.jpg)
Proving a set is countable
There are several techniques to prove a set S is countable.
1. Provide a bijection between S and N2. Provide injections (1-1 functions) in each direction between S
and NOr, equally validly, describe an algorithm that produces anenumeration of the elements of S .
![Page 10: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/10.jpg)
Proving that Z− is countable
To prove that Z− = {−1,−2,−3, . . .} is countable, we define abijection f : Z− → N.
I Let f (n) = |n| − 1. We prove that f is a bijection between Z−
and N.I (f ix 1− 1:) Suppose f (x) = f (y). Then |x | − 1 = |y | − 1,
and so |x | = |y |. Since {x , y} ⊂ Z−, both x and y arenegative. Hence x = y , and so f is 1− 1.
I (f is onto:) Let n ∈ N; hence n ≥ 0. Let n′ = −(n + 1). Notethat f (n′) = | − (n + 1)| − 1 = n + 1− 1 = n. Hence f is onto.
Hence Z− is countable.
![Page 11: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/11.jpg)
Proving that Z is countable
Here we show that Z is countable. We have three options:
1. Provide a bijection between Z and N2. Provide injections (1-1 functions) in each direction between Z
and N3. Or, equally validly, describe an algorithm that produces an
enumeration of the elements of Z.
Let’s do the third one.
We will alternate between listing the non-negative integers (N) andthe negative integers (Z−).
So:
0,−1, 1,−2, 2,−3, 3, . . .
This is a perfectly valid proof that Z is countable!
![Page 12: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/12.jpg)
The Zig-Zag Technique
Suppose A and B are both countable. How do we prove thatA ∪ B is countable?
Zig-zag technique:
I Step 1: List the elements of A and B.
I Step 2: List the elements of A ∪ B by alternating between theelements of A and B.
Because A is countable, we can list its elements,A = {a0, a1, a2, . . . , }. Ditto for B, so B = {b0, b1, b2, . . . , }.
Enumerate A ∪ B by alternating between elements of A and B:A ∪ B = {a0, b0, a1, b1, a2, b2, . . .}.
![Page 13: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/13.jpg)
Finite unions of countable sets are countableSuppose A1, A2, . . . ,Ak are all countable. How do we prove that∪k
i=1Ai is countable?
Enumerate the elements of the finite union as follows:I List the first element from each of the k setsI Then list the second element from each of the k setsI Then list the third element from each of the k setsI and so on
Let Ai = {ai0, ai1, ai2, . . . , }, i = 1, 2, . . . , k .
We obtain the list
∪ki=1Ai = {a10, a20, . . . , ak0, a11, a21, . . . , ak1, . . .}
![Page 14: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/14.jpg)
Countable unions of countable sets are countableWe will use the zig-zag technique to prove that ∪i∈NAi iscountable, if each Ai is countable.
Consider the infinite by infinite matrix M, where A0 is in the firstrow, A1 is in the second row, etc.
The i th row lists the elements of Ai .
We need to enumerate all the elements of ∪iAi .
![Page 15: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/15.jpg)
Countable unions of countable sets are countable
Each Ai is countable, i ∈ N. We list all the elements of Ai as thei th row in an infinite by infinite matrix, M.
We then use the zig-zag technique to enumerate all the elements,visiting them as follows:
I M[0, 0]
I M[1, 0], M[0, 1]
I M[2, 0], M[1, 1], M[0, 2]
I etc.
Note that because some elements may appear in more than oneset, we may list an element more than once. We’ll just skip theelement if it’s already appeared in our list.
![Page 16: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/16.jpg)
Countable unions of finite sets are countable
Suppose Ai is a finite set for i = 0, 1, 2, . . .
To prove that ∪iAi is countable, we can just list each set in theorder we see it.Hence, we begin with A0, then we list A1, then we list A2, etc.
![Page 17: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/17.jpg)
The product of two countable sets is countableSuppose A and B are countable. Is A× B countable?
Use the zig-zag technique.
Let A = {a0, a1, . . . , } and B = {b0, b1, . . . , }.
Define matrix M[i , j ] = (ai , bj).
Enumerate the elements of A× B using the zig-zag technique.
![Page 18: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/18.jpg)
The product of finitely many countable sets is countable
Suppose Ai is countable for each i = 0, 1, 2, . . . , k . We prove∏ki=0 Ai countable by induction on k .
I Base case: k = 2 (see previous slide)
I Inductive hypothesis: ∃K ∈ Z+ such that ∀k , 1 ≤ k ≤ K ,∏ki=1 Ai is countable if each Ai is countable.
I By definition,∏K+1
i=0 Ai =∏K
i=0 Ai × AK+1.
I By the inductive hypothesis,∏K
i=0 Ai is countable.
I By the inductive hypothesis, the product of two countable setsis countable.
I Hence∏K+1
i=0 Ai =∏K
i=0 Ai × AK+1 is countable.
![Page 19: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/19.jpg)
So far
We have shown we can prove countability of a set S
I by demonstrating a bijection between S and NI by demonstrating 1-1 functions between S and N in both
directions
I by defining an infinite two-dimensional matrix containing allthe elements of the set, and using a zig-zag technique to listthe elements
Hence:
I The countable union of countable sets is countable
I The finite product of countable sets is countable
I If X ⊆ S and S is countable, then so is X
I If |X | ≤ |S | and S is countable, then so is X
![Page 20: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/20.jpg)
What about uncountability?
A set X is uncountable if X is infinite but |X | 6= |N|.Examples:
I [0, 1]
I RI P(N)
I The set of functions from N to {0, 1}
Furthermore, for any set A that is listed above, then
I Any set X that contains A as a subset is uncountable
I Any set X that contains a subset Y where |Y | = |A| isuncountable
![Page 21: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/21.jpg)
Why P(N) is uncountableThe proof that P(N) is uncountable is in the book, and we’ve goneover it already.
![Page 22: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/22.jpg)
Why [0, 1] is uncountableProof by contradiction.Suppose it is countable. Then we can list the elements asa0, a1, a2, . . ..
Write out the matrix, with ai the i th row, and give each number indecimal notation, written as 0.y (for some y). Note that this ispossible, even for x=1! (In other words, 1.0 = 0.9̄)
![Page 23: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/23.jpg)
Why [0, 1] is uncountable
Hence, if a0 = 0.1701, then the first row would look like:
1, 7, 0, 1, 0, 0, 0, . . .
If a1 = 13 = 0.3̄ then the second row would be:
3, 3, 3, 3, 3, 3, 3, . . .
if a2 = 1, we list it as
9, 9, 9, 9, 9, 9, 9, . . .
We have to define a real number z that is not in this matrix. Howdo we do this?
![Page 24: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/24.jpg)
Why [0, 1] is not countableWe set the digits for z by setting zi so that it is different fromevery element in the matrix in the i th position.
We set be zi = M[i , i ] + 2(mod10).
![Page 25: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/25.jpg)
Why [0, 1] is not countable
The mapping we used is:
I If M[i , i ] = 0 we set zi = 2
I If M[i , i ] = 1 we set zi = 3
I If M[i , i ] = 2 we set zi = 4
I If M[i , i ] = 3 we set zi = 5
I If M[i , i ] = 4 we set zi = 6
I If M[i , i ] = 5 we set zi = 7
I If M[i , i ] = 6 we set zi = 8
I If M[i , i ] = 7 we set zi = 9
I If M[i , i ] = 8 we set zi = 0
I If M[i , i ] = 9 we set zi = 1
![Page 26: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/26.jpg)
Finishing the proof
Now we derive the contradiction!
I We assumed that the set [0, 1] is countable, and that matrixM has a row for every element in the set.
I We defined the number z based on its decimal expansion, sothat zi 6= M[i , i ] for any i .
I Therefore the matrix M cannot have a row for every elementof [0, 1].
I Hence we derive a contradiction, and [0, 1] must beuncountable.
![Page 27: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/27.jpg)
Why didn’t we use zi = M[i , i ] + 1(mod10)?
Note how we defined z ... our mapping...Suppose we had set zi = M[i , i ] + 1(mod10).
Note that .1 = .09̄ (they are really the same number).
Suppose we had obtained z = .1 because the diagonal elementswere 0, 9, 9, 9, 9, . . ..
The first row could have been for the element 0.09̄.
![Page 28: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/28.jpg)
Proving a set is uncountable
To prove a set X is uncountable, do one of the following:
I The same kind of proof by contradiction – enumeration anddiagonalization
I Prove that |X | = |Y | where Y is uncountable
I Find an uncountable set Y and show that Y ⊂ X
I Find an uncountable set Y and a 1-1 function from Y to X ;this is denoted by |Y | ≤ |X |
![Page 29: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/29.jpg)
Other uncountable sets
Using the diagonalization argument, or using other theorems, orcombining these techniques with proofs by contradiction, we cannow prove that the following sets are uncountable:
I P(Y ), where Y is any infinite set
I The set of functions from A to X , where A is countable and|X | ≥ 2 (e.g., A = Z and X = {1, 2, 3}).
I RI R \Q
![Page 30: CS173 Lecture B](https://reader031.vdocuments.site/reader031/viewer/2022022418/58a0330d1a28abc24a8c661d/html5/thumbnails/30.jpg)
Summary
Definitions:
I Countable and uncountable
I Finite and infinite
Techniques:
I Cantor’s diagonalization (proves uncountability)
I Zig-zag (proves countability)
Theorems:
I The countable union of countable sets is countable (zig-zagtechnique).
I The finite product of countable sets is countable (zig-zagtechnique for two sets, induction to generalize).
I Any subset of a countable set is countable.
I Any superset of an uncountable set is uncountable.