1 / 35

Set Operations

Set Operations. When sets are equal. A equals B iff for all x, x is in A iff x is in B. or. … and this is what we do to prove sets equal. Note: remember all that stuff about implication?. Union of two sets. Give me the set of elements, x where x is in A or x is in B. Example.

mairi
Télécharger la présentation

Set Operations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Set Operations

  2. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal

  3. Note: remember all that stuff about implication?

  4. Union of two sets Give me the set of elements, x where x is in A or x is in B Example A membership table 0 0 0 0 1 1 1 0 1 1 1 1 OR

  5. Union of two sets

  6. Note: we are using set builder notation and the laws of logical equivalence (propositional equivalence)

  7. Intersection of two sets Give me the set of elements, x where x is in A and x is in B Example 0 0 0 0 1 0 1 0 0 1 1 1 AND

  8. Disjoint sets

  9. Difference of two sets Give me the set of elements, x where x is in A and x is not in B Example 0 0 0 0 1 0 1 0 1 1 1 0

  10. Note: Compliment of a set

  11. Symmetric Difference of two sets Give me the set of elements, x where x is in A and x is not in B OR x is in B and x is not in A Example 0 0 0 0 1 1 1 0 1 1 1 0 XOR

  12. Complement of a set Give me the set of elements, x where x is not in A Example U is the “universal set” Not

  13. Cardinality of a Set • In claire • A = {1,3,5,7} • B = {2,4,6} • C = {5,6,7,8} • |A u B| ? • |A u C| • |B u C| • |A u B u C|

  14. Cardinality of a Set The principle of inclusion-exclusion

  15. Cardinality of a Set The principle of inclusion-exclusion U Potentially counted twice (“over counted”)

  16. Set Identities Note similarity to logical equivalences! Identity Domination Indempotent • Think of • U as true (universal) • {} as false (empty) • Union as OR • Intersection as AND • Complement as NOT

  17. Set Identities Note similarity to logical equivalences! Commutative Associative Distributive De Morgan

  18. Four ways to prove two sets A and B equal • a membership table • a containment proof • show that A is a subset of B • show that B is a subset of A • set builder notation and logical equivalences • Venn diagrams

  19. Prove lhs is a subset of rhs Prove rhs is a subset of lhs

  20. … set builder notation and logical equivalences Defn of complement Defn of intersection De Morgan law Defn of complement Defn of union

  21. Class prove using membership table

  22. Me They are the same

  23. Class prove using set builder and logical equivalence

  24. Me

  25. Prove using set builder and logical equivalences

  26. A containment proof See the text book  That’s a cop out if ever I saw one!

  27. A containment proof Guilt kicks in • To do a containment proof of A = B do as follows • 1. Argue that an arbitrary element in A is in B • i.e. that A is an improper subset of B • 2. Argue that an arbitrary element in B is in A • i.e. that B is an improper subset of A • 3. Conclude by saying that since A is a subset of B, and vice versa • then the two sets must be equal

  28. Collections of sets

More Related