CS411-2012S-01 Set Theory & Proof Techniques 1
CS411-2012S-01 Set Theory & Proof Techniques 1
01-0: Syllabus
Ofce Hours Course Text Prerequisites Test Dates & Testing Policies Check dates now! Grading Policies
01-1: How to Succeed
Come to class. Pay attention. Ask questions. A question as vague as I dont get it is perfectly acceptable. If youre confused, at least 2 other people are, too.
01-3: How to Succeed
Come to class. Pay attention. Ask questions. A question as vague as I dont get it is perfectly acceptable. If youre confused, at least 2 other people are, too. Come by my ofce I am very available to students.
01-4: How to Succeed
Come to class. Pay attention. Ask questions. A question as vague as I dont get it is perfectly acceptable. If youre confused, at least 2 other people are, too. Come by my ofce I am very available to students. Start the homework assignments early Homework in this class requires thinking time
01-5: How to Succeed
Come to class. Pay attention. Ask questions. A question as vague as I dont get it is perfectly acceptable. If youre confused, at least 2 other people are, too. Come by my ofce
CS411-2012S-01
I am very available to students. Start the homework assignments early Homework in this class requires thinking time Read the textbook. Ask Questions! The textbook can be hard to follow reading a dense, technical work is a learning outcome for this class
01-6: Class Goals
Prove that there are some problems that cannot be solved Show that there are some problems that (are believed to) require an exponential amount of time to solve (NPComplete) Examine some strategies for dealing with these problems Along the way, learn how to model computation mathematically, and pick up some useful formalisms & techniques DFA, regular expressions, CFGs, etc.
01-7: Review of the Basics
Most (but perhaps not all) of the following material is review from discrete mathematics I will go fairly fast, assuming it is review Ask me to slow down if you have any questions!
01-8: Sets Denition
A set is an unordered collection of objects S = {a, b, c} a, b, c are elements or members of the set S
01-9: Sets Denition
A set is an unordered collection of objects S = {a, b, c} a, b, c are elements or members of the set S Elements in a set need have no relation to each other S1 = { 1 , 2 , 3 } S2 = { red, farmhouse, , -32 }
01-10: Sets Denition
Sets can contain other sets as elements S1 = {3, {3, 4}, {4, {5, 6}}}
CS411-2012S-01 S2 = {{1, 2}, {{4}}} Sets do not contain duplicates NotASet = {4, 2, 4, 5}
01-11: Sets Cardinality
Cardinality of a set is the number of elements in the set |{a, b, c}| = 3 |{{a, b}, c}| =?
01-12: Sets Cardinality
Cardinality of a set is the number of elements in the set |{a, b, c}| = 3 |{{a, b}, c}| = 2
01-13: Sets Empty, Singleton
({a, b} and c)
Empty Set: {} or , |{}| = || = 0 Singleton set set with one element {1} {4} {} ? {{}} ? {{3, 1, 2}} ?
01-14: Sets Empty, Singleton
Empty Set: {} or , |{}| = || = 0 Singleton set set with one element {1} Singleton {4} Singleton {} Not a Singleton (empty) {{}} Singleton {{3, 1, 2}} Singleton
01-15: Sets Membership
Set membership: x S 3 {1, 3, 5} a {b, c, d} 3 {1, {2, 3}} ? {} {1, 2, 3} ? {} {1, {}, 4} ?
CS411-2012S-01
01-16: Sets Membership
Set membership: x S 3 {1, 3, 5} a {b, c, d} 3 {1, {2, 3}} {} {1, 2, 3} {} {1, {}, 4}
01-17: Sets Describing
Referring to sets List all members {3, 4, 5}, {0, 1, 2, 3, . . . } S = {x : x has a certain property} S = {x | x has a certain property} S = {x : x N x < 10} N is the set of natural numbers {0, 1, 2, . . . } S = {x : x is prime } A B = {x : x A x B } A B = {x : x A x B } A B = {x : x A x B }
01-18: Sets ,
More Union & Intersection A and B are disjoint if A B = {} S is a collection of sets (set of sets) S = {x : x A for some A S } {{1, 2}, {2, 3}} = {1, 2, 3} {{1, 2}, {2, 3}} = {2} S = {x : x A for all A S }
Subsets & Supersets A is a subset of B , A B if: x, x A = x B (x A), x B A is a proper subset of B , A B if: A B (x, x B x A) {} is a subset of any set (including itself) {} is the only set that does not have a proper subset
CS411-2012S-01
01-20: Sets Power Set
Power set: Set of all subsets 2S = {x : x S } 2{a,b} = {{}, {a}, {b}, {a, b}} 2{} = {{}} |2S | = 2|S |
01-22: Sets Partition
{{a, c}, {b, d, e}, {f}} is a partition of {a,b,c,d,e,f} {{a, b, c, d, e, f}} is a partition of {a,b,c,d,e,f} {{a, b, c}, {d, e, f}} is a partition of {a,b,c,d,e,f} 01-23: Sets Partition In other words, a partition of a set S is just a division of the elements of S into 1 or more groups. All the partitions of the set {a, b, c}?
01-24: Sets Partition
In other words, a partition of a set S is just a division of the elements of S into 1 or more groups. All the partitions of the set {a, b, c}? {{a, b, c}}, {{a, b}, {c}}, {{a, c}, {b}}, {{a},{b, c}}, {{a}, {b}, {c}}
01-25: Ordered Pair
(x, y ) is an ordered pair Order matters (x, y ) = (y, x) if x = y hence ordered x and y are the components of the ordered pair (x, y )
CS411-2012S-01
01-26: Cartesian Product
A B = {(x, y ) : x A y B } {1, 2} {3, 4} = {(1, 3), (1, 4), (2, 3), (2, 4)} {1, 2} {1, 2} = ? 2{a}{b} = ? 2{a} 2{b} = ?
01-27: Cartesian Product
A B = {(x, y ) : x A y B } {1, 2} {3, 4} = {(1, 3), (1, 4), (2, 3), (2, 4)} {1, 2} {1, 2} = {(1, 1), (1, 2), (2, 1), (2, 2)} 2{a}{b} = {{(a, b)}, {}} 2{a} 2{b} = {({a}, {b}), ({a}, {}), ({}, {b}), ({}, {})}
01-28: Cartesian Product
If and only if A = B
01-30: Cartesian Product
Why Cartesian? Think Cartesian Coordinates (standard coordinate system) R R is the real plane Set of all points (x, y ) where x, y R R is the set of real numbers (think oats if youre CS)
01-31: Cartesian Product
CS411-2012S-01
{a} {b, c} {d} = {(a, b, d), (a, c, d)} (Techinally, A B C = (A B ) C ) {a} {b, c} {d} = {((a, b), d), ((a, c), d)} Often drop the extra parentheses for readability
01-32: Relations
A relation R is a set of ordered pairs For example the relation < over the Natural Numbers is the set: (0,1), (0,2), (0,3), ... (1,2), (1,3), (1,4), ... (2,3), (2,4), (2,5), ... ... 01-33: Relations {
Often, relations are over the same set that is, a subset of A A for some set A Not all relations are over the same set, however Relation describing prices of computer components {(Hard dive, $55), (WAP, $49), (2G DDR, $44), . . .}
01-34: Functions
A function is a special kind of relation (all functions are relations, but not all relations are functions) A relation R A B is a function if: For each a A, there is exactly one ordered pair in R with the rst component a
01-35: Functions
A function f that is a subset of A B is written: f : A B (a, b) f is written f (a) = b A is the domain of the function if A A, f (A ) = {b : a A f (a) = b} is the image of A The range of a function is the image of its domain
01-36: Functions
A function f : A B is: one-to-one if no two elements in A match to the same element in B onto Each element in B is mapped to by at least one element in A a bijection if it is both one-to-one and onto The inverse of a binary relation R A B is denoted R1 , and dened to be {(b, a) : (a, b) R}
A function f : A B is: one-to-one if no two elements in A match to the same element in B onto Each element in B is mapped to by at least one element in A a bijection if it is both one-to-one and onto The inverse of a binary relation R A B is denoted R1 , and dened to be {(b, a) : (a, b) R} A function only has an inverse if it is a bijection
01-38: Functions
What if we want to take the inverse of a function that is not a bijection what can we do? Want to preserve full information about the original function Resulting inverse must be an actual function
01-39: Functions
What if we want to take the inverse of a function that is not a bijection what can we do? Want to preserve full information about the original function Resulting inverse must be an actual function How can we have an element map to 0, 1, or more elements, and still have a function? HINT: If we modied the range ...
01-40: Functions
What if we want to take the inverse of a function that is not a bijection what can we do? Want to preserve full information about the original function Resulting inverse must be an actual function f :AB f 1 : B 2 A
(example on chalkboard) 01-41: Relations Q and R are two relations The composition of Q and R, Q R is: {(a, b) : (a, c) Q, (c, b) R for some c} Q = {(a, c), (b, d), (c, a)} R = {(a, c), (b, c), (c, a)} Q R = {(a, a), (c, c)} QQ? (Q R) Q? 01-42: Relation Graph
if (a, b) R, then there is an edge from a to b in the graph R = {(a, b), (a, c), (c, a), (b, b), (b, d)}
a b
01-43: Relation Types
c d
A relation R A A is reexive if (a, a) R for each a A (a A), (a, a) R Each node has a self loop
a c Reflexive
b d
a c
b d
Not Reflexive
A relation R A A is symmetric if (a, b) R whenever (b, a) R (a, b) R = (b, a) R Every edge goes both ways
a c
b d
a c
b d
Symmetric
01-45: Relation Types
Not Symmeteric
A relation R A A is antisymmetric if whenever (a, b) R, a, b are distinct (b, a) R (a, b) R a = b = (b, a) R No edge goes both ways
a c
b d
a c
b d
Antisymmetric
Not Antisymmeteric
CS411-2012S-01
10
A relation R A A is antisymmetric if whenever (a, b) R, a, b are distinct (b, a) R (a, b) R a = b = (b, a) R No edge goes both ways
a c
b d
a c
b d
Antisymmetric
Not Antisymmeteric
A relation R A A is transitive if whenever (a, b) R, and (b, c) R, (a, c) R (a, b) R (b, c) R = (a, c) R Every path of length 2 has a direct edge
a c
b d
a c
b d
Transitive
01-48: Closure
Not Transitive
A set A B is closed under a relation R ((B B ) B ) if: a1 , a2 A ((a1 , a2 ), c) R = c A That is, if a1 and a2 are both in A, and ((a1 , a2 ), c) is in the relation, then c is also in A N is closed under addtion N is not closed under subtraction or division
01-49: Closure
Relations are also sets (of ordered pairs) We can talk about a relation R being closed over another relation R Each element of R is an ordered triple of ordered pairs!
01-50: Closure
CS411-2012S-01
11
Relations are also sets (of ordered pairs) We can talk about a relation R being closed over another relation R Each element of R is an ordered triple of ordered pairs! Example: R AA R = {(((a, b), (b, c)), (a, c)) : a, b, c A} If R is closed under R , then . . .
01-51: Closure
Relations are also sets (of ordered pairs) We can talk about a relation R being closed over another relation R Each element of R is an ordered triple of ordered pairs! Example: R AA R = {(((a, b), (b, c)), (a, c)) : a, b, c A} If R is closed under R , then R is transitive!
01-52: Closure
Reexive closure of a relation R A A is the smallest possible superset of R which is reexive Add self-loop to every node in relation Add (a,a) to R for every a A Transitive Closure of a relation R A A is the smallest possible superset of R which is transitive Add direct link for every path of length 2. (a, b, c A) if (a, b) R (b, c) R add (a, c) to R. (examples on board) 01-53: Relation Types Equivalence Relation Symmetric, Transitive, Reexive Examples: Equality (=) A is the set of English words, (w1 , w2 ) R if w1 and w2 start with the same letter (example graphs) 01-54: Relation Types Equivalence Relation Symmetric, Transitive, Reexive Separates set into equivalence classes (all words that start with a, for example
CS411-2012S-01
12
Partial Order Antisymmetric, Transitive, Reexive Examples: for integers A is the set of integers, (a, b) R if a b Ancestor R A A = {(x, y ) : x is an ancestor of y , or x = y } (example graphs) 01-56: Relation Types Total Order R A A is a total order if: R is a partial order For all a, b A, either (a, b) R or (b, a) R Is a total order? Is Ancestor a total order? (example graphs) 01-57: Cardinality How can we tell if two sets A and B have the same cardinality?
01-58: Cardinality
How can we tell if two sets A and B have the same cardinality? Calculate |A| and |B |, make sure numbers are the same Match each element in A to an element in B Create a bijection f : A B (or f : B A)
01-59: Cardinality
What about innite sets? Are they all equinumerous (that is, have the same cardinality)? A set is countable innite (or just countable) if it is equinumerous with N.
01-60: Countable Sets
A set is countable innite (or just countable) if it is equinumerous with N. Even elements of N?
01-61: Countable Sets
13
A set is countable innite (or just countable) if it is equinumerous with N. Integers (Z)?
01-63: Countable Sets
A set is countable innite (or just countable) if it is equinumerous with N. Integers (Z)? x f (x) = x 2 (1)
-4
-3
-2
-1
2 ...
A set is countable innite (or just countable) if it is equinumerous with N. Union of 3 (disjoint) countable sets A, B, C?
01-65: Countable Sets
A set is countable innite (or just countable) if it is equinumerous with N. Union of 3 (disjoint) countable sets A, B, C? a0 a1 a2 a3 a4 ...
b0 b1 b2 b3 b4 ... c0 c1 c2 c3 c4 ... ax 3 b x 1 f (x) = 3 c x 2
3
(0,4) ... (1,4) ... (2,4) ... (3,4) ... (4,4) ...
...
...
CS411-2012S-01
01-67: Countable Sets
14
(0,4) ... (1,4) ... (2,4) ... (3,4) ... (4,4) ...
...
f ((x, y )) =
01-68: Countable Sets
A set is countable innite (or just countable) if it is equinumerous with N. Real numbers between 0 and 1 (exclusive)?
01-69: Uncountable R
...
+x
Proof by contradiction Assume that R between 0 and 1 (exclusive) is countable (that is, assume that there is some bijection from N to R between 0 and 1) Show that this leads to a contradiction Find some element of R between 0 and 1 that is not mapped to by any element in N
01-70: Uncountable R
0 1 2 3 4 5 6
...
01-71: Uncountable R
0 1 2 3 4 5 6
...
15
Three basic proof techniques used in this class Induction Diagonalization Pigeonhole Principle
01-73: Induction
Can create exact postage for any amount $0.08 using only 3 cent and 5 cent stamps
01-74: Induction
Can create exact postage for any amount $0.08 using only 3 cent and 5 cent stamps Base case Can create postage for 0.08 using one 5-cent and one 3-cent stamp
01-75: Induction
Can create exact postage for any amount $0.08 using only 3 cent and 5 cent stamps Inductive case To show: if we can create exact postage for $x using only 3-cent and 5-cent stamps, we can create exact postage for $x + $0.01 using 3-cent and 5-cent stamps Two cases: Exact postage for $x uses at least one 5-cent stamp Exact postage for $x uses no 5-cent stamps
01-76: Induction
To show: if we can create exact postage for $x using only 3-cent and 5-cent stamps, we can create exact postage for $x + $0.01 using 3-cent and 5-cent stamps Exact postage for $x uses at least one 5-cent stamp Replace a 5-cent stamp with two 3-cent stamps to get $x + $0.01 Exact postage for $x uses no 5-cent stamps Replace three 3-cent stamps with two 5-cent stamps to get $ + $0.01
01-77: Pigeonhole Principle
A, B are nite sets, with |A| > |B |, then there is no one-to-one function from A to B If you have n pigeonholes, and > n pigeons, and every pigeon is in a pigeonhole, there must be at least one hole with > 1 pigeon.
01-78: Pigeonhole Principle
Show that in a relation R over a set A, if there is a path from ai to aj in R, then there is a path from a to b whose length is at most |A|.
01-79: Pigeonhole Principle
Proof by Contradiction
CS411-2012S-01
16
Assume that there exists some shortest path from ai to aj of length > |A|. By pigeonhole principle, some element must repeat: {ai , . . . , ak , . . . , ak . . . aJ } We can create a shorter path by removing elements between ak s. Weve just found a shorter path from ai to aj a contradiction