Presentation is loading. Please wait.

Presentation is loading. Please wait.

DISCRETE MATHEMATICS I LECTURES CHAPTER 6 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam.

Similar presentations


Presentation on theme: "DISCRETE MATHEMATICS I LECTURES CHAPTER 6 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam."— Presentation transcript:

1 DISCRETE MATHEMATICS I LECTURES CHAPTER 6 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco

2 … and now for something completely different… Set Theory Actually, you will see that logic and set theory are very closely related.

3 Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element of A” A = {a 1, a 2, …, a n } “A contains…” Order of elements is meaningless It does not matter how often the same element is listed – repeats are OK!.

4 Set Equality  Sets A and B are equal if and only if they contain exactly the same elements.  Examples: A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A = B A = {dog, cat, horse}, B = {cat, horse, squirrel, dog} : A  B A = {dog, cat, horse}, B = {cat, horse, dog, dog} : A = B

5 Examples for Sets  “Standard” Sets: Natural numbers N = {0, 1, 2, 3, …} Integers Z = {…, -2, -1, 0, 1, 2, …} Positive Integers Z + = {1, 2, 3, 4, …} Real Numbers R = {47.3, -12, , …} Rational Numbers Q = {1.5, 2.6, -3.8, 15, …} (correct definition will follow)

6 Examples for Sets A =  “empty set/null set” A = {z} Note: z  A, but z  {z} A = {{b, c}, {c, x, d}} A = {{x, y}} Note: {x, y}  A, but {x, y}  {{x, y}} A = {x | P(x)} “set of all x such that P(x)” A = {x | x  N  x > 7} = {8, 9, 10, …} “set builder notation”

7 Examples for Sets  We are now able to define the set of rational numbers Q:  Q = {a/b | a  Z  b  Z + } or  Q = {a/b | a  Z  b  Z  b  0}  And how about the set of real numbers R?  R = {r | r is a real number} That is the best we can do.

8 Exercise 1  What are the members of the following sets?  A = {x| x  R  x 2 = 5}  B = {n | n  Z  n  2}  Use set-builder notation to describe the following sets:  The set of all positive integers that are divisible by 3  The set of all animals with black and white stripes

9 Why Sets?  Sets add another layer of notational convenience  Call it Logic 3.0!  We can use sets to simplify logic expressions  Let BW = {x | x is an animal and x has black and white stripes}  All animals with black and white stripes are easy to see  a  BW, easy-to-see(a)  There exists an animal without black and white stripes that is easy to see  a  BW, easy-to-see(a)

10 Subsets  A  B “A is a subset of B”  A  B if and only if every element of A is also an element of B.  We can completely formalize this:  A  B   x (x  A  x  B)  Examples: A = {3, 9}, B = {5, 9, 1, 3}, A  B ?true A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A  B ? false true A = {1, 2, 3}, B = {2, 3, 4}, A  B ?

11 Subsets  Useful rules: A = B  (A  B)  (B  A) (A  B)  (B  C)  A  C (see Venn Diagram)U A B C

12 Subsets  Useful rules:   A for any set A A  A for any set A  Proper subsets:  A  B “A is a proper subset of B”  A  B   x (x  A  x  B)   x (x  B  x  A)  or  A  B   x (x  A  x  B)   x (x  B  x  A)

13 Exercise 2  Is 3  A?  Is {3}  A?  Is {3}  A?  Is 3  A?  Is 3  B?  Is 3  B?  Is A  B?  Is A  D?  Is C  A?  Is D  A?  Is A = C?  Is A = D? Let A = {1,3,4}, B = {1,2,4}, C = {4,3,1,1}, D = {1,2,3,4}

14 Exercise 3  Let A = {a | a  Z    a  -3}, B = {b | b  Z  bk = 5 for some k  Z + }, C = {c | c  Z  c is prime  7 < c < 10}  Describe A, B and C by listing their elements  Is B  A?  Is A  B?  Is C  A?

15 Cardinality of Sets  If a set S contains n distinct elements, n  N, we call S a finite set with cardinality n.  Examples:  A = {Mercedes, BMW, Porsche}, |A| = 3 B = {1, {2, 3}, {4, 5}, 6}|B| = 4 C =  |C| = 0 D = { x  N | x  7000 }|D| = 7001 E = { x  N | x  7000 }E is infinite!

16 The Power Set   (A) “power set of A”   (A) = {B | B  A} (contains all subsets of A)  Examples:  A = {x, y, z}   (A) = { , {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}}  A =    (A) = {  }  Note: |A| = 0, |  (A)| = 1

