SlideShare una empresa de Scribd logo
1 de 42
1
Discrete Math
CS 23022
Prof. Johnnie Baker
jbaker@cs.kent.edu
Module
Basic Structures: Sets
Acknowledgement
Most of these slides were either created by
Professor Bart Selman at Cornell University or
else are modifications of his slides
2
3
Set Theory - Definitions and notation
A set is an unordered collection of objects referred to as elements.
A set is said to contain its elements.
Different ways of describing a set.
1 – Explicitly: listing the elements of a set
{1, 2, 3} is the set containing “1” and “2” and “3.” list the members between
braces.
{1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant.
{1, 2, 3} = {3, 2, 1} since sets are unordered.
{1,2,3, …, 99} is the set of positive integers less than 100; use ellipses when
the general pattern of the elements is obvious.
{1, 2, 3, …} is a way we denote an infinite set (in this case, the natural
numbers).
 = {} is the empty set, or the set containing no elements.
Note:   {}
4
Set Theory - Definitions and notation
2 – Implicitly: by using a set builder notations, stating the property or
properties of the elements of the set.
S = {m| 2 ≤ m ≤ 100, m is integer}
S is
the set of
all m
such that
m is between 2 and 100
and
m is integer.
5
Set Theory - Ways to define sets
Explicitly: {John, Paul, George, Ringo}
Implicitly: {1,2,3,…}, or {2,3,5,7,11,13,17,…}
Set builder: { x : x is prime }, { x | x is odd }. In general { x : P(x) is true },
where P(x) is some description of the set.
Let D(x,y) denote “x is divisible by y.”
Give another name for
{ x : y ((y > 1)  (y < x))  D(x,y) }.
Can we use any predicate P to define a set S = { x : P(x) }?
: and | are read
“such that” or
“where”
Primes
6
Set Theory - Russell’s Paradox
Can we use any predicate P to define a set
S = { x : P(x) }?
Define S = { x : x is a set where x  x }
Then, if S  S, then by defn of S, S  S.
So S must not be
in S, right?
ARRRGH!But, if S  S, then by defn of S, S  S.
No!
There is a town with a barber who shaves all the people (and only the
people) who don’t shave themselves.
Who shaves the
barber?
"the set of all sets that do not
contain themselves as members“ 
Reveals contradiction in Frege’s naïve set theory.
7
Set Theory - Russell’s Paradox
There is a town with a barber who shaves all the people (and only the people)
who don’t shave themselves. Who shaves the
barber?Does the barber shave himself?
If the barber does not shave himself, he must abide by the rule and shave himself.
If he does shave himself, according to the rule he will not shave himself.
)),(),()(()(()( yxshavesyyshavesyxbarberx 
This sentence is unsatisfiable (a contradiction) because of the universal quantifier.
The universal quantifier y will include every single element in the domain,
including our infamous barber x. So when the value x is assigned to y,
the sentence can be rewritten to:
)},((),({
))},(),(()),(),({(
)},(),({
xxshavesxxshaves
xxshavesxxshavesxxshavesxxshaves
xxshavesxxshaves



Contradiction!
Aside: this layman’s version of Russell’s paradox has some drawbacks.
8
Set Theory - Definitions and notation
Important Sets
N = {0,1,2,3,…}, the set of natural numbers, non negative integers, (occasionally IN)
Z = { …, -2, -1, 0, 1, 2,3, …), the set of integers
Z+ = {1,2,3,…} set of positive integers
Q = {p/q | p  Z, q Z, and q0}, set of rational numbers
R, the set of real numbers
Note: Real number are the numbers that can be represented by an infinite decimal
representation, such as 3.4871773339…. The real numbers include both rational, and
irrational numbers such as π and the and can be represented as points along an
infinitely long number line.
2
9
Set Theory - Definitions and notation
x  S means “x is an element of set S.”
x  S means “x is not an element of set S.”
A  B means “A is a subset of B.”
Venn Diagram
or, “B contains A.”
or, “every element of A is also in B.”
or, x ((x  A)  (x  B)).
A
B
10
Set Theory - Definitions and notation
A  B means “A is a subset of B.”
A  B means “A is a superset of B.”
A = B if and only if A and B have exactly the same elements.
iff, A  B and B  A
iff, A  B and A  B
iff, x ((x  A)  (x  B)).
So to show equality of sets A and B, show:
• A  B
• B  A
11
Set Theory - Definitions and notation
A  B means “A is a proper subset of B.”
– A  B, and A  B.
– x ((x  A)  (x  B))  x ((x  B)  (x  A))
– x ((x  A)  (x  B))  x ((x  B) v (x  A))
– x ((x  A)  (x  B))  x ((x  B)  (x  A))
– x ((x  A)  (x  B))  x ((x  B)  (x  A))
A
B
12
Set Theory - Definitions and notation
Quick examples:
{1,2,3}  {1,2,3,4,5}
{1,2,3}  {1,2,3,4,5}
Is   {1,2,3}? Yes! x (x  )  (x  {1,2,3}) holds (for all
over empty domain)
Is   {1,2,3}? No!
Is   {,1,2,3}? Yes!
Is   {,1,2,3}? Yes!
13
Set Theory - Definitions and notation
A few more:
Is {a}  {a}?
Is {a}  {a,{a}}?
Is {a}  {a,{a}}?
Is {a}  {a}?
Yes
Yes
Yes
No
14
Set Theory - Cardinality
If S is finite, then the cardinality of S, |S|, is the number of distinct
elements in S.
If S = {1,2,3}, |S| = 3.
If S = {3,3,3,3,3},
If S = ,
If S = { , {}, {,{}} },
|S| = 1.
|S| = 0.
|S| = 3.
If S = {0,1,2,3,…}, |S| is infinite.
15
CS 173
Set Theory - Power sets
If S is a set, then the power set of S is
2S = { x : x  S }.
If S = {a},
aka P(S)
If S = {a,b},
If S = ,
If S = {,{}},
We say, “P(S) is
the set of all
subsets of S.”
2S = {, {a}}.
2S = {, {a}, {b}, {a,b}}.
2S = {}.
2S = {, {}, {{}}, {,{}}}.
Fact: if S is finite, |2S| = 2|S|. (if |S| = n, |2S| = 2n) Why?
16
Set Theory – Ordered Tuples
Cartesian Product
When order matters, we use ordered n-tuples
The Cartesian Product of two sets A and B is:
A x B = { <a,b> : a  A  b  B}
If A = {Charlie, Lucy, Linus}, and B =
{Brown, VanPelt}, then
A,B finite  |AxB| = ?
A1 x A2 x … x An = {<a1, a2,…, an>: a1  A1, a2  A2, …, an  An}
A x B = {<Charlie, Brown>, <Lucy, Brown>, <Linus,
Brown>, <Charlie, VanPelt>, <Lucy, VanPelt>,
<Linus, VanPelt>}
We’ll use these
special sets
soon!
a) AxB
b) |A|+|B|
c) |A+B|
d) |A||B|Size?
nn if (i) Ai  = n
17
Set Theory - Operators
The union of two sets A and B is:
A  B = { x : x  A v x  B}
If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi},
then
A  B = {Charlie, Lucy, Linus, Desi}
A
B
18
Set Theory - Operators
The intersection of two sets A and B is:
A  B = { x : x  A  x  B}
If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi},
then
A  B = {Lucy}
A
B
19
Set Theory - Operators
The intersection of two sets A and B is:
A  B = { x : x  A  x  B}
If A = {x : x is a US president}, and B = {x : x is deceased}, then
A  B = {x : x is a deceased US president}
A
B
20
Set Theory - Operators
The intersection of two sets A and B is:
A  B = { x : x  A  x  B}
If A = {x : x is a US president}, and B = {x : x is in this room}, then
A  B = {x : x is a US president in this room} = 
A
B
Sets whose
intersection is
empty are called
disjoint sets
21
Set Theory - Operators
The complement of a set A is:
A = { x : x  A}
If A = {x : x is bored}, then
A = {x : x is not bored}
A = U
and
U = 
U
I.e., A = U – A, where U is the universal set.
“A set fixed within the framework of a theory and consisting
of all objects considered in the theory. “
22
Set Theory - Operators
The set difference, A - B, is:
A
U
B
A - B = { x : x  A  x  B }
A - B = A  B
23
Set Theory - Operators
The symmetric difference, A  B, is:
A  B = { x : (x  A  x  B) v (x  B  x  A)}
= (A - B) U (B - A)
like
“exclusive
or”
A
U
B
24
Set Theory - Operators
A  B = (A - B) U (B - A)
Proof: A  B = { x : (x  A  x  B) v (x  B  x  A)}
= { x : (x  A - B) v (x  B - A)}
= { x : x  ((A - B) U (B - A))}
= (A - B) U (B - A)
Q.E.D.
Theorem:
25
Set Theory - Identities
Identity
Domination
Idempotent
A  U = A
A U  = A
A  U = U
A   = A
A  A = A
A  A = A
Directly from defns.
Semantically clear.
26
Set Theory – Identities, cont.
Complement Laws
Double complement
A  A = U
A  A = 
A = A
27
Set Theory - Identities, cont.
Commutativity
Associativity
Distributivity
A U B =
(A U B) U C =
A  B =
B U A
B  A
(A  B)  C =
A U (B U C)
A  (B  C)
A U (B  C) =
A  (B U C) =
(A U B)  (A U C)
(A  B) U (A  C)
28
DeMorgan’s I
DeMorgan’s II
A B
Proof by
“diagram”
(useful!), but
we aim for a
more formal
proof.
(A U B) = A  B
(A  B) = A U B
29
Proving identities
Prove that
1. () (x  A U B)
 (x  (A U B))
 (x  A and x  B)
 (x  A  B)
