The Church-Turing Thesis

Download Report

Transcript The Church-Turing Thesis

The Church-Turing Thesis
http://cis.k.hosei.ac.jp/~yukita/
Example M1
decides thelanguage A  {w# w | w  {0,1}*}.
M 1 " On input string w :
1.Scan theinput tobe sure thatit containsa single # symbol.
If not,reject.
2. Zig - zag across the tapeto corresponding positionson either
side of the# symbol to check on whetherthesepositions
contain the same symbol.If theydo not,reject. Cross off
symbolsas theyare checkedto keep trackof which symbols
correspond.
3. Whenall symbols to theleft of the# havebeen crossed off,
check for any remainingsymbols to theright of the#.
If any symbolsremain,reject; otherwiseaccept."
2
Definition 3.1
A Turing machine is a 7 - t uple,(Q, , ,  , q0 , qaccept, qreject ), where
Q, ,  are finit eset s and
1. Q is t heset of st at es,
2.  is t heinput alphabetnot cont ainingt hespecialblank symbol_,
3.  is t he t apealphabet ,where _   and   ,
4.  : Q    Q    {L, R} is t he t ransit ion funct ion,
5. q0  Q is t hest art st at e,
6. qaccept  Q is t heacceptst at e,and
7. qreject  Q is t hereject st at e,where qreject  qaccept.
3
Configuration 1011q701111
q7
1
0
1
1
0
1
1
1
1
_
_
_
...
A T uringmachinereceivesits input w  w1  wn  * on theleft most
n squares of the tapeand therest of the tapeis filled with blank symbols.
Configurations are represented as finitestringsin tapealphabet with trailing
blank symbolsbeing omit ted.
T hus, thestart configuration is represented as q0 w  q0 w1  wn .
4
Computation
Let a, b  , u, v  * , and qi , q j  Q.
Let uaqi bv and uq j acv are two configurations. Wesay that
uaqi bv yields uq j acv if  (qi , b)  (q j , c, L). Likewise we say that
uaqi bv yields uacqj v if  (qi , b)  (q j , c, R ).
Assumptionfor convenience :
qi bv yields q j cv if the transition is left moving.
5
Recognizer and Decider
De fi n i ti on3.2 A language is Turing - recognizable [recursively enumerable]
if some T uringmachinerecognizesit .
Re m ark: T hemachinemay loop on some input .
De fi n i ti on3.3 A language is Turing - decidable[recursive]
if some T uringmachinedecides it .
Re m ark: T hemachinehalt son any input .
6
Example 3.4 M2
decides thelanguage A  {0 | n  0}.
2n
M 2 " On input stringw :
1.Sweep left toright across the tape,crossingoff everyother0.
2. If in stage1 the tapecontaineda single 0, accept.
3. If in stage1 the tapecontainedmore thana single 0 and the
number of 0s was odd, reject.
4. Return thehead to theleft - hand end of the tape.
5. Go to stage1."
7
Example 3.6 M3
decides t helanguage C  {a i b j c k | i  j  k and i, j , k  1}.
M 3 " On input st ring w :
1.Scan t heinput from left toright t obe sure t hatit is a member
of a *b*c * and reject if it is not .
2. Ret urn t hehead t o t heleft - hand end of t he t ape.
3. Cross off an a and scan t ot heright unt il a b occurs.Shut t le
bet ween the b' s and t hec' s, crossingoff one of each unt il
all b' s are gone.
4. Rest oret hecrossed off b' s and repeatst age 3 if t hereis anot her
a t o cross off. If all a ' s are crossed off,check on whet herall c' s
also are crossed off.If yes, accept; ot herwise,reject."
8
Example 3.7 [Element distinctness problem] M4
decides thelanguage
E  {# x1 # x2 #  # xl | each xi  {0,1} * and xi  x j for each i  j}.
M 4 " On input string w :
1. P lacea mark on topof theleftmost ape
t symbol.If thatsymbol
was not a # , reject.
2.Scan right tothenext # and place a second mark on topof it.
If no # is encountered beforea blank symbol,only x1 is present ,
so accept.
3. By zig - zagging, comparethe two strings to theright of the
marked# s. If theyare equal, reject.
4. Move therightmostof the two marksto thenext # symbol to
theright.If no # symbolis encountered beforea blank symbol,
movetheleftmostmark tothenext # to its right and therightmost
mark tothe# after that. T his time,if no # is availablefor the
rightmostmark,all thestrings havebeen compared,so accept.
5. Go toSt age 3."
9
Multitape Turing Machines
 : Q   k  Q   k {L, R}k , wherek is thenumber of tapes.
Initiallytheinput appearson tape1, and theothersstart out blank.
Each tapehas its own head for reading and writing.
10
Theorem 3.8 Every multitape Turing machine M
has an equivalent single tape Turing machine S.
0
1
0
1
a
a
a
_
b
a
_
0
M
...
_
...
...
S
#
0
1
0
1
0
#
a
a
a
#
b
a
#
_
...
11
Simulation
S " On input w  w1w2  wn :
1. S puts its tapeinto theformat tha
t representsall k tapesof M .
T heformattedtapecontains # w1w2  wn # _ # _ # #
2. T o simulatea single move,S scans its tapefrom thefirst # , which
markstheleft - hand end, to the(k  1)st # , which marksthe
right - hand end, in order todeterminethesymbolsunder the
virtualheads.T henS makesa secondpass to update the tapes
accordingto the way thatM ' s transit ion functiondictates.
3. (omitted)
12
Nondeterministic Turing Machines
 : Q  2
Q{L,R}
.
13
Theorem 3.10 Every nondeterministic Turing machine has
an equivalent deterministic Turing machine.
...
0
0
1
0
_
_
x
x
#
0
1
x
_
_
1
2
3
3
2
3
1
2
input tape
D
...
1
1
simulation tape
3
_
_
...
address tape
14
Proof
T ape3 keeps t rackof D' s locat ionin N ' s nondet erminist ic
comput at ion t reewit h b - adic represent at ion,where b is t hemaximumnumber
of children at each node, which is det erminedby  . All t henodes are odered
by breadt h first and lexicographical manner.
1. Init iallyt ape1 cont ainst heinput w, and t apes2 and 3 are empt y.
2. Copy t ape1 t o t ape2.
3. Use t ape2 t o simulat e N wit h input won t hebranch of it s nondet erminist ic
comput at ion. Beforeeach st ep of N consult t he next symbolon t ape3
t o det erminewhich choice t o makeamongt hoseallowed by N ' s t ransit ion
funct ion.If no moresuch symbolremainon t ape3 or if t hisnondet erminist ic
choiceis invalid,abort t hisbranch by going t o st age 4. Also got o st age 4 if a
reject ingconfiguration is encount ered. If an accept ingconfiguration is
encount ered, accept t heinput .
4. Replace t hest ringon t ape3 wit h t helexicographically next st ring.
Simulat e t henext branch of N ' s comput at ion by going t o st age 2.
15
Corollary 3.11 A language is Turing recognizable if and
only if some nondeterministic Turing machine recognizes it.
16
Enumerators
An enumeratoris a T uringmachinewith a printer.
An enumeratorstartswith a blank input tape. If theenumeratordoes not
halt,it may print an infinitelist of strings.T helanguage enumeratedby E
is theset of all strings thatit eventuallyprintsout. E may generatethe
stringsof thelanguage in any order,possibly with repetitions.
17
Theorem 3.13 A language is Turing-recognizable if
and only if some enumerator enumerates it.
P roof (1) Let E enumeratesA. ConstructM thatrecognizesA.
M " On input w :
1. Run E. Every timethat E outputsa string,compareit with w.
2. If w ever appearsin theoutput of E , accept."
(2) Let M recognizesA. ConstructE thatenumeratesA.
Let {s1 , s2 , s3 ,}  * .
E " Ignoretheinput.
1. Repeat thefollowingfor i  1,2,3,
2. Run M for i stepson each input,s1 , s2 , s3 ,, si .
3.
If any computations accept,print out thecorresponding s j ."
18
To avoid depth-first loops
s1
s2
s3
s4
s5
s6
19
Hilbert’s 10th Problem
D  { p | p is a polynomialwith an itegralroot}.
D1  { p | p is a polynomialover x with an itegralroot}.
M 1 " T heinput is a polynomialp over x.
1. Evaluate p with x set successively tothe values0,1,1,2,2, 
If at any point thepolynomialevaluatesto 0, accept."
M 1 recognizes D1.
Likewise, we can constructM thatrecognizesD.
Since M 1 and M loop when p has no integralroots, theyare not deciders.
We can convertM 1 to be a decider for D1 because we can restrict he
t
effectivesearch area.For multivariable cases, we can not.
20
Problem 3.18
Let f ( x)  c1 x n  c2 x n 1    cn x  cn 1 be a polynomialwit h integral
coefficients and has a root at x  x0 . Let cmax be thelargest absolut e value of a ci .
T hen wehave| x0 | (n  1) 
cmax
.
| c1 |
Proof.
If x0  0, we havenothingto prove. Let us assume that x0  0.
| c1 x0 || c2  c3 
1
1
   cn 1  n 1 | n  cmax  (n  1)cmax .
x0
x0
21
Example 3.14 An algorithm
A  { G | G is a connectedundirectedgraph}, where G is some encoding
for graphs.
M " On input G :
1. Select thefirst node of G and mark it.
2. Repeat thefollowingstage until no new nodes are marked.
3.
For each node in G, mark it if it is at tachedby an edge to a
node thatis already marked.
4. Scan all thenodes of G to determinewhether hey
t all are
marked. If theyare, accept; otherwisereject."
22