GMN Atc Module 4
GMN Atc Module 4
State [ q0, B] : In the initial state, M is in q0and TM has seen only B in its data portion.
o In state [q0, B] on seeing the first symbol as 0, of the input sting w, M moves right, enters into
state[q1,0]
o In state [q0, B] on seeing the first symbol as 1, of the input sting w, M moves right, enters into
state [q2,1]
In [q1, 0] ,M moves R/W head right without changing state for input symbol 1.
o In state [q1, 0] if it sees next symbol as B, M enters [qf, B], an accepting state.
In [q2, 1] ,M moves R/W head right without changing state for input symbol 0.
o In state [q2, 1] if it sees next symbol asB, M enters [qf, B], an accepting state.
In a multiple track TM, a single tape is assumed to be divided into several tracks. Now the tape alphabet
is required to consist of k-tuples of tape symbols, k being the number of tracks. Hence the only
difference between the standard TM and the TM with multiple tracks is the set of tape symbols.
In the case of the standard Turing machine, tape symbols are elements of Γ; in the case of TM with
multiple track, it is Γk. The moves are defined in a similar way.
Example:
Here, input symbols are tape symbols defined in 3 tracks. ie:Γ3;for example input is [c, a, b]
δ ( q, c, a, b) = (qnext, Z, X, Y, R)
4. Subroutines
Subroutines are used in computer languages, when some task has to be done repeatedly. We can
implement this facility for TMs as well.
TM subroutine is a set of states that perform some pre-defined task. The TM subroutine has a start state
and a state without any moves. This state which has no moves serves as the return state and passes the
control to the state which calls the subroutine.
First ,TM program for the subroutine is written.
This TM program will have an initial state and a 'return state.
After reaching the return state, there is a temporary halt.
For using a subroutine, new states are introduced.
When there is a need for calling the subroutine, moves are effected to enter the initial state for the
subroutine (when the return state of the subroutine is reached) and to return to the main program of
TM.
For example multiply 2 and 4: Initially tape consists of these two unary numbers, as follows:
B B B B B B B B B B B B B 0 0 0 0 0 0 0 0 B B
Here we have to copy n number of 0’s from the second group to the last group by replacing n number of
B’s by n number of 0’s
In start state q0replace leftmost 0 by B, change state to q1and move the r/w head towards right till we get
1.
δ (q0, 0) = ( q1, B, R)
Now we should copy n 0’s from the second group to last group.
δ (q1, 0) = ( q1, 0,R)
δ (q1, 1) = ( q2, 1,R)
Now the R/w is pointing to the first 0 of second group. (COPY subroutine in start state q2 ) In q2replace 0
by X and change the state to q3,move r/w head towards right till we get B.
δ (q2, 0) = ( q3, X,R)
δ (q3, 0) = ( q3, 0,R)
δ (q3, 1) = ( q3, 1,R)
In q3 when it reads B, replace B by 0 and change state to q4 and move left.( at this point one symbol is
copied from second group to last group)
δ (q3, B) = ( q4, 0, L)
In q4 we should search for rightmost X.
While moving left in q4, replace 0 by 0 , 1 by 1 till we get X.
δ (q4, 0) = ( q4, 0,L)
δ (q4, 1) = ( q4, 1,L)
When it reads X, change state to q2 , replace X by X and move right.
δ (q4, X) = ( q2, X, R)
When n number of B’s in last group are, replaced by n number of 0’s in second group. In state q2
machine reads 1 then change state to q5 and move left.
δ (q2, 1) = ( q5, 1, L)
In state q5 while moving left, replace all X’s in second group by 0’s, till we get 1.
δ (q5, X) = ( q5, 0, L)
When machine reads 1 in q5 replace 1 by 1 and move right, change state to q6
δ (q5, 1) = ( q6, 1, R)
In state q6 machine reads 0,(pointing to the first symbol of 2nd group) move left and change state to q7.
δ (q6, 0) = ( q7, 1, L)
In q7 machine reads 1; the delimiter of 1st and 2nd group. Change state to q8 and move left, so that
machine enters the 1st group.
δ (q7, 1) = ( q8, 1, L)
In q8 when it reads 0 change state to q9 and move left.
δ (q8, 0) = ( q9, 0, L)
In q9 on any number 0s move the r/w towards left.
δ (q9, 0) = ( q9, 0, L)
In q9 if we encounter B, change the state to q0 and move right.
δ (q9, B) = ( q0, B, R)
But, in state q8, instead of 0’s if machine encounters B’s it means that n0’s have been copied from the
second group to last group m number of times.
Now replace the delimiter1 which precede and follow the second group and second group 0’s by B’s.
δ (q8, B) = ( q10, B,R)
δ (q10,1) = ( q11, B,R)
δ (q11,0) = ( q11, B,R)
δ (q11,1) = ( q12, B,R)
B B B B B B B B B B B B B 0 0 0 0 0 0 0 0 B B
Multi-Tape TM:
A Turing machine M with more than one tape is said to be Multi-Tape TM.
The following figure represents a multi-tape TM.
A multi-tape TM has a finite set Q of states, an initial state q0, a subset F of Q, called the set of final
states, a set P of tape symbols, a new symbol B, not in P called the blank symbol.
There are k tapes, each divided into cells. The first tape holds the input string w.
Initially all the other tapes hold the blank symbol.(B)
Initially the head of the first tape (input tape) is at the left end of the input w.
All the other heads can be placed at any cell initially.
δ is a partial transition function from Q x Гk into Q x Гk x {L, R, S}k. where k is the number of tapes.
Multi-tape TM is more powerful than single tape TM , but the language accepted by Multi- tape TM is
recursively enumerable language. That means language accepted by Multi- tape TM is also accepted
by basic or standard TM. Thus, Multi-tape TM and standard TM are equivalent.
A move depends on the current state and k tape symbols under k tape heads. In a typical move,
The Multi-tape TM M enters a new state.
On each tape, a new symbol is written in the cell under the head.
Each tape head moves to the left or right or remains stationary. The heads move independently:
some move to the left, some to the right and the remaining heads do not move.
The initial ID has the initial state q0, the input string w in the first tape (input tape), empty strings of
B's in the remaining k – 1 tapes.
An accepting ID has a final state, some strings in each of the k tapes.
Example: δ(q, a, b, c) = (p, X, Y, Z, L, R, R)
Theorem-1:
Every language accepted by a multi-tape TM is acceptable by some single-tape TM (that is, the
standard TM).
OR
Show that language accepted by Multi-tape TM is recursively enumerable language.
Proof:
Suppose, a language L is accepted by a k-tape (Multi tape) TM M.
We simulate M with a single- tape TM M1with 2k tracks.
Let us consider the implementation description by considering k = 2 .We will prove this theorem by
simulating the working of 2-tape TM (M) with the working of single tape 4-track TM (M1).
Assume that the second, fourth, ..., (2k) th tracks hold the contents of the k-tapes. The first, third, ...
,(2k - 1)th tracks hold the R/W head marker (a symbol say X) to indicate the position of the respective
tape head.
Let’s consider a Multi-tape TM, M with 2-tapes (i.e, k=2) as shown below:
Initially, the contents of tapes 1 and 2 of M are stored in the second and fourth tracks of M1.The R/w
head markers (X) of the first and third tracks are at the cells containing the first symbol.
To simulate the above move of Multi-tape TM M in a single tape TM M1, the single tape TM M1 has
to visit the two R/w head markers and store the scanned symbols in its finite control. Also, the finite
control of single tape TM M1 has the information about the states of multi-tape TM M and its moves.
The initial snapshot of simulating M using M1 is shown below
Now M1 revisits each of the head markers to perform the following operations:
It changes the tape symbol in the corresponding track of single tape TM M1 based on the
information regarding the move of 2-tape TM M corresponding to the state (of M) and the tape
symbol in the corresponding tape M.
It moves the head markers to the left or right.
M1 changes the state of M in its control
The snapshot of simulating M using M1 for a single move is shown below
At the end of this, M1 is ready to implement its next move based on the revised positions of its head
markers and the changed state available in its control.
Single tape TM M1 accepts a string w only when it reaches a state that is recorded as a final state of M
in its control at the end of the processing of w.
Hence the proof.
Non-Deterministic TM:
A non-deterministic Turing machine is a type of TM in which the set of rules denote more than one
specific action for a particular input at specific state.
A Non-deterministic TM can be formally defined as M: which is a 7-tuple, namely (Q, ∑ ,Г, δ, q0. B, F)
where
Q is a finite nonempty set of states.
Г is a finite nonempty set of tape symbols,
B is the blank symbol.
∑ is a non empty subset of Г , called the set of input symbols and B≠∑
δ is the transition function mapping (q, x) onto (q’, y, D) where D denotes the direction of movement
of R/W head, D = L or R
It is a partial function Q X Г into the power set of Q X Г X {L, R}
q0ϵ Q is the initial state
F is the subset of Q, is the set of final states.
If qϵQ and xϵГ and δ(q,x)={(q1,y1,D1), (q2,y2,D2),…….., (qn,yn,Dn)} then the NTM can chose any one
of the actions defined by (qi,yi,Di), for i=1,2,….,n
Example:
When δ(q,x)={ (qi,yi,Di) | i=1,2,….,n} then NTM chooses any one of the n triples totally.
The non-deterministic TM in fact is no more powerful than the deterministic TM. Any language
accepted by non-deterministic TM can be accepted by deterministic TM.
Theorem – 2
If M is a nondeterministic TM, there is a deterministic TM M 1 such that T(M)=T(M1).
Proof:
We construct M1 as a multi-tape TM.
Each symbol in the input string leads to a change in ID.
M1 should be able to reach all IDs and stop when an ID containing a final state is reached.
So, the first tape is used to store IDs of M as a sequence and also the state of M. These IDs are
separated by the symbol * (included as a tape symbol).
The current ID is known by marking an x along with the ID-separator * (The symbol * marked with x
There are two tapes: one is called the input tape, and the other, working tape.
On the input tape, the head never prints and never moves to the left.
On the working tape, the head can modify the contents in any way, without any restriction.
The set of strings accepted by nondeterministic LBA is the set of strings generated by the context-
sensitive grammars, excluding the null strings.
i.e, if L is a context sensitive language, then L is accepted by a linear bounded automaton and vice
versa.
*********************************************************************************