1 discussion #21 discussion #21 sets & set operations; tuples & relations
TRANSCRIPT
![Page 1: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/1.jpg)
1Discussion #21
Discussion #21
Sets & Set Operations;Tuples & Relations
![Page 2: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/2.jpg)
2Discussion #21
Topics
Sets and Set OperationsDefinitionsOperationsSet LawsDerivations, Equivalences, Proofs
Tuples and RelationsTuples pairs & n-tuplesCartesian ProductRelations subset of the cross product
![Page 3: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/3.jpg)
3Discussion #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 NN natural numbers {0, 1, 2, …} (some exclude 0 from this set) ZZ integers; RR reals
“set builder” notation { x | P(x)} all elements in U that satisfy predicate P { x | x>5 x<10} = {6, 7, 8, 9} when U = NN
Element of: x A Cardinality
|A| or #A both denote the number of elements in A, e.g. |{a,b}| = 2
![Page 4: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/4.jpg)
4Discussion #21
Set Equality, Subsets, Supersets Set Equality
A = B if A and B have the same elementsA = B xA xB
SubsetsA B xA xB (subset or equal)A B A B x(xB xA) (proper subset)
SupersetsA B if B A
A B if B A
![Page 5: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/5.jpg)
5Discussion #21
Proofs about Set Equalityand the Empty Set
Prove: A = B iff A B B AA = B xA xB definition of set equality
(xA xB) (xB xA) 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 xA definition of subset
F xA x is false (for if not there is an element of U in the empty set, contrary to the defintion)
T
![Page 6: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/6.jpg)
6Discussion #21
Set Operations: IntersectionIntersection
A B {x | xA xB}{1, 2, 3} {2, 3, 4} = {2, 3}
Prove: A B ABy definition, A B A xAB xA
1. xA assume negation of conclusion
2. xAB premise3. xA xB def of 4. xA 3, simplification5. xA xA 1&4, conjunction6. F 5, contradiction
A B
![Page 7: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/7.jpg)
7Discussion #21
Set Operations: IntersectionIntersection
A B {x | xA xB}{1, 2, 3} {2, 3, 4} = {2, 3}
Prove: A B ABy definition, A B A xAB xA
1. xA assume negation of conclusion
2. xAB premise3. xA xB def of 4. xA 3, simplification5. xA xA 1&4, conjunction6. F 5, contradiction
A B
A simpler proof.
![Page 8: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/8.jpg)
8Discussion #21
Set Operations: Union
UnionA B {x | xA xB}{1, 2, 3} {2, 3, 4} = {1, 2, 3, 4}No duplicates!
Prove: A A BBy definition, A AB xA xA xB
1. xA premise2. xA xB 1, law of addition
A B
![Page 9: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/9.jpg)
9Discussion #21
Set Operations: Set Difference
A B
Difference (minus)A – B {x | xA xB}{1, 2, 3} – {2, 3, 4} = {1}Remove elements of B from A
Prove: A – B ABy definition, A – B A xA–B xA
1. x A – B premise
2. x A x B definition
3. x A simplification
![Page 10: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/10.jpg)
10Discussion #21
Set Operations: Complement
Complement~ A U – A {x | xU xA}~{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
![Page 11: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/11.jpg)
11Discussion #21
Basic Set IdentitiesSet Algebra Name
A ~A = UA ~A =
Complementation lawExclusion law
A U = AA = A
Identity laws
A U = UA =
Domination laws
A A = AA A = A
Idempotent laws
Duals: and E
![Page 12: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/12.jpg)
12Discussion #21
Basic Set Identities (continued…)Set Algebra Name
~(~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
![Page 13: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/13.jpg)
13Discussion #21
Example: Set Laws Absorption
A (A B) = AA (A B) = A
Venn Diagram “Proof”
Prove: A (A B) = A A (A B)
= (A ) (A B) ident.= A ( B) distrib.= A dominat.= A ident.
A B
![Page 14: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/14.jpg)
14Discussion #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 = (x1, x2, …, xn) 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 car17) e.g. might mean: Mary owns red sports car17
x, y, z integers(3, 4, 7) e.g. might mean: 3 + 4 = 7
![Page 15: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/15.jpg)
15Discussion #21
Cartesian Product
A B = {(x, y) | xA yB}
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
![Page 16: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/16.jpg)
16Discussion #21
Cartesian Product (continued…) n-fold Cartesian Product
A1 … An = {(x1, …, xn) | xA1 … xnAn}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 1013
![Page 17: 1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations](https://reader035.vdocuments.site/reader035/viewer/2022071806/56649d8b5503460f94a71738/html5/thumbnails/17.jpg)
17Discussion #21
Relations Relation
Subset of the cross productNot necessarily a proper subsetR 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