Download B - arl.wustl.edu

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Announcements
•  Quiz2istoday
•  Exam1nextweek!
Networking
Platform
1 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
1
SetTheory(Review)
AsetisanunorderedcollecAonofelements.
Someexamples:
{1,2,3}isthesetcontaining“1”and“2”and“3.”
{1,1,2,3,3}={1,2,3}sincerepeAAonisirrelevant.
{1,2,3}={3,2,1}sincesetsareunordered.
{1,2,3,…}isawaywedenoteaninfiniteset(inthiscase,the
naturalnumbers).
∅={}istheemptyset,orthesetcontainingnoelements.
Note:∅≠{∅}
Networking
Platform
2 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
2
SetTheory-DefiniAonsandnotaAon
x∈Smeans“xisanelementofsetS.”
x∉Smeans“xisnotanelementofsetS.”
A⊆Bmeans“AisasubsetofB.”
or, “B contains A.”
or, “every element of A is also in B.”
or, ∀x ((x ∈ A) → (x ∈ B)).
A
B
VennDiagram
Networking
Platform
3 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
3
SetTheory-DefiniAonsandnotaAon
A⊆Bmeans“AisasubsetofB.”
A=BifandonlyifAandBhaveexactlythe
sameelements.
iff,A⊆BandB⊆A
iff,∀x((x∈A)↔(x∈B)).
SotoshowequalityofsetsAandB,show:
A⊆B
B⊆A
Networking
Platform
4 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
4
SetTheory-DefiniAonsandnotaAon
A⊂Bmeans“AisapropersubsetofB.”
–  A⊆B,andA≠B.
–  ∀x((x∈A)→(x∈B))∧¬∀x((x∈B)→(x∈A))
–  ∀x((x∈A)→(x∈B))∧∃x((x∈B)∧¬(x∈A))
A
B
Networking
Platform
5 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
5
SetTheory-DefiniAonsandnotaAon
Quickexamples:
{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,
because(x∈∅)isfalse.
Is∅∈{1,2,3}?
Is∅⊆{∅,1,2,3}?
No!
Yes!
Is∅∈{∅,1,2,3}?
Yes!
Networking
Platform
6 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
Vacuous
6
SetTheory-DefiniAonsandnotaAon
QuizAme:
Isx⊆{x}?
No
Is{x}⊆{x}?
Yes
Is{x}∈{x,{x}}?
Is{x}⊆{x,{x}}?
Is{x}∈{x}?
Yes
Yes
No
Networking
Platform
7 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
7
SetTheory-Waystodefinesets
•  Explicitly:{John,Paul,George,Ringo}
•  Implicitly:{1,2,3,…},or{2,3,5,7,11,13,17,…}
•  Setbuilder:{x:xisprime},{x|xisodd}.
Ingeneral{x:P(x)istrue},whereP(x)issomedescripAonof
theset.
:and|areread
“suchthat”or
“where”
Ex.LetD(x,y)denote“xisdivisiblebyy.”
Giveanothernamefor
{x:∀y((y>1)∧(y<x))→¬D(x,y)}.
Whatisthissetof
numbers?
Primes
Networking
Platform
8 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
8
SetTheory-Cardinality
IfSisfinite,thenthecardinalityofS,
|S|,isthenumberofdisAnctelementsinS.
If S = {1,2,3}, |S|=3
If S = {3,3,3,3,3}, |S|=1
If S = ∅, |S|=0
If S = { 1, {1}, {1,{1}} },
|S|=3
If S = {0,1,2,3,…}, |S| is (one kind of) infinity. (more
on this later)
Networking
Platform
9 Extensible
- CSE 240 – Logic
and Discrete
Mathematics
9
SetTheory-Powersets
IfSisaset,thenthepowersetofSis
2S={x:x⊆S}.
akaP(S)
IfS={a},
2S={{},{a}}.
IfS={a,b},
2S={{},{a},{b},{a,b}}.
IfS=∅,
2S={}.
IfS={∅,{∅}},
Wesay,“P(S)isthe
setofallsubsetsof
S.”
2S={{},{∅},{{∅}},{∅,{∅}}}.
Fact:ifSisfinite,|P(S)|=2|S|.(if|S|=n,|P(S)|=2n)
Extensible
Networking
Platform
10
- CSE 240 – Logic
and Discrete
Mathematics
10
SetTheory-CartesianProduct
TheCartesianProductoftwosetsAandBis:
AxB={<a,b>:a∈A∧b∈B}
IfA={Charlie,Lucy,Linus},and
B={Brown,VanPelt},then
AxB={<Charlie,Brown>,<Charlie,VanPelt>,
<Lucy,Brown>,>,<Lucy,VanPelt>,
<Linus,Brown>,<Linus,VanPelt>}
A1xA2x…xAn={<a1,a2,…,an>:a1∈A1,a2∈A2,…,an∈An} Networking
Platform
11Extensible
- CSE 240 – Logic
and Discrete
Mathematics
11
SetTheory-Operators
TheunionoftwosetsAandBis:
A∪B={x:x∈Avx∈B}
IfA={Charlie,Lucy,Linus},and
B={Lucy,Desi},then
A∪B={Charlie,Lucy,Linus,Desi}
B
Extensible
Networking
Platform
12
- CSE 240 – Logic
and Discrete
Mathematics
A
12
SetTheory-Operators
Theintersec3onoftwosetsAandBis:
A∩B={x:x∈A∧x∈B}
IfA={Charlie,Lucy,Linus},and
B={Lucy,Desi},then
A∩B={Lucy}
B
A
Extensible
Networking
Platform
13
- CSE 240 – Logic
and Discrete
Mathematics
13
SetTheory-Operators
Anotherexample
IfA={x:xisaUSpresident},and
B={x:xisdeceased},then
A∩B={x:xisadeceasedUSpresident}
B
Extensible
Networking
Platform
14
- CSE 240 – Logic
and Discrete
Mathematics
A
14
SetTheory-Operators
Onemoreexample
IfA={x:xisaUSpresident},and
B={x:xisinthisroom},then
A∩B={x:xisaUSpresidentinthisroom}=∅
B
A
Setswhose
interseceonisempty
arecalleddisjoint
sets
Extensible
Networking
Platform
15
- CSE 240 – Logic
and Discrete
Mathematics
15
SetTheory-Operators
ThecomplementofasetAis:
A={x:x∉A}
IfA={x:xisbored},
thenA={x:xisnotbored}
U
Extensible
Networking
Platform
16
- CSE 240 – Logic
and Discrete
Mathematics
A
∅ = U
and
U = ∅
16
SetTheory-Operators
Thesetdifference,A-B,is(alsowri]enA\B):
U
B
A
• A-B={x:x∈A∧x∉B}
• A-B=A∩B
Extensible
Networking
Platform
17
- CSE 240 – Logic
and Discrete
Mathematics
17
SetRepresentaAon
•  Howcouldyourepresentasetonacomputer?
–  BitmapRepresentaeon
•  Thesetof10numbers,with1,3,and5set
–  1010100000
–  LinkedList
1
3
5
•  Howwouldyoucomplementtheset?
–  Bitmap?
–  LinkedList?
Extensible
Networking
Platform
18
- CSE 240 – Logic
and Discrete
Mathematics
18
SetTheory-Operators
Thesymmetricdifference,A⊕B,is:
A⊕B={x:(x∈A∧x∉B)v(x∈B∧x∉A)}
=(A-B)U(B-A)
like“exclusiveor”
U
B
A
Extensible
Networking
Platform
19
- CSE 240 – Logic
and Discrete
Mathematics
19
SetTheory-Operators
A⊕B={x:(x∈A∧x∉B)v(x∈B∧x∉A)}
=(A-B)U(B-A)
Proof:
{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)
Extensible
Networking
Platform
20
- CSE 240 – Logic
and Discrete
Mathematics
20
SetTheory-FamousIdenAAes
Iden3ty
A∩U=A
AU∅=A
Domina3on
AUU=U
A∩∅=∅
Idempotent
AUA=A
A∩A=A
Extensible
Networking
Platform
21
- CSE 240 – Logic
and Discrete
Mathematics
21
SetTheory-FamousIdenAAes
•  ExcludedMiddle
AUA=U
•  Uniqueness
A∩A=∅
•  Doublecomplement
A=A
Extensible
Networking
Platform
22
- CSE 240 – Logic
and Discrete
Mathematics
22
SetTheory-FamousIdenAAes
•  Commuta3vity
AUB= BUA
A∩B= B∩A
•  Associa3vity
(AUB)UC=
AU(BUC)
(A∩B)∩C=
A∩(B∩C)
•  Distribu3vity
AU(B∩C)= (AUB)∩(AUC)
A∩(BUC)= (A∩B)U(A∩C)
Extensible
Networking
Platform
23
- CSE 240 – Logic
and Discrete
Mathematics
23
SetTheory-FamousIdenAAes
•  DeMorgan’sI
•  DeMorgan’sII
(AUB)=A∩B
(A∩B)=AUB
Extensible
Networking
Platform
24
- CSE 240 – Logic
and Discrete
Mathematics
A
B
Handwavingis
goodfor
intuieon,butwe
aimforamore
formalproof.
24
SetTheory–4WaystoproveidenAAes
•  ShowthatA⊆BandthatB⊆A.
•  Useamembershiptable.
Liketruthtables
•  UsepreviouslyprovenidenAAes.
Like≡
•  Uselogicalequivalencestoprove
equivalentsetdefiniAons.
Nothard,alijletedious
Extensible
Networking
Platform
25
- CSE 240 – Logic
and Discrete
Mathematics
25
SetTheory–4WaystoproveidenAAes
Provethat (A U B) = A ∩ B
1.  (⊆)(x∈AUB)→(x∉AUB)→
(x∉Aandx∉B)→(x∈A∩B)
⊇
2.()(x∈A∩B)→(x∉Aandx∉B)
→(x∉AUB)→(x∈AUB)
Extensible
Networking
Platform
26
- CSE 240 – Logic
and Discrete
Mathematics
26
SetTheory–4WaystoproveidenAAes
Provethat
(AUB)=A∩B
usingamembershiptable.
0:xisnotinthespecifiedset
1:otherwise
A B A B A∩B AUB
AUB
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’tweseen
thisbefore?
Extensible
Networking
Platform
27
- CSE 240 – Logic
and Discrete
Mathematics
27
SetTheory–4WaystoproveidenAAes
(AUB)=A∩B
Provethatusinglogically
equivalentsetdefiniAons.
(AUB)={x:¬(x∈Avx∈B)}
={x:¬(x∈A)∧¬(x∈B)}
={x:(x∈A)∧(x∈B)}
=A∩B
Extensible
Networking
Platform
28
- CSE 240 – Logic
and Discrete
Mathematics
28
SetTheory-GeneralizedUnion
n
A = A ∪A
i
1
2
∪ … ∪ An
i=1
Ex.LetU=N,anddefine:
€
Ai = {x : ∃k > 1, x = ki, k ∈ Ν}
A1={2,3,4,…}
A2={4,6,8,…}
A3={6,9,12,…}
€
Extensible
Networking
Platform
29
- CSE 240 – Logic
and Discrete
Mathematics
29
SetTheory-GeneralizedUnion
n
A = A ∪A
i
1
2
∪ … ∪ An
i=1
Ex.LetU=N,anddefine:
€
Ai = {x : ∃k > 1, x = ki, k ∈ Ν}
Then
∞
€
 Ai = ?