17 The Power Set  Cardinality of power sets:  |  (A) | = 2 |A| Imagine each element in A has an “on/off” switch Each possible switch configuration in A corresponds to one element in 2 A z z z z z z z z z z z z z z z z z z y y y y y y y y y y y y y y y y y y x x x x x x x x x x x x x x x x x x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 A A For 3 elements in A, there are 2  2  2 = 8 elements in P(A)

18 Exercise 4  Find the power sets  ({1,2}) and  ({1,2,3})

19 Ordered Pairs  We are familiar with ordered pairs in algebra when we plot on a Cartesian coordinate system:  The pair (x,y) is ordered so that we know how to plot it on the axes  Important: (a,b) = (c,d)  a = c and b = d  The order matters! (x,y)

20 Cartesian Product  The ordered n-tuple (a 1, a 2, a 3, …, a n ) is an ordered collection of objects.  Just a general version of the ordered pair:  Two ordered n-tuples (a 1, a 2, a 3, …, a n ) and (b 1, b 2, b 3, …, b n ) are equal if and only if they contain exactly the same elements in the same order, i.e. a i = b i for 1  i  n.  The Cartesian product of two sets is defined as:  A  B = {(a, b) | a  A  b  B}  Example: A = {x, y}, B = {a, b, c} A  B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}

