Upcoming SlideShare
×

# Discrete Mathematics - Predicates and Sets

17,703 views

Published on

Predicates, quantifiers. Sets, subsets, power sets, set operations, laws of set theory, principle of inclusion-exclusion.

1 Comment
7 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• These slides have been deprecated. Please refer to the "Predicates and Proofs" and "Sets" slides.

Are you sure you want to  Yes  No
Views
Total views
17,703
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
462
1
Likes
7
Embeds 0
No embeds

No notes for slide

### Discrete Mathematics - Predicates and Sets

1. 1. Discrete Mathematics Predicates and SetsH. Turgut Uyar Ay¸eg¨l Gen¸ata Yayımlı s u c Emre Harmancı 2001-2013
2. 2. License c 2001-2013 T. Uyar, A. Yayımlı, E. Harmancı You are free: to Share – to copy, distribute and transmit the work to Remix – to adapt the work Under the following conditions: Attribution – You must attribute the work in the manner speciﬁed by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial – You may not use this work for commercial purposes. Share Alike – If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. Legal code (the full license): http://creativecommons.org/licenses/by-nc-sa/3.0/
3. 3. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
4. 4. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
5. 5. Predicate Deﬁnition predicate (or open statement): a declarative sentence which contains one or more variables, and is not a proposition, but becomes a proposition when the variables in it are replaced by certain allowable choices
6. 6. Universe of Discourse Deﬁnition universe of discourse: U set of allowable choices examples: Z: integers N: natural numbers Z+ : positive integers Q: rational numbers R: real numbers C: complex numbers
7. 7. Universe of Discourse Deﬁnition universe of discourse: U set of allowable choices examples: Z: integers N: natural numbers Z+ : positive integers Q: rational numbers R: real numbers C: complex numbers
8. 8. Predicate Examples Example U =N p(x): x + 2 is an even integer p(5): F p(8): T ¬p(x): x + 2 is not an even integer Example U =N q(x, y ): x + y and x − 2y are even integers q(11, 3): F , q(14, 4): T
9. 9. Predicate Examples Example U =N p(x): x + 2 is an even integer p(5): F p(8): T ¬p(x): x + 2 is not an even integer Example U =N q(x, y ): x + y and x − 2y are even integers q(11, 3): F , q(14, 4): T
10. 10. Predicate Examples Example U =N p(x): x + 2 is an even integer p(5): F p(8): T ¬p(x): x + 2 is not an even integer Example U =N q(x, y ): x + y and x − 2y are even integers q(11, 3): F , q(14, 4): T
11. 11. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
12. 12. Quantiﬁers Deﬁnition Deﬁnition existential quantiﬁer: universal quantiﬁer: predicate is true for some values predicate is true for all values symbol: ∃ symbol: ∀ read: there exists read: for all symbol: ∃! read: there exists only one
13. 13. Quantiﬁers Deﬁnition Deﬁnition existential quantiﬁer: universal quantiﬁer: predicate is true for some values predicate is true for all values symbol: ∃ symbol: ∀ read: there exists read: for all symbol: ∃! read: there exists only one
14. 14. Quantiﬁers Deﬁnition Deﬁnition existential quantiﬁer: universal quantiﬁer: predicate is true for some values predicate is true for all values symbol: ∃ symbol: ∀ read: there exists read: for all symbol: ∃! read: there exists only one
15. 15. Quantiﬁers existential quantiﬁer U = {x1 , x2 , . . . , xn } ∃x p(x) ≡ p(x1 ) ∨ p(x2 ) ∨ · · · ∨ p(xn ) p(x) is true for some x universal quantiﬁer U = {x1 , x2 , . . . , xn } ∀x p(x) ≡ p(x1 ) ∧ p(x2 ) ∧ · · · ∧ p(xn ) p(x) is true for all x
16. 16. Quantiﬁers existential quantiﬁer U = {x1 , x2 , . . . , xn } ∃x p(x) ≡ p(x1 ) ∨ p(x2 ) ∨ · · · ∨ p(xn ) p(x) is true for some x universal quantiﬁer U = {x1 , x2 , . . . , xn } ∀x p(x) ≡ p(x1 ) ∧ p(x2 ) ∧ · · · ∧ p(xn ) p(x) is true for all x
17. 17. Quantiﬁer Examples Example U =R p(x) : x ≥ 0 ∃x [p(x) ∧ r (x)] q(x) : x 2 ≥ 0 ∀x [p(x) → q(x)] r (x) : (x − 4)(x + 1) = 0 ∀x [q(x) → s(x)] s(x) : x 2 − 3 > 0 ∀x [r (x) ∨ s(x)] ∀x [r (x) → p(x)] are the following expressions true?
18. 18. Quantiﬁer Examples Example U =R p(x) : x ≥ 0 ∃x [p(x) ∧ r (x)] q(x) : x 2 ≥ 0 ∀x [p(x) → q(x)] r (x) : (x − 4)(x + 1) = 0 ∀x [q(x) → s(x)] s(x) : x 2 − 3 > 0 ∀x [r (x) ∨ s(x)] ∀x [r (x) → p(x)] are the following expressions true?
19. 19. Quantiﬁer Examples Example U =R p(x) : x ≥ 0 ∃x [p(x) ∧ r (x)] q(x) : x 2 ≥ 0 ∀x [p(x) → q(x)] r (x) : (x − 4)(x + 1) = 0 ∀x [q(x) → s(x)] s(x) : x 2 − 3 > 0 ∀x [r (x) ∨ s(x)] ∀x [r (x) → p(x)] are the following expressions true?
20. 20. Quantiﬁer Examples Example U =R p(x) : x ≥ 0 ∃x [p(x) ∧ r (x)] q(x) : x 2 ≥ 0 ∀x [p(x) → q(x)] r (x) : (x − 4)(x + 1) = 0 ∀x [q(x) → s(x)] s(x) : x 2 − 3 > 0 ∀x [r (x) ∨ s(x)] ∀x [r (x) → p(x)] are the following expressions true?
21. 21. Quantiﬁer Examples Example U =R p(x) : x ≥ 0 ∃x [p(x) ∧ r (x)] q(x) : x 2 ≥ 0 ∀x [p(x) → q(x)] r (x) : (x − 4)(x + 1) = 0 ∀x [q(x) → s(x)] s(x) : x 2 − 3 > 0 ∀x [r (x) ∨ s(x)] ∀x [r (x) → p(x)] are the following expressions true?
22. 22. Quantiﬁer Examples Example U =R p(x) : x ≥ 0 ∃x [p(x) ∧ r (x)] q(x) : x 2 ≥ 0 ∀x [p(x) → q(x)] r (x) : (x − 4)(x + 1) = 0 ∀x [q(x) → s(x)] s(x) : x 2 − 3 > 0 ∀x [r (x) ∨ s(x)] ∀x [r (x) → p(x)] are the following expressions true?
23. 23. Negating Quantiﬁers replace ∀ with ∃, and ∃ with ∀ negate the predicate ¬∃x p(x) ⇔ ∀x ¬p(x) ¬∃x ¬p(x) ⇔ ∀x p(x) ¬∀x p(x) ⇔ ∃x ¬p(x) ¬∀x ¬p(x) ⇔ ∃x p(x)
24. 24. Negating Quantiﬁers replace ∀ with ∃, and ∃ with ∀ negate the predicate ¬∃x p(x) ⇔ ∀x ¬p(x) ¬∃x ¬p(x) ⇔ ∀x p(x) ¬∀x p(x) ⇔ ∃x ¬p(x) ¬∀x ¬p(x) ⇔ ∃x p(x)
25. 25. Negating Quantiﬁers Theorem ¬∃x p(x) ⇔ ∀x ¬p(x) Proof. ¬∃x p(x) ≡ ¬[p(x1 ) ∨ p(x2 ) ∨ · · · ∨ p(xn )] ⇔ ¬p(x1 ) ∧ ¬p(x2 ) ∧ · · · ∧ ¬p(xn ) ≡ ∀x ¬p(x)
26. 26. Negating Quantiﬁers Theorem ¬∃x p(x) ⇔ ∀x ¬p(x) Proof. ¬∃x p(x) ≡ ¬[p(x1 ) ∨ p(x2 ) ∨ · · · ∨ p(xn )] ⇔ ¬p(x1 ) ∧ ¬p(x2 ) ∧ · · · ∧ ¬p(xn ) ≡ ∀x ¬p(x)
27. 27. Negating Quantiﬁers Theorem ¬∃x p(x) ⇔ ∀x ¬p(x) Proof. ¬∃x p(x) ≡ ¬[p(x1 ) ∨ p(x2 ) ∨ · · · ∨ p(xn )] ⇔ ¬p(x1 ) ∧ ¬p(x2 ) ∧ · · · ∧ ¬p(xn ) ≡ ∀x ¬p(x)
28. 28. Negating Quantiﬁers Theorem ¬∃x p(x) ⇔ ∀x ¬p(x) Proof. ¬∃x p(x) ≡ ¬[p(x1 ) ∨ p(x2 ) ∨ · · · ∨ p(xn )] ⇔ ¬p(x1 ) ∧ ¬p(x2 ) ∧ · · · ∧ ¬p(xn ) ≡ ∀x ¬p(x)
29. 29. Predicate Equivalences Theorem ∃x [p(x) ∨ q(x)] ⇔ ∃x p(x) ∨ ∃x q(x) Theorem ∀x [p(x) ∧ q(x)] ⇔ ∀x p(x) ∧ ∀x q(x)
30. 30. Predicate Equivalences Theorem ∃x [p(x) ∨ q(x)] ⇔ ∃x p(x) ∨ ∃x q(x) Theorem ∀x [p(x) ∧ q(x)] ⇔ ∀x p(x) ∧ ∀x q(x)
31. 31. Predicate Implications Theorem ∀x p(x) ⇒ ∃x p(x) Theorem ∃x [p(x) ∧ q(x)] ⇒ ∃x p(x) ∧ ∃x q(x) Theorem ∀x p(x) ∨ ∀x q(x) ⇒ ∀x [p(x) ∨ q(x)]
32. 32. Predicate Implications Theorem ∀x p(x) ⇒ ∃x p(x) Theorem ∃x [p(x) ∧ q(x)] ⇒ ∃x p(x) ∧ ∃x q(x) Theorem ∀x p(x) ∨ ∀x q(x) ⇒ ∀x [p(x) ∨ q(x)]
33. 33. Predicate Implications Theorem ∀x p(x) ⇒ ∃x p(x) Theorem ∃x [p(x) ∧ q(x)] ⇒ ∃x p(x) ∧ ∃x q(x) Theorem ∀x p(x) ∨ ∀x q(x) ⇒ ∀x [p(x) ∨ q(x)]
34. 34. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
35. 35. Multiple Quantiﬁers ∃x∃y p(x, y ) ∀x∃y p(x, y ) ∃x∀y p(x, y ) ∀x∀y p(x, y )
36. 36. Multiple Quantiﬁer Examples Example U =Z p(x, y ) : x + y = 17 ∀x∃y p(x, y ): for every x there exists a y such that x + y = 17 ∃y ∀x p(x, y ): there exists a y so that for all x, x + y = 17 what if U = N?
37. 37. Multiple Quantiﬁer Examples Example U =Z p(x, y ) : x + y = 17 ∀x∃y p(x, y ): for every x there exists a y such that x + y = 17 ∃y ∀x p(x, y ): there exists a y so that for all x, x + y = 17 what if U = N?
38. 38. Multiple Quantiﬁer Examples Example U =Z p(x, y ) : x + y = 17 ∀x∃y p(x, y ): for every x there exists a y such that x + y = 17 ∃y ∀x p(x, y ): there exists a y so that for all x, x + y = 17 what if U = N?
39. 39. Multiple Quantiﬁer Examples Example U =Z p(x, y ) : x + y = 17 ∀x∃y p(x, y ): for every x there exists a y such that x + y = 17 ∃y ∀x p(x, y ): there exists a y so that for all x, x + y = 17 what if U = N?
40. 40. Multiple Quantiﬁers Example Ux = {1, 2} ∧ Uy = {A, B} ∃x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∨ [p(2, A) ∨ p(2, B)] ∃x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∨ [p(2, A) ∧ p(2, B)] ∀x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∧ [p(2, A) ∨ p(2, B)] ∀x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∧ [p(2, A) ∧ p(2, B)]
41. 41. Multiple Quantiﬁers Example Ux = {1, 2} ∧ Uy = {A, B} ∃x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∨ [p(2, A) ∨ p(2, B)] ∃x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∨ [p(2, A) ∧ p(2, B)] ∀x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∧ [p(2, A) ∨ p(2, B)] ∀x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∧ [p(2, A) ∧ p(2, B)]
42. 42. Multiple Quantiﬁers Example Ux = {1, 2} ∧ Uy = {A, B} ∃x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∨ [p(2, A) ∨ p(2, B)] ∃x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∨ [p(2, A) ∧ p(2, B)] ∀x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∧ [p(2, A) ∨ p(2, B)] ∀x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∧ [p(2, A) ∧ p(2, B)]
43. 43. Multiple Quantiﬁers Example Ux = {1, 2} ∧ Uy = {A, B} ∃x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∨ [p(2, A) ∨ p(2, B)] ∃x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∨ [p(2, A) ∧ p(2, B)] ∀x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∧ [p(2, A) ∨ p(2, B)] ∀x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∧ [p(2, A) ∧ p(2, B)]
44. 44. Multiple Quantiﬁers Example Ux = {1, 2} ∧ Uy = {A, B} ∃x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∨ [p(2, A) ∨ p(2, B)] ∃x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∨ [p(2, A) ∧ p(2, B)] ∀x∃y p(x, y ) ≡ [p(1, A) ∨ p(1, B)] ∧ [p(2, A) ∨ p(2, B)] ∀x∀y p(x, y ) ≡ [p(1, A) ∧ p(1, B)] ∧ [p(2, A) ∧ p(2, B)]
45. 45. References Required Reading: Grimaldi Chapter 2: Fundamentals of Logic 2.4. The Use of Quantiﬁers Supplementary Reading: O’Donnell, Hall, Page Chapter 7: Predicate Logic
46. 46. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
47. 47. Set Deﬁnition set: a collection of elements that are distinct unordered non-repeating
48. 48. Set Representation explicit representation elements are listed within braces: {a1 , a2 , . . . , an } implicit representation elements that validate a predicate: {x|x ∈ G , p(x)} ∅: empty set let S be a set, and a be an element a ∈ S: a is an element of set S a ∈ S: a is not an element of set S / |S|: number of elements (cardinality)
49. 49. Set Representation explicit representation elements are listed within braces: {a1 , a2 , . . . , an } implicit representation elements that validate a predicate: {x|x ∈ G , p(x)} ∅: empty set let S be a set, and a be an element a ∈ S: a is an element of set S a ∈ S: a is not an element of set S / |S|: number of elements (cardinality)
50. 50. Set Representation explicit representation elements are listed within braces: {a1 , a2 , . . . , an } implicit representation elements that validate a predicate: {x|x ∈ G , p(x)} ∅: empty set let S be a set, and a be an element a ∈ S: a is an element of set S a ∈ S: a is not an element of set S / |S|: number of elements (cardinality)
51. 51. Set Representation explicit representation elements are listed within braces: {a1 , a2 , . . . , an } implicit representation elements that validate a predicate: {x|x ∈ G , p(x)} ∅: empty set let S be a set, and a be an element a ∈ S: a is an element of set S a ∈ S: a is not an element of set S / |S|: number of elements (cardinality)
52. 52. Set Representation explicit representation elements are listed within braces: {a1 , a2 , . . . , an } implicit representation elements that validate a predicate: {x|x ∈ G , p(x)} ∅: empty set let S be a set, and a be an element a ∈ S: a is an element of set S a ∈ S: a is not an element of set S / |S|: number of elements (cardinality)
53. 53. Explicit Representation Example Example {3, 8, 2, 11, 5} 11 ∈ {3, 8, 2, 11, 5} |{3, 8, 2, 11, 5}| = 5
54. 54. Implicit Representation Examples Example {x|x ∈ Z+ , 20 < x 3 < 100} ≡ {3, 4} {2x − 1|x ∈ Z+ , 20 < x 3 < 100} ≡ {5, 7} Example A = {x|x ∈ R, 1 ≤ x ≤ 5} Example E = {n|n ∈ N, ∃k ∈ N [n = 2k]} A = {x|x ∈ E , 1 ≤ x ≤ 5}
55. 55. Implicit Representation Examples Example {x|x ∈ Z+ , 20 < x 3 < 100} ≡ {3, 4} {2x − 1|x ∈ Z+ , 20 < x 3 < 100} ≡ {5, 7} Example A = {x|x ∈ R, 1 ≤ x ≤ 5} Example E = {n|n ∈ N, ∃k ∈ N [n = 2k]} A = {x|x ∈ E , 1 ≤ x ≤ 5}
56. 56. Implicit Representation Examples Example {x|x ∈ Z+ , 20 < x 3 < 100} ≡ {3, 4} {2x − 1|x ∈ Z+ , 20 < x 3 < 100} ≡ {5, 7} Example A = {x|x ∈ R, 1 ≤ x ≤ 5} Example E = {n|n ∈ N, ∃k ∈ N [n = 2k]} A = {x|x ∈ E , 1 ≤ x ≤ 5}
57. 57. Set Dilemma There is a barber who lives in a small town. He shaves all those men who don’t shave themselves. He doesn’t shave those men who shave themselves. Does the barber shave himself? yes → but he doesn’t shave men who shave themselves → no no → but he shaves all men who don’t shave themselves → yes
58. 58. Set Dilemma There is a barber who lives in a small town. He shaves all those men who don’t shave themselves. He doesn’t shave those men who shave themselves. Does the barber shave himself? yes → but he doesn’t shave men who shave themselves → no no → but he shaves all men who don’t shave themselves → yes
59. 59. Set Dilemma There is a barber who lives in a small town. He shaves all those men who don’t shave themselves. He doesn’t shave those men who shave themselves. Does the barber shave himself? yes → but he doesn’t shave men who shave themselves → no no → but he shaves all men who don’t shave themselves → yes
60. 60. Set Dilemma let S be the set of sets that are not an element of themselves S = {A|A ∈ A} / Is S an element of itself? yes → but the predicate is not valid → no no → but the predicate is valid → yes
61. 61. Set Dilemma let S be the set of sets that are not an element of themselves S = {A|A ∈ A} / Is S an element of itself? yes → but the predicate is not valid → no no → but the predicate is valid → yes
62. 62. Set Dilemma let S be the set of sets that are not an element of themselves S = {A|A ∈ A} / Is S an element of itself? yes → but the predicate is not valid → no no → but the predicate is valid → yes
63. 63. Set Dilemma let S be the set of sets that are not an element of themselves S = {A|A ∈ A} / Is S an element of itself? yes → but the predicate is not valid → no no → but the predicate is valid → yes
64. 64. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
65. 65. Subset Deﬁnition A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B] set equality: A = B ⇔ (A ⊆ B) ∧ (B ⊆ A) proper subset: A ⊂ B ⇔ (A ⊆ B) ∧ (A = B) ∀S [∅ ⊆ S]
66. 66. Subset Deﬁnition A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B] set equality: A = B ⇔ (A ⊆ B) ∧ (B ⊆ A) proper subset: A ⊂ B ⇔ (A ⊆ B) ∧ (A = B) ∀S [∅ ⊆ S]
67. 67. Subset Deﬁnition A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B] set equality: A = B ⇔ (A ⊆ B) ∧ (B ⊆ A) proper subset: A ⊂ B ⇔ (A ⊆ B) ∧ (A = B) ∀S [∅ ⊆ S]
68. 68. Subset Deﬁnition A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B] set equality: A = B ⇔ (A ⊆ B) ∧ (B ⊆ A) proper subset: A ⊂ B ⇔ (A ⊆ B) ∧ (A = B) ∀S [∅ ⊆ S]
69. 69. Subset not a subset A B ⇔ ¬∀x [x ∈ A → x ∈ B] ⇔ ∃x ¬[x ∈ A → x ∈ B] ⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ (x ∈ B)] /
70. 70. Subset not a subset A B ⇔ ¬∀x [x ∈ A → x ∈ B] ⇔ ∃x ¬[x ∈ A → x ∈ B] ⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ (x ∈ B)] /
71. 71. Subset not a subset A B ⇔ ¬∀x [x ∈ A → x ∈ B] ⇔ ∃x ¬[x ∈ A → x ∈ B] ⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ (x ∈ B)] /
72. 72. Subset not a subset A B ⇔ ¬∀x [x ∈ A → x ∈ B] ⇔ ∃x ¬[x ∈ A → x ∈ B] ⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ (x ∈ B)] /
73. 73. Subset not a subset A B ⇔ ¬∀x [x ∈ A → x ∈ B] ⇔ ∃x ¬[x ∈ A → x ∈ B] ⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)] ⇔ ∃x [(x ∈ A) ∧ (x ∈ B)] /
74. 74. Power Set Deﬁnition power set: P(S) the set of all subsets of a set, including the empty set and the set itself if a set has n elements, its power set has 2n elements
75. 75. Power Set Deﬁnition power set: P(S) the set of all subsets of a set, including the empty set and the set itself if a set has n elements, its power set has 2n elements
76. 76. Example of Power Set Example P({1, 2, 3}) = { ∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3} }
77. 77. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
78. 78. Set Operations complement A = {x|x ∈ A} / intersection A ∩ B = {x|(x ∈ A) ∧ (x ∈ B)} if A ∩ B = ∅ then A and B are disjoint union A ∪ B = {x|(x ∈ A) ∨ (x ∈ B)}
79. 79. Set Operations complement A = {x|x ∈ A} / intersection A ∩ B = {x|(x ∈ A) ∧ (x ∈ B)} if A ∩ B = ∅ then A and B are disjoint union A ∪ B = {x|(x ∈ A) ∨ (x ∈ B)}
80. 80. Set Operations complement A = {x|x ∈ A} / intersection A ∩ B = {x|(x ∈ A) ∧ (x ∈ B)} if A ∩ B = ∅ then A and B are disjoint union A ∪ B = {x|(x ∈ A) ∨ (x ∈ B)}
81. 81. Set Operations diﬀerence A − B = {x|(x ∈ A) ∧ (x ∈ B)} / A−B =A∩B symmetric diﬀerence: A B = {x|(x ∈ A ∪ B) ∧ (x ∈ A ∩ B)} /
82. 82. Set Operations diﬀerence A − B = {x|(x ∈ A) ∧ (x ∈ B)} / A−B =A∩B symmetric diﬀerence: A B = {x|(x ∈ A ∪ B) ∧ (x ∈ A ∩ B)} /
83. 83. Set Operations diﬀerence A − B = {x|(x ∈ A) ∧ (x ∈ B)} / A−B =A∩B symmetric diﬀerence: A B = {x|(x ∈ A ∪ B) ∧ (x ∈ A ∩ B)} /
84. 84. Cartesian Product Deﬁnition Cartesian product: A × B = {(a, b)|a ∈ A, b ∈ B} A × B × C × · · · × N = {(a, b, . . . , n)|a ∈ A, b ∈ B, . . . , n ∈ N} |A × B × C × · · · × N| = |A| · |B| · |C | · · · |N|
85. 85. Cartesian Product Deﬁnition Cartesian product: A × B = {(a, b)|a ∈ A, b ∈ B} A × B × C × · · · × N = {(a, b, . . . , n)|a ∈ A, b ∈ B, . . . , n ∈ N} |A × B × C × · · · × N| = |A| · |B| · |C | · · · |N|
86. 86. Cartesian Product Example Example A = {a1 .a2 , a3 , a4 } B = {b1 , b2 , b3 } A×B = { (a1 , b1 ), (a1 , b2 ), (a1 , b3 ), (a2 , b1 ), (a2 , b2 ), (a2 , b3 ), (a3 , b1 ), (a3 , b2 ), (a3 , b3 ), (a4 , b1 ), (a4 , b2 ), (a4 , b3 ) }
87. 87. Equivalences Double Complement A=A Commutativity A∩B =B ∩A A∪B =B ∪A Associativity (A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C ) Idempotence A∩A=A A∪A=A Inverse A∩A=∅ A∪A=U
88. 88. Equivalences Double Complement A=A Commutativity A∩B =B ∩A A∪B =B ∪A Associativity (A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C ) Idempotence A∩A=A A∪A=A Inverse A∩A=∅ A∪A=U
89. 89. Equivalences Double Complement A=A Commutativity A∩B =B ∩A A∪B =B ∪A Associativity (A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C ) Idempotence A∩A=A A∪A=A Inverse A∩A=∅ A∪A=U
90. 90. Equivalences Double Complement A=A Commutativity A∩B =B ∩A A∪B =B ∪A Associativity (A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C ) Idempotence A∩A=A A∪A=A Inverse A∩A=∅ A∪A=U
91. 91. Equivalences Double Complement A=A Commutativity A∩B =B ∩A A∪B =B ∪A Associativity (A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C ) Idempotence A∩A=A A∪A=A Inverse A∩A=∅ A∪A=U
92. 92. Equivalences Identity A∩U =A A∪∅=A Domination A∩∅=∅ A∪U =U Distributivity A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ) Absorption A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A DeMorgan’s Laws A∩B =A∪B A∪B =A∩B
93. 93. Equivalences Identity A∩U =A A∪∅=A Domination A∩∅=∅ A∪U =U Distributivity A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ) Absorption A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A DeMorgan’s Laws A∩B =A∪B A∪B =A∩B
94. 94. Equivalences Identity A∩U =A A∪∅=A Domination A∩∅=∅ A∪U =U Distributivity A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ) Absorption A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A DeMorgan’s Laws A∩B =A∪B A∪B =A∩B
95. 95. Equivalences Identity A∩U =A A∪∅=A Domination A∩∅=∅ A∪U =U Distributivity A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ) Absorption A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A DeMorgan’s Laws A∩B =A∪B A∪B =A∩B
96. 96. Equivalences Identity A∩U =A A∪∅=A Domination A∩∅=∅ A∪U =U Distributivity A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ) Absorption A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A DeMorgan’s Laws A∩B =A∪B A∪B =A∩B
97. 97. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
98. 98. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
99. 99. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
100. 100. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
101. 101. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
102. 102. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
103. 103. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
104. 104. DeMorgan’s Laws Proof. A ∩ B = {x|x ∈ (A ∩ B)} / = {x|¬(x ∈ (A ∩ B))} = {x|¬((x ∈ A) ∧ (x ∈ B))} = {x|¬(x ∈ A) ∨ ¬(x ∈ B)} = {x|(x ∈ A) ∨ (x ∈ B)} / / = {x|(x ∈ A) ∨ (x ∈ B)} = {x|x ∈ A ∪ B} = A∪B
105. 105. Example of Equivalence Theorem A ∩ (B − C ) = (A ∩ B) − (A ∩ C )
106. 106. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
107. 107. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
108. 108. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
109. 109. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
110. 110. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
111. 111. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
112. 112. Equivalence Example Proof. (A ∩ B) − (A ∩ C ) = (A ∩ B) ∩ (A ∩ C ) = (A ∩ B) ∩ (A ∪ C ) = ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C )) = ∅ ∪ ((A ∩ B) ∩ C )) = (A ∩ B) ∩ C = A ∩ (B ∩ C ) = A ∩ (B − C )
113. 113. Topics 1 Predicates Introduction Quantiﬁers Multiple Quantiﬁers 2 Sets Introduction Subset Set Operations Inclusion-Exclusion
114. 114. Principle of Inclusion-Exclusion |A ∪ B| = |A| + |B| − |A ∩ B| |A ∪ B ∪ C | = |A| + |B| + |C | − (|A ∩ B| + |A ∩ C | + |B ∩ C |) + |A ∩ B ∩ C | Theorem |A1 ∪ A2 ∪ · · · ∪ An | = |Ai | − |Ai ∩ Aj | i i,j + |Ai ∩ Aj ∩ Ak | i,j,k · · · + −1n−1 |Ai ∩ Aj ∩ · · · ∩ An |
115. 115. Principle of Inclusion-Exclusion |A ∪ B| = |A| + |B| − |A ∩ B| |A ∪ B ∪ C | = |A| + |B| + |C | − (|A ∩ B| + |A ∩ C | + |B ∩ C |) + |A ∩ B ∩ C | Theorem |A1 ∪ A2 ∪ · · · ∪ An | = |Ai | − |Ai ∩ Aj | i i,j + |Ai ∩ Aj ∩ Ak | i,j,k · · · + −1n−1 |Ai ∩ Aj ∩ · · · ∩ An |
116. 116. Principle of Inclusion-Exclusion |A ∪ B| = |A| + |B| − |A ∩ B| |A ∪ B ∪ C | = |A| + |B| + |C | − (|A ∩ B| + |A ∩ C | + |B ∩ C |) + |A ∩ B ∩ C | Theorem |A1 ∪ A2 ∪ · · · ∪ An | = |Ai | − |Ai ∩ Aj | i i,j + |Ai ∩ Aj ∩ Ak | i,j,k · · · + −1n−1 |Ai ∩ Aj ∩ · · · ∩ An |
117. 117. Inclusion-Exclusion Example Example (sieve of Eratosthenes) a method to identify prime numbers 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 2 3 5 7 11 13 17 19 23 25 29 2 3 5 7 11 13 17 19 23 29
118. 118. Inclusion-Exclusion Example Example (sieve of Eratosthenes) a method to identify prime numbers 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 2 3 5 7 11 13 17 19 23 25 29 2 3 5 7 11 13 17 19 23 29
119. 119. Inclusion-Exclusion Example Example (sieve of Eratosthenes) a method to identify prime numbers 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 2 3 5 7 11 13 17 19 23 25 29 2 3 5 7 11 13 17 19 23 29
120. 120. Inclusion-Exclusion Example Example (sieve of Eratosthenes) a method to identify prime numbers 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 2 3 5 7 11 13 17 19 23 25 29 2 3 5 7 11 13 17 19 23 29
121. 121. Inclusion-Exclusion Example Example (sieve of Eratosthenes) a method to identify prime numbers 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 2 3 5 7 11 13 17 19 23 25 29 2 3 5 7 11 13 17 19 23 29
122. 122. Inclusion-Exclusion Example Example (sieve of Eratosthenes) number of primes between 1 and 100 numbers that are not divisible by 2, 3, 5 and 7 A2 : set of numbers divisible by 2 A3 : set of numbers divisible by 3 A5 : set of numbers divisible by 5 A7 : set of numbers divisible by 7 |A2 ∪ A3 ∪ A5 ∪ A7 |
123. 123. Inclusion-Exclusion Example Example (sieve of Eratosthenes) number of primes between 1 and 100 numbers that are not divisible by 2, 3, 5 and 7 A2 : set of numbers divisible by 2 A3 : set of numbers divisible by 3 A5 : set of numbers divisible by 5 A7 : set of numbers divisible by 7 |A2 ∪ A3 ∪ A5 ∪ A7 |
124. 124. Inclusion-Exclusion Example Example (sieve of Eratosthenes) number of primes between 1 and 100 numbers that are not divisible by 2, 3, 5 and 7 A2 : set of numbers divisible by 2 A3 : set of numbers divisible by 3 A5 : set of numbers divisible by 5 A7 : set of numbers divisible by 7 |A2 ∪ A3 ∪ A5 ∪ A7 |
125. 125. Inclusion-Exclusion Example Example (sieve of Eratosthenes) |A2 | = 100/2 = 50 |A2 ∩ A3 | = 100/6 = 16 |A3 | = 100/3 = 33 |A2 ∩ A5 | = 100/10 = 10 |A5 | = 100/5 = 20 |A2 ∩ A7 | = 100/14 = 7 |A7 | = 100/7 = 14 |A3 ∩ A5 | = 100/15 = 6 |A3 ∩ A7 | = 100/21 = 4 |A5 ∩ A7 | = 100/35 = 2
126. 126. Inclusion-Exclusion Example Example (sieve of Eratosthenes) |A2 | = 100/2 = 50 |A2 ∩ A3 | = 100/6 = 16 |A3 | = 100/3 = 33 |A2 ∩ A5 | = 100/10 = 10 |A5 | = 100/5 = 20 |A2 ∩ A7 | = 100/14 = 7 |A7 | = 100/7 = 14 |A3 ∩ A5 | = 100/15 = 6 |A3 ∩ A7 | = 100/21 = 4 |A5 ∩ A7 | = 100/35 = 2
127. 127. Inclusion-Exclusion Example Example (sieve of Eratosthenes) |A2 ∩ A3 ∩ A5 | = 100/30 = 3 |A2 ∩ A3 ∩ A7 | = 100/42 = 2 |A2 ∩ A5 ∩ A7 | = 100/70 = 1 |A3 ∩ A5 ∩ A7 | = 100/105 = 0 |A2 ∩ A3 ∩ A5 ∩ A7 | = 100/210 = 0
128. 128. Inclusion-Exclusion Example Example (sieve of Eratosthenes) |A2 ∩ A3 ∩ A5 | = 100/30 = 3 |A2 ∩ A3 ∩ A7 | = 100/42 = 2 |A2 ∩ A5 ∩ A7 | = 100/70 = 1 |A3 ∩ A5 ∩ A7 | = 100/105 = 0 |A2 ∩ A3 ∩ A5 ∩ A7 | = 100/210 = 0
129. 129. Inclusion-Exclusion Example Example (sieve of Eratosthenes) |A2 ∪ A3 ∪ A5 ∪ A7 | = (50 + 33 + 20 + 14) − (16 + 10 + 7 + 6 + 4 + 2) + (3 + 2 + 1 + 0) − (0) = 78 number of primes: (100 − 78) + 4 − 1 = 25
130. 130. Inclusion-Exclusion Example Example (sieve of Eratosthenes) |A2 ∪ A3 ∪ A5 ∪ A7 | = (50 + 33 + 20 + 14) − (16 + 10 + 7 + 6 + 4 + 2) + (3 + 2 + 1 + 0) − (0) = 78 number of primes: (100 − 78) + 4 − 1 = 25
131. 131. References Required Reading: Grimaldi Chapter 3: Set Theory 3.1. Sets and Subsets 3.2. Set Operations and the Laws of Set Theory Chapter 8: The Principle of Inclusion and Exclusion 8.1. The Principle of Inclusion and Exclusion Supplementary Reading: O’Donnell, Hall, Page Chapter 8: Set Theory