Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations.

Similar presentations


Presentation on theme: "1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations."— Presentation transcript:

1 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations

2 2 Discussion #21 Topics Sets and Set Operations  Definitions  Operations  Set Laws  Derivations, Equivalences, Proofs Tuples and Relations  Tuples  pairs & n-tuples  Cartesian Product  Relations  subset of the cross product

3 3 Discussion #21 Sets Sets are collections  The things in a collection are called elements or members  Sets have no duplicates. Notation { }  Enumerate: {1, 2, 3}  Ellipsis: {1, 2, …} or {1, 2, …, 100}  Universe: U, universe of discorse  Empty set: { } or  i.e. set with no elements Special sets  N  N natural numbers {0, 1, 2, …} (some exclude 0 from this set)  ZR  Z integers; R reals “set builder” notation  { x | P(x)} all elements in U that satisfy predicate P N  { x | x>5  x<10} = {6, 7, 8, 9} when U = N Element of: x  A Cardinality  |A| or #A  both denote the number of elements in A, e.g. |{a,b}| = 2

4 4 Discussion #21 Set Equality, Subsets, Supersets Set Equality  A = B if A and B have the same elements  A = B  x  A  x  B Subsets  A  B  x  A  x  B (subset or equal)  A  B  A  B   x(x  B  x  A) (proper subset) Supersets A  B if B  A A  B if B  A

5 5 Discussion #21 Proofs about Set Equality and the Empty Set Prove: A = B iff A  B  B  A A = B  x  A  x  B definition of set equality  (x  A  x  B)  (x  B  x  A) P  Q  (P  Q)  (Q  P)  A  B  B  A definition of subset Prove:   A (i.e.  is a subset of every set.)   A  x    x  A definition of subset  F  x  A x   is false (for if not there is an element of U in the empty set, contrary to the defintion)  T

6 6 Discussion #21 Set Operations: Intersection Intersection A  B  {x | x  A  x  B} {1, 2, 3}  {2, 3, 4} = {2, 3} Prove: A  B  A By definition, A  B  A  x  A  B  x  A 1. x  Aassume negation of conclusion 2. x  A  Bpremise 3. x  A  x  Bdef of  4. x  A3, simplification 5. x  A  x  A1&4, conjunction 6. F5, contradiction AB

7 7 Discussion #21 Set Operations: Intersection Intersection A  B  {x | x  A  x  B} {1, 2, 3}  {2, 3, 4} = {2, 3} Prove: A  B  A By definition, A  B  A  x  A  B  x  A 1. x  Aassume negation of conclusion 2. x  A  Bpremise 3. x  A  x  Bdef of  4. x  A3, simplification 5. x  A  x  A1&4, conjunction 6. F5, contradiction AB A simpler proof.

8 8 Discussion #21 Set Operations: Union Union A  B  {x | x  A  x  B} {1, 2, 3}  {2, 3, 4} = {1, 2, 3, 4} No duplicates! Prove: A  A  B By definition, A  A  B  x  A  x  A  x  B 1. x  A premise 2. x  A  x  B1, law of addition AB

9 9 Discussion #21 Set Operations: Set Difference AB Difference (minus) A – B  {x | x  A  x  B} {1, 2, 3} – {2, 3, 4} = {1} Remove elements of B from A Prove: A – B  A By definition, A – B  A  x  A–B  x  A 1. x  A – B premise 2. x  A  x  B definition 3. x  A simplification

10 10 Discussion #21 Set Operations: Complement Complement ~ A  U – A  {x | x  U  x  A} ~{1, 2, 3} = {4} if U = {1, 2, 3, 4} Prove: A  ~A =  A  ~A =   A  ~A      A  ~A set equality  A  ~A    T  is a subset of every set  A  ~A   identity  x  A  x  ~A  x   def of  and   x  A  x  U  x  A  x   def of ~  F  x   comm., contradict., dominat.  T Note: Unary operators have precedence over binary operators.Use parentheses for the rest. Possible to define precedence: ~, , , . A

11 11 Discussion #21 Basic Set Identities Set AlgebraName A  ~A = U A  ~A =  Complementation law Exclusion law A  U = A A   = A Identity laws A  U = U A   =  Domination laws A  A = A A  A = A Idempotent laws Duals:  and  E

12 12 Discussion #21 Basic Set Identities (continued…) Set AlgebraName ~(~A) = A Double Complement A  B = B  A A  B = B  A Commutative laws (A  B)  C = A  (B  C) (A  B)  C = A  (B  C) Associative laws A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C) Distributive laws ~ (A  B) = ~A  ~B ~ (A  B) = ~A  ~B De Morgan’s laws

13 13 Discussion #21 Example: Set Laws Absorption A  (A  B) = A A  (A  B) = A Venn Diagram “Proof” Prove: A  (A  B) = A A  (A  B) = (A   )  (A  B)ident. = A  (   B)distrib. = A   dominat. = Aident. AB

14 14 Discussion #21 Tuples Things (usually a small number of things) arranged in order 2-tuples  pairs (x, y)  ordered (x, y)  (y, x) unless x = y n-tuples = (x 1, x 2, …, x n ) Typically, elements in tuples are taken from known sets  x  females, y  males (Mary, Jim) e.g. might mean: Mary and Jim are a married couple  x  people, y  cars (Mary, red sports car 17 ) e.g. might mean: Mary owns red sports car 17  x, y, z  integers (3, 4, 7) e.g. might mean: 3 + 4 = 7

15 15 Discussion #21 Cartesian Product A  B = {(x, y) | x  A  y  B} e.g.A = {1, 2} B = {a, b, c} A  B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)} |A  B| = |A| · |B| = 2 · 3 = 6

16 16 Discussion #21 Cartesian Product (continued…) n-fold Cartesian Product A 1  …  A n = {(x 1, …, x n ) | x  A 1  …  x n  A n } e.g.A = {1, 2} B = {a, b, c} C = { ,  } A  B  C = {(1,a,  ), (1,a,  ), (1,b,  ), (1,b,  ), (1,c,  ), (1,c,  ), (2,a,  ), (2,a,  ), (2,b,  ), (2,b,  ), (2,c,  ), (2,c,  )} Can get large: A = set of students at BYU(30,000) B = set of BYU student addresses(10,000) C = set of BYU student phone#’s(60,000) |A|  |B|  |C| = 1.8  10 13

17 17 Discussion #21 Relations Relation  Subset of the cross product  Not necessarily a proper subset  R  A  B or R  A  B  C Examples:  A = {1, 2} & B = {a, b, c} R = {(1, a), (2, b), (2, c)}  A = {1, 2} & B = {a, b, c} & C = { ,  } R = {(1, a,  ), (2, c,  )}  Marriage: subset of the cross product of males and females


Download ppt "1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations."

Similar presentations


Ads by Google