# Turing Machines 2009-2010 Part 1:. 2 Church-Turing Thesis Part 1 An effective procedure is defined as: a procedure which can be broken down into simple.

## Presentation on theme: "Turing Machines 2009-2010 Part 1:. 2 Church-Turing Thesis Part 1 An effective procedure is defined as: a procedure which can be broken down into simple."— Presentation transcript:

Turing Machines 2009-2010 Part 1:

2 Church-Turing Thesis Part 1 An effective procedure is defined as: a procedure which can be broken down into simple steps carried out in accordance with a set of rules This relates to Turing machines: If an effective procedure is defined as above then every Turing machine embodies an effective procedure

3 Turing Machine A Turing Machine (TM) uses a tape which is an extension of an input tape (unbounded in one direction, unused portion is blank) may be read in either direction may be written over as often as required for intermediate calculations Tape Finite-state machine a Turing Machine

4 Formally: TM = (Q, T, g, q 0, F) where ­Q is a finite number of states with initial state q 0 ­F is a set of final states which are a subset of Q ­T is a finite vocabulary of symbols (e.g. T = {0,1, b} where b means blank) ­g is a transition function, a partial function: g: (Q\F) T Q T {L, R} where L and R denote left and right moves of the read-write head. Thus g(q, a) = (q, a, X) defines a move, where q, q Q, a, a T, X {L, R}

5 Turing Machine Initially there is a series of symbols (from T) on the tape. The move is determined by the current state (q) and the symbol (a) under the read-write head. The move consists of three actions: a change of state (to q), writing of a new symbol onto the tape (a), and a shift of the head (L or R). If the TM reaches a state q F then it halts and succeeds. If it reaches a state q Q\F and no move is possible then it halts and fails.

6 Simple TM example Checking odd parity of 4 digit binary number Q = {q 0, q 1, q 2, q 3, q 4, q 5, q 6, q 7, q 8, q 9 } T = {1, 0, b} F = {q 9 } 01100 parity(n) n tape start

7 Simple TM example Finite state machine to control TM 0110bb Start 01100b End q0q0 q2q2 q1q1 q4q4 q3q3 q6q6 q5q5 q8q8 q7q7 0,0,r b,0,r 0,0,r b,1,r 1,1,r read symbol write symbol q9q9

8 Church-Turing Thesis Part 2 From the first slide we saw that every Turing machine embodies an effective procedure The Church-Turing Thesis states the converse: any effective procedure (or algorithm) can be encoded as a Turing machine. This has not been proved (partly because the notion of effective procedure is rather vague), but it is widely believed to be true.

9 Turing Machine Halting It is quite possible that a Turing machine will never halt, for example if it enters an endless loop, as follows: A string x T is accepted by a TM if it halts and succeeds, starting from x on the tape (input). If a TM always halts for any input then it defines analgorithm. The output is left on the tape when it halts. g(q 1, a) = (q 2, a, R) g(q 2, a) = (q 1, a, L) q 1, q 2 F aa

10 Turing Machine Extensions Possible Extensions: (1) two-way infinite tape, (2) multiple tracks on the tape, (3) multiple heads on the tape, (4) multiple tapes (with independent movement of each head), (5) multi-dimensional tape, (6) non-deterministic machine: g is then a mapping from a subset of (Q\F) T to subsets of Q T {L, R}.

11 Power of TM Extensions (2) multiple tracks on the tape:(5) multi-dimensional tape: If a TM contains any or all of the extensions (1),...,(6), an equivalent simple TM can be constructed containing none of them: they give no extra power. For example for a multi-track machine, each a T is a tuple of simpler symbols but there is still a finite number of these tuples so the original definition applies.

12 Simulation of TMs by extensions (4) multiple tapes, independent heads TM 1 (2) multiple tracks, one head TM 2 Tape 1 Tape 2 Tape 3 Tape 1 Tape 2 Tape 3 Head 1 Head 2 Head 3

13 Simulation of TMs by extensions Simulation of a multi-tape machine (TM 1 ) by a multi-track machine (TM 2 ): Number of tracks = twice the number of tapes, with position of each head recorded by a marker ( ). Each move of TM 1 is simulated in TM 2 by a sweep from left to right (recording symbols alongside markers for each tape), then from right to left (updating symbols and moving markers as required). This process takes longer, so the advantage of have multiple tapes (with independent heads) is speed. What a TM can compute, therefore, may be computed faster with these extensions, but they cannot extend the range of computability.

14 Example The following TM will add two binary numbers and leave the sum on the tape. The tape has two tracks, each initially containing one number with a \$ symbol as left end marker, (the two numbers are aligned bit for bit). The total is left on one track with the other one blank (b), and the rest of the tape is blank (to each end). e.g. start: b b b b b b \$ \$ 0 0 0 0 bb bb 1 1 11 1 11 1 000b bb \$ bbbbb finish:

15 Examplenot b ( (b ) (0 )( 1b1b ) (\$ )( 1b1b ) (1 )( 0b0b ) (b )( \$b\$b ) (\$ )( \$b\$b ) (0 )( 0b0b )( 1010 )( 1b1b )( 0101 )( 1b1b ) ( 1010 )( 0b0b )( 1b1b )(1 )( 0101 )( 0b0b ) start no carry carry write carry halt ) same () R () L L L L R R LLL LLL b b b b b b \$ \$ 0 0 0 0 bb bb 1 1 11 1 11 1 000b bb \$ bbbbb start: finish:

16 Summary Church-Turing thesis says that we can turn any algorithm into a Turing Machine TM characterised by M = (Q, T, g, q 0, F) extensions to TM include two-way infinite tape, multiple tracks on the tape, multiple heads on the tape, multiple tapes, multi-dimensional tape, non-deterministic machine But these do not increase power, just speed and compactness

17

Similar presentations