Set Operations
description
Transcript of Set Operations
![Page 1: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/1.jpg)
Set Operations
![Page 2: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/2.jpg)
L5 2
AgendaSection 1.5: Set Operations
Union and Disjoint union Intersection Difference “” Complement “ ” Symmetric Difference
![Page 3: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/3.jpg)
L5 3
Universe of ReferenceWhen talking about a set, a universe
of reference (universal set ) needs to be specified. Even though a set is defined by the elements which it contains, those elements cannot be arbitrary. If arbitrary elements are allowed paradoxes can result arising from self reference.
![Page 4: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/4.jpg)
L5 4
Set Builder Notation
Up to now sets have been defined using the curly brace notation “{ … }” or descriptively “the set of all natural numbers”. The set builder notation allows for concise definition of new sets. For example { x | x is an even integer } { 2x | x is an integer }
are equivalent ways of specifying the set of all even integers.
![Page 5: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/5.jpg)
L5 5
Set Builder NotationIn general, one specifies a set by writing
{ f (x ) | P (x ) }Where f (x ) is a function of x and P (x ) is a
propositional function of x. The notation is read as
“the set of all elements f (x ) such that P (x ) holds”Stuff between “{“ and “|”
specifies how elements lookStuff between the “|” and “}”
gives properties elements satisfyPipe symbol “|” is
short-hand for “such that”.
![Page 6: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/6.jpg)
L5 6
Set Builder Notation.Shortcuts.
To specify a subset of a pre-defined set, f (x ) takes the form xS. For example
{x N | y (x = 2y ) }defines the set of all even natural numbers (assuming universe of reference Z).When universe of reference is understood, don’t need to specify propositional function EG: { x 3 | } or simply {x 3 } specifies the set of perfect cubes
{0,1,8,27,64,125, …} assuming U is the set of natural numbers.
![Page 7: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/7.jpg)
L5 7
Set Builder Notation.Examples.
Q1: U = N. { x | y (y x ) } = ?Q2: U = Z. { x | y (y x ) } = ?Q3: U = Z. { x | y (y R y 2 = x )}
= ?Q4: U = Z. { x | y (y R y 3 = x )}
= ?Q5: U = R. { |x | | x Z } = ?Q6: U = R. { |x | } = ?
![Page 8: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/8.jpg)
L5 8
Set Builder Notation.Examples.
A1: U = N. { x | y (y x ) } = { 0 }A2: U = Z. { x | y (y x ) } = { }A3: U = Z. { x | y (y R y 2 = x )}
= { 0, 1, 2, 3, 4, … } = NA4: U = Z. { x | y (y R y 3 = x )} =
Z A5: U = R. { |x | | x Z } = NA6: U = R. { |x | } = non-negative reals.
![Page 9: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/9.jpg)
L5 9
Set Theoretic OperationsSet theoretic operations allow us to build new
sets out of old, just as the logical connectives allowed us to create compound propositions from simpler propositions. Given sets A and B, the set theoretic operators are: Union () Intersection () Difference ( Complement (“—”) Symmetric Difference ()
give us new sets AB, AB, A-B, AB, andA .
![Page 10: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/10.jpg)
L5 10
Venn DiagramsVenn diagrams are useful in
representing sets and set operations. Various sets are represented by circles inside a big rectangle representing the universe of reference.
![Page 11: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/11.jpg)
L5 11
Union
AB = { x | x A x B } Elements in at least one of the two sets:
A B
U
AB
![Page 12: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/12.jpg)
L5 12
Intersection
AB = { x | x A x B } Elements in exactly one of the two sets:
A B
U
AB
![Page 13: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/13.jpg)
L5 13
Disjoint SetsDEF: If A and B have no common elements, theyare said to be disjoint, i.e. A B = .
A B
U
![Page 14: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/14.jpg)
L5 14
Disjoint UnionWhen A and B are disjoint, the disjoint union operation is well defined. The circle above the union symbol indicates disjointedness.
A B
U
BA
![Page 15: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/15.jpg)
L5 15
Disjoint UnionFACT: In a disjoint union of finite
sets, cardinality of the union is the sum of the cardinalities. I.e.
BABA
![Page 16: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/16.jpg)
L5 16
Set Difference
AB = { x | x A x B } Elements in first set but not second:
A
B
U
AB
![Page 17: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/17.jpg)
L5 17
Symmetric Difference
A B
UAB
AB = { x | x A x B } Elements in exactly one of the two sets:
![Page 18: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/18.jpg)
L5 18
Complement
A = { x | x A } Elements not in the set (unary operator):
A
U
A
![Page 19: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/19.jpg)
L5 19
Set IdentitiesTable 1, Rosen p. 49
Identity laws Domination laws Idempotent laws Double complementation Commutativity Associativity Distribuitivity DeMorgan
This table is gotten from the previous table of logical identities (Table 5, p. 17) by rewriting as follows:
disjunction “” becomes union “” conjunction “” becomes intersection “” negation “” becomes complementation “–” false “F” becomes the empty set true “T” becomes the universe of reference U
![Page 20: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/20.jpg)
L5 20
Set Identities
In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example:
LEMMA: (Associativity of Unions) (AB )C = A(B C )
![Page 21: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/21.jpg)
L5 21
Set Identities
In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example:
LEMMA: (Associativity of Unions) (AB )C = A(B C )
Proof : (AB )C = {x | x A B x C } (by def.)
![Page 22: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/22.jpg)
L5 22
Set Identities
In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example:
LEMMA: (Associativity of Unions) (AB )C = A(B C )
Proof : (AB )C = {x | x A B x C } (by def.)
= {x | (x A x B ) x C } (by def.)
![Page 23: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/23.jpg)
L5 23
Set Identities
In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example:
LEMMA: (Associativity of Unions) (AB )C = A(B C )
Proof : (AB )C = {x | x A B x C } (by def.)
= {x | (x A x B ) x C } (by def.)
= {x | x A ( x B x C ) } (logical assoc.)
![Page 24: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/24.jpg)
L5 24
Set Identities
In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example:
LEMMA: (Associativity of Unions) (AB )C = A(B C )
Proof : (AB )C = {x | x A B x C } (by def.)= {x | (x A x B ) x C } (by def.)= {x | x A ( x B x C ) } (logical assoc.)= {x | x A x B C ) } (by def.)
![Page 25: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/25.jpg)
L5 25
Set IdentitiesIn fact, the logical identities create the set
identities by applying the definitions of the various set operations. For example:
LEMMA: (Associativity of Unions) (AB )C = A(B C )
Proof : (AB )C = {x | x A B x C } (by def.)= {x | (x A x B ) x C } (by def.)= {x | x A ( x B x C ) } (logical assoc.)= {x | x A (x B C ) } (by def.)= A(B C ) (by def.)
�Other identities are derived similarly.
![Page 26: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/26.jpg)
L5 26
Set Identities via VennIt’s often simpler to understand an
identity by drawing a Venn Diagram.
For example DeMorgan’s first law
can be visualized as follows.
BABA
![Page 27: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/27.jpg)
L5 27
Visual DeMorgan
A: B:
![Page 28: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/28.jpg)
L5 28
Visual DeMorgan
A: B:
AB :
![Page 29: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/29.jpg)
L5 29
Visual DeMorgan
A: B:
AB :
:BA
![Page 30: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/30.jpg)
L5 30
Visual DeMorgan
A: B:
![Page 31: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/31.jpg)
L5 31
Visual DeMorgan
A: B:
A: B:
![Page 32: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/32.jpg)
L5 32
Visual DeMorgan
A: B:
A: B:
:BA
![Page 33: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/33.jpg)
L5 33
Visual DeMorgan
= BA
BA
![Page 34: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/34.jpg)
L5 34
Sets as Bit-StringsIf we order the elements of our universe, we
can represent sets by bit-strings. For example, consider the universe
U = {ant, beetle, cicada, dragonfly}Order the elements alphabetically. Subsets of
U are represented by bit-strings of length 4. Each bit in turn, tells us whether the corresponding element is contained in the set. EG: {ant, dragonfly} is represented by the bit-string 1001.
Q: What set is represented by 0111 ?
![Page 35: Set Operations](https://reader035.fdocuments.us/reader035/viewer/2022062323/56816337550346895dd3c750/html5/thumbnails/35.jpg)
L5 35
Sets as Bit-StringsA: 0111 represents {beetle, cicada, dragonfly}Conveniently, under this representation the
various set theoretic operations become the logical bit-string operators that we saw before. For example, the symmetric difference of {beetle} with {ant, beetle, dragonfly} is represented by:0100 1101
1001 = {ant, dragonfly}