Operations on Sets Gazihan Alanku¸s August 6, 2012

advertisement
Outline
Venn Diagrams
Operations
Laws of Set Theory
Operations on Sets
Gazihan Alankuş
(Based on original slides by Brahim Hnich et al.)
August 6, 2012
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Venn Diagrams
Operations
Laws of Set Theory
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Venn Diagrams
I
Often it is convenient to visualize various relations between
sets.
I
We use Venn Diagrams for that
A = {1, a, {2, b}}
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Intersection
I
I
The intersection of sets A and B, denoted by A ∩ B, is the
set that contains those elements both in A and B
A ∩ B = {x|x ∈ A ∧ x ∈ B}
I
I
I
{1, 3, 5, 7} ∩ {2, 3, 4, 5, 6} = {3, 5}
{Jan, Feb, Dec} ∩ {Jan, Feb, Mar } = {Jan, Feb}
{x | ∃y (x = 2y )} ∩ {x | ∃y (x = 3y )} = {x | ∃y (x = 6y )}
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Union
I
I
The union of sets A and B, denoted by A ∪ B, is the set that
contains those elements that are either in A or in B
A ∪ B = {x|x ∈ A ∨ x ∈ B}
I
I
I
{1, 3, 5, 7} ∪ {2, 3, 4, 5, 6} = {1, 2, 3, 4, 5, 6, 7}
{Jan, Feb, Dec} ∪ {Jan, Feb, Mar } = {Jan, Feb, Mar , Dec}
{x|∃y (x = 2y )} ∪ {x|∃y (x = 3y )} = {x|∃y (x = 2y ∨ x = 3y )}
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Disjoint
I
Sets A and B are said to be disjoint if A ∩ B = ∅
I
I
{1, 3, 5, 7} ∩ {2, 4, 6} = ∅
{Jan, Feb, Dec} ∩ {May , Aug } = ∅
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Principle of Inclusion-exclusion
Principle of inclusion-exclusion For any finite sets A and B
|A ∪ B| = |A| + |B| − |A ∩ B|
To count the elements in A ∪ B, we first count the elements of A,
then the elements of B. Elements of A ∩ B are counted twice so
we subtract the number of such elements.
If A and B are disjoint, then |A ∪ B| = |A| + |B|
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Symmetric Difference
I
I
The symmetric difference of sets A and B denoted by A∆B,
is the set that contains those elements that are either in A or
in B, but not in both.
A∆B = {x|x ∈ A ⊕ x ∈ B}
I
I
{1, 3, 5, 7}∆{2, 3, 4, 5, 6} = {1, 2, 4, 6, 7}
{Jan, Feb, May }∆{May , Feb, Aug } = {Jan, Aug }
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Disjoint Sets and Symmetric Difference
Theorem
Sets A and B are disjoint if and only if A ∪ B = A∆B
Proof.
Notice first that A∆B ⊆ A ∪ B.
Suppose that A and B are disjoint. To prove the equality, it
suffices to show that A ∪ B ⊆ A∆B.
Take x ∈ A ∪ B. It belongs to A or B, but x ∈
/ A ∩ B, as the
intersection is empty. Therefore, x ∈ A∆B.
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Complement
I
I
Let A be a set and U a universe, A ⊆ U. The complement of
A denoted by A, is the set that contains all elements in U
that do not belong to A.
A = {x|x ∈ U ∧ x ∈
/ A} = {x|x ∈
/ A}
I
Let the universe be the set of all integers, and
A = {x| ∃y x = 2y }. Then A is the set of all odd integers
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Difference
I
The difference of sets A and B denoted by A − B, is the set
containing those elements in A, but not in B.
I
A − B = {x|x ∈ A ∧ x ∈
/ B}
I
{1, 3, 5} − {1, 2, 3} = {5}
I
Clearly, A = U − A
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Connection with logic connectives
I
Similar to logic connectives and formulas, expressions built
from set operations and sets also satisfy some laws
I
There is a tight connection between set operations and logic
connectives
¬
∨
∧
⊕
0
1
corresponds to complement X
corresponds to union ∪
corresponds to intersection ∩
corresponds to symmetric difference ∆
corresponds to ∅
corresponds to U
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory
Double Complement law : (A) = A
DeMorgan’s Laws
(A ∩ B) = A ∪ B
(A ∪ B) = A ∩ B
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Commutative laws
I
I
A∪B =B ∪A
A∩B =B ∩A
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Commutative laws
I
I
A∪B =B ∪A
A∩B =B ∩A
Associative laws
I
I
A ∪ (B ∪ C ) = (A ∪ B) ∪ C
A ∩ (B ∩ C ) = (A ∩ B) ∩ C
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Commutative laws
I
I
A∪B =B ∪A
A∩B =B ∩A
Associative laws
I
I
A ∪ (B ∪ C ) = (A ∪ B) ∪ C
A ∩ (B ∩ C ) = (A ∩ B) ∩ C
Distributive laws
I
I
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C )
A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Commutative laws
I
I
A∪B =B ∪A
A∩B =B ∩A
Associative laws
I
I
A ∪ (B ∪ C ) = (A ∪ B) ∪ C
A ∩ (B ∩ C ) = (A ∩ B) ∩ C
Distributive laws
I
I
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C )
A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )
Idempotent laws
I
I
A∪A=A
A∩A=A
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Identity laws
I
I
A∪∅=A
A∩U =A
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Identity laws
I
I
A∪∅=A
A∩U =A
Complement laws
I
I
A∪A=U
A∩A=∅
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Identity laws
I
I
A∪∅=A
A∩U =A
Complement laws
I
I
A∪A=U
A∩A=∅
Domination laws
I
I
A∪U =U
A∩∅=∅
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Identity laws
I
I
A∪∅=A
A∩U =A
Complement laws
I
I
A∪A=U
A∩A=∅
Domination laws
I
I
A∪U =U
A∩∅=∅
Absorption laws
I
I
A ∩ (A ∪ B) = A
A ∪ (A ∩ B) = A
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Laws of Set Theory (cntd)
Theorem
A∩B =A∪B
Proof.
We will show that A ∩ B ⊆ A ∪ B and A ∪ B ⊆ A ∩ B.
(1) We show that A ∩ B ⊆ A ∪ B. Take x ∈ A ∩ B. By the
definition, x ∈
/ A ∩ B. Therefore, x ∈
/ A or x ∈
/ B. Hence x ∈ A or
x ∈ B. Thus x ∈ A ∪ B.
(2) We show that A ∪ B ⊆ A ∩ B. Take x ∈ A ∪ B. By definition,
x ∈ A or x ∈ B. Therefore, x ∈
/ A or x ∈
/ B. This implies
x∈
/ A ∩ B. And, finally, x ∈ A ∩ B.
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Outline
Venn Diagrams
Operations
Laws of Set Theory
Another proof
Theorem
A∩B =A∪B
Another way to prove equalities in sets is to use the set builder
construction and some logic
Proof.
A∩B
= {x| x ∈
/ A ∩ B}
= {x| ¬(x ∈ A ∩ B)}
= {x| ¬(x ∈ A ∧ x ∈ B)}
= {x| ¬(x ∈ A) ∨ ¬(x ∈ B)}
= {x| (x ∈
/ A) ∨ (x ∈
/ B)}
= {x| (x ∈ A) ∨ (x ∈ B)}
= {x| x ∈ A ∪ B}
=A∪B
by definition of complement
by definition of does not belong
by definition of intersection
by DeMorgan’s Law
by definition of does not belong
by definition of complement
by definition of union
Gazihan Alankuş (Based on original slides by Brahim Hnich et al.)Operations on Sets
Download