Professional Documents
Culture Documents
Disc Math Handout 2
Disc Math Handout 2
Sets
Objective
To introduce the basics of the theory of sets and some of its Sets
applications. adapted from Section 1.1 of Sets for Mathematics
by F.W. Lawvere and R. Rosebrugh
Complementary reading:
An abstract set is supposed to have elements, each of which has no
◮ Chapters 1, 30, and 31 of How to Think Like a Mathematician
structure, and is itself supposed to have no internal structure, except
by K. Houston.
that the elements can be distinguished as equal or unequal, and to
◮ Chapters 4.1 and 7 of Mathematics for Computer Science by have no external structure except for the number of elements. There
E. Lehman, F. T. Leighton, and A. R. Meyer. are sets of all possible sizes, including finite and infinite sizes.
It has been said that a set is like a mental “bag of dots”, except of
course that the bag has no shape; thus, Set Theory
?> =<
•(1,1) •(1,2) •(1,3) •(1,4) •(1,5) Set Theory a is the branch of mathematical logic that studies axiom
systems for the notion of abstract set as based on a membership
89 • •(2,2) •(2,3) •(2,4) •(2,5):;
(2,1)
predicate (recall page 178). As we will see (on page 296), care
may be a convenient way of picturing a certain set for some con- must be taken in such endeavour.
siderations, but what is apparently the same set may be pictured
Set Theory aims at providing foundations for mathematics. There
as
are however other approaches, as Category Theory and Type
?> (1,1) =<
89 • •(2,1) •(1,2) •(2,2) •(1,3) •(2,3) •(1,4) •(2,4) •(1,5) •(2,5) :; Theory, that also play an important role in Computer Science.
or even simply as
?> =<
a
(for which you may start by consulting the book Naive Set Theory by
89 • • • • • • • • • • :; P. Halmos)
Extensionality axiom
A widely used set theory is ZFC: Zermelo-Fraenkel Set Theory
with Choice. It embodies postulates of: extensionality (page 291); Two sets are equal if they have the same elements.
separation [aka restricted comprehension, subset, or
specification] (page 294); powerset (page 300); pairing (page 313); Thus,
union (page 326); replacement; infinity; foundation [aka regularity];
∀ sets A, B. A = B ⇐⇒ ( ∀ x. x ∈ A ⇐⇒ x ∈ B )
and choice.
We are not going to be formally studying Set Theory here; rather,
we will be naively looking at ubiquituous structures that are Example:
available within it.
{0} 6= {0, 1} = {1, 0} 6= {2} = {2, 2}
— 290 — — 291 —
Version of February 4, 2014 Version of February 4, 2014
∀ x. x ∈ A =⇒ x ∈ B
Go to Workout 21
holds. on page 437
Example:
Set comprehension
Separation principle The set whose existence is postulated by the separation principle
for a set A and a property P typically denoted
For any set A and any definable property P, there is a
set containing precisely those elements of A for which { x ∈ A | P(x) } .
the property P holds. (Recall the discussion on set comprehension on page 181.)
Thus, the statement (†) on page 181 follows.
— 294 — — 295 —
Version of February 4, 2014 Version of February 4, 2014
Russell ′ s paradox
The separation principle does not allow us to consider the class of Empty set
those R such that R 6∈ R as a set (and, btw, the same goes for the
class of all sets). This is not a bug, but a feature! The set whose existence is postulated by the separation principle
for a set A and the absurd property false typically denoted
∅ or {} .
∀ x. x 6∈ ∅
or, equivalently, by
¬(∃ x. x ∈ ∅) .
— 296 — — 297 —
Version of February 4, 2014 Version of February 4, 2014
Cardinality
Example:
#∅ = 0
— 298 — — 299 —
Version of February 4, 2014 Version of February 4, 2014
Hasse diagramsa
Example: P {x, y, z}
Powerset axiom
P(U) .
Thus,
∀ X. X ∈ P(U) ⇐⇒ X ⊆ U .
a
From http://en.wikipedia.org/wiki/Powerset; see also
http://en.wikipedia.org/wiki/Hasse_diagram.
— 300 — — 301 —
Version of February 4, 2014 Version of February 4, 2014
P ROOF IDEA :
a
From http://en.wikipedia.org/wiki/Union_(set_theory) and
http://en.wikipedia.org/wiki/Intersection_(set_theory); see also
http://en.wikipedia.org/wiki/Venn_diagram.
— 302 — — 303 —
Version of February 4, 2014 Version of February 4, 2014
Union Intersection
( P(U) , ∅ , U , ∪ , ∩ , (·)c )
A ∪ B = {x ∈ U | x ∈ A ∨ x ∈ B}
A ∩ B = {x ∈ U | x ∈ A & x ∈ B}
Ac = { x ∈ U | ¬(x ∈ A) }
Complement
— 304 — — 305 —
Version of February 4, 2014 Version of February 4, 2014
◮ The union operation ∪ and the intersection operation ∩ are ◮ The empty set ∅ is a neutral element for ∪ and the universal
associative, commutative, and idempotent. set U is a neutral element for ∩.
— 306 — — 307 —
Version of February 4, 2014 Version of February 4, 2014
◮ The empty set ∅ is an annihilator for ∩ and the universal set U ◮ With respect to each other, the union operation ∪ and the
is an annihilator for ∪. intersection operation ∩ are absorptive and distributive.
— 308 — — 309 —
Version of February 4, 2014 Version of February 4, 2014
P(U) false , true
∅ false
U true
∪ ∨
∩ &
(·)c ¬(·)
— 310 — — 311 —
Version of February 4, 2014 Version of February 4, 2014
Pairing axiom
∀x. x ∈ {a, b} ⇐⇒ (x = a ∨ x = b)
Singletons Examples:
For every a, the pairing axiom provides the set {a, a} which is ∅ ⊂ {∅} ⊂ { ∅ , {∅} } ⊃ { {∅} } ⊃ ∅
abbreviated as ◮ #{∅} = 1
{a} , ◮ #{ {∅} } = 1
and referred to as a singleton. ◮ #{ ∅ , { ∅ } } = 2
NB
NB
#{a} = 1
{ ∅ } ∈ { { ∅ } } , { ∅ } 6⊆ { { ∅ } } , { { ∅ } } 6⊆ { ∅ }
— 314 — — 315 —
Version of February 4, 2014 Version of February 4, 2014
ha, bi ,
— 316 — — 317 —
Version of February 4, 2014 Version of February 4, 2014
— 318 — — 319 —
Version of February 4, 2014 Version of February 4, 2014
# (A × B) = #A · #B .
P ROOF IDEA :
Go to Workout 24
on page 446
— 320 — — 321 —
Version of February 4, 2014 Version of February 4, 2014
Definition 86 Let U be a set. For a collection of sets F ⊆ P(U), Examples: For A, A1 , A2 ∈ P(U),
S T
◮ let the big union (relative to U) be defined as ∅=∅ ∅=U
S S T
F = { x ∈ U | ∃A ∈ F. x ∈ A } , {A} = A {A} = A
S T
and {A1 , A2 } = A1 ∪ A2 {A1 , A2 } = A1 ∩ A2
S T
◮ let the big intersection (relative to U) be defined as {A, A1 , A2 } = A ∪ A1 ∪ A2 {A, A1 , A2 } = A ∩ A1 ∩ A2
T
F = { x ∈ U | ∀A ∈ F. x ∈ A } .
— 322 — — 323 —
Version of February 4, 2014 Version of February 4, 2014
P ROOF :
Theorem 87 Let
F = S ⊆ R (0 ∈ S) & ∀x ∈ R. x ∈ S =⇒ (n + 1) ∈ S .
T T
Then, (i) N ∈ F and (ii) N ⊆ F. Hence, F = N.
— 324 — — 325 —
Version of February 4, 2014 Version of February 4, 2014
Union axiom
Using the separation and union axioms, for every collection F,
Every collection of sets has a union. consider the set
S
The set whose existence is postulated by the union axiom for a x ∈ F | ∀ X ∈ F. x ∈ X .
collection F is typically denoted For non-empty F this set is denoted
S T
F F
and, in the case F = {A, B}, abbreviated to because, in this case,
T
A∪B . ∀x. x ∈ F ⇐⇒ ∀ X ∈ F. x ∈ X .
Thus, In particular, for F = {A, B}, this is abbreviated to
S
x∈ F ⇐⇒ ∃ X ∈ F. x ∈ X , A∩B
and hence with defining property
x ∈ (A ∪ B) ⇐⇒ (x ∈ A) ∨ (x ∈ B) . ∀ x. x ∈ (A ∩ B) ⇐⇒ (x ∈ A) & (x ∈ B) .
— 326 — — 327 —
Version of February 4, 2014 Version of February 4, 2014
Tagging
The construction
{ℓ} × A = (ℓ, a) | a ∈ A
{ ℓ1 } × A = { ℓ2 } × A ⇐⇒ ℓ1 = ℓ2 .
— 328 — — 329 —
Version of February 4, 2014 Version of February 4, 2014
Disjoint unions More generally, for a fixed natural number n and sets A1 , . . . , An , we
have
Definition 88 The disjoint union A ⊎ B of two sets A and B is the Un
i=1 Ai = A1 ⊎ · · · ⊎ An
set
= {1} × A1 ∪ · · · ∪ {n} × An
A ⊎ B = {1} × A ∪ {2} × B .
U0
NB Cunningly enough, the definition is such that i=1 Ai = ∅.
Thus,
Notation 89 For a natural number n and a set A, one typically
∀ x. x ∈ (A ⊎ B) ⇐⇒ ∃a ∈ A. x = (1, a) ∨ ∃b ∈ B. x = (2, b) . U
writes n · A for ni=1 A.
— 330 — — 331 —
Version of February 4, 2014 Version of February 4, 2014
# (A ⊎ B) = #A + #B .
P ROOF IDEA :
Go to Workout 26
on page 451
— 332 — — 333 —
Version of February 4, 2014 Version of February 4, 2014
Workout 21
from page 293
Workout 22
1. Write an ML function
from page 298
subset: ’’a list * ’’a list -> bool
Prove the following statements:
such that for every list xs representing a finite set X and every
list ys representing a finite set Y, subset(xs,ys)=true iff X ⊆ Y. 1. ∀ set S. ∅ ⊆ S.
2. Prove the following statements: 2. ∀ set S. (∀x. x 6∈ S) ⇐⇒ S = ∅.
(a) ∀ sets A. A ⊆ A.
(b) ∀ sets A, B, C. (A ⊆ B & B ⊆ C) =⇒ A ⊆ C.
(c) ∀ sets A. (A ⊆ B & B ⊆ A) ⇐⇒ A = B.
— 437 — — 438 —
Version of February 4, 2014 Version of February 4, 2014
3. Write ML functions
Workout 23 union: ’a list * ’a list -> ’a list
from page 312 intersection: ’’a list * ’’a list -> ’a list
such that for every list xs representing a finite set X and every
list ys representing a finite set Y, the lists union(xs,ys) and
1. Referring to the definitions on pages 183 and 184, show that intersection(xs,ys) respectively represent the finite sets X∪Y
CD(m, n) = D(m) ∩ D(n) for all natural numbers m and n. and X ∩ Y.
2. Find the union and intersection of: Use these functions to check your answer to the first part of the
previous item.
(a) {1, 2, 3, 4, 5} and {−1, 1, 3, 5, 7};
(b) {x ∈ R | x > 7} and {x ∈ N | x > 5}. 4. Give an explicit description of P P(P(∅)) , and draw its Hasse
diagram.
— 439 — — 440 —
Version of February 4, 2014 Version of February 4, 2014
5. Write an ML function 8. Let U be a set. For all A, B ∈ P(U) prove that the following
powerset: ’a list -> ’a list list statements are equivalent.
such that for every list as representing a finite set A, the list of (a) A ∪ B = B.
lists powerset(as) represents the finite set P(A). (b) A ⊆ B.
6. Establish the laws of the powerset Boolean algebra. (c) A ∩ B = A.
(a) A ⊆ B =⇒ P(A) ⊆ P(B), 9. Let U be a set. For all A, B ∈ P(U) prove that
(b) P(A ∪ B) ⊆ P(A) ∪ P(B), (a) Ac = B ⇐⇒ (A ∪ B = U & A ∩ B = ∅),
(c) P(A) ∪ P(B) ⊆ P(A ∪ B). (b) (Ac )c = A, and
(d) P(A ∩ B) ⊆ P(A) ∩ P(B), (c) the De Morgan’s laws:
(e) P(A) ∩ P(B) ⊆ P(A ∩ B). (A ∪ B)c = Ac ∩ Bc and (A ∩ B)c = Ac ∪ Bc .
— 441 — — 442 —
Version of February 4, 2014 Version of February 4, 2014
A \ B = { x ∈ A | x 6∈ B } (c) (A △ B) ∩ (A ∩ B) = ∅ & (A △ B) ∪ (A ∩ B) = A ∪ B,
— 443 — — 444 —
Version of February 4, 2014
Version of February 4, 2014
Workout 24
from page 321
12. The purpose of this exercise is to show that, for a set U, the
structure P(U), ∅, △, U, ∩ is a commutative ring.
1. Find the product of {1, 2, 3, 4, 5} and {−1, 1, 3, 5, 7}.
(a) Prove that (P(U), ∅, △) is a commutative group; that is, a
commutative monoid (refer to page 151) in which every 2. Write an ML function
element has an inverse (refer to page 156).
product: ’a list * ’b list -> ( ’a * ’b ) list
(b) Prove that P(U) with additive structure (∅, △) and
such that for every list as representing a finite set A and every
multiplicative structure (U, ∩) is a commutative semiring.
list bs representing a finite set B, the list of pairs
product(as,bs) represents the product set A × B.
Use this function to check your answer to the previous item.
— 445 — — 446 —
Version of February 4, 2014
Version of February 4, 2014
(b) (A ∪ C) × (B ∪ D) ⊆ (A × B) ∪ (C × D).
(c) (A × B) ∪ (C × D) ⊆ (A ∪ C) × (B ∪ D). 1. Let I = {2, 3, 4, 5}, and for each i ∈ I let Ai = {i, i + 1, i − 1, 2 · i}.
(d) A × (B ∪ D) ⊆ (A × B) ∪ (A × D). (a) List the elements of all the sets Ai for i ∈ I.
(e) (A × B) ∪ (A × D) ⊆ A × (B ∪ D). (b) Let {Ai | i ∈ I} stand for {A2 , A3 , A4 , A5 }.
S T
What happens with the above when A ∩ C = ∅ and/or Find {Ai | i ∈ I} and {Ai | i ∈ I}.
B ∩ D = ∅?
— 447 — — 448 —
Version of February 4, 2014
Version of February 4, 2014
2. Write ML functions
NB For intuition when tackling the following exercises it might
bigunion: ’a list list -> ’a list help considering the case of finite collections first.
bigintersection: ’a list list -> ’a list
4. Prove that, for all collections F, it holds that
such that for every list of lists as representing a finite set of S
∀ set U. F ⊆ U ⇐⇒ ∀ X ∈ F. X ⊆ U .
finite sets A, the lists bigunion(as) and bigintersection(as)
S T State and prove the analogous property for intersections of big
respectively represent the finite sets X and X.
intersections of non-empty collections.
Use these functions to check your answer to the previous item.
5. Prove that for all collections F1 and F2 ,
3. For F ⊆ P(A), let U = X ⊆ A | ∀ S ∈ F. S ⊆ X ⊆ P(A).
S T S S S
Prove that F = U. F1 ∪ F2 = (F1 ∪ F2 ) .
T S
Analogously, define L ⊆ P(A) such that F = L. Also State and prove the analogous property for intersections of
prove this statement. non-empty collections.
— 449 — — 450 —
Version of February 4, 2014
Version of February 4, 2014
Workout 26
from page 333