CS103
HO#15
Slides--Sets
April 14, 2010
1
Sets
Sipser:
"A set is a group of objects represented as a unit.
Sets may contain
any type of object, including numbers, symbols, and even other sets."
If A is a set and x is an object,
we write
x
∈
A
to mean that x is an element of (or member of) A, and
x
∉
A
to mean that x is not an element of (or member of) A.
Sets
Another definition:
"A set is an unordered collection of distinct elements."
One way to specify a set is to list the elements:
A = {2, 3, 5, 7, 11}
An object is either in a set or not, so there is no point in repeating
elements in the list, nor does the order matter:
{2, 3, 5, 7, 11} is the same set
as {11, 7, 5, 2, 3, 7, 11}
Another way to specify a set is by providing a rule or property that
determines membership:
A = {n | Prime(n)
∧
n < 12}
This is called set builder
notation.
Sets
Sets A and B are
equal
if and only if they have exactly the same members:
A = B
↔ ∀
x ((x
∈
A)
↔
(x
∈
B))
A is a
subset
of B means that every member of A is a member of B:
(A
⊆
B)
↔ ∀
x ((x
∈
A)
→
(x
∈
B))
A is a
proper subset
of B means that A subset of B and A is not equal to B:
(A
⊂
B)
↔
((A
⊆
B)
∧
(A
≠
B)
Sipser writes this as
A
⊂
B
Sets
Sets A and B are
equal
if and only if they have exactly the same members:
A = B
↔ ∀
x ((x
∈
A)
↔
(x
∈
B))
↔ ∀
x ((x
∈
A)
→
(x
∈
B))
∧∀
x ((x
∈
B)
→
(x
∈
A))
↔
(A
⊆
B)
∧
(B
⊆
A)
Alternate definition:
A = B
↔
((A
⊆
B)
∧
(B
⊆
A))
The Empty Set
We say that a set A is
empty
if
∀
x (x
∉
A)
and we denote the empty set by { } or Ø
Alternate:
Ø = {x | x
≠
x}
Is the empty set unique?
Suppose that
∀
x (x
∉
Ø) and
∀
x (x
∉
Ö)
Then
∀
x( ((x
∈
Ø)
→
(x
∈
Ö))
∧
((x
∈
Ö)
→
(x
∈
Ø)) )
since both conditionals are vacuously true.
So
Ø = Ö
Union of two sets
We say that
union
of two sets A and B is the set consisting
of all elements that belong to A or B, and we denote
the union operator by the symbol
∪
A
∪
B = {x | x
∈
A
∨
x
∈
B}
Intersection of two sets
We say that
intersection