turing machine.pdf
TRANSCRIPT
-
7/27/2019 turing machine.pdf
1/22
1
Turing
Machin
es
-
7/27/2019 turing machine.pdf
2/22
2
TuringMachine
ATuring
machineisadevicethatma
nipulates
symbolsonastripoftapeaccording
toatableof
rules.De
spiteitssimplicity,aTuring
machinecanb
e
adapted
tosimulatethelogicofanycomputer
algorithm
,andispartic
ularlyusefulinexplainingth
e
functions
ofaCPUinsideacomputer
.
The"Tur
ing"machinewasdescribed
byAlanTuring
[in1936]whocalledit
an"a(utomatic)-machine".
TheTuringmachineis
notintendeda
sapractical
computin
gtechnology,
butratheras
ahypothetical
devicere
presentingac
omputingmachine.
Turing
machineshelpcomputerscientistsun
derstandthe
limitsofmechanicalcomputation.
-
7/27/2019 turing machine.pdf
3/22
3
Turingmachine
ATur
ingmachin
eisthesimplestform
ofac
omputer.
Thiswast
hefirst
comp
uterinvented(onpaperonly).
-
7/27/2019 turing machine.pdf
4/22
4
PrinciplesofaTuringm
achine
ATuringmachinec
onsistsof:
Atapewhichisdividedintocells,onenexttotheother.Eachc
ellc
ontainsasymbolfrom
somefinitealp
habet.Thealphabetcon
tainsaspecialblanksym
bol(herewrittenas'B')and
oneormoreothersymbols.
TheTuring
machineisalwayssuppliedwithasmuchtape
asit
needsforitscomputation.
Cellsthathavenotbeenwrittentobeforeareassumedtobe
filledwiththeblanksymbol.Insomem
odelsthetapehasaleftendmarkedwithaspe
cial
symbol;thetapeextendsorisindefinitelyextensibletotheright.
Aheadthatcanreadandwritesymbolsonthetapeandmove
thetapeleftandrighto
ne
(andonlyone)
cella
tatime.
Insomemodelstheheadmoves
andthetapeisstationary.
Afinitetable(occasionallycalledanac
tiontableortransitionfunction)ofinstructions
(usuallyquintu
ples[5-tuples]:qiajqi1aj1dk,
butsometimes4-tuples)that,giventhe
state(qi)them
achineiscurrentlyinan
dthesymbol(aj)itisreadingonthetape(symb
ol
currentlyunderthehead)tellsthemac
hinetodothefollowing
insequence(forthe5-tuple
models):
Eithereraseor
writeasymbol(instead
ofaj,writeaj1),andth
en
Movethehead
(whichisdescribedbydkandcanhavevalues:
'L'foronestepleftor'R'for
onesteprightor'N'forstayinginthesameplace),andthen
Assumethesameoranewstateasprescribed(gotostateqi1
).
-
7/27/2019 turing machine.pdf
5/22
5
FunctionOfT
uringMachine
1.
ATurin
gmachinecanbothwriteonthetapeand
readfromit.
2.
Theread-writehead
canmovebothtotheleftan
d
totheright.
3.
Thetapeisinfinite.
4.
Thespecialstatesforrejectingand
acceptingtak
e
immediateeffect.
-
7/27/2019 turing machine.pdf
6/22
6
A
ThinkingMachine
e.gS
ucces
sor
Program
SampleRules:
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
Letsseehowtheya
recarried
outona
pieceofpaperth
atcontainsthe
revers
ebinaryre
presentationof47:
-
7/27/2019 turing machine.pdf
7/22
7
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
0
1
1
1
1
-
7/27/2019 turing machine.pdf
8/22
8
A
ThinkingMachine
EGS
uccess
or
Pro
gram
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
0
1
1
1
0
-
7/27/2019 turing machine.pdf
9/22
9
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
0
1
1
0
0
-
7/27/2019 turing machine.pdf
10/22
10
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
0
1
0
0
0
-
7/27/2019 turing machine.pdf
11/22
-
7/27/2019 turing machine.pdf
12/22
12
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
1
0
0
0
0
-
7/27/2019 turing machine.pdf
13/22
13
A
ThinkingMachine
e.gS
ucces
sor
Program
Sothesuccessorso
utputon1
11101was
00001
1whichis
thereversebinary
repres
entationof48.
Similarly,
thesucces
sorof127
shouldbe
128:
-
7/27/2019 turing machine.pdf
14/22
14
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
1
1
1
1
1
1
-
7/27/2019 turing machine.pdf
15/22
15
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
1
1
1
1
1
0
-
7/27/2019 turing machine.pdf
16/22
16
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
1
1
1
1
0
0
-
7/27/2019 turing machine.pdf
17/22
17
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
1
1
1
0
0
0
-
7/27/2019 turing machine.pdf
18/22
18
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
1
1
0
0
0
0
-
7/27/2019 turing machine.pdf
19/22
-
7/27/2019 turing machine.pdf
20/22
20
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
1
0
0
0
0
0
0
-
7/27/2019 turing machine.pdf
21/22
21
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT!
0
0
0
0
0
0
0
-
7/27/2019 turing machine.pdf
22/22
22
A
ThinkingMachine
e.gS
ucces
sor
Program
Ifread1,
write0,goright,rep
eat.
Ifread0,
write1,H
ALT!
Ifread
,write1,H
ALT! 1
0
0
0
0
0
0
0