2. () (x ( A  B))
 (x  A and x  B)
 (x  A U B)
 (x  A U B)
(A U B) = A  B (De Morgan)
Alt. proof
Prove that using a membership table.
0 : x is not in the specified set
1 : otherwise
(A U B) = A  B
A B A B A  B A U B A U B
1 1 0 0 0 1 0
1 0 0 1 0 1 0
0 1 1 0 0 1 0
0 0 1 1 1 0 1 Haven’t we seen
this before?
A B
General connection via Boolean algebras (Rosen chapt. 11)
31
Proof using logically equivalent set definitions.
(A U B) = A  B
(A U B) = {x : (x  A v x  B)}
= {x : (x  A)  (x  B)}
= A  B
= {x : (x  A)  (x  B)}
32
Example
X  (Y - Z) = (X  Y) - (X  Z). True or False?
Prove your response.
= (X  Y)  (X’ U Z’)
= (X  Y  X’) U (X  Y  Z’)
=  U (X  Y  Z’)
= (X  Y  Z’)
(X  Y) - (X  Z) = (X  Y)  (X  Z)’
= X  (Y - Z)
(X  Z) = (X  Z)’ (just different notation)Note:
What kind of law?
Distributive law
Suppose to the contrary, that A  B  , and that x  A  B.
Example
Pv that if (A - B) U (B - A) = (A U B) then ______
Then x cannot be in A-B and x cannot be in B-A.
Do you see the contradiction yet?
But x is in A U B since (A  B)  (A U B).
Thus, (A - B) U (B - A) ≠ (A U B).
Contradiction.
A  B = 
Thus, A  B = .
a) A = B
b) A  B = 
c) A-B = B-A = 
Then x is not in (A - B) U (B - A).
Trying to prove p --> q
Assume p and not q, and find
a contradiction.
Our contradiction was that
sets weren’t equal.
35
Set Theory - Generalized Union/Intersection