21 Cartesian Product  The Cartesian product of two sets is defined as: A  B = {(a, b) | a  A  b  B}  Example:  A = {good, bad}, B = {student, prof}  A  B = { (good, student),(good, prof),(bad, student), (bad, prof) } (student, good),(prof, good),(student, bad), (prof, bad) } B  A = {

22 Cartesian Product  Note that: A  =   A =  For non-empty sets A and B: A  B  A  B  B  A |A  B| = |A|  |B|  The Cartesian product of two or more sets is defined as:  A 1  A 2  …  A n = {(a 1, a 2, …, a n ) | a i  A for 1  i  n}

23 Set Operations  Union: A  B = {x | x  A  x  B}  Example: A = {a, b}, B = {b, c, d} A  B = {a, b, c, d}  Intersection: A  B = {x | x  A  x  B}  Example: A = {a, b}, B = {b, c, d} A  B = {b}

24 Set Operations  Two sets are called disjoint if their intersection is empty, that is, they share no elements:  A  B =   If a set C = A  B and A and B are disjoint, then the set P = {A,B} is referred to as a partition of C  The difference between two sets A and B contains exactly those elements of A that are not in B:  A-B = {x | x  A  x  B} Example: A = {a, b}, B = {b, c, d}, A-B = {a}

25 Set Operations  Given a Universe identified by the set U, the complement of a set A contains exactly those elements under consideration that are not in A:  A c = U-A  Example: U = N, B = {250, 251, 252, …} B c = {0, 1, 2, …, 248, 249}

26 Exercise 5  Let the Universe U = {0,1,2,3,…,9} and: A = {0,2,4,6,8} B = {1, 2, 4, 7} C = {1,5,7}  Find the following:  A  B  A  B  B c  A - B   (A  B) c   A  (B  C)   (A  B)  C   A c  B c

27 Exercise 6  Let A = {1,2,3,4,5,6,7} Which collections form a partition of A?  P 1 = {1,3}, {2,5}, {4,6,7}  P 2 ={1}, {2,4,6}, {3,5}  P 3 ={1,3,5,7}, {2,4,6}, {3,6}  Let B = {x | x  R  x  -2 }, C = {x | x  R  -2 4}  Is P 4 = {B,C,D} a partition of R?

28 Venn Diagrams of Operations  NOTE: The amount that A and B overlap is not always guaranteed AABB

29 Venn Diagrams of Operations AA AABB

30 BB AABB

31  A  B AABB

32 Venn Diagrams of Operations  A  B

33 Venn Diagrams of Operations  A - B

34 Venn Diagrams of Operations AcAc

35 Exercise 7  Draw a Venn Diagram to represent the following expressions over the sets A,B and C:  A  B =   A  B = A and C  B  C  A  B  A c – C  A  B   and A  C   and B  C   BUT A  B  C  

36 Section 6.2,6.3: Properties of Sets  Unifying Logic and Sets  Proofs with sets  Set identities

37 Logic and Sets  We can interpret our set operations logically:  A  B  x  A  x  B (Set-based implication)  A  B  x  A  x  B (Set-based OR)  A  B  x  A  x  B (Set-based AND)  x  A c  x  A (Set-based Negation)  A – B  x  A  x  B (NEW expressive power!)  (x,y)  A x B  x  A  y  B (NEW expressive power!)

38 Element Arguments  Prove that for all sets A and B, A  B  A  Normal starting Point: “Suppose A and B are arbitrarily chosen sets”  Where does this get us?  We make more progress using an ‘element argument’:  Note that A  B  A translates to “If x  A  B then x  A”  From this, we get the statement: “Suppose A and B are arbitrarily chosen sets and x  A  B”  Idea: focusing on a single arbitrary element in a set lets us prove something about every single element in the set!

39 Transitivity Revisited  Prove, using logical interpretations, the transitive property for subsets:  For all sets A, B and C, if A  B and B  C, then A  C.

40 Proving Equality  How can we Prove A  (B  C) = (A  B)  (A  C)?  Recall: A = B  A  B  B  A  To prove A = B, you must show both subset claims are true  So an equality proof really requires 2 element proofs!

41 Prove A  (B  C) = (A  B)  (A  C). 1. Prove that A  (B  C)  (A  B)  (A  C): Suppose that x is an arbitrarily chosen element of A  (B  C). There are 2 cases for x: x  A or x  (B  C) Case 1: x  A Since x  A, by definition of union, x  (A  B) and x  (A  C). Therefore, by definition, x  (A  B)  (A  C). Case 2: x  (B  C). By definition of intersection, x  B and x  C. By definition of union, x  (A  B) and x  (A  C). Therefore, by definition of intersection, x  (A  B)  (A  C)

42 Prove A  (B  C) = (A  B)  (A  C). 2. Prove that (A  B)  (A  C)  A  (B  C)  Drawing a Venn diagram might help us think this through… Suppose that x is an arbitrarily chosen element of (A  B)  (A  C). We’ll analyze this one element in two cases: x  A and x  A. Case 1: x  A It immediately follows that x  A  (B  C) by definition of union. Case 2: x  A Since x  (A  B)  (A  C), it must be true that x  (A  B) and x  (A  C). Since x  A in this case, it must follow that x  B and x  C or else x would not be a member of (A  B)  (A  C). Therefore, by definition of intersection, x  (B  C) and by definition of Union, x  A  (B  C)

43 OR…Use logic instead!  How can we prove A  (B  C) = (A  B)  (A  C)?  Suppose x is an arbitrary element of A  (B  C). Then by definition, the following statements are true: x  (A  (B  C))  (x  A)  (x  (B  C))  (x  A)  (x  B  x  C)  (x  A  x  B)  (x  A  x  C) (distributive law for logical expressions)  (x  (A  B))  (x  (A  C))  x  ((A  B)  (A  C)) Since each statement is a biconditional with the one before it, x  (A  (B  C))  x  ((A  B)  (A  C)) and x  ((A  B)  (A  C))  x  (A  (B  C)). So by definition, (A  (B  C))  ((A  B)  (A  C)) and ((A  B)  (A  C))  (A  (B  C)). Therefore, A  (B  C) = (A  B)  (A  C)

44 Which method to use?  You may use an element argument or logic conversions to prove set identities on assignments and exams  Which one you choose depends on your strengths  Neither approach is ‘easier’ than the other  Element arguments provide more direction about where you’re headed  Logic arguments have less direction, but tend to be more concise

45 Set Identities—Look Familiar?

46 Exercise 1  Use Venn Diagrams to verify the following set-theoretic DeMorgan’s law:  (A  B) c = A c  B c

47 Exercise 2  Recall that two sets are disjoint if their intersection is the empty set (A  B =  ).  Draw venn diagrams for the sets A – B and B – A  Use Theorem 6.2.2 to construct a proof that A – B and B – A are disjoint

48 Exercise 3  Use Theorem 6.2.2 to prove the following: (A  (B  C)  ((A  B) – C) = A  B

49 A Technology Tie-In  Don’t forget your set theory—You’ll use it in Databases!  Each ‘table’ in a database is called a relation, filled with tuples  Database theory says that a relation is actually a subset of the universe of all possible tuples Sailors

50 A Technology Tie-In  SQL ( structured query language ): Select SID, SNAME, RATING, AGE FROM SAILORS WHERE AGE > 40  S = {X  SAILORS | AGE > 40}  See the similarity? Remembering set-theory will really help you work with databases Sailors


Download ppt "DISCRETE MATHEMATICS I LECTURES CHAPTER 6 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam."

Similar presentations


Ads by Google