04 - Sets

1 380 vues

Publié le

I used this set of slides for the lecture on Sets I gave at the University of Zurich for the 1st year students following the course of Formale Grundlagen der Informatik.

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

04 - Sets

  1. 1. Logic reloaded www.tudorgirba.com
  2. 2. What exactly is logic?
  3. 3. What exactly is logic? the study of the principles of correct reasoning
  4. 4. Wax on … wax off … these are the basics http://www.youtube.com/watch?v=3PycZtfns_U
  5. 5. Sets www.tudorgirba.com
  6. 6. computer information information computation
  7. 7. Set A set is a group of objects.
  8. 8. Set A set is a group of objects. {10, 23, 32}
  9. 9. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … }
  10. 10. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … } Z = {… , -2, -1, 0, 1, 2, … }
  11. 11. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … } Z = {… , -2, -1, 0, 1, 2, … } Ø empty set
  12. 12. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … } Z = {… , -2, -1, 0, 1, 2, … } Ø U empty set universe
  13. 13. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … } Z = {… , -2, -1, 0, 1, 2, … } Ø U empty set universe Membership a is a member of set A
  14. 14. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … } Z = {… , -2, -1, 0, 1, 2, … } 10 ∈ {10, 23, 32} Ø U empty set universe Membership a is a member of set A
  15. 15. Set A set is a group of objects. {10, 23, 32} N = {0, 1, 2, … } Z = {… , -2, -1, 0, 1, 2, … } 10 ∈ {10, 23, 32} -1 ∉ N Ø U empty set universe Membership a is a member of set A
  16. 16. Subset A⊆B Every member of A is also an element of B.
  17. 17. Subset A⊆B ∀x:: x∈A x∈B Every member of A is also an element of B.
  18. 18. Subset A⊆B ∀x:: x∈A x∈B ∅ ⊆ A. A ⊆ A. A = B A ⊆ B ∧ B ⊆ A. Every member of A is also an element of B.
  19. 19. Subset A⊆B ∀x:: x∈A x∈B ∅ ⊆ A. A ⊆ A. A = B A ⊆ B ∧ B ⊆ A. Proper subset A⊂B A is a subset of B and not equal to B. Every member of A is also an element of B.
  20. 20. Subset A⊆B ∀x:: x∈A x∈B ∅ ⊆ A. A ⊆ A. A = B A ⊆ B ∧ B ⊆ A. Proper subset A⊂B ∀x:: A⊆B ∧ A≠B A is a subset of B and not equal to B. Every member of A is also an element of B.
  21. 21. Union A∪B ∀x:: x∈A ∨ x∈B A∪B={ x | x∈A or x∈B }
  22. 22. Union A∪B ∀x:: x∈A ∨ x∈B A∪B={ x | x∈A or x∈B }
  23. 23. Union A∪B ∀x:: x∈A ∨ x∈B A∪B={ x | x∈A or x∈B } A ∪ B = B ∪ A. A ∪ (B ∪ C) = (A ∪ B) ∪ C. A ⊆ (A ∪ B). A ∪ A = A. A ∪ ∅ = A. A ⊆ B A ∪ B = B.
  24. 24. Intersection A∩B ∀x:: x∈A ∧ x∈B A∩B={ x | x∈A and x∈B }
  25. 25. Intersection A∩B ∀x:: x∈A ∧ x∈B A∩B={ x | x∈A and x∈B }
  26. 26. Intersection A∩B ∀x:: x∈A ∧ x∈B A∩B={ x | x∈A and x∈B } A ∩ B = B ∩ A. A ∩ (B ∩ C) = (A ∩ B) ∩ C. A ∩ B ⊆ A. A ∩ A = A. A ∩ ∅ = ∅. A ⊆ B A ∩ B = A.
  27. 27. Complements AB, A’ ∀x:: x∈A ∧ x∉B AB={ x | x∈A and x∉B }
  28. 28. Complements AB, A’ ∀x:: x∈A ∧ x∉B AB={ x | x∈A and x∉B } A B ≠ B A. A ∪ A′ = U. A ∩ A′ = ∅. (A′)′ = A. A A = ∅. U′ = ∅. ∅′ = U. A B = A ∩ B′.
  29. 29. A ∩ U = A A ∪ ∅ = A Neutral elements
  30. 30. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements
  31. 31. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements A ∩ A = A A ∪ A = A Idempotence
  32. 32. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements A ∩ A = A A ∪ A = A Idempotence A ∪ B = B ∪ A A ∩ B = B ∩ A Commutativity
  33. 33. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements A ∩ A = A A ∪ A = A Idempotence A ∪ B = B ∪ A A ∩ B = B ∩ A Commutativity A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∪ (B ∪ C) = (A ∪ B) ∪ C Associativity
  34. 34. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements A ∩ A = A A ∪ A = A Idempotence A ∪ B = B ∪ A A ∩ B = B ∩ A Commutativity A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∪ (B ∪ C) = (A ∪ B) ∪ C Associativity A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Distributivity
  35. 35. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements A ∩ A = A A ∪ A = A Idempotence A ∩ A’ = ∅ A ∪ A’ = U Complement A ∪ B = B ∪ A A ∩ B = B ∩ A Commutativity A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∪ (B ∪ C) = (A ∪ B) ∪ C Associativity A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Distributivity
  36. 36. Similar to boolean algebra a ∧ 1 = a a ∨ 0 = a Neutral elements a ∧ 0 = 0 a ∨ 1 = 1 Zero elements a ∧ a = a a ∨ a = a Idempotence a ∧ ¬ a = 0 a ∨ ¬ a = 1 Negation a ∨ b = b ∨ a a ∧ b = b ∧ a Commutativity a ∧ (b ∧ c) = (a ∧ b) ∧ c a ∨ (b ∨ c) = (a ∨ b) ∨ c Associativity a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c) Distributivity
  37. 37. A ∩ U = A A ∪ ∅ = A Neutral elements A ∩ ∅ = ∅ A ∪ U = U Zero elements A ∩ A = A A ∪ A = A Idempotence A ∩ A’ = ∅ A ∪ A’ = U Complement A ∪ B = B ∪ A A ∩ B = B ∩ A Commutativity A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∪ (B ∪ C) = (A ∪ B) ∪ C Associativity A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Distributivity
  38. 38. A ∩ U = A A ∪ B = B ∪ A A ∪ ∅ = A A ∩ ∅ = ∅ A ∪ U = U A ∩ A = A A ∪ A = A A ∩ A’ = ∅ A ∪ A’ = U Neutral elements Zero elements Idempotence Complement A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∩ B = B ∩ A A ∪ (B ∪ C) = (A ∪ B) ∪ C A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) (A ∩ B)’ = (A’) ∪ (B’) (A ∪ B)’ = (A’) ∩ (B’) Commutativity Associativity Distributivity DeMorgan’s
  39. 39. A ⊆ A. A ⊆ B ∧ B ⊆ A A = B. A ⊆ B ∧ B ⊆ C A ⊆ C Reflexivity Anti-symmetry Transitivity
  40. 40. Scissors Paper Stone
  41. 41. Scissors Paper Stone beats beats beats
  42. 42. Scissors Paper Stone beats beats beats
  43. 43. Scissors Paper Stone beats beats beats beats Scissors Paper Stone Scissors FALSE TRUE FALSE Paper FALSE FALSE TRUE Stone TRUE FALSE FALSE
  44. 44. Scissors Paper Stone beats beats beats beats Scissors Paper Stone Scissors FALSE TRUE FALSE Paper FALSE FALSE TRUE Stone TRUE FALSE FALSE
  45. 45. Scissors Paper Stone beats beats beats beats Scissors Paper Stone Scissors FALSE TRUE FALSE Paper FALSE FALSE TRUE Stone TRUE FALSE FALSE
  46. 46. Scissors Paper Stone beats beats beats beats Scissors Paper Stone Scissors FALSE TRUE FALSE Paper FALSE FALSE TRUE Stone TRUE FALSE FALSE
  47. 47. beats Scissors Paper Stone Scissors FALSE TRUE FALSE Paper FALSE FALSE TRUE Stone TRUE FALSE FALSE beats = {(Scissors, Paper), (Paper, Stone), (Stone, Scissors)}
  48. 48. beats Scissors Paper Stone Scissors FALSE TRUE FALSE Paper FALSE FALSE TRUE Stone TRUE FALSE FALSE beats = {(Scissors, Paper), (Paper, Stone), (Stone, Scissors)} beats ⊆ {Scissor, Paper, Stone} x {Scissor, Paper, Stone}
  49. 49. Cartesian product AxB AxB={ (a,b) | a∈A and b∈B }
  50. 50. Cartesian product AxB AxB={ (a,b) | a∈A and b∈B } A × ∅ = ∅. A × (B ∪ C) = (A × B) ∪ (A × C). (A ∪ B) × C = (A × C) ∪ (B × C).
  51. 51. N-ary Relation A1, A2, ..., An R ⊆ A1 x A2 x...x An
  52. 52. N-ary Relation A1, A2, ..., An R ⊆ A1 x A2 x...x An Binary Relation
  53. 53. N-ary Relation A1, A2, ..., An R ⊆ A1 x A2 x...x An Binary Relation A1, A2 R ⊆ A1 x A2 (a,b) ∈ R aRb
  54. 54. N-ary Relation A1, A2, ..., An R ⊆ A1 x A2 x...x An Binary Relation A1, A2 R ⊆ A1 x A2 (a,b) ∈ R aRb
  55. 55. Tudor Gîrba www.tudorgirba.com creativecommons.org/licenses/by/3.0/

×