Вы находитесь на странице: 1из 86

Welcome to CS103!

Two Handouts Today:


Course Overview Introduction to Set Theory The Limits o Com!utation

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

The Course We+site

http://cs103.stanford.edu

4rere5uisite

CS1067

84rere5uisite9

CS1067

Recommended 1eadin*

Recommended 1eadin*

(but just the first chapter)

Online Course /otes

:radin* 4olicies

60% Assignments 15% Midterm 25% Final

:oals or this Course

"ey ;uestions

How do we !rove somethin* with a+solute certainty<

Discrete Mathematics Computability heory

Can com!uters solve every !ro+lem<

Why are some !ro+lems harder than others<

Comple!ity

heory

"ntroduction to Set

heory

8CS103 students9

87ll the com!uters on the Stan ord networ%'9

8Cool !eo!le9

8The chemical elements9

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('

This symbol means is defined as

We denote it with this symbol

?
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

The integers> H: D E> 32> 31> 0> 1> 2> E F

The real numbers> J> includin* rational and irrational num+ers'

Constructin* Sets rom Other Sets

Consider these Kn*lish descri!tions:


87ll even num+ers'9 87ll real num+ers less than 13L'9 87ll ne*ative inte*ers'9

We canBt list their $in initely many!( elements' How would we ri*orously descri+e them<

The Set o Kven /um+ers


D x % x # C and x is e&en F
The set of all $ where $ is in the set of natural numbers and $ is e%en

Set )uilder /otation

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

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

A
T

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

B
T

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

=nion

AVB
T

D 1> 2> 3> S> T F B

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

Intersection

AWB
T

D3F
B

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

Ri erence

AXB
T

D 1> 2 F
B

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

Ri erence

A(B
T

D 1> 2 F
B

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

1 3 2

Symmetric Ri erence

AB

D 1> 2> S> T F


B

A A U D 1> 2> 3 F B U D 3> S> T F

Qenn Ria*rams

AB

Qenn Ria*rams

Qenn Ria*rams or Three Sets

Qenn Ria*rams or Nour Sets


) C

&uestion &uestion to to ponder: ponder: why why can't can't we we just just draw draw four four circles# circles#

Qenn Ria*rams or Nive Sets

7 Nun We+site: Qenn Ria*rams or Seven Sets http://moebio.com/research/se&ensets/

Su+sets and 4ower Sets

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(

What 7+out the Km!ty Set<

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*'

87ll unicorns are +lue'9 87ll unicorns are !in%'9

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'

We need to introduce a new term' Re inition: MCM U

4ronounced 87le!h3Iero>9 87le!h3/ou*ht>9 or 87le!h3/ull'9

Consider the set


S U D x M x @ C and x is even F

What is MSM<

How )i* 7re These Sets<

> >

> > > >

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:

> > > > >


We'%e run out of elements in the second set!

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

'''

MCM U MHM U 0 n]n^2 $i n is even( n ] 3$n _ 1( ^ 2 $i n is odd(

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

"mportant 0uestion Ro all in inite sets have the same cardinality<

4re!are or one o the most +eauti ul $and sur!risin*!( !roo s in mathematics'''

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

D D8a+9> 0>2 2> S> ''' F 2 F 2 +8+9> 2 + 2 + ''' + + 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

D D8a+9> 0>2 2> S> ''' F 2 F 2 +8+9> 2 + 2 + ''' + + 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?

D D8a+9> 0>2 2> S> ''' F 2 F 2 +8+9> 2 + 2 + ''' + + 3 + + 3 2 + 3 2 + 3 2 + 3 2

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

D D8a+9> 0>2 2> S> ''' F 2 F 2 +8+9> 2 + 2 + ''' + + 3 2 + + 3 2 + + 3 2 + + 3 2 + + 3 2 +

vice-versa vice-versa to to get get aa new new 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 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?

The Ria*onali#ation 4roo

The complemented diagonal cannot a!!ear anywhere in the ta+le'

In row n> the nth element must +e wron*'

/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

1ecall: MCM U `' )y CantorBs Theorem:


MCM P M$C(M M$C(M P M$$C((M M$$C((M P M$$$C(((M M$$$C(((M P M$$$$C((((M E

2ot all infinite sets ha&e the same si9e. here are many different infinities.

What does this have to do with com!utation<

: he set of all computer programs; : he set of all problems to sol&e;

Strin*s and 4ro+lems

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'

%>rograms% ? %Strings% 6 %Sets of Strings% ? %>roblems%

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'

)ut then it *ets +etter'''

Where WeBre :oin*

@i&en this hard theoretical limit. =hat can =e computeA

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<

<hat tools do =e need to reason about thisA

/eOt Time

Mathematical >roof

What is a mathematical !roo < How can we !rove thin*s with certainty<

Вам также может понравиться