Ai
i1
n
U  A1  A2 K  An

Ai
i1
n
I  A1  A2 K  An
36
Set Theory - Generalized Union/Intersection
Ex. Suppose that:
,...3,2,1},...,3,2,1{  iiAi
?
1



i
iA
?
1



i
iA



 ZA
i
i1
{1}
1



i
iA
Example:

Ai
i1
n
U  A1  A2 K  An
Ex. Let U = N, and define:

Ai  {x : k 1,x  ki,k  }
A1 = {2,3,4,…}
A2 = {4,6,8,…}
A3 = {6,9,12,…}
i=1,2,…,N
a) Primes
b) Composites
c) 
d) N
e) I have no clue.
primes

Ai
i 2

U  ?
Note: i starts at 2
Union is all the composite numbers.
38
Set Theory - Inclusion/Exclusion
Example:
There are 217 cs majors.
157 are taking CS23021.
145 are taking cs23022.
98 are taking both.
How many are taking neither?
217 - (157 + 145 - 98) = 13
157
145
Generalized Inclusion/Exclusion
Suppose we have:
And I want to know |A U B U C|
A B
C
|A U B U C| = |A| + |B| + |C|
+ |A  B  C|
- |A  B| - |A  C| - |B  C|
What about 4 sets?
Generalized Inclusion/Exclusion
For sets A1, A2,…An we have:
 
