Académique Documents
Professionnel Documents
Culture Documents
Rothenberg, Germany
1
Outline
Problems that Computers Cannot Solve The Turing Machine (TM) (in part b) Programming Techniques for TMs Extensions to the Basic TM Restricted TMs TMs and Computers
2
8.0 Introduction
Concepts to be taught -- Studying questions about what languages can be defined be any computational device?? There are specific problems that cannot be solved by computers! --- undecidable! Studying the Turing machine which seems simple, but can be recognized as an accurate model for what any physical computing device is capable of doing.
3
Define hello, world problem to be: determine whether a given C program, with a given input, prints hello, world as the first 12 characters that it prints.
The answer is: undecidable! That is, there exists no such program H. We will prove this by contradiction.
6
2nd step: transform H to another form H2 in simple ways which can be done by C programs 3rd step: prove H2 not existing. So H also not existing.
7
H1
yes
Figure 8.5 hello, world
Figure 8.5
hello, world
10
Now, (1) if the box H2, given itself as input, makes output yes, then it means that the input H2, given itself as input, prints hello world as first output. But this is contradictory because we just suppose that H2, given itself as input, makes output yes. 11
H2
H2
tester H2
Figure 8.6
Hello, world
The above contradiction means the other alternative must be true (since it must be one or the other), that is --(2) the box H2, given itself as input, prints hello, world. This then means that such H2, when taken as input to the box H2(itself), will make the box H2 to make output yes. Contradiction again because we just say that the box H2, given itself as input, prints hello, world.
12
H2
tester H2
Hello, world
Now we have an undecidable problem, which can be used to prove other undecidable problems by a technique of problem reduction. That is, if we know P1 is undecidable, then we may reduce P1 to a new problem P2, so that we may prove P2 undecidable by contradiction in the following way: If P2 is decidable, then P1 is decidable.
But P1 is known undecidable. So, contradiction! Consequently, P2 is undecidable.
15
to be undecidable. Solution: regard Q in P1; reduce P1: the hello-world problem to P2: the callsfoo problem in the following way:
(continued in the next page)
16
function a new program Q1 doing the same as Q. () Add to Q1 a function foo doing nothing & not called a new Q2 Modify Q2 to remember the first 12 characters that it prints, storing them in a global array A Q3
Modify Q3 so that whenever it executes any output statement, it checks A to see if it has written 12 characters or more, and if so, whether hello, world are the first characters. In that case, call the new function foo R with input z = y. 17
(3) That is, R, with input y, calls foo if and only if Q, with input y, prints hello, world.
(4) So, if we can decide whether R, with input z, calls foo, then we can decide whether Q, with input y, prints hello, world.
18
no
19
(in particular, he asked if there was a way to decide whether any formula in the 1st-order predicate calculus, applied to integer, was true)
21
The proof technique is diagonalization, resembling the self-contradictory technique used previously.
22
24
B B X1 X2
Xi
Xn B B
26
28
A TM is a deterministic automaton with a twoway infinite tape which can be read and written in either direction.
29
The tape head is scanning the ith symbol from the left;
X1X2Xn is the portion of the tape between the leftmost and the rightmost nonblank symbols.
30
X1X2Xi1qXiXi+1Xn |_ X1X2Xi2pXi1YXi+1Xn M
Right moves are defined similarly.
31
Change 0 to an X.
Move to the right over 0s and Ys until a 1. Change 1 to Y.
33
0
(q1, X, R)1 (q1, 0, R)2 (q2, 0, L)5
Y
(q3, Y, R)8 (q1, Y, R)3 (q2, Y, L)6 (q3, Y, R)9
(q2, Y, L)4
(q0, X, R)7
(q4, B, R)10
34
_ | (use instead of )
q00011 Xq1011 X0q111 Xq20Y1 q2X0Y1
The set of languages accepted by a TM is often called the recursively enumerable language or RE language. The term RE came from computational formalism that predate the TM.
37
It is not always possible to require that a TM halts even it does not accept.
39
So TMs that always halt can be used for studies of decidability (see Chapter 9).
40