Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic...
Transcript of Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic...
![Page 1: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/1.jpg)
Set Operations
Jing YangOctober 4, 2010
1
![Page 2: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/2.jpg)
Review
Sets: definition, representation
Set membership, subsets, proper subsets, power set, Cartesian product
Today: set operations
2
![Page 3: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/3.jpg)
Set Operations
Union: A∪B = {x|(x∈A)∨(x∈B)}
Intersection: A∩B = {x|(x∈A)∧(x∈B)}
Disjoint sets: A, B are disjoint iff A∩B=∅
Difference: A-B = {x|(x∈A)∧(x∉B)}
Complement: AC or Ā = {x|x∉A} = U-A
3
![Page 4: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/4.jpg)
Union A∪B
UA
B
U
AB
UAB
Union: A∪B = {x|(x∈A)∨(x∈B)}
4
![Page 5: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/5.jpg)
Intersection A∩B
UA
B
U
AB
UAB
Intersection: A∩B = {x|(x∈A)∧(x∈B)}
Disjoint setsA, B are disjoint iff A∩B=∅
5
![Page 6: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/6.jpg)
Difference A-B
UA
B
U
AB
UAB
Difference: A-B = {x|(x∈A)∧(x∉B)}
U
AB
6
![Page 7: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/7.jpg)
Complement Ac or Ā
UA
Complement: AC or Ā = {x|x∉A} = U-A
7
![Page 8: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/8.jpg)
ExamplesFor U = {0,1,2,3,4,5,6,7,8,9,10},
If A = {1,2,3,4,5}, B = {4,5,6,7,8}, then:
A∪B = {1,2,3,4,5,6,7,8}
A∩B = {4,5}
A-B = {1,2,3}
B-A = {6,7,8}
Ā = {6,7,8,9,10}8
![Page 9: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/9.jpg)
Set Identities
Set identities correspond to logical equivalences
How to prove the set identities?
Show each set is a subset of the other
Use membership tables
9
![Page 10: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/10.jpg)
Example:
10
A ! B = A " B
Proof by showing:
Let x be arbitrary, then we can treat the predicates as propositions
!x(x " A # B $ x " A % B)
![Page 11: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/11.jpg)
Example:
11
A ! B = A " B
x ! A " B# x /! A " B# ¬(x ! A " B)# ¬(x ! A $ x ! B)# ¬(x ! A) % ¬(x ! B)# x /! A % x /! B# x ! A % x ! B# x ! A & B
Def. of complementDef. of ∉Def. of ∪De Morgan’s LawsDef. of ∉Def. of complementDef. of ∩
![Page 12: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/12.jpg)
Example:
12
A ! B = A " B
Since:x was arbitraryBy using only logically equivalent assertions and definitions we showed
is a tautologySo we can claim:
!x(x " A # B $ x " A % B)
x ! A " B # x ! A $ B
![Page 13: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/13.jpg)
Example:
13
A ! B = A " B
Proof by using a membership table
A B A∪B1 1 1 0 0 0 01 0 1 0 0 1 00 1 1 0 1 0 00 0 0 1 1 1 1
A ! B A B A ! B
![Page 14: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/14.jpg)
Set Identities
Important set identities (Page 124)
Associative Laws, Distributive Laws, De Morgan’s Laws
Similarity of the laws in P124 and P24
14
![Page 15: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/15.jpg)
Generalized Unions
A∪B∪C
Let A1, A2, ..., An be an indexed collection of sets, we have:
15
n!
i=1
Ai = A1 ! A2 ! ... ! An
UCB
A
![Page 16: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/16.jpg)
Generalized Intersections
A∩B∩C
Let A1, A2, ..., An be an indexed collection of sets, we have:
16
UCB
A
n!
i=1
Ai = A1 ! A2 ! ... ! An
![Page 17: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/17.jpg)
Example
Let Ai={i,i+1,i+2,...}, then:
17
n!
i=1
Ai = {n, n + 1, n + 2, ...}
n!
i=1
Ai = {1, 2, 3, ...}
![Page 18: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18.](https://reader034.fdocuments.us/reader034/viewer/2022051923/6010a00b6fedac13a46564c9/html5/thumbnails/18.jpg)
Reading and Notes
Understand the relationship between set operations and logic operations
Practice proving set identities
Recommended exercises: 3,5,19,25
18