n
i
i
n
nji
ji
ni
i
n
i
i AAAAA
1
)1(
111
)1(



 
Set Theory - Sets as bit strings
Let U = {x1, x2,…, xn}, and let A  U.
Then the characteristic vector of A is the
n-vector whose elements, xi, are 1 if xi  A,
and 0 otherwise.
Ex. If U = {x1, x2, x3, x4, x5, x6}, and
A = {x1, x3, x5, x6}, then the
characteristic vector of A is
(101011)
42
Sets as bit strings
Ex. If U = {x1, x2, x3, x4, x5, x6},
A = {x1, x3, x5, x6}, and
B = {x2, x3, x6},
Then we have a quick way of finding
the characteristic vectors of A  B
and A  B.
A 1 0 1 0 1 1
B 0 1 1 0 0 1
A  B
A  B
1 1 1 0 1 1
0 0 1 0 0 1
Bit-wise OR
Bit-wise AND

Más contenido relacionado

La actualidad más candente

t5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functionst5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functionsmath260
 
3.3 graphs of factorable polynomials and rational functions
3.3 graphs of factorable polynomials and rational functions3.3 graphs of factorable polynomials and rational functions
3.3 graphs of factorable polynomials and rational functionsmath265
 
3 2 linear equations and lines
3 2 linear equations and lines3 2 linear equations and lines
3 2 linear equations and linesmath123a
 
2.2 Graphs of First Degree Functions
2.2 Graphs of First Degree Functions2.2 Graphs of First Degree Functions
2.2 Graphs of First Degree Functionsmath260
 
57 graphing lines from linear equations
57 graphing lines from linear equations57 graphing lines from linear equations
57 graphing lines from linear equationsalg1testreview
 
3.4 looking for real roots of real polynomials
3.4 looking for real roots of real polynomials3.4 looking for real roots of real polynomials
3.4 looking for real roots of real polynomialsmath260
 
3.2 properties of division and roots
3.2 properties of division and roots3.2 properties of division and roots
3.2 properties of division and rootsmath260
 
2.0 rectangular coordinate system
2.0 rectangular coordinate system2.0 rectangular coordinate system
2.0 rectangular coordinate systemmath260
 
1.6 slopes and the difference quotient
1.6 slopes and the difference quotient1.6 slopes and the difference quotient
1.6 slopes and the difference quotientmath265
 
2.9 graphs of factorable polynomials
2.9 graphs of factorable polynomials2.9 graphs of factorable polynomials
2.9 graphs of factorable polynomialsmath260
 

La actualidad más candente (16)

t5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functionst5 graphs of trig functions and inverse trig functions
t5 graphs of trig functions and inverse trig functions
 
SETS
SETSSETS
SETS
 
Discrete mathematics notes
Discrete mathematics notesDiscrete mathematics notes
Discrete mathematics notes
 
3.3 graphs of factorable polynomials and rational functions
3.3 graphs of factorable polynomials and rational functions3.3 graphs of factorable polynomials and rational functions
3.3 graphs of factorable polynomials and rational functions
 
A
AA
A
 
3 2 linear equations and lines
3 2 linear equations and lines3 2 linear equations and lines
3 2 linear equations and lines
 
2.2 Graphs of First Degree Functions
2.2 Graphs of First Degree Functions2.2 Graphs of First Degree Functions
2.2 Graphs of First Degree Functions
 
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
 
57 graphing lines from linear equations
57 graphing lines from linear equations57 graphing lines from linear equations
57 graphing lines from linear equations
 
3.4 looking for real roots of real polynomials
3.4 looking for real roots of real polynomials3.4 looking for real roots of real polynomials
3.4 looking for real roots of real polynomials
 
3.2 properties of division and roots
3.2 properties of division and roots3.2 properties of division and roots
3.2 properties of division and roots
 
Set Theory 1
Set Theory 1Set Theory 1
Set Theory 1
 
2.0 rectangular coordinate system
2.0 rectangular coordinate system2.0 rectangular coordinate system
2.0 rectangular coordinate system
 
Problem Set 1
Problem Set 1Problem Set 1
Problem Set 1
 
1.6 slopes and the difference quotient
1.6 slopes and the difference quotient1.6 slopes and the difference quotient
1.6 slopes and the difference quotient
 
2.9 graphs of factorable polynomials
2.9 graphs of factorable polynomials2.9 graphs of factorable polynomials
2.9 graphs of factorable polynomials
 

Similar a Chpt 2-sets v.3

Set and Set operations, UITM KPPIM DUNGUN
Set and Set operations, UITM KPPIM DUNGUNSet and Set operations, UITM KPPIM DUNGUN
Set and Set operations, UITM KPPIM DUNGUNbaberexha
 
Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Kwonpyo Ko
 
SETS - Vedantu.pdf
SETS - Vedantu.pdfSETS - Vedantu.pdf
SETS - Vedantu.pdfAneeshRenu
 
Mathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfMathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfgowhiksankar54
 
sets and their introduction and their exercises.pptx
sets and their introduction and their exercises.pptxsets and their introduction and their exercises.pptx
sets and their introduction and their exercises.pptxZenLooper
 
Mkk1013 chapter 2.1
Mkk1013 chapter 2.1Mkk1013 chapter 2.1
Mkk1013 chapter 2.1ramlahmailok
 
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).pptDediTriLaksono1
 
