Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1

2 SETS CSC 172 SPRING 2002 LECTURE 20

3 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

4 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

5 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}

6 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 (-)

7 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

8 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

9 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)

10 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

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

12 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

13 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 

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

15 Example: (S  T)  S  S ST S  T RHS 0000 0110 1011 1111

16 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

17 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”


Download ppt "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."

Similar presentations


Ads by Google