i= 2
Extensible
Networking
Platform
30
- CSE 240 – Logic
and Discrete
Mathematics
€
primes
a) 
b) 
c) 
d) 
e) 
Primes
Composites
∅
N
Ihavenoclue.
30
SetTheory-GeneralizedIntersecAon
n
A = A ∩A
i
1
2
∩ … ∩ An
i=1
Ex.LetU=N,anddefine:
€
Ai = {x : ∃k, x = ki, k ∈ Ν}
A1={1,2,3,4,…}
A2={2,4,6,…}
A3={3,6,9,…}
€
Extensible
Networking
Platform
31
- CSE 240 – Logic
and Discrete
Mathematics
31
SetTheory-GeneralizedIntersecAon
n
A = A ∩A
i
1
2
∩ … ∩ An
i=1
Ex.LetU=N,anddefine:
€
Ai = {x : ∃k, x = ki, k ∈ Ν}
Then
n
€
A =
i
?
i=1
Extensible
Networking
Platform
32
- CSE 240 – Logic
and Discrete
Mathematics
€
Muleplesof
LCM(1,…,n)
32
SetTheory-Inclusion/Exclusion
Example:
Howmanypeoplearewearingawatch?
Howmanypeoplearewearingsneakers?
Howmanypeoplearewearinga
watchORsneakers?
B
A
|A∪B|=|A|+|B|-|A∩B|
Extensible
Networking
Platform
33
- CSE 240 – Logic
and Discrete
Mathematics
33
SetTheory-Inclusion/Exclusion
Example:
Thereare83csmajors.
40aretakingcs240.
40
31aretakingcs101.
22aretakingboth.
Howmanyaretakingneither?
31
83-(40+31-22)=34
Extensible
Networking
Platform
34
- CSE 240 – Logic
and Discrete
Mathematics
34
SetTheory-GeneralizedInclusion/Exclusion
Supposewehave:
B
A
C
AndIwanttoknow|AUBUC|
|AUBUC|=|A|+|B|+|C|
-|A∩B|-|A∩C|-|B∩C|
+|A∩B∩C|
Extensible
Networking
Platform
35
- CSE 240 – Logic
and Discrete
Mathematics
35
Quiz
Extensible
Networking
Platform
36
- CSE 240 – Logic
and Discrete
Mathematics
36
Related documents