Universal Turing Machine
Universal Turing Machine
Universal Turing Machine
A Turing machine can, simulate a computer that had been loaded with an arbitrary
program . I.e. A – TM can be used as a “stored program computer ” taking its program as well as
data from one or more tapes on which it is placed .
Modern computer are completely flexible in which the task it performs is to execute the
instructions stored in its memory , and can represent an algorithm for computation . Turing
describes a “Universal Computing Machine ” that can be defined as:
Definition : A Universal Turing machine Tu is a TM whose input consist of program and a
data set for the program to process. The program takes the from of a string specifying some other
(special – purpose) TM T1 and the data set is second string w interpreted as input to T1. Tu then
simulates the processing of w by T1.
Encoding of TM:
For the representation of any arbitrary TM T1, and an input string w over an arbitrary alphabet
as strings e(T1) , e(w) over some fixed alphabet , a notational system should be formulated .
Encoding the TM T1 and input string w in to e (T1) and e (w) , it must not destroy any
information , for the encoding of TM , we use the alphabet {0,1} although the TM may have a
much larger alphabet .
For encoding , we start by assigning positive integers to each state , each tape symbol and
each of three directions S,L and R in the TM we want to encode. We assume two fixed infinite
sets Q = { q1,q2,…………} and S = { a1, a2, ………} so that for any TM
T1 = (Q1 , Σ, Γ, δ , q 0 , B, F ) , we have Q1 ⊆ Q and Γ ⊆ S .
Hence once we have a subscript attached to every possible state and tape symbols, we can
represent a state or a symbol by a string of 0’s of the appropriate length. 1’s are used as
separators.
The Encoding Function e
First, associate to each tape symbol, to each state and to each of the three directions , a string of
0’s. Let
s(B) = 0
s(ai) = 0i+1 for each ai ∈ S
i+2
s(qi) = 0 for each qi ∈ S
s(S) = 0
s(L) = 00
s(R) = 000
Then each move of TM , described by formula
δ ( q, a ) = ( p, b, D ) is encoded as
e(m) =s(q)1s(a)1s(p)1s(b)1s(D)1
and for any TM T, with initial state q, T is encoded as:
e(T ) = s (q )1e(m1 )1e(m2 )1...................1e(mk )1
1 -HGC
Automata Theory Universal Turing Machine
Where m1 , m2 ,.........mk are the distinct moves of T arranged in some arbitrary order.
Finally, any string w = w1 w2 w3 ............wk , for each wk ∈ S is encoded as:
e( w) = 1s ( w1 )1s ( w2 )1...................1s ( wk )1
♦ -The 1 at beginning of e(w) included so that a composite string of the form e(T)e(w),
there is no doubt for the stoppage of e(T) since separated by three 1’s. Since no valid
code for TM contains three 1’s in a row, we can be sure that the first occurrence of 111
separates the code for TM T1and input w.
♦ Also encoding of s(a) of a symbol a ∈ S is different from the encoding e(a) of the one
character string a.
♦ There may be any possible codes for a TM T1. The codes for the TM for n transitions
may be listed in any of n! orders.
Encoding :
s(q1 ) = 000
s(q 2 ) = 0000
s (q3 ) = 00000
s(a1 ) = 00 considering a1 = a and a2 = b
s(a 2 ) = 000
s( B) = 0
s(S ) = 0
s ( L) = 00
s ( R ) = 000
Now e(m1 ) = s (q1 )1s (b)1s (q3 )1s (a)1s ( R)1 = 000100010000010010001
2 -HGC
Automata Theory Universal Turing Machine
e(m4 ) = s (q3 )1s ( B)1s (q3 )1s (b)1s ( L)1 = 000001010000010001001
=0001000100010000010010001100000100100010001000110000010001000010010001100
00010100000100010011
for this machine the input (T,w) where w= ab , the code will be,
Finite Control
M w
Tape of M 001000010010001………………….
State of M 000…..
Scratch
A Sketch of Universal TM
3 -HGC
Automata Theory Universal Turing Machine
4 -HGC