Unit V (TM) - Part2
Unit V (TM) - Part2
Unit V (TM) - Part2
δ: Q × (∑ ∪ {ε}) × τ × τ = Q × τ*x τ*
4. Offline TM B X a Y b B B . .
δ: Q × τ = Q × τ x (L,R) FC
B a a b b B B . .
5. Multi-dimensional TM B B B B B B B . .
B a a b b B B . .
δ: Q × × τ = Q × τ x (L,R,U,D)
B B B B B B B . .
6. Jumping TM : δ: Q × τ = Q × τ x {L,R},{N}
Jump with n cells
7. Non-deterministic Turing Machines
•The T.M. has more than one transition for one symbol from the
current state.
A Non –determnistic TM Tape TM is a seven-tuple:
M = (Q, Σ, Γ, δ, q0, B, F)
Q A finite set of states
Σ A finite input alphabet, which is a subset of Γ– {B}
Γ A finite tape alphabet, which is a strict superset of Σ
B A distinguished blank symbol, which is in Γ
q0 The initial/starting state, q0 is in Q
F A set of final/accepting states, which is a subset of Q
δ A next-move function, which is a mapping (i.e., may
be undefined) from δ : Q x Γ –> 2Q x (Γ x {L,R})
Time 0
a b c Time 1
Choice 1
q1
q2 b b c
a b, L
q2
q1
Choice 2
c b c
a c, R q3
q3 is blank
a b c e f g
FC
Tape 1 Time 1 Tape 2
a b c e f g
q1 Time 2 q1
a g c e d g
q2 q2
(b, f ) ( g , d ), L, R
q1 q2
δ(q1,b,f) = (q2,g,d,L,R)
7
A universal Turing machine is just a Turing machine whose
programming simulates other Turing machines. That is, the input
to the UTM is a description of a Turing machine TM and an input w
for TM, and the UTM simulates TM on that input w.
Operation:
1. The first tape observed carefully to check whether the code for
M is valid or not, If the code is not valid then UTM halts with
out accepting.
2. Initialize the second tape for placing the tape values of M in
encoding form.
3. Third tape store states of machine M. The head of the third
tape will now positioned to state and the head for tape 2 will
positioned at the first simulated cell of second
It's universal in the sense that, for any problem that can be solved
by Turing machines, you could either use a Turing machine that
directly solves that problem, or you could use a UTM and give it
the description of a TM that directly solves the problem.
https://www.youtube.com/watch?v=9Kxumc0ooiw
Linear Bounded Automata
CSG generated CSL and CSL is accepted by LBA
δ : Q x Γ -> 2 Q x Γ x {L,R}
FC
Some Context Sensitive languages are:
L= {anbncn|n>=1}
L= {an|n>=0}
L= {an|n=m2,m>=1}
L= {an|n is prime}
L={ww| wϵ(a,b)+}
RECURSIVE FUNCTION THEORY
Clearly successor function takes one argument and returns the succeeding
number.
It means projection function takes n arguments and returns its ith argument.
e.g. P23(7,6,8)=6 .
•We can define a new function by the combination of two or more functions.
Such defined functions are called composition function.
Solution:
g(f1, f2, f3)=g(f1(x,y), f2(x,y), f3(x,y)) = g(x+y,2x,xy) = 3x+xy+y
Note: g(x,y,z)=x+y+z
Recursive Function:
Let f(a1, a2, a3, ..., an.) be a function and defined on function g(b1, b2, b3, ...,
bm.) then f is total function if every element of f is assigned to some unique
element of function g. i.e.
f(m,n)=m+n for m,n>=0
e.g. y=2x i.e. for each value of x, there will be a unique value of y.
Let f(a1, a2, a3, ..., an.) be a function and defined on function g(b1, b2, a3,
..., bm.) then f is partial function if some element of f is assigned to almost
one element of function g. i.e f(x,y) = x-y | if x>y otherwise 0
A partial function is recursive if
•It is an initial function over N, or
•It is obtained by applying recursion or composition or minimization on
initial function over N.
Primitive Recursive Function
Solution:
A(1,1)= A(0,A(1,0)) by A(m-1,A(m,n-1)
A(1,0)= A(0,1) by A(m,n) = A(m-1,1)
A(0,1) = 2 by A(m,n) = n+1 | m=0
A(1,0)= 2
A(1,1)= A(0,2)
= 2+1 = 3
A(1,2) = A(0,A(1,1))
= A(0,3)
=4
A(2,1)= ?
Example: Show that function f(x,y) is primitive recursive where
•f(x,y)=x+y ii) f(x,y)= xy iii) f(x,y) = xy
•f(x,y)=x+y
Step 1: Put y as 0,
f( x,0)) = x+0 = x
Step 1: Put y as 0,
f( x,0) = x*0 = 0
= Z(0) (Note: Zero function)
Step 3: Take a function h with three parameters as x,y and f(x,y) which
is equivalent to f(x,y)+x
h( x, y, f(x,y)) = f(x,y)+x
= P33(x,y,f(x,y))+P13(x,y,f(x,y))
(Note: 1) Explanation of P33(x,y,f(x,y)) is the projection function of f(x,y)
(i.e. 3rd argument) and 2) Explanation of P13(x,y,f(x,y)) is the projection
function of x (i.e 1st argument)
Since addition is already primitive recursive function.
Hence f(x,y)=xy is primitive recursive function.
Iii ) f(x,y)=xy for practice.
Step 1: Put y as 0,
f( x,0) = x0 = 1
= S(Z(0)) (Note: Successor function)
Step 3: Take a function h with three parameters as x,y and f(x,y) which is
equivalent to f(x,y).x
h( x, y, f(x,y)) = f(x,y)*x
= P33(x,y,f(x,y))*P13(x,y,f(x,y))
(Note: 1) Explanation of P33(x,y,f(x,y)) is the projection function of f(x,y) (i.e.
3rd argument) and 2) Explanation of P13(x,y,f(x,y)) is the projection function
of x (i.e 1st argument)
Since multiplication is already primitive recursive function.
Hence f(x,y)=xy is primitive recursive function.
Programming Techniques for Turing machine Construction
1. Storage in a state:
Finite control can be used not only to represent the position in the program
of TM but to hold a finite amount of data as it shown here.
B B B B B B . .
.
q
A B C
This makes the state to remember and to have a memory for the symbol
scanned in the input.
Ex: Design a TM to accept string 01*+10*
L={ 01,10,011,01111,100,10000,........}
S1: At initial state [q0, B], if it finds 0 or 1 , it stores in its state without replacing
and moves right and enters the state q1.
S2: At state [q1,0], if it finds1 then it skips all 1 and moves right and remains in
the same state.
S3: At state [q1,1], if it finds 0 then it skips all 0 and moves right and remains in
the same state.
S4: At state [q1,0], it finds B, then it reaches the accepting state [q1,B]
S5: At state [q1,1], it finds B, then it reaches the accepting state [q1,B]
q0 q1
B 01 B [q0,B]
01111B 10000
1,1,R
0,0,R
[q0,B] [q1,0]
B,B,R
1,1,R
[q1,B]
B,B,R
[q1,1]
0,0,R
state 0 1 B
[q0,B] ([q1,0],0,R) ([q1,1],1,R) -
[q1,0] - ([q1,0],1,R) ([q1,B],B,R)
[q1,1] ([q1,1],0,R) ([q1,1],B,R)
2. Multiple Track Tape
A specific type of T.M. contains multiple track but just one
tape head reads and writes on all tracks. A single tape head
reads n symbols from n track at one step.
A useful trick to perform more complicated simulations.
One Tape
a b a b track 1
b a c d track 2 is blank
One r/w head One symbol ( a, b)
Finite State
control unit δ(q0,a,b) = (q1,x,y,R)
Here symbol ab replaces with xy and head moves to right
B a b
b a
30
A Multi Track TM is a seven-tuple:
M = (Q, Σ, Γ, δ, q0, B, F)
Q A finite set of states
Σ A finite input alphabet, which is a subset of Γ– {B}
Γ A finite tape alphabet, which is a strict superset of Σ
B A distinguished blank symbol, which is in Γ
q0 The initial/starting state, q0 is in Q
F A set of final/accepting states, which is a subset of Q
δ A next-move function, which is a mapping (i.e., may
be undefined) from
k k
δ : Q x Γ –> Q x Γ x {L,R} K is no of tracks on tape
The power of Multi track TM is equivalent to Single track TM.
To understand the similarity of multi track and single track TM, click the link below
4. Subroutines:
In some problems, some tasks needed to be performed repeatedly
and it can be done by subroutines called a function. And
Subroutine is a set of instructions designed to perform a
frequently used operations within a program. e.g. f(a,b)= a*b
where a and b are unary numbers. 2 * 3=6
B B B B B B B 0 1 1 1 1 1 1
1,1,R 1,1,L
1,1,R 0,0,R 0,0,L
1,B,R 1,Y,R
q0 q1 0,0,R q2 q3 B,1,L q4
0,B,R
0,0,L Y,Y,R
B,B,R X,X,R
q6
q5 Y,1,L
0,0,L
1,B,R 0,B,R qf
1,1,L
3. Checking off symbol:
This trick/method is used by Turing Machine for the language that contains the
repeated string and to compare the length of the two substring.
e.g. L={wcw|wϵ∑*}, L={ww|wϵ∑*}, L={wwr|wϵ∑*}, L={a^nb^n| n>=1} etc.
B X Y X X c X Y X X B