Turing Machine
Turing Machine
TURING MACHINE
Introduction to Turing machine, model, TM as a acceptor, TM as a recognizer, FSM to TM,
TM as a evaluator, Variants of Turing machine, Universal Turing Machine, Power of TM,
Application of TM
INTRODUCTION
The Turing machine (TM) is a simple and powerful mathematical model of computation that
can be used as language acceptor, language translator, and function evaluator. The languages
that the Turing machine can compute are recursively enumerable.
B a a b b B
R/W head
Finite control
Turing machine consist of the input tape which is divided into number of cells. In each cell at
a time one symbol can be stored. The head of Turing machine is read/write head which can
move either in left direction or in right direction.
It can read and also can write one symbol at a time onto the input tape. It has finite set of
states which represents the status of the machine and at a given time machine can reside in
any one of these states. Turing machine consists of finite set of symbols which includes a
special symbol Blank symbol denoted by „B‟. Initially when no input is stored on tape, all
cells of tape consist of the blank symbol.
A move in the Turing machine depends on the current input symbol and the current state A
step in a Turing machine program is an action which is specified as a 5-tuple of the form:
(current state, current input symbol, new state, new symbol, direction of move)
Let us see one example how the transition is denoted:
δ(q0, a) = (q1, X, R)
Current state
Move
Current input
New state New symbol
Formal Definition: The Turing Machine M, is a 7-tuple variable as given below:
M= {Q, , Г, δ, q0 ,B,F }
q0 : Initial state
B: Blank symbol
1. Transition diagram
2. Transition table
3. Instantaneous description
Transition Diagram:
It is the graphical representation of the transition function. All notations are similar with the
transition diagram of Finite automata; just the way how transitions are labeled is different.
Current input
Move
Initial State
Replaced symbol
Transition table:
It is the tabular representation of the transition function. The transition table for transition
diagram shown below
0 1 B
Q
q0 - (q1,X,R) -
q1 (q1,0,R) - (q2,B, L)
q2* - - -
Instantaneous description:
The working of Turing machine for a particular string is represented using instantaneous
description.
Examples of TM:
Logic:
1. Each „a‟ is replaced by „X‟ and head movement towards right till „b‟.
q1:.Search for „b‟ and replace it by „Y‟ and head moves towards left, Bypass all „a‟s &„Y‟s.
q2: Bypass all „a‟s and „Y‟s. Search for „X‟ and replace it by „X‟only and head moves
towards right whenever get „a‟ at qo state repeat the cycle for all a‟s and b‟s.
q3: On q0 state if we get „Y‟ replace it by „Y‟only and head moves towards right Now, move
the head right till we get blank symbol to check that any „b‟ is remaining or not. Bypass all
Y‟s.
q4: After all Y‟s if we get blank symbol means no more b‟s are remaining.
Transition Diagram:
Transition Table:
a b X Y B
Q
q0 (q1, X, R) - - (q3,Y, R) -
q3 - - - (q3, Y, R) (q4, B, S)
q4* - - - - -
Instantaneous Description:
|- q0aabbB |-XXYq1bB
|- Xq1abbB |-XXq2YYB
|- Xaq1bbB |-Xq2XYYB
|- Xaq2YbB |-XXq0YYB
|- Xq2aYbB |-XXYq3YB
|-q2XaYbB |-XXYYq3B
|-Xq0aYbB |-XXYYq4 (Accept)
|-XXq1YbB
Logic:
1. Each „a‟ is replaced by „X‟ and head movement towards right till „b‟.
2. Each „b‟ is replaced by „Y‟ and head movement towards right till „c‟.
3. Each „c‟ is replaced by „Z‟ and head movement towards left till „X‟.
q1:.Search for „b‟ and replace it by „Y‟ and head moves towards right, Bypass all „a‟s and
„Y‟s.
Search for „C‟ and replace it by „Z‟ and head moves towards left
q3: Search for „X‟ and replace it by „X‟only and head moves towards right whenever get „a‟
at qo state repeat the steps.
q4: On q0 state if we get „Y‟ replace it by „Y‟only and head moves towards right Now, move
the head right till we get blank symbol. Bypass all Y‟s and „Z‟s.
q5: After reading all Y‟s and „Z‟s if we get blank symbol means that is final state.
Transition Diagram:
Transition Table:
Q a b c X Y Z B
q5* - - - - - - -
Instantaneous Description:
|-q0abcB |-q3XYZB
|-Xq1bcB |-Xq0YZB
|-Xq1bcB |-XYq4ZB
|-XYq2cB |-XYZq4B
|-XYq3ZB |-XYZq5 (Accept)
|-Xq3YZB
Solution: Well formedness of parenthesis means for every (,{,[ there will be ),},]
Logic:
1. Each „(‟ is replaced by „X‟ and head movement towards right till „)‟.
F={q4}
Working:
q1:.Search for „)‟ and replace it by „Y‟ and head moves towards left, Bypass all „(‟s &„Y‟s.
q2: Bypass all „(‟s and „Y‟s. Search for „X‟ and replace it by „X‟ only and head moves
towards right whenever get „(‟ at qo state repeat the cycle for all (‟s and )‟s.
q3: On q0 state if we get „Y‟ replace it by „Y‟only and head moves towards right Now, move
the head right till we get blank symbol to check that any „)‟ is remaining or not. Bypass all
Y‟s.
q4: After all Y‟s if we get blank symbol means no more (‟s are remaining.
Transition Diagram:
Transition Table:
Q ( ) X Y B
q3 - - - (q3, Y, R) (q4, B, S)
q4* - - - - -
Instantaneous Description:
|- X( q1) )B |-Xq2XYYB
|- X( q2Y )B |-XXq0YYB
|- Xq2( Y )B |-XXYq3YB
|-q2X(Y )B |-XXYYq3B
|-Xq0( Y) B |-XXYYq4 (Accept)
|-XXq1Y )B
Logic:
1 Each „a‟ is replaced by „X‟ and head movement towards right till „b‟.
2. Each „b‟ is replaced by „Y‟ and head movement towards left till „X‟ .
3. Repeat above two steps till all a‟s and b‟s are over..
q1:.Search for „b‟ and replace it by „Y‟ and head moves towards left, Bypass all „a‟s and
„Y‟s.
q2: Bypass all „a‟s and „Y‟s. Search for „X‟ and replace it by „X‟only and head moves
towards right whenever get „a‟ at qo state repeat the cycle for all a‟s and b‟s.
q3: On q0 state if we get „Y‟ replace it by „Y‟only and head moves towards right Now, move
the head right to search for the last „b‟. Bypass all Y‟s.
q4: After all Y‟s if we get „b‟ this indicates one extra „b‟ than „a‟ is found.
q5: After the last „b‟ if we get blank symbol means no more b‟s are remaining.
Transition Diagram:
Transition Table:
a b X Y B
Q
q3 - (q4,B,R) - (q3, Y, R) -
q4 - - - - (q5,B,S)
q5* - - - - -
Instantaneous Description:
|-q0abbB |-Xq0YbB
|-Xq1bbB |-XYq3bB
|-Xq2YbB |-XYBq4B
|-q2XYbB |-XYBq5(Accept)
Logic:
1 Each „a‟ is replaced by „a‟ and head movement towards right till „b‟.
2. Whenever reading „b‟ for each „b‟ is replaced by „X‟ and head movement towards right till
„c‟ .
3. Each „c‟ is replaced by „Y‟ and head movement towards left till „X‟
q1:.Search for „b‟ and replace it by „X‟ and head moves towards right
q2: Bypass all „a‟s ,‟b‟s and „Y‟s. Search for „c‟ and replace it by „Y‟ and head moves
towards left
q3: Search for „X‟ and replace it by „X‟only and head moves towards right whenever get „a‟
at qo state repeat the steps. Bypass all „a‟s ,‟b‟s and „Y‟s.
q4: On q0 state if we get „Y‟ replace it by „Y‟ only and head moves towards right Now,
move the head right till we get blank symbol. Bypass all Y‟s.
q5: After reading all Y‟s if we get blank symbol means that is final state.
Transition Diagram:
Transition Table:
Q a b c X Y B
q1 - (q2, X,R) - - - -
q4 - - - - (q4, Y, R) (q5,B,S)
q5* - - - - - -
Instantaneous Description:
|-q0abcB |-q3XYB
|-aq1bcB |-Xq0YB
|-Xq2cB |-XYq4B
|-Xq3YB |-XYq5 (Accept
Logic:
1. For each„a‟, replace it as „X‟ and move right till we get blank symbol.
2. After getting blank symbol move left and search for „b‟.
3. For each „b‟, replace it as „X‟ and move left till we get blank symbol.
q1: Search for blank symbol, „B ‟is replace with „and head moves towards left. While doing
this skip all a‟s, b‟s and X‟s.
q2: Search for „b‟, replace it by „X‟ and head moves towards left. While doing this skip all
a‟s and X‟s .
q3: Search for blank symbol, keep it as it is and head moves towards right.While doing this
skip all a‟s, b‟s and X‟s.
q4: On q0 state after moving right if we get blank symbol indicates that all a‟s are over. So
move left to check any „b‟ is remaining or not. Skip all X‟s.
q5 : After reading all X‟s if we get blank symbol means that is final state.
Transition Diagram:
Transition Table:
a b X B
Q
q0 (q1, X, R) (q0, b, R) (q0 ,X, R) (q4 ,B ,S)
q4* - - - -
Instantaneous Description:
Logic:
1. For each „a‟, replace it as „X‟ and move right till we get blank symbol.
2. After getting blank symbol move left and search for „b‟.
3. For each „b‟, replace it as „X‟ and move left till we get blank symbol.
q1: Search for blank symbol, „B ‟is replace with „and head moves towards left. While doing
this skip all a‟s, b‟s and X‟s.
q2: Search for „b‟, replace it by „X‟ and head moves towards left. While doing this skip all
a‟s and X‟s .
q3: Search for blank symbol, keep it as it is and head moves towards right.While doing this
skip all a‟s, b‟s and X‟s.
q5: On q2 state if we read one more a‟s meaning is that no of a‟a greater than b‟s means that
is final state.
Transition Diagram:
Transition Table:
Q a b X B
q5 * - - - -
Instantaneous Description:
|-q0aabB |-Xq3aXB
|-Xq1abB |-q3XaXB
|-Xaq1bB |-Xq0aXB
|-Xabq1B |-XXq1XB
|-Xaq2bB |-XXXq1B
|-Xaq3XB |-XXXq2B
|-XXXq5
8] Design TM for the language of odd length palindrome over ∑={0,1} i.e WCWR
Solution: The language L consists of all odd length palindrome strings. May-14 (CBGS)
1. For each „0‟ or „1‟, replace it as „X‟ and move right till we get blank symbol.
2. After getting blank symbol move left. If the last character matches with the first
character then mark it as blank symbol and move left
Transition Diagram:
Working:
q0 : Take the first character (either „0‟ or „1‟), mark it as „X‟ and move right.
q1 & q4: Search for blank symbol, keep it as it is and then move left. While doing this skip all
0‟s, 1‟s &c‟s.
q2 & q5: On q2 & q5 if we get same symbol, mark it as ‟B‟ and move left.
q7 : On q3 and q6 states after moving left if we get „X‟ that means all symbols are over.So
move q0 state and from q0 state bypass c‟s.
Transition Table:
0 1 c X B
Q
q0 (q4, X, R) (q1, X, R) (q7, c, R) - -
q2 - (q3, B, L) - - -
q5 (q6, B, L) - - - -
q7 - - - - (q8.B,S)
q8* - - - - -
Instantaneous Description:
9] Design Turing machine for the language of even length palindrome i.e.WWR
┌ ={1,0, X, B}
q0=q0
B=Blank symbol
F={q7}
Logic:
1. For each „0‟ or „1‟, replace it as „X‟ and move right till we get blank symbol.
2. After getting blank symbol move left. If the last character matches with the first
character then mark it as blank symbol and move left
Transition Diagram:
Working:
q0 : Take the first character (either „0‟ or „1‟), mark it as „X‟ and move right.
q1 & q4: Search for blank symbol, keep it as it is and then move left. While doing this skip all
0‟s, 1‟s.
q2 & q5: On q2 & q5 if we get same symbol, mark it as ‟B‟ and move left.
q3 & q6: Bypass 0‟s,1‟s and move left. After moving left if we get „X‟ replace it‟X‟ .
Transition Table:
0 1 X B
Q
q0 (q4, X, R) (q1, X, R) - (q7,B,S)
q2 - (q3, B, L) - -
q5 (q6, B, L) - - -
q7* - - - -
Instantaneous Description:
10] Design Turing machine to replace the substring “111” by “101”from a sequence of
0’s and 1’s.
May-10
Solution:
Logic: The given language consists of string such that for every occurrence of 111 by 101.
┌ ={0,1, B}
q0=q0
B=Blank symbol
F={q5}
Working:
q1: If I/P is „0‟ on q1, mark it „0‟ and move right goto q0.Else if I/P is „1‟ mark it as „1‟ and
move right.
q2: If I/P is „0‟ on q2, mark it „0‟ and move right goto q0. Else if I/P is „1‟ mark it as „1‟ and
move left goto q3.
q3: If I/P is „1‟ on q3, mark it „0‟ and move right goto q4.
q4: If I/P is „1‟ on q4, mark it „1‟ and move right goto q0.On q0 if we get blank symbol
means that is an accepted state.
Transition Diagram:
Transition table:
Q 0 1 B
q3 - (q4, 0 , R) -
q4 - (q0, 1, R) -
q5 -- - -
Instantaneous Description:
Solution:
Logic: The given language consists of string that starts with „0‟ and ends with „11‟
L={011,0011,0111,00111……}
q1: If I/P is „0‟ on q1, bypass „0‟ else if I/P is „1‟ mark it as „1‟ and move right.
q2: If I/P is „0‟ on q2, mark it „0‟ and move right goto q1. If I/P is „1‟ mark it as „1‟ and move
right goto q3.
q3: If I/P is „0‟ on q3, mark it „0‟ and move right goto q1. Bypass „1‟if we get blank symbol
means that is an accepted State q4.
Transition Diagram:
Transition table:
Q 0 1 B
q0 (q1, 0, R) - -
q1 (q1, 0, R) (q2, 1, R) -
q2 (q1, 0, R) (q3, 1, L) -
q4* - - -
Instantaneous Description:
12] Design Turing machine to perform addition of two unary numbers. i.e m+n
May-11
O/P = B0pB where p=m+n
Solution: Let us use the symbol “0” to represent the unary numbers. here we will use symbol
“1” as a separator.
Consider input is 3+2 so the content becomes
I/P B 0 0 0 1 0 0 B
O/P B 0 0 0 0 0 B B
Logic:
1. Bypass all 0‟s and head moves towards right to search for „1‟.
2. When we get the „1‟, replace it with „0‟ and moves towards right till blank symbol.
3. After reaching to blank symbol moves towards left and replace the last „0‟ as „B‟.
∑={0,1}
┌ ={0,1, B}
q0=q0
B=Blank symbol
F={q3}
Working:
q0 : Replace the „0‟of by „0‟.on getting „1‟ replace it by „0‟ and move right.
q1: Search for „B‟, and replace „B‟ with „B‟ and moves towards left. Bypass all 0‟s.
Transition Diagram:
Transition Table:
0 1 B
Q
q0 (q0, 0, R) (q1, 0, R) -
q1 (q1, 0, R) - (q2, B, L)
q2 (q3, B, S) - -
q3* - - -
|-B0010B |-000q10B
|-q00010B |-0000q1B
|-0q0010B |-000q20B
|-00q010B |-000Bq3
13] Design Turing machine to perform subtraction of two unary numbers. i.e m-n
defined as, m-n if m>n
0 if m<=n
I/P = B0m10nB
Solution: Here 3 cases are, m>n, m=n and m<n. Consider input becomes,
Logic:
1. For first „0‟, replace it with „B‟ and move right till Blank symbol.
2. On receiving Blank symbol as „B‟ move left and replace the rightmost „0‟as „B‟.
q0 : Replace the leftmost „0‟of first number by „B‟ and move right.
q1: Search for „B‟, and replace „B‟ with „B‟ and moves towards left. Bypass all 0‟s and 1‟s.
q2: Replace the rightmost „0‟ of second number by „B‟ and move left.
If we get „1‟ on this state then it indicates that all 0‟s of second number are over so second
number is smaller than first number. Now, replace the „1‟ by „0‟ and move to final state.
q3: Search for „B‟ and replace „B‟ with „B‟. and moves towards right and go to q0 state to
repeat the cycle. Bypass all 0‟s and 1‟s.
q4: On q0 state after moving right if we get „1‟ that means all 0‟s of first number are over.
Replace the „1‟ by „B‟. Now, move right to check, whether any „0‟ of second number is
remaining. If not then this means that both numbers are equal, so move to final state.
If any „0‟ is found then this indicates that first number is smaller than the second
number. Replace all remaining 0‟s by „B‟and move to final state.
Transition Diagram:
Transition Table:
0 1 B
Q
q0 (q0, B, R) (q4, B, R) -
q2 (q3, B, L) (q5, 0, S) -
q4 (q4, B, R) - (q5, B, S)
q5 - - -
|-0010B |-B0q31B
|-q00010B |-Bq301B
|-B q1010B |-q3B01B
|-B0q110B |-Bq001B
|-B01q10B |-BBq11B
|-B010q1B |-BB1q1B
|-B01q20B |-Bq21B
|-B0q5
14] Design Turing machine to compare two unary numbers according to following
criteria. If m=n then output is E
DEC-13
If m>n then output is G
If m<n then output is L
I/P = B0m10nB
Solution: Here 3 cases are, m>n, m=n and m<n logic is similar only the output on tape
will be E, L, or G.
B1 B q0 BBq0
B q2
Logic:
1. For first „0‟, replace it with „B‟ and move right till Blank symbol.
2. On receiving Blank symbol as „B‟ move left and replace the rightmost „0‟as „B‟ and move
left till blank symbol
q0 : Replace the leftmost „0‟of first number by „B‟ and move right.
q1: Search for „B‟, and replace „B‟ with „B‟ and moves towards left. Bypass all 0‟s and 1‟s.
q2: Replace the rightmost „0‟ of second number by „B‟ and move left.
If we get „1‟ on this state then it indicates that all 0‟s of second number are over so first
number is greater than second number. Now, replace the „1‟ by „B‟ and move left.
q3: Search for „B‟ and replace „B‟ with „B‟. and moves towards right and go to q0 state to
repeat the cycle. Bypass all 0‟s and 1‟s.
q4: On q0 state after moving right if we get „1‟ Replace that „1‟ by „B‟. If any „0‟ is found
replace „0‟ by „B‟ and moves right. If not that means that both numbers are equal, so move
to final state.
q5: Replace „0‟ by „B‟ and moves right. If any „0‟ is found then this indicates that first
number is smaller than the second number.
q6: Replace „0‟s by „B‟and move left.
Transition Diagram:
Transition table:
0 1 B
Q
q0 (q1,B,R) (q4,B,R) -
q2 (q3,B,L) (q6,B,L) -
q4 (q5,B,R) - (q7,E,S)
q5 (q5,B,R) - (q7,L,S)
q6 (q6,B,L) - (q7,G,S)
q7* - - -
|-010B |- Bq31B
|-q0010B |-q3B1B
|-Bq110B |-Bq01B
|-B1q10B |-BBq4B
|-B10q1B |-BBq7
|-B1q20B
Solution:
Logic:
Where, Q = {q0, q1 }
∑={0,1}
┌ ={0,1, B}
q0=q0
B=Blank symbol
F={q1}
Working:
q0 : Replace the „0‟with‟1‟ and „1‟with‟0‟ and move right. Search for „B‟, and replace „B‟
with „B‟ and moves towards left.
q1: On q0 state after reading all 0‟s and 1,s if we get blank symbol means that is final state.
Transition diagram:
Transition table:
0 1 B
Q
q0 (q0, 1, R) (q0, 0, R) (q1, B, L)
q1* - - -
Instantaneous Description:
B101B
Solution:
Logic:
q0=q0
B=Blank symbol
F={q3}
Working:
q0 : Replace the „0‟with‟0‟ and „1‟with‟1‟ and move right. Search for „B‟, and replace „B‟
with „B‟ and moves towards left.
q1: Replace „0‟with‟0‟ and „1‟with‟1‟ move towards left. Search for „B‟, and replace „B‟ with
„B‟ and moves towards right.
q2: Replace „0‟with‟1‟ and „1‟with‟0‟ move towards left. Search for „B‟, and replace „B‟ with
„B‟ and moves towards right.
Transition diagram:
Transition table:
0 1 B
Q
q0 (q0, 0, R) (q0, 1, R) (q1, B, L)
q3* - - -
Instantaneous Description:
|-B101B |-10q21
|-q0101B |-1q201
|-1q001B |-q2111
|-10q01B |-q2B011
|-101q0B |-Bq3011
|-10q1 1
Logic:
q0 : Replace the „0‟with‟0‟ and „1‟with‟1‟ and move right. Search for „B‟, and replace „B‟
with „B‟ and moves towards left.
q1: Trailing 1‟s are replace with‟0‟ move towards left. Search for „B‟, and „0‟ from rightmost
end and replace with „1‟ .
Transition Diagram:
Transition table:
0 1 B
Q
q0 (q0, 0, R) (q0, 1, R) (q1, B, L)
q2* - - -
Instantaneous Description:
|-1q10 |-11q2
Logic:
q0 : Replace the „0‟with‟0‟ and „1‟with‟1‟ and move right. Search for „B‟, and replace „B‟
with „B‟ and moves towards left.
q1: Trailing 0‟s are replace with‟1‟ move towards left. Search for „1‟, from rightmost end and
replace with „0‟ .keep Blank symbol as it is.
Transition Diagram:
Transition table:
0 1 B
Q
q0 (q0, 0, R) (q0, 1, R) (q1, B, L)
q2* - - -
Instantaneous Description:
19] Design Turing machine to perform multiplication of two unary numbers. i.e m*n
I/P = B0m10nB
Solution:
Logic:
Multiplication means repetitive addition. In order to multiply two numbers, for each „0‟ of
first number all 0‟s of second number are copied after the second „#‟ symbol. here # is is a
separator.
Example: 2*2
Initially: B 0 0 # 0 0 # B
B X 0 # 0 0 # 0 0 B
Iteration1
1X2=2
Iteration2 B X X # 0 0 # 0 0 0 0 B
2x2=4
Implementation: LetM= (Q, ∑,┌, δ, q0,B, F)
q0 : Replace the leftmost „0‟ of first number by „X‟ and move right.
q1: Search for „#‟, keep it as it is and move right. While doing this bypass all 0‟s.
q2: Replace the leftmost „0‟ of second number by „X‟ and move right. On q2 state after
moving right if we get „#‟ that means all 0‟s of second number are over. Now, keep „#‟ as it is
and move left to repeat the same cycle for the next „0‟ of first number.
q3: Search for „B‟, replace it by „0‟ and move left. While doing this bypass all 0‟s and „#”.
q4: Search for „X‟, replace it by „0‟ and move right. Go to q2. While doing this bypass all 0‟s
and „#”.
q5: Search for „X‟, replace it by „0‟ and move right. Go to q0. While doing this bypass all 0‟s
and „#”.
q6: On q0 state after moving right if we get „#‟ that means all 0‟s of first number are over.
Now, keep „#‟ as it is go to the final state.
Transition Diagram:
Transition Table:
0 # X B
Q
q0 (q1,X,R) (q6,#,S) - -
q1 (q1,0,R) (q2,#,R) - -
q2 (q3,X,R) (q5,#,L) - -
q6* - - - -
Instantaneous Description:
In order to enhance of power of Turing machine TM has many variations. All these variations
are equivalent to the basic Turing machine with respect to the computing function but, they
may add some sort of extra power to it.
In standard Turing machine the left end is bounded. In case of Two-way infinite tape Turing
machine the input tape is infinite on both left and right side. There exists infinite continuous
sequence of blank symbols on each of the left-hand and right-hand of the sequences of non-
blanks.
It is possible to move left as possible as required. Regardless of this, the new model doesn‟t
add any extra computational capability to the standard Turing machine.
A Multi head Turing machine can be defined as a Turing machine with a single tape and a
single finite state control but with multiple independent R/W heads.The transition function of
this Multi-head Turing machine can be described as follows:
δ: Q x ┌ Tq x ┌T x {L,R}n
This type of Turing machine consists of multiple tapes each having an independent head.
Each head is capable to perform read/ write operations and the movement includes left or
right or no movement. Thus this type of TM is controlled by its own independent R/W head.
There are certain computations like reversing, verification of palindrome string, copying etc.
which can be done more easily with the mutilate Turing machine as compared to standard
Turing machine.
In normal TM, head has to move back and forth to match each pair of symbols a and b.On a
multitape TM ,no such movements are needed.
Consider the Turing machine with two tapes and two independent heads. Let I/P =aabb
A Turing machine is said to be multi-dimensional Turing machine if its tapes can be viewed
as extending infinitely in more than one dimension. This TM does not add s any extra power.
Depending upon the state and the scanned symbol, the device changes states, points new
symbol and move the head in one of the 2k directions.
The standard Turing machine is also referred as Deterministic Turing machine. But, for non-
deterministic Turing machine, it is possible that there are multiple transitions from the current
state for the current input.
Example of NDTM:
A general purpose computer is able to solve all sorts of problems from all domains. There is
no need to have a separate computer for each problem. In order to solve any problem a
program or sequence of steps along with data is stored in computer‟s memory. The control
unit of computer reads one step at a time and executes it. This process is repeated till the final
result is generated.
A similar approach can be applied to Turing machine. We can construct a single Turing
machine which can solve all sorts of problems. This type of Turing machine is called as
Universal Turing Machine (UTM). Thus, Universal Turing Machine is a Turing Machine
which simulates the behavior of digital computer or any Turing Machine for a given input.
Consider that Universal Turing Machine P is designed to simulate any Turing Machine M.
The input of this Universal Turing Machine consists of:
Universal Turing Machine consists of three different tapes to store all its input. As shown in
figure , the Tape 1 stores description of any other Turing machine M , Tape 2 stores input
string of machine M and Tape 3 stores the states of machine M.
Symbol Encoding: Here one assumption is made that the alphabet always consists of
symbols like {a ,b,c,d,……}. These symbols are encoded as shown below
Symbol „a‟ is encoded as „1', symbol „b‟ as „11‟, symbol „c‟ as „111‟ and so on.
State Encoding: Here the assumption is all states are always numbered as q1, q2, q3,q4
…. where q1 is initial state and q2 will be always a final state. The encoding scheme
for states is as shown in below
Move Encoding: The possible moves for the head of Turing machine are left move
and right move. These are encoded as shown in below
Transition Encoding: The entire transition is encoded using the above discussed
scheme is shown in figure
Thus, all transitions of machine M are encoded as a binary string and the multiple transitions
are separated by two 0‟s. For example the two transitions: δ(q1 , a) =( q2 , b, L) and
δ(q2 , b) =( q3 , c, R) are stored in the form of binary sequence as shown in figure
1] Scan the cell on the state area of the tape and read the symbol from the same area that
reads to start called initial state.
2] Move the tape to the program which contains finite automation table ,find the row which is
headed by the symbol scanned in the previous state.
3] Find the required column.
4] Move the tape to the appropriate square, Replace the symbol ,move the tape ,read the next
symbol, Reach the state area and replace the state by the current state and Repeat the above
steps.
2] TM has memory in the form of tape while FA does not have memory.
3] TM can modify its own input while FA cannot modify its input.
4] TM can perform arithmetic operation while FA cannot used for arithmetic operation.
5]TM can handles all languages like Recursive language ,CSL,CFL,RL while FA can
handles only RL.
2] Language generation
May-2014(CBGS)
1 Design TM that recognizes palindrome strings where ∑={0,1} 10
2 Write Short note on variants of TM 05
Dec-2014(CBGS)
1 Design TM to add two binary numbers,and simulate”110+10” 10
2 Design TM as an acceptor for the language L={anbm| m>=0and m>=n} 10
May-2014
1 Design TM for the language L={anbn| n>=1 } 10
Dec-2014
1 Design TM for the language L={0n1n| n>=1 } 10
2 Design TM to find the value of log2n where n is unary number 10
May-13
1 Design TM for the language L={anbn| n>=1 } 10
DEC-13
1 Design TM for the language L={anbn| n>=1 } 10
2 Design Turing machine to compare two unary numbers according to 10
following criteria. If m=n then output is E,If m>n then output is G
If m<n then output is L.
3 Write Short note on Universal Turing Machine 05
May-12
1 Explain different techniques for turing machine 05
2 Design TM for “set of all strings of balanced parenthesis” 10
3 Write Short note on Universal Turing Machine 05
DEC-12
1 What is TM. Give power of TM over FSM .Explain undecidability and 10
incompleteness of TM.
2 Write Short note on Universal Turing Machine 05
May-11
1 Design TM for the language L={anbn| n>=1 } 10
2 Design TM for addition of two unary numbers 10
DEC-11
1 Design TM for the language L={anbn cn| n>=1 } 10
L={X |na(x)=nb(X)}
2 Write Short note on Universal Turing Machine 05
May-10
1 Design Turing machine to replace the substring “111” by “101”from a 10
sequence of 0‟s and 1‟s.
2 Write Short note on Universal Turing Machine 05
DEC-10
1 Design TM for the regular expression 0(0+1)*11 10
2 Write Short note on variants of TM 05