Sets functions-sequences-exercises
Sets functions-sequences-exercisesSets functions-sequences-exercises
Sets functions-sequences-exercisesRoshayu Mohamad
 
20200911-XI-Maths-Sets-2 of 2-Ppt.pdf
20200911-XI-Maths-Sets-2 of 2-Ppt.pdf20200911-XI-Maths-Sets-2 of 2-Ppt.pdf
20200911-XI-Maths-Sets-2 of 2-Ppt.pdfMridulDhamija
 

Similar a Chpt 2-sets v.3 (20)

Sets.pdf
Sets.pdfSets.pdf
Sets.pdf
 
Set and Set operations, UITM KPPIM DUNGUN
Set and Set operations, UITM KPPIM DUNGUNSet and Set operations, UITM KPPIM DUNGUN
Set and Set operations, UITM KPPIM DUNGUN
 
Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Ch1 sets and_logic(1)
Ch1 sets and_logic(1)
 
Sets
SetsSets
Sets
 
4898850.ppt
4898850.ppt4898850.ppt
4898850.ppt
 
Mtk3013 chapter 2-3
Mtk3013   chapter 2-3Mtk3013   chapter 2-3
Mtk3013 chapter 2-3
 
Sets
SetsSets
Sets
 
01_Sets.pdf
01_Sets.pdf01_Sets.pdf
01_Sets.pdf
 
discrete maths notes.ppt
discrete maths notes.pptdiscrete maths notes.ppt
discrete maths notes.ppt
 
sets.pptx
sets.pptxsets.pptx
sets.pptx
 
SETS - Vedantu.pdf
SETS - Vedantu.pdfSETS - Vedantu.pdf
SETS - Vedantu.pdf
 
Mathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfMathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdf
 
sets and their introduction and their exercises.pptx
sets and their introduction and their exercises.pptxsets and their introduction and their exercises.pptx
sets and their introduction and their exercises.pptx
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Mkk1013 chapter 2.1
Mkk1013 chapter 2.1Mkk1013 chapter 2.1
Mkk1013 chapter 2.1
 
6.1_set.pptx
6.1_set.pptx6.1_set.pptx
6.1_set.pptx
 
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
00_1 - Slide Pelengkap (dari Buku Neuro Fuzzy and Soft Computing).ppt
 
Sets functions-sequences-exercises
Sets functions-sequences-exercisesSets functions-sequences-exercises
Sets functions-sequences-exercises
 
20200911-XI-Maths-Sets-2 of 2-Ppt.pdf
20200911-XI-Maths-Sets-2 of 2-Ppt.pdf20200911-XI-Maths-Sets-2 of 2-Ppt.pdf
20200911-XI-Maths-Sets-2 of 2-Ppt.pdf
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 

