talk set-theory

Download Report

Transcript talk set-theory

Dr. Trần Văn Hoài
Set theory
Set theory
2011-2012
Dr. Trần Văn Hoài
Definition
☞ Set is a basic discrete structure to construct other discrete structures
☞ To group objects which have similar properties
Set is a collection of objects in which order (priority)
is not considered and multiplicity is ignored.
(Concise Encyclopedia of Mathematics)
A set is an unordered collection of objects.
(Discrete Mathematics & Its Applications)
Objects in a set are called elements (members), and
the set contains elements.
Set theory
2011-2012
Dr. Trần Văn Hoài
Examples & Notations
Example:
➠ Set of students in the discrete math class
➠ Set of courses in CS&CE program
➠ Set of required courses in CS&CE program
➠ Set of optional courses in CS&CE program
➠ Set of integers
➠
Z
R = {x|xis a real number}
☞ S = {a, b, c, d} denotes the set of a, b, c, d.
☞ a ∈ S denotes that a is a element of S.
☞ a 6∈ S denotes a not contains in S.
Set theory
2011-2012
Dr. Trần Văn Hoài
Venn diagram
☞ John Venn (1981)
☞ Universe
of
all
objects
(which have the same property) in consideration is
a
b
S
c
d
represented by a rectangle
☞ Circle or other geometrical
shapes to represent sets
☞ Points represent elements
Set theory
2011-2012
Dr. Trần Văn Hoài
The equality of sets
Two sets are equal if and only if they have the same
elements.
Denoted by A = B
In logic, it can be said A = B ⇔ ∀x(x ∈ A ↔ x ∈ B)
Example:
{1, 4, 5} = {4, 1, 5}
{1, 3, 5, 5, 1} = {1, 3, 5}
Set theory
2011-2012
Dr. Trần Văn Hoài
Subset
Set A is a subset of set B iff all elements of A are
also elements of B.
Denoted by A ⊆ B.
If A 6= B, and A is subset of B then A ⊂ B, proper
subset.
Example: {10, 9, 8} ⊆
Z
U
Empty set is a set which has no element.
Denoted by ∅, {}.
Obviously, ∅ ⊆ S, ∀S.
Set theory
B
A
2011-2012
Dr. Trần Văn Hoài
Cardinality
If set S has exactly n (n ≥ 0, ∈ Z) distinct elements,
then we say that S is a finite set which cardinality
is n.
Denoted by |S| = n.
Example:
➳ A is the set of positive odd integers less than 20, ⇒ |A| =
10.
➳ B is the set of students in discrete math class, ⇒ |B| = 5.
➳ |∅| = 0.
Infinite set is a set which is not finite.
Set theory
2011-2012
Dr. Trần Văn Hoài
Power set (1)
☞ Combinations of elements of a set
Given a set S, power set of S is the set of all subsets
of S.
Denoted by P (S), or 2S (note that: Y X is a set of
all functions from X to Y ).
Example:
➠ Power set of S = {1, 2, 3} is
P (S) = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}
➠ Power set of ∅ and {∅}
P (∅) = {∅}, and P ({∅}) = {∅, {∅}}
Set theory
2011-2012
Dr. Trần Văn Hoài
Power set (2)
Cardinality of the power set of a set with cardinality
n is sn .
➳ Proved by mathematical induction.
Set theory
2011-2012
Dr. Trần Văn Hoài
Ordered n-tuples
☞ Order in a collection of objects are sometimes important.
Ordered n-tuple (a1 , a2 , . . . , an ) is the ordered collection that has a1 as the first element, a2 as the
second, . . ., an as the nth elements.
Two ordered n-tuples (a1 , . . . , an ) and (b1 , . . . , bn ) are
equal iff ai = bi, ∀i = 1, . . . , n.
If n = 2, we call a pair.
Set theory
2011-2012
Dr. Trần Văn Hoài
Cartesian product (1)
☞ René Descartes (1596-1650)
Given two sets A, B. Cartesian product of A and B
is defined as follows
A × B = {(a, b)|a ∈ A, b ∈ B}
Example: A = {0, 1} and B = {a, b, c}. Then,
A × B = {(0, a), (0, b), (0, c), (1, a), (1, b), (1, c)}
Set theory
2011-2012
Dr. Trần Văn Hoài
Cartesian product (2)
Example: What is the meaning of the following Cartesian
product ?
A is the set of students in a university, B is a set of courses
in education program of that university.
Generally, Cartesian product of n sets,
A1 × A2 × . . . × An =
{(a1 , a2 , . . . , an )|a1 ∈ A1, a2 ∈ A2, . . . , an ∈ An }
Set theory
2011-2012
Dr. Trần Văn Hoài
Set operations
Union/Intersection
U
Union of A and B is defined as follows
A ∪ B = {x|x ∈ A ∨ x ∈ B}
A
B
U
Intersection of A and B is defined as
follows
A ∩ B = {x|x ∈ A ∧ x ∈ B}
Set theory
A
B
2011-2012
Dr. Trần Văn Hoài
Example of union/intersections
Example: Given two sets A = {1, 3, 5} and B = {1, 2, 3}.
A ∪ B = {1, 2, 3, 5}
A ∩ B = {3}
Given C = {4, 5}.
B∩C =∅
Two sets is called disjoint if their intersection is
empty.
Set theory
2011-2012
Dr. Trần Văn Hoài
Set operations
Difference/Complement
U
Difference of A and B is defined as
follows
A − B = {x|x ∈ A ∧ x 6∈ B}
A
B
U
Complement of A is defined as follows
A
A = {x|x 6∈ A}
Set theory
2011-2012
Dr. Trần Văn Hoài
Example on Difference/Complement
Example: Given two sets A = {1, 3, 5} and B = {1, 2, 3}. Universial set U = {x|x ∈ + ∧ x < 10}.
Z
A − B = {1, 5}
A = {2, 4, 6, 7, 8, 9}
Set theory
2011-2012
Dr. Trần Văn Hoài
Set identities
Identity
Name
A∪∅=A
Identity laws
A∩U =A
A∪U =U
Domination laws
A∩∅=∅
A∪A=A
Idempotent laws
A∩A=A
(A) = A
Set theory
Complementation law
Identity
Name
A∪B =B∪A
Commutative laws
A∩B =B∩A
A ∪ (B ∪ C) = (A ∪ B) ∪ C
Associative laws
A ∩ (B ∩ C) = (A ∩ B) ∩ C
A ∩ (B ∪ C) = (A ∪ B) ∩ (A ∪ C)
Distributive laws
A ∪ (B ∩ C) = (A ∩ B) ∪ (A ∩ C)
A∪B =A∩B
De Morgan laws
A∩B =A∪B
2011-2012
Dr. Trần Văn Hoài
How to prove set equality
In order to prove two sets A and B are equal
➳ To prove
A⊆B∧B ⊆A
➳ To show elements having the same property
➳ To use membership table
Set theory
2011-2012
Dr. Trần Văn Hoài
Example (1)
Example: A ∩ B = A ∪ B.
Proof 1: Suppose x ∈ A ∩ B.
It implies x 6∈ (A ∩ B).
⇒ x 6∈ A or x 6∈ B.
⇒ x ∈ Ā or x ∈ B̄.
It also means x ∈ Ā ∪ B̄.
Set theory
2011-2012
Dr. Trần Văn Hoài
Example (2)
Example: Problem as previous slide.
Proof 2:
A ∩ B = {x|x 6∈ A ∩ B}
= {x|¬(x ∈ A ∩ B)}
= {x|¬(x ∈ A ∧ x ∈ B)}
= {x|¬(x ∈ A) ∨ ¬(x ∈ B)}
= {x|x 6∈ A ∨ x 6∈ B}
= {x|x ∈ Ā ∨ x ∈ B̄}
= {x|x ∈ Ā ∪ B̄}
Set theory
2011-2012
Dr. Trần Văn Hoài
Example (3)
Example: Problem as previous slide.
Proof 3:
A B A ∩ B A ∩ B Ā ∪ B̄
Set theory
0
0
0
1
1
0
1
0
1
1
1
0
0
1
1
1
1
1
0
0
2011-2012
Dr. Trần Văn Hoài
Example (4)
Example: Problem as previous slide.
Proof 4: Using Venn diagram.
U
A
Set theory
B
2011-2012
Dr. Trần Văn Hoài
Generalization
A1 ∪ A2 ∪ . . . ∪ An = ∪ni=1Ai
= {x|x ∈ A1 ∨ x ∈ A2 ∨ . . . ∨ x ∈ An }
A1 ∩ A2 ∩ . . . ∩ An = ∩ni=1Ai
= {x|x ∈ A1 ∧ x ∈ A2 ∧ . . . ∧ x ∈ An }
Set theory
2011-2012
Dr. Trần Văn Hoài
How to represent set in computer
memory (data structure)
☞ To use an array (unoredered)
⇒ Set operations not performed efficiently
☞ To use a sequence of bits to represent the existence of
every element in the set
• Consider a universal set U with n elements. For example U =
{a, b, c, d, e}
• Each set A ⊆ U is represented by a sequence of n bit. For example,
A = {a, d, e} is represented as 10011.
• What happens if n is large ?
☞ To use an ordered array
Set theory
2011-2012