Professional Documents
Culture Documents
Introduction
In 1936, A.M. Turing proposed the Turing machine as a model of any possible
computation. This model is computer like rather than program like, even though electronic or
electrochemical computers were in the future. A model of computation has the same power that
is they compute the same functions or recognize the same languages. The un-provable
assumption that any general way to compute will allow us to compute only the partial recursive
functions (equivalently Turing machines or modern day computers compute) is known as Church
Turing hypothesis. Turing hypothesis believed that a function is said to be computable if and
only if it can be computed by a Turing machine
It is used to define languages and compute integer functions.
It accepts recursive languages or recursively enumerable languages.
Turing machine differs from finite automata and pushdown automata.
The advantage of Turing machine over programs as representation of what can be
computed is that the Turing machine is sufficiently simple that we can represent its configuration
precisely, using a simple notation much like instantaneous descriptions (IDs) of PDA.
Turing machine has infinite memory and there is no restriction in accessing the inputs
and also the tape head can move either left or right. The PDA has infinite memory and access in
LIFO order and the finite automata has finite memory.
Input tape
All other tape cells extending infinitely to the left and right of the input tape contains the
special symbol called Blank symbol. The tape head is positioned at one of the tape cells for
scanning the input symbol from the input tape and initially the tape head points at the left most
cell of the input tape.
The single move of a Turing machine depends on the current state of finite control and
the tape symbol present in the input tape. These are the following changes happen in one move
of a Turing machine.
1. Changes the state after consuming an input symbol and it may remain in the same
state or transfer to a new state.
2. Tape symbol has to be replaced for the scanned input tape symbol.
3. Decide the moves of tape head either to the left or right of the input tape.
4. Whether to halt the Turing machine or not.
The two-way infinite tape Turing machine is same as that of basic Turing machine but
the only difference exists in Blank symbols. The tuples of two way infinite Turing machine are,
M= (Q, , , , q0, or B, F)
Where,
Q- Finite non-empty set of states
- non-empty finite set of input alphabets
- Set of all tape symbols
- Transition function
q0- Starting state
- Blank symbol which is placed on both ends of the tape and the input string has to
be placed in between the blank symbols.
F- Set of final or accepting states
4.2.1 Transition function of Turing Machine
The transition function of Turing machine is of the form,
(p, X) = (q, Y, D)
Where,
p- Current state
X- Tape symbol
q- Next state in Q
Y- Symbol in written in the cell being scanned
D- Direction of move (Left or Right)
Give transition functions for the following transition diagram of the Turing machine.
1/Y
0/Y X/X /
p 1 / X q 0/X
r
X/Y
p q
/ /
Halting of Turing Machine Y Y
Another notation of acceptance commonly used for Turing machine is Acceptance by
halting. If the Turing machine recognizes the languages L then the Turing machine halts.
Turing machine never halts, if the input string is not accepted.
Turing machine halts whenever it reaches an accepting state.
Turing machine halts whether they accept the string or not accept the string if
the language is said to be a recursive language.
If the Turing machine is designed in such a way that it should only halt after
reaching the final state if not then the Turing machine goes into an infinite
loop and the Turing machine does not halt.
Construct Turing Machine for a language consisting of strings having any
number of 0s and only even number of 1s over the input set ={0, 1}.
1. Construct Turing Machine for a language consisting of strings having any number of 0s and
only even number of 1s over the input set ={0, 1}.
SOLUTION
Let us assume the input as 1001 which has even number of 1s and any number of 0s.
1001 Read 1 and move to right
1001 Read 0 and move to right
1001 Read 0 and move to right
1001 HALT
States 0 1
q1 (q1, 0, R) (q1, 1, R) -
HALT - - -
(1, 1, R)
(0, 0, R) (0, 0, R)
(1, 1, R)
q0 q1 HALT
(, , L)
2. Design a Turing Machine for checking the palindrome of the string of even length.
SOLUTION
The logic is that we will read first symbol from left and then we compare it with the first
symbol from right to check whether it is the same. Again we compare second symbol from left
with the second symbol from right. We repeat this process for all the symbols.
If we found any symbol not matching, we cannot lead the machine to HALT state. The
simulation of machine for a valid input such as
States a b *
q2 (q3, , L) - - -
q5 - (q6, , L) - -
q6 (q6, a, L) (q6, b, L) (q0, *, R) -
HALT - - - -
(b, b, R) (b, b, L)
(a, a, R) (a, a, L)
(a, *, R) (, , L) (a, , L)
q0 q1 q2 q3
(b, *, R)
(*, *, R) (, , L)
(, , L)
q4 q5 q6 HALT
(b, , L)
(a, a, R) (a, a, L)
(b, b, R) (b, b, L)
(*, *, R)
SOLUTION
aabb Read a and convert it to A and move right in search of b
Aabb skip it, moves ahead
Aabb Read b and convert it to B and move left till A
AaBb move right
AaBb convert a to A and move right in search of b
AABb move right
AABb convert it to B and move left till A
AABB now immediately before B is A that means all the as are marked by A.
AABB move right till to ensure that no b is present.
AABB HALT
States A A b B
q0 (q1, A, R) - - (q3, B, R) -
q3 - - - (q3, B, R) (HALT, , L)
HALT - - - - -
(B, B, R) (B, B, L)
(a, a, R) (a, a, L) (B, B, R)
(a, A, R) (b, B, L)
q0 q1 q2 q3
(A, A, R)
(, , L)
(B, B, R)
HALT