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

WhydowestudyTheoryof

Computation?
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 2
ImportanceofTheoryofComputation
Languages
LanguagesandProblems
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 3
WhatisComputation?
Sequenceofmathematicaloperations?
Whatare,andarenot,mathematicaloperations?
Sequenceofwell-definedoperations
Howmanyoperations?
Thefewer,thebetter.
Whichoperations?
Thesimpler,thebetter.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 4
WhatdowestudyinTheoryofComputation?
Whatiscomputable,
andwhatisnot?

Basisof
Algorithmanalysis
Complexitytheory
Whatacomputercan
andcannotdo
Areyoutryingtowritea
non-existingprogram?

Canyoumakeyour
programmoreefficient?
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 5
WhatdowestudyinComplexityTheory?
Whatiseasy,andwhat
isdifficult,tocompute?
Whatiseasy,andwhat
ishardforcomputersto
do?
Isyourcryptograpic
schemesafe?
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 6
ApplicationsinComputerScience
Analysisof
algorithms
ComplexityTheory
Cryptography
Compilers
Circuitdesign

Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 7


1936AlanTuringinventedtheTuringmachine,and
provedthatthereexistsanunsolvableproblem.
1940sStored-programcomputerswerebuilt.
1943McCullochandPittsinventedfiniteautomata.
1956Kleeneinventedregularexpressionsand
provedtheequivalenceofregularexpressionand
finiteautomata.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 8
1956ChomskydefinedChomskyhierarchy,which
organizedlanguagesrecognizedbydifferent
automataintohierarchicalclasses.
1959RabinandScottintroducednondeterministic
finiteautomataandproveditsequivalenceto
(deterministic)finiteautomata.
1950s-1960sMoreworksonlanguages,
grammars,andcompilers
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 9
1965HartmantisandStearnsdefinedtime
complexity,andLewis,HartmantisandStearns
definedspacecomplexity.
1971CookshowedthefirstNP-completeproblem,
thesatisfiabilityprooblem.
1972KarpShowedmanyotherNP-complete
problems.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 10
1976DiffieandHelllmandefinedModern
CryptographybasedonNP-completeproblems.
1978Rivest,ShamirandAdelmanproposeda
public-keyencryptionscheme,RSA.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 11
Analphabetisafinite,non-emptysetofsymbols.
{0,1 }isabinaryalphabet.
{A, B,, Z, a, b,, z }isanEnglishalphabet.
AstringoveranalphabetEisasequenceofany
numberofsymbolsfromE.
0, 1, 11, 00,and01101arestringsover{0,1 }.
Cat,CAT,andcomputearestringsovertheEnglish
alphabet.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 12
Anemptystring,denotedbyc,isastring
containingnosymbol.
c isastringoveranyalphabet.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 13
Thelengthofastringx,denotedbylength(x),
isthenumberofpositionsofsymbolsinthe
string.
Let={a,b,,z}
length(automata)=8
length(computation)=11
length()=0
x(i),denotesthesymbolinthei
th
positionofa
stringx,for1sislength(x).
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 14
Concatenation
Substring
Reversal
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 15
Theconcatenationofstringsxandy,
denotedbyxyorx y,isastringzsuchthat:
z(i)=x(i)for1si slength(x)
z(i)=y(i)forlength(x)<islength(x)+length(y)

Example
automatacomputation = automatacomputation
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 16
Theconcatenationofstring x forntimes,
where n>0, isdenotedbyx
n

x
0
= c
x
1
= x
x
2
= x x
x
3
= x x x

Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 17
Letxandybestringsoveranalphabet
Thestring x isasubstringof y ifthereexiststrings
w and z over suchthat y = w x z.
isasubstringofeverystring.
Foreverystringx,xisasubstringofxitself.
Example
, computandcomputationaresubstringsof
computation.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 18
Letxbeastringoveranalphabet
Thereversalofthestring x,denotedbyx
r
, isa
stringsuchthat
ifxis,thenx
r
is.
Ifaisin,yisin
*
andx=a y,thenx
r
=y
r
a.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 19
(automata)
r

=(utomata)
r
a
=(tomata)
r
ua
=(omata)
r
tua
=(mata)
r
otua
=(ata)
r
motua
=(ta)
r
amotua
=(a)
r
tamotua
=(c)
r
atamotua
= atamotua
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 20

Thesetofstringscreatedfromanynumber
(0or1or)ofsymbolsinanalphabetEis
denotedbyE
*
.
Thatis,E
* =

i=

0

E
i
LetE ={0,1}.
E
*
={c,0,1, 00,01, 10,11, 000,001,010,011, }.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 21

+
Thesetofstringscreatedfromatleastone
symbol(1or2or)inanalphabetEisdenotedby
E
+
.
Thatis,E
+
=
i=

1

E
i
=
i=0..