Último

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Último (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Chpt 2-sets v.3

  • 1. 1 Discrete Math CS 23022 Prof. Johnnie Baker jbaker@cs.kent.edu Module Basic Structures: Sets
  • 2. Acknowledgement Most of these slides were either created by Professor Bart Selman at Cornell University or else are modifications of his slides 2
  • 3. 3 Set Theory - Definitions and notation A set is an unordered collection of objects referred to as elements. A set is said to contain its elements. Different ways of describing a set. 1 – Explicitly: listing the elements of a set {1, 2, 3} is the set containing “1” and “2” and “3.” list the members between braces. {1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant. {1, 2, 3} = {3, 2, 1} since sets are unordered. {1,2,3, …, 99} is the set of positive integers less than 100; use ellipses when the general pattern of the elements is obvious. {1, 2, 3, …} is a way we denote an infinite set (in this case, the natural numbers).  = {} is the empty set, or the set containing no elements. Note:   {}
  • 4. 4 Set Theory - Definitions and notation 2 – Implicitly: by using a set builder notations, stating the property or properties of the elements of the set. S = {m| 2 ≤ m ≤ 100, m is integer} S is the set of all m such that m is between 2 and 100 and m is integer.
  • 5. 5 Set Theory - Ways to define sets Explicitly: {John, Paul, George, Ringo} Implicitly: {1,2,3,…}, or {2,3,5,7,11,13,17,…} Set builder: { x : x is prime }, { x | x is odd }. In general { x : P(x) is true }, where P(x) is some description of the set. Let D(x,y) denote “x is divisible by y.” Give another name for { x : y ((y > 1)  (y < x))  D(x,y) }. Can we use any predicate P to define a set S = { x : P(x) }? : and | are read “such that” or “where” Primes
  • 6. 6 Set Theory - Russell’s Paradox Can we use any predicate P to define a set S = { x : P(x) }? Define S = { x : x is a set where x  x } Then, if S  S, then by defn of S, S  S. So S must not be in S, right? ARRRGH!But, if S  S, then by defn of S, S  S. No! There is a town with a barber who shaves all the people (and only the people) who don’t shave themselves. Who shaves the barber? "the set of all sets that do not contain themselves as members“  Reveals contradiction in Frege’s naïve set theory.
  • 7. 7 Set Theory - Russell’s Paradox There is a town with a barber who shaves all the people (and only the people) who don’t shave themselves. Who shaves the barber?Does the barber shave himself? If the barber does not shave himself, he must abide by the rule and shave himself. If he does shave himself, according to the rule he will not shave himself. )),(),()(()(()( yxshavesyyshavesyxbarberx  This sentence is unsatisfiable (a contradiction) because of the universal quantifier. The universal quantifier y will include every single element in the domain, including our infamous barber x. So when the value x is assigned to y, the sentence can be rewritten to: )},((),({ ))},(),(()),(),({( )},(),({ xxshavesxxshaves xxshavesxxshavesxxshavesxxshaves xxshavesxxshaves    Contradiction! Aside: this layman’s version of Russell’s paradox has some drawbacks.
  • 8. 8 Set Theory - Definitions and notation Important Sets N = {0,1,2,3,…}, the set of natural numbers, non negative integers, (occasionally IN) Z = { …, -2, -1, 0, 1, 2,3, …), the set of integers Z+ = {1,2,3,…} set of positive integers Q = {p/q | p  Z, q Z, and q0}, set of rational numbers R, the set of real numbers Note: Real number are the numbers that can be represented by an infinite decimal representation, such as 3.4871773339…. The real numbers include both rational, and irrational numbers such as π and the and can be represented as points along an infinitely long number line. 2
  • 9. 9 Set Theory - Definitions and notation x  S means “x is an element of set S.” x  S means “x is not an element of set S.” A  B means “A is a subset of B.” Venn Diagram or, “B contains A.” or, “every element of A is also in B.” or, x ((x  A)  (x  B)). A B
  • 10. 10 Set Theory - Definitions and notation A  B means “A is a subset of B.” A  B means “A is a superset of B.” A = B if and only if A and B have exactly the same elements. iff, A  B and B  A iff, A  B and A  B iff, x ((x  A)  (x  B)). So to show equality of sets A and B, show: • A  B • B  A
  • 11. 11 Set Theory - Definitions and notation A  B means “A is a proper subset of B.” – A  B, and A  B. – x ((x  A)  (x  B))  x ((x  B)  (x  A)) – x ((x  A)  (x  B))  x ((x  B) v (x  A)) – x ((x  A)  (x  B))  x ((x  B)  (x  A)) – x ((x  A)  (x  B))  x ((x  B)  (x  A)) A B
  • 12. 12 Set Theory - Definitions and notation Quick examples: {1,2,3}  {1,2,3,4,5} {1,2,3}  {1,2,3,4,5} Is   {1,2,3}? Yes! x (x  )  (x  {1,2,3}) holds (for all over empty domain) Is   {1,2,3}? No! Is   {,1,2,3}? Yes! Is   {,1,2,3}? Yes!
  • 13. 13 Set Theory - Definitions and notation A few more: Is {a}  {a}? Is {a}  {a,{a}}? Is {a}  {a,{a}}? Is {a}  {a}? Yes Yes Yes No
  • 14. 14 Set Theory - Cardinality If S is finite, then the cardinality of S, |S|, is the number of distinct elements in S. If S = {1,2,3}, |S| = 3. If S = {3,3,3,3,3}, If S = , If S = { , {}, {,{}} }, |S| = 1. |S| = 0. |S| = 3. If S = {0,1,2,3,…}, |S| is infinite.
  • 15. 15 CS 173 Set Theory - Power sets If S is a set, then the power set of S is 2S = { x : x  S }. If S = {a}, aka P(S) If S = {a,b}, If S = , If S = {,{}}, We say, “P(S) is the set of all subsets of S.” 2S = {, {a}}. 2S = {, {a}, {b}, {a,b}}. 2S = {}. 2S = {, {}, {{}}, {,{}}}. Fact: if S is finite, |2S| = 2|S|. (if |S| = n, |2S| = 2n) Why?
  • 16. 16 Set Theory – Ordered Tuples Cartesian Product When order matters, we use ordered n-tuples The Cartesian Product of two sets A and B is: A x B = { <a,b> : a  A  b  B} If A = {Charlie, Lucy, Linus}, and B = {Brown, VanPelt}, then A,B finite  |AxB| = ? A1 x A2 x … x An = {<a1, a2,…, an>: a1  A1, a2  A2, …, an  An} A x B = {<Charlie, Brown>, <Lucy, Brown>, <Linus, Brown>, <Charlie, VanPelt>, <Lucy, VanPelt>, <Linus, VanPelt>} We’ll use these special sets soon! a) AxB b) |A|+|B| c) |A+B| d) |A||B|Size? nn if (i) Ai  = n
  • 17. 17 Set Theory - Operators The union of two sets A and B is: A  B = { x : x  A v x  B} If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then A  B = {Charlie, Lucy, Linus, Desi} A B
  • 18. 18 Set Theory - Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then A  B = {Lucy} A B
  • 19. 19 Set Theory - Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {x : x is a US president}, and B = {x : x is deceased}, then A  B = {x : x is a deceased US president} A B
  • 20. 20 Set Theory - Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {x : x is a US president}, and B = {x : x is in this room}, then A  B = {x : x is a US president in this room} =  A B Sets whose intersection is empty are called disjoint sets
  • 21. 21 Set Theory - Operators The complement of a set A is: A = { x : x  A} If A = {x : x is bored}, then A = {x : x is not bored} A = U and U =  U I.e., A = U – A, where U is the universal set. “A set fixed within the framework of a theory and consisting of all objects considered in the theory. “
  • 22. 22 Set Theory - Operators The set difference, A - B, is: A U B A - B = { x : x  A  x  B } A - B = A  B
  • 23. 23 Set Theory - Operators The symmetric difference, A  B, is: A  B = { x : (x  A  x  B) v (x  B  x  A)} = (A - B) U (B - A) like “exclusive or” A U B
  • 24. 24 Set Theory - Operators A  B = (A - B) U (B - A) Proof: A  B = { x : (x  A  x  B) v (x  B  x  A)} = { x : (x  A - B) v (x  B - A)} = { x : x  ((A - B) U (B - A))} = (A - B) U (B - A) Q.E.D. Theorem:
  • 25. 25 Set Theory - Identities Identity Domination Idempotent A  U = A A U  = A A  U = U A   = A A  A = A A  A = A Directly from defns. Semantically clear.
  • 26. 26 Set Theory – Identities, cont. Complement Laws Double complement A  A = U A  A =  A = A
  • 27. 27 Set Theory - Identities, cont. Commutativity Associativity Distributivity A U B = (A U B) U C = A  B = B U A B  A (A  B)  C = A U (B U C) A  (B  C) A U (B  C) = A  (B U C) = (A U B)  (A U C) (A  B) U (A  C)
  • 28. 28 DeMorgan’s I DeMorgan’s II A B Proof by “diagram” (useful!), but we aim for a more formal proof. (A U B) = A  B (A  B) = A U B
  • 29. 29 Proving identities Prove that 1. () (x  A U B)  (x  (A U B))  (x  A and x  B)  (x  A  B) 2. () (x ( A  B))  (x  A and x  B)  (x  A U B)  (x  A U B) (A U B) = A  B (De Morgan)
  • 30. Alt. proof Prove that using a membership table. 0 : x is not in the specified set 1 : otherwise (A U B) = A  B A B A B A  B A U B A U B 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 1 Haven’t we seen this before? A B General connection via Boolean algebras (Rosen chapt. 11)
  • 31. 31 Proof using logically equivalent set definitions. (A U B) = A  B (A U B) = {x : (x  A v x  B)} = {x : (x  A)  (x  B)} = A  B = {x : (x  A)  (x  B)}
  • 32. 32 Example X  (Y - Z) = (X  Y) - (X  Z). True or False? Prove your response. = (X  Y)  (X’ U Z’) = (X  Y  X’) U (X  Y  Z’) =  U (X  Y  Z’) = (X  Y  Z’) (X  Y) - (X  Z) = (X  Y)  (X  Z)’ = X  (Y - Z) (X  Z) = (X  Z)’ (just different notation)Note: What kind of law? Distributive law
  • 33.
  • 34. Suppose to the contrary, that A  B  , and that x  A  B. Example Pv that if (A - B) U (B - A) = (A U B) then ______ Then x cannot be in A-B and x cannot be in B-A. Do you see the contradiction yet? But x is in A U B since (A  B)  (A U B). Thus, (A - B) U (B - A) ≠ (A U B). Contradiction. A  B =  Thus, A  B = . a) A = B b) A  B =  c) A-B = B-A =  Then x is not in (A - B) U (B - A). Trying to prove p --> q Assume p and not q, and find a contradiction. Our contradiction was that sets weren’t equal.
  • 35. 35 Set Theory - Generalized Union/Intersection  Ai i1 n U  A1  A2 K  An  Ai i1 n I  A1  A2 K  An
  • 36. 36 Set Theory - Generalized Union/Intersection Ex. Suppose that: ,...3,2,1},...,3,2,1{  iiAi ? 1    i iA ? 1    i iA     ZA i i1 {1} 1    i iA
  • 37. Example:  Ai i1 n U  A1  A2 K  An Ex. Let U = N, and define:  Ai  {x : k 1,x  ki,k  } A1 = {2,3,4,…} A2 = {4,6,8,…} A3 = {6,9,12,…} i=1,2,…,N a) Primes b) Composites c)  d) N e) I have no clue. primes  Ai i 2  U  ? Note: i starts at 2 Union is all the composite numbers.
  • 38. 38 Set Theory - Inclusion/Exclusion Example: There are 217 cs majors. 157 are taking CS23021. 145 are taking cs23022. 98 are taking both. How many are taking neither? 217 - (157 + 145 - 98) = 13 157 145
  • 39. Generalized Inclusion/Exclusion Suppose we have: And I want to know |A U B U C| A B C |A U B U C| = |A| + |B| + |C| + |A  B  C| - |A  B| - |A  C| - |B  C| What about 4 sets?
  • 40. Generalized Inclusion/Exclusion For sets A1, A2,…An we have:   n i i n nji ji ni i n i i AAAAA 1 )1( 111 )1(     
  • 41. Set Theory - Sets as bit strings Let U = {x1, x2,…, xn}, and let A  U. Then the characteristic vector of A is the n-vector whose elements, xi, are 1 if xi  A, and 0 otherwise. Ex. If U = {x1, x2, x3, x4, x5, x6}, and A = {x1, x3, x5, x6}, then the characteristic vector of A is (101011)
  • 42. 42 Sets as bit strings Ex. If U = {x1, x2, x3, x4, x5, x6}, A = {x1, x3, x5, x6}, and B = {x2, x3, x6}, Then we have a quick way of finding the characteristic vectors of A  B and A  B. A 1 0 1 0 1 1 B 0 1 1 0 0 1 A  B A  B 1 1 1 0 1 1 0 0 1 0 0 1 Bit-wise OR Bit-wise AND