1 / 16

SETS

SETS. CSC 172 SPRING 2002 LECTURE 20. Sets. Defined by membership relation  Atoms many not have members, but may be members ofa set Sets may also be members of sets Membership is “only once” An element can not be a member of a set more than once

Download Presentation

SETS

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. SETS CSC 172 SPRING 2002 LECTURE 20

  2. Sets Defined by membership relation  Atoms many not have members, but may be members ofa set Sets may also be members of sets Membership is “only once” An element can not be a member of a set more than once Mulitsets, or bags, can contain elements more than once Sets underlie most information representation

  3. Use of Sets Sturctured sets represent record structures, tables Relational models are used in data base systems Probability space is a kind of set Set theory underlies much (all?) mathematics Real numbers, infinities

  4. Representing sets Extension – list the elements {1, 2, {3, 4}} set with 3 elements Abstraction – describe the elements {x | 3 <= x <= 10 and x is an integer}

  5. Algebra of Sets Union : S  T = set of elements in S or T or both (+) Intersection : S  T = set of elements in both (*) Difference: S – T = elements in S, not T (-)

  6. Equality of Sets Two sets are equal if they have exactly the same members Two expression involving sets are equivalent () if they produce the same values regardless of what values we assign to the set-variables in the expressions

  7. Algebraic Laws Observations about pairs of equivalent expressions Commutative laws of union, intersection The order of the operands may be reversed Associative laws of union, intersection Operations may be grouped in any order Similar law for union and difference S - (T  R)  (S – T) - R

  8. Algebraic Laws Distributive laws like x(y+z) = xy + xz 3 different laws for distribution on sets S (T R)  (S T)  (S  R) S  (T  R)  (S  T)  (S  R) (S  T) - R  (S - R)  (T – R)

  9. Empty Set   is the identity for union S   = S  is the annihilator for intersection S   =  There is no identity for intersection or annihilator for union because no universal “set containing everything” exists S – S =   - S =  Idempotence : S  S = S and S  S = S

  10. Proving Equivalences Three approaches • Manipulating known equivalences • Classifying elements by sets of which they are members Venn diagrams and truth-tables • Proving containment in both directions Using definitions of operations

  11. Manipulating Equivlences Substituting an expression for all occurrences of some variable Replacing a subexpression by a known equivalent expression Using transitivity of equivalence If E  F and F  G then E  G Using commutativity of equivalence If E  F then F  E

  12. Example: (S  T)  S  S S  (T  R)  (S T)  (S  R) distributive law S  (T  )  (S T)  (S  ) R S  (S T)  (S  ) Annihilation S  (S T)  S Identity S  (S T)  S Identity (S T)  S  S Commutititvity of 

  13. Enumerating Cases If there are n sets in an expession, we can divide elements into 2n classes, dependin on whether they are in or out of the set

  14. Example: (S  T)  S  S

  15. Equivalence Through Containment S  T (S is contained in T) means every element of S is an element of T S = T if and only if (S  T) and (T  S) We can prove the equivalence of two expression by showing the result of each is contained in the other

  16. Example: (S  T)  S  S • If x  S then x  (S  T) definition of “union” If x  (S  T) then x  (S  T)  S definition of “intersection”  If x  (S  T)  S then x  S definition of “intersection”

More Related