The University of Nottingham
School of Computer Science and IT
Dr. Natalio Krasnogor
2
The
formal model of the Turing machine
is: TM = ( Q ,
Σ
,
Γ
,
δ
, q
0
, F ) with:
Q is the set of states
Σ
is the set of input symbols
Γ
is the set of tape symbols including
Σ
and #.
δ
is the transition (partial) function
δ
= Q x
Γ
→
Q x
Γ
x { L , R }
q
0
is the initial state
F is the set of final states
Turing machines can also be represented graphically using a
state diagram
which
is a labelled directed graph.
Examples of Turing Machines
Simple Eraser
. This Turing machine reads strings in the language given by the
expression (0,1)* and replaces the right-most symbol by a blanc (#).
TM = ({q
0
,q
1
,q
2
,q
3
},{0,1},{0,1,#},
δ
,q
0
,{p}) where
δ
is given by:
Σ
Q
0
1
#
q
0
( q
1
, 0 , R ) ( q
1
, 1 , R )
∅
q
1
( q
1
, 0 , R ) ( q
1
, 1 , R ) ( q
2
, # , L )
q
2
( q
3
, # , L ) ( q
3
, # , L )
∅
q
3
( q
3
, 0 , L ) ( q
3
, 1 , L ) ( p , # , L )
Then, the above Turing machine processes the input string “1110” as follows:
#q
0
1110#
→
#1q
1
110#
→
#11q
1
10#
→
#111q
1
0#
→
#1110q
1
#
→
#111q
2
0#
→
#11q
3
1##
→
#1q
3
11##
→
#q
3
111##
→
q
3
#111##
→
p##111##
q0
q1
q3
p
q2
1,1,R
0,0,R
0,0,R
1,1,R
#,#,L
0,#,L
1,#,L
0,0,L
1,1,L
#,#,L