Turing Machines

Introduction

Turing machines were described in 1936 by Alan Turing. It is a theoretical model that can be adapted tosimulate the logic of any computer algorithm. Thus it can be considered an ideal model of a general purpose computer. But even the Turing machine cannot solve problems which are beyond the theoreticallimits of computation. Turing machines can be used to prove the decidability (whether they can or cannot be done) of any problem that may or may not be related to programming. e.g. Ambiguity of a grammar.They can also be used the find whether a problem is tractable (can be solved in polynomial time) or not.Thus turing machines can be used to differentiate between intractable and undecidable problems. Theclass of languages accepted by Turing machines is the class of Type 0 (recursively enumerable)languages.

Definition:

A Turing machine consists of a,

y

a finite control,

y

a tape

y

a head that can be used for reading or writing on that tapeThe finite control can be in any of the finite set of states. The tape is divided into cells and each cell canhold a single symbol from a finite set. The tape head is always placed over any of the tape cells and issaid to scan that cell. Initially it is placed over the left cell holding the input. The tape head can read/writesymbols and move around on the tape (left/right). It is similar to a finite automata but has unlimited andunrestricted memory. Thus they can manipulate infinite tapes.Figure A

B

asic working

Figure A shows a Turing machine. Initially the tape will have only the input string chosen from the inputalphabet and the rest of the tape is blank. Blank is a tape symbol and not a symbol from the inputalphabet. The tape can also contain tape symbols other than blank or input symbols. The tape head readsthe current symbol and depending upon the state of the finite control a move is carried out. When themachine need to store any information, it is written on tape and later read when needed. Once started, the

computing continues and there are three possible outcomes possible

accept

,

reject

or

loo

p

. Loopingsimply means that the machine won¶t halt. The output is obtained when the machine enters the designatedaccepting and rejecting states or else it will go on forever without halting. One major problem faced inturing machine is that we cannot distinguish between looping and merely taking long time to execute. For this, turing machines are made so that they halt on all inputs. Such turing machines are called

deciders

because they always make a decision to accept or reject.

Defining

m

ov

e

The

move

taken by the turing machine at any time is a function of the present state of finite control andthe symbol scanned from the tape. When a move occurs the following may take place:

y

C

hange State (sometimes retain the current state)

y

Write a symbol on cell scanned (sometimes retain the current symbol)

y

M

ove the tape head left or right (if the tape head is not required to move by the turing machinelogic, it can be stationary. But a move will be formally accepted if the head moves. So a move isdefined when the head moves, then previous moves are combined with the present move into asingle move)

F

ormal Definition:

A Turing machine (T

M

) can be formally notated similar to a finite automata or PDA. A T

M

can bedescribed by a 7-tuple:

M

= (Q, , , , q

0

, B, F)where,Q : The finite set of states of the finite control : The finite set of input symbols. : The complete set of tape symbols. is subset of . : The transition function.(q, X) = (p, Y, D)

y

q is a current state which is a member of Q.

y

X is a tape symbol which is a member of .

y

p is the next state which is a member of Q.

y

Y is a symbol in replacing the previous state symbol.

y

D is direction in which the head moves and can be L or R (left/right)q

0

: The start state of finite control which is a member on Q.B : The blank symbol which is in but not in .F : The set of final (accepting) states which is a subset of Q.

C

onventions for Representation

Lower case letters at the beginning of alphabet are used to represent input symbols. eg: a,b,c

Lower case letters from the end of alphabet are used to represent the strings of input symbols. eg:w,x

C

apital letters from the end of alphabet are used for tape symbols. eg: X1, X2, B (blank)

G

reek alphabets are used to represent tape strings.eg: ,

Letters p, q and nearby are used for states.

Difference between finite automata and Turing machine

The following list summarizes the differences between finite automata and Turing machines.1. A Turing machine can both write on the tape and read from it.2. The read-write head can move both to the left and to the right.3. The tape is infinite.4. The special states for rejecting and accepting take effect immediately.

Instantaneous Descriptions

Instantaneous Descriptions (ID) like those used for PDAs can also be used to represent the current state of a turing machine. Each ID has to represents the current state of finite control and current position of head.These information can be represented together by placing the symbol representing current state to the leftof the next symbol to be scanned in the tape string as shown in example. We can then call this the tape- plus-state string or ID. Since the tape of the turing machine is infinitely long, it is impossible to representthe whole tape in an ID. A representation of the whole tape in an ID will result in an infinite prefix andsuffix for a state. We thus show only the portion of tape between the leftmost and rightmost non-blank.Thus a typical ID will be,X

1

X

2

. . . X

i-1

q X

i

X

i+1

« X

n

in which,1.

q is the current state of the machine2.

The head is going to scan the i

th

symbol from left.3.

X

1

X

2

« X

n

is the portion between the leftmost and rightmost non-blank.

Representing

m

ov

es

Using Instantaneous Description

A single

move

or group of

moves

can be represented as a transition from on ID to another. As usual for the machine

M

= (Q, , , , q

0

, B, F) symbol or are used to represent a single move and or (

reflexive, transitive closure

)

to represent more than one move.

C

onsider the move from state q to state p after reading symbol X

i

and the head then moves to left:(q, X) = (p, Y,L)It can be represented as,X

1

X

2

. . . X

i-1

q X

i

X

i+1

« X

n

X

1

X

2

. . . X

i-2

p X

i-1

Y X

i+1

« X

n

Initially the tape head was positioned over X

i

and now it is positioned over X

i-1

There are two exceptions to this.1.

If i=1, then the head moves to left and it will be over a blank.q X

1

X

2

« X

n

p B Y

X

2

« X

n

2.

If i=n and Y=B, then the symbol B is written over X

n

and X

n

disappears into the infinitesequence and does not appear in the next ID.

Filters

1 hundred reads

1 thousand reads

Reply

jincyjoseph added this note

thanks..

Divya Sangar liked this

Nazneen Mustafa liked this

Sravani Sravs liked this

Priya Manavalan liked this

ggardu liked this

puretrust liked this