Академический Документы
Профессиональный Документы
Культура Документы
Course Sta
"eith Schwar# $htie%&cs'stan ord'edu( "yle )ro*le $+ro*le%&stan ord'edu( ,auri#io Calo Cali*aris $mauri#io&cs'stan ord'edu( -ulius Chen* $.uliusc&stan ord'edu( -ustin Heermann $.ustin'heermann&*mail'com( /icholas Isaacs $nisaacs00&*mail'com( ,ichael "im $michael'%im&cs'stan ord'edu( Tarun Sin*h $tarun1&stan ord'edu( 1emin*ton Won* $rwon*2&stan ord'edu( Course Staff Mailing List: cs1033win12133sta &lists'stan ord'edu
http://cs103.stanford.edu
4rere5uisite
CS1067
84rere5uisite9
CS1067
Recommended 1eadin*
Recommended 1eadin*
:radin* 4olicies
"ey ;uestions
Comple!ity
heory
"ntroduction to Set
heory
8CS103 students9
8Cool !eo!le9
8Cute animals9
8=S coins'9
>
> >
the the elements elements
Set Set notation: notation: Curly Curly braces braces with with commas commas separating separating out out
7 set is an unordered collection o distinct o+.ects> which may +e anythin* $includin* other sets('
> >
These These are are the the same same set! set!
7 set is an unordered collection o distinct o+.ects> which may +e anythin* $includin* other sets('
These These are are the the same same set! set!
>
>
7 set is an unordered collection o distinct o+.ects> which may +e anythin* $includin* other sets('
?
The empty set contains no elements!
7 set is an unordered collection o distinct o+.ects> which may +e anythin* $includin* other sets('
,em+ershi!
>
"s
>
in this set#
>
,em+ershi!
>
"s
>
in this set#
>
Set ,em+ershi!
:iven a set S and an o+.ect x> we write x#S i x is contained in S> and x$S otherwise'
I x @ S> we say that x is an element o S' :iven any o+.ect and any set> either that o+.ect is an element o the set or it isnBt'
In inite Sets
Sets can +e in initely lar*e' The natural numbers> C: D 0> 1> 2> 3> EF
Some authors donBt include #eroG in this class> assume that 0 is a natural num+er' I is rom :erman 8Iahlen'9
We canBt list their $in initely many!( elements' How would we ri*orously descri+e them<
7 set may +e s!eci ied in set'builder notation: D x M some property x satisfies F Nor eOam!le:
D r M r @ J and r P 13L F D n M n is a !ower o two F D x M x is a set o =S currency F D p M p is a le*al -ava !ro*ram F
Com+inin* Sets
Qenn Ria*rams
1 3 2
Qenn Ria*rams
1 3 2
A
T
Qenn Ria*rams
1 3 2
B
T
Qenn Ria*rams
1 3 2
=nion
AVB
T
Qenn Ria*rams
1 3 2
Intersection
AWB
T
D3F
B
Qenn Ria*rams
1 3 2
Ri erence
AXB
T
D 1> 2 F
B
Qenn Ria*rams
1 3 2
Ri erence
A(B
T
D 1> 2 F
B
Qenn Ria*rams
1 3 2
Symmetric Ri erence
AB
Qenn Ria*rams
AB
Qenn Ria*rams
&uestion &uestion to to ponder: ponder: why why can't can't we we just just draw draw four four circles# circles#
Su+sets
7 set S is a subset o a set T $denoted S)*)T( i all elements o S are also elements o T' KOam!les:
D 1> 2> 3 F Y D 1> 2> 3> S F C Y H $every natural number is an integer( H Y J $every integer is a real number(
7 set S is a subset o a set T $denoted S)*)T( i all elements o S are also elements o T' Is Z Y S or any set S< +es: The a+ove statement is always true' ,acuous truth: 7 statement that is true +ecause it does not a!!ly to anythin*'
4ro!er Su+sets
)y de inition> any set is a su+set o itsel ' (Why?) 7 proper subset o a set S is a set T such that
TYS TS
There are multi!le notations or thisG they all mean the same thin*:
TS T[S
SU
$S( U
>
( SS ) ( ) is is the the power power set set of of SS (the (the set set of of all all subsets ) subsets of of SS )
Cardinalities
Cardinality
The cardinality o a set is the num+er o elements it contains' We denote it MSM' KOam!les:
M D a> +> c> d> eF M U T M D -a. b/> -c. d. e. f. g/> -h/ F M U 3 M D 1> 2> 3> 3> 3> 3> 3 F M U 3 M D x M x @ C and x P 13L F M U 13L
The Cardinality o C
What is MCM<
There are in initely many natural num+ers' MCM canBt +e a natural num+er> since itBs in initely lar*e'
What is MSM<
> >
Com!arin* Cardinalities
Two sets have the same cardinality i their elements can +e !ut into a one3to3one corres!ondence with one another' The intuition:
Com!arin* Cardinalities
Two sets have the same cardinality i their elements can +e !ut into a one3to3one corres!ondence with one another' The intuition:
In inite Cardinalities
C S
0 1 2 3 S T 6 L \ '''
\ 10 12 1S 16 '''
n ] 2n
S U D x M x @ C and x is even F MSM U MCM U 0
In inite Cardinalities
C H
0 1 2 3 S T 6 L \ '''
31
32
33
3S
'''
In inite Cardinalities
C
0 1 2 3 S T 6 L '''
\ 16 32 6S 12\ '''
n ] 2n
U D x M x @ C and x is a !ower o twoF M M U MCM U 0
SU
$S( U
>
!SM P M(S)!
SU 1>
$S( U
> > > > > > > > > > > >
>
!SM P M(S)!
S U Da> +> c> dF $S ( U D Z> DaF> D+F> DcF> DdF> Da> +F> Da> cF> Da> dF> D+> cF> D+> dF> D+> eF Da> +> cF> Da> +> dF> Da> c> dF> D+> c> dF> Da> +> c> dF F MSM P M$S(M
I S is in inite> what is the relation +etween MSM and M$S(M< Roes MSM U M$S(M<
I MSM U M$S(M> there has to +e a one3to3one corres!ondence +etween elements o S and su+sets o S' What mi*ht this corres!ondence loo% li%e<
O O O O O O 0 1 2 3 S T ''' 0 1 2 3 S T O0 O1 O2 O3 OS OT '''
D O0> O OS2> > ''' D2> 0> S>F''' F D O0> O OS2> > ''' D3> 0> S>F''' F D OS> ''' F 2> S> ''' F D 0> D O1> O ''' F S> ''' F DS> 0> 2> DO > OT > ''' F S> 8+9> 8a+9> 0> 2> ''' ''' F F 0 D D O0> O O22> > OS> > OS> F OT> ''' F D1> 0> 3 '''
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS OT '''
+ + 2 2 D 0> + 2> S> 2 2''' F + 2 2 + 2 2 2 + 2 2 + + + 2 2 2 2 2 + + 3 3 3 3 3 3 3 3
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 D 0> + 2> S> 2 2''' F + 2 2 + 2 2 2 + 2 2 + + + 2 2 2 2 2 + + 3 3 3 3 3 3 3 3
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 D 0> + 2> S> 2 2''' F + 2 2 + 2 2 2 + 2 2 + + + 2 2 2 2 2 + + 3 + 3 3 3 3 3 3 3 3
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 D 0> + 2> S> 2 2''' F + 2 2 + 2 2 2 + 2 2 + + + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ... 3
Flip Flip all all Y's Y's to to N's N's and and
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
O0 O1 O2 O3 OS OT ''' O0 O1 O2 O3 OS 3 OT S '''
+ + 2 2 2 + + 3 2 + D 0> + 2> S> 2 2''' F + 2 2 + 2 + 3 2 + 2 2 2 2 + + 3 2 + + 2 2 2 + + 3 2 + + + + 2 + + 3 2 + 2 2 2 2 2 + + 3 2 + 3 3 3 3 3 3 3 ...
Which Which row row in in the the table table is is paired paired with with this this set? set?
/o matter how we try to assi*n su+sets o S to elements o S> there will always +e at least one su+set le t over' Cantor4s heorem: Kvery set is smaller than its !ower set: 5or any set S. %S% 6 %7S8%
In inite Cardinalities
2ot all infinite sets ha&e the same si9e. here are many different infinities.
Consider the set o all strin*s: D 89> 8a9> 8+9> 8c9> '''> 8aa9> 8a+9> 8ac>9 E F Nor any set o strin*s S> we can solve the ollowin* !ro+lem a+out S:
<rite a program that accepts as input a string. then prints out =hether or not that string belongs to set S.
There ore> there are at least as many !ro+lems to solve as there are sets o strin*s'
Kvery com!uter !ro*ram is a strin*' So> there canBt +e any more !ro*rams than there are strin*s' Nrom CantorBs Theorem> we %now that there are more sets o strin*s than strin*s' There are at least as many !ro+lems as there are sets o strin*s'
Kvery com!uter !ro*ram is a strin*' So> there canBt +e any more !ro*rams than there are strin*s' Nrom CantorBs Theorem> we %now that there are more sets o strin*s than strin*s' There are at least as many !ro+lems as there are sets o strin*s'
%>rograms% 6 %>roblems%
here are more problems to sol&e than there are programs to sol&e them.
It :ets Worse
)ecause there are more !ro+lems than strin*s> we canBt even describe some o the !ro+lems that we canBt solve' =sin* more advanced set theory> we can show that there are infinitely more !ro+lems than solutions' In act> i you !ic% a totally random !ro+lem> the !ro+a+ility that you can solve it is "ero'
What are the hardest !ro+lems we can solve< How !ower ul o a com!uter do we need to solve these !ro+lems< O what we can com!ute> what can we com!ute efficiently< How do we +uild mathematical models o com!utation< How can we reason a+out these models<
/eOt Time
Mathematical >roof
What is a mathematical !roo < How can we !rove thin*s with certainty<