E
i
- E
0

=
i=0..

E
i
- {c}

LetE ={0,1}. E
+
={0,1, 00,01, 10,11, 000,001,010,011,
}.
E
*
andE
+
areinfinitesets.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 22
Alanguageoveranalphabet isasetof
stringsover.
Let = {0, 1} bethealphabet.
L
e
={ee*|thenumberof1sineiseven}.
c,0, 00, 11, 000, 110, 101, 011, 0000, 1100, 1010,
1001, 0110, 0101, 0011, areinL
e
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 23
Complementation
Union
Intersection
Concatenation
Reversal
Closure
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 24
LetLbealanguageoveranalphabet.
ThecomplementationofL,denotedbyL,is*L.

Example:
Let = {0, 1} bethealphabet.
L
e
={ee*|thenumberof1sineiseven}.
L
e
={ee*|thenumberof1sineisnoteven}.
L
e
={ee*|thenumberof1sineisodd}.
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 25
LetL
1
andL
2
belanguagesoveranalphabet.
TheunionofL
1
andL
2
,denotedbyL
1
L
2
,
is{x|xisinL
1
or L
2
}.
Example:
{xe{0,1}*|xbeginswith0} {xe{0,1}*|xendswith0}
={xe{0,1}*|xbeginsorendswith0}
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 26
LetL
1
andL
2
belanguagesoveranalphabet.
TheintersectionofL
1
andL
2
,denotedby
L
1
L
2
,is{x|xisinL
1
and L
2
}.
Example:
{xe{0,1}*|xbeginswith0} {xe{0,1}*|xendswith0}
={xe{0,1}*|xbeginsandendswith0}
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 27
LetL
1
andL
2
belanguagesoveranalphabet.
TheconcatenationofL
1
andL
2
,denotedbyL
1
L
2
,is
{w
1
w
2
| w
1
isin L
1
andw
2
isin L
2
}.
Example
{x e{0,1}*|xbeginswith0}{xe{0,1}*|xendswith0}
={xe{0,1}*|xbeginsandendswith0andlength(x) > 2}
{xe{0,1}*|xendswith0}{xe{0,1}*|xbeginswith0}
={xe{0,1}*|xhas00asasubstring}
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 28
LetLbealanguageoveranalphabet.
ThereversalofL,denotedbyL
r
,is{w
r
| w

isin L}.
Example
{x e{0,1}*|xbeginswith0}
r
={xe{0,1}*|xendswith0}
{xe{0,1}*|xhas00asasubstring}
r

={xe{0,1}*|xhas00asasubstring}
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 29
LetLbealanguageoveranalphabet.
TheKleenesclosureofL,denotedbyL*,is{x|foran
integern >0x =x
1
x
2
x
n
andx
1
,x
2
, , x
n
areinL}.
Thatis,L* =
i

= 0
L
i
Example:Let={0,1}and
L
e
={ee*|thenumberof1sineiseven}
L
e
*={ee*|thenumberof1sineiseven}
(L
e
)*

={ee*|thenumberof1sineisodd}*
={ee*|thenumberof1sine>0}
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 30
LetLbealanguageoveranalphabet.
TheclosureofL,denotedbyL
+
,is{x|foran
integern >1,x =x
1
x
2
x
n
andx
1
,x
2
, , x
n
areinL}
Thatis,L
+
=
i

= 1
L
i
Example:
Let = {0, 1} bethealphabet.
L
e
={ee*|thenumberof1sineiseven}
L
e
+

={ee*|thenumberof1sineiseven}=L
e
*

Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 31


L
+
= L
*
{}?

Example:
L={ee*|thenumberof1sineiseven}
L
+

={ee*|thenumberof1sineiseven}=L
e
*

Why?
L
*
= L
+
{}?
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 32
Problem
Example:Whatareprimenumbers>20?
Decisionproblem
ProblemwithaYES/NOanswer
Example:Givenapositiveintegern,isnaprimenumber
>20?
Language
Example:{n|nisaprimenumber>20}
={23,29,31,37,}
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 33
LanguageRecognitionandProblem
Aproblemisrepresentedbyasetofstringsofthe
inputwhoseanswerforthecorrespondingproblem
isYES.
astringisinalanguage=theanswerofthe
correspondingproblemforthestringisYES
LetGivenapositiveintegern,isnaprimenumber>20?
betheproblemP.
Ifastringrepresentsanintegeri in{m|misaprime
number>20},thentheanswerfortheproblemPforn=i
istrue.
Beware
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 35
1
01
001
0001
00001
1
10
100
1000
10000
L
1
L
2
Jaruloj Chongstitvatana 2301379 Chapter 1 Introduction 36
And,thereisalsoasetoflanguages.
1
01
001
0001
00001
L
1
1
10
100
1000
10000
L
2
L
1
L
2
A class of language

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