Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and...
-
Upload
antonio-adair -
Category
Documents
-
view
214 -
download
0
Transcript of Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and...
![Page 1: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/1.jpg)
Set Operations
![Page 2: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/2.jpg)
When sets are equal
][ BxAxxBA
A equals B iff for all x, x is in A iff x is in B
)]()[( AxBxBxAxxBA
or
ABBABA
… and this is what we do to prove sets equal
![Page 3: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/3.jpg)
Note: remember all that stuff about implication?
tivecontraposi
inverse
converse
nalbiconditio
qppq
qp
pq
pqqpqp
![Page 4: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/4.jpg)
}|{ BxAxxBA
Union of two sets
Give me the set of elements, x where x is in A or x is in B
}5,4,3,2,1{A }8,7,6,5,4{B
}8,7,6,5,4,3,2,1{BA
Example
BABA0 0 00 1 11 0 11 1 1 OR
A membership table
![Page 5: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/5.jpg)
Union of two sets
![Page 6: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/6.jpg)
}|{ BxAxxBA
![Page 7: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/7.jpg)
Note: we are using set builder notation and the
laws of logical equivalence (propositional equivalence)
![Page 8: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/8.jpg)
}|{ BxAxxBA
Intersection of two sets
Give me the set of elements, x where x is in A and x is in B
}5,4,3,2,1{A }8,7,6,5,4{B
}5,4{ BA
Example
BABA0 0 00 1 01 0 01 1 1
AND
![Page 9: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/9.jpg)
}|{ BxAxxBA
![Page 10: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/10.jpg)
),(disjoint{} BABA
Disjoint sets
][ BxAxx
![Page 11: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/11.jpg)
![Page 12: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/12.jpg)
}|{ BxAxxBA
Difference of two sets
Give me the set of elements, x where x is in A and x is not in B
}5,4,3,2,1{A }8,7,6,5,4{B
}3,2,1{ BA
Example
BA BA0 0 00 1 01 0 11 1 0 BA
BABA
![Page 13: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/13.jpg)
}|{ BxAxxBA
![Page 14: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/14.jpg)
Note: Compliment of a set
}|{ AxUxxA
![Page 15: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/15.jpg)
)()( ABBABA
Symmetric Difference of two sets
Give me the set of elements, x where x is in A and x is not in B OR x is in B and x is not in A
}5,4,3,2,1{A }8,7,6,5,4{B
}8,7,6,3,2,1{BA
Example
BABA0 0 00 1 11 0 11 1 0
XOR
![Page 16: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/16.jpg)
)()( ABBABA
![Page 17: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/17.jpg)
}|{ AxxA
Complement of a set
Give me the set of elements, x where x is not in A
}5,4,3,2,1{A
}10,9,8,7,6,5,4,3,2,1,0{U
}10,9,8,7,6,0{A
Example
Not
U is the “universal set”
AUA
![Page 18: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/18.jpg)
Cardinality of a Set
In claire
• A = {1,3,5,7}• B = {2,4,6}• C = {5,6,7,8}
• |A u B| ?• |A u C|• |B u C|• |A u B u C|
![Page 19: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/19.jpg)
Cardinality of a Set
|BA| |B| |A| || BA
The principle of inclusion-exclusion
![Page 20: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/20.jpg)
Cardinality of a Set
|BA| |B| |A| || BA
The principle of inclusion-exclusion
U
Potentially counted twice (“over counted”)
![Page 21: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/21.jpg)
Set Identities
{} AA
AUA Identity
UUA {}{} A
Domination
•Think of• U as true (universal)• {} as false (empty)• Union as OR• Intersection as AND• Complement as NOT
AAA AAA
Indempotent
Note similarity to logical equivalences!
![Page 22: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/22.jpg)
Set Identities
ABBA ABBA
Commutative
CBACBA )()(CBACBA )()(
Associative
)()()( CABACBA )()()( CABACBA
Distributive
BABA
BABA De Morgan
Note similarity to logical equivalences!
![Page 23: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/23.jpg)
lawsnegation
laws absorption)(
)(
laws sMorgan' De)(
)(
law vedistributi)()()(
)()()(
laws eassociativ)()(
)()(
laws ecommutativ
lawnegation double)(
lawst indempoten
law domination
lawidentity
NameeEquivalenc
Fpp
Tpppqpp
pqppqpqp
qpqprpqprqp
rpqprqprqprqp
rqprqppqqp
pqqp
pp
ppp
pppFFp
TTppFp
pTp
![Page 24: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/24.jpg)
Four ways to prove two sets A and B equal
• a membership table• a containment proof
• show that A is a subset of B• show that B is a subset of A
• set builder notation and logical equivalences• Venn diagrams
![Page 25: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/25.jpg)
B BA :RTP A
Prove lhs is a subset of rhs
Prove rhs is a subset of lhs
![Page 26: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/26.jpg)
B BA :RTP A
… set builder notation and logical equivalences
}|{ BAxx
)}(|{ BAxx
)}(|{ BxAxx
)}()(|{ BxAxx
}|{ BxAxx }|{ BAxx
Defn of complement
Defn of intersection
De Morgan law
Defn of complement
Defn of union
![Page 27: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/27.jpg)
B BA :RTP A
prove using membership table
Class
![Page 28: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/28.jpg)
B BA :RTP AMe
0000111
1101001
1011010
1111000
BABABABABA
They are the same
![Page 29: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/29.jpg)
B BA :RTP A
prove using set builder and logical equivalence
Class
![Page 30: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/30.jpg)
B BA :RTP AMe
notationbuilder set of Meaning
ion)(intersect ofDefn }|{
complement ofDefn )}()(|{
ofDefn )}()(|{
lawMorgan De ))}()(|{
)( ofDefn }(|{
ofDefn )}(|{
}|{
BA
BAxx
BxAxx
BxAxx
BxAxx
unionBxAxx
BAxx
BAxxBA
![Page 31: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/31.jpg)
{})( :RTP ABA
)}(|{)(
ABxAxxABA
)}(|{ AxBxAxx
}|{ BxAxAxx
}{}|{ Bxxx
{}
Prove using set builder and logical equivalences
![Page 32: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/32.jpg)
A containment proof
See the text book
That’s a cop out if ever I saw one!
![Page 33: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/33.jpg)
A containment proof Guilt kicks in
To do a containment proof of A = B do as follows
1. Argue that an arbitrary element in A is in B i.e. that A is an improper subset of B
2. Argue that an arbitrary element in B is in A i.e. that B is an improper subset of A
3. Conclude by saying that since A is a subset of B, and vice versa then the two sets must be equal
![Page 34: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/34.jpg)
ni
n
i
AAAA
...211
Collections of sets
ni
n
i
AAAA
...211
![Page 35: Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.](https://reader035.fdocuments.in/reader035/viewer/2022062619/5515c9d855034693758b4a63/html5/thumbnails/35.jpg)