CS 373 – Fall 2003 – ********** solution ***** **********
November 12, 2003
Homework Assignment 9 - Turing Machines
Due 11/21/03 (Friday)
Problems related to chapter 9
1.
Consider the Turing Machine:
M = ( {q
0
, q
1
, q
2
, q
3
}, {a, b}, {a, b, #, },
δ
, q
0
, , { q
3
} ), where
δ
is given by:
δ
(q
0
, a) = (q
1
, a, L)
δ
(q
0
, b) = (q
0
, b, R)
δ
(q
0
, ) = (q
0
, , R)
δ
(q
0
, #) = (q
0
, #, R)
δ
(q
1
, a) = (q
1
, a, L)
δ
(q
1
, b) = (q
2
, b, R)
δ
(q
1
, ) = (q
1
, , L)
δ
(q
1
, #) = (q
1
, #, R)
//typo fixed
δ
(q
2
, a) = (q
2
, a, R)
δ
(q
2
, b) = (q
2
, b, R)
δ
(q
2
, ) = (q
3
, , L)
δ
(q
2
, #) = (q
2
, #, R)
(a)
Trace the computation of M (until it halts if it halts)
starting with the instantaneous
description:
#a
q
0
bbbbaba
(b)
Give an informal description of what M does when started in state q
0
at
any
position
on
the entire tape
.
Assume the initial tape content is a random sequence of symbols from
Γ
=
{a, b, #, }, and there may be an arbitrary and unbounded number of these symbols on the
tape.
2.
Design a Turing machine which accepts the language:
L = {a
n
b
m
a
n+m
: n
≥
0, m
≥
1}.
Use pseudo code or very clear English to give an overview or
description of the algorithm.
Finally you must give a “low level” delta function
implementation of this TM.
The transition functions must be clearly commented.
Remember
that in addition to writing the code for the path to accepting a string, you must account for all
the ways a string could be rejected.
There should be three reasons for rejection to be
accounted for by your code:
(1) the suffix of “a’s” is too long (too many a’s: larger than
n+m), (2) the suffix of a’s is too short (not enough a’s, less than n+m), (3) the over all format
is wrong: string does not have a distinct prefix of a’s, a mid field of b’s and a suffix of a’s.
3.
Design a turing machine which would accept the language:
L = { ww : w
∈
(a, b)
+
}
Instead of using a low level delta function implementation, you may use a high level outline
of the algorithm for the design.
The outline must be clear enough to allow a person to
unambiguously write the transitions functions for this automaton.