You are on page 1of 3

Automata and Formal Languages

Fall 2009 Homework 8, due Wednesday, Dec 2nd at beginning of class

Problem 1 (3 pt) Write a simple program for a nondeterministic Turing Machine which
will accept the language
L = {xwwR y : x, y, w ∈ {a, b}+ , |x| ≥ |y|}
a b X Y 
q0 (q0 , a, R),(q1 , a, R) (q0 , b, R),(q1 , b, R)
q1 (q2 , X, R) (q3 , Y, R)
q2 (q2 , a, R),(q4 , X, L) (q2 , b, R)
q3 (q3 , a, R) (q3 , b, R),(q5 , X, L)
q4 (q5 , A, L) (q7 , , L)
q5 (q5 , , L) (q6 , , R)
q6 (q6 , , R) (q1 , , R)
q7 (q7 , 1, L) (q8 , , R)
Describe in words how you could solve this problem deterministically. Writing the program
for the deterministic case is tedious.
You could solve the problem deterministically by going to the end of the string and marking
a Y. Then looking for two adjacent characters that are the same. After finding this checking
if there are more spaces to the left or the right.
Problem 2 (3 pt) Find a linear bounded automaton for L = {an : n = m2 , m ≥ 1}
a X Y 
q0 (q1 , X, R)
q1 (q2 , a, L) (qf , , L)
q2 (q2 , X, L) (q2 , Y, L) (q3 , , R)
q3 (q4 , , R) (q5 , , R)
q4 (q6 , Y, L) (q4 , X, R) (q4 , Y, R)
q6 (q6 , X, L) (q6 , Y, L) (q7 , , R)
q7 (q4 , , R) (q8 , Y, R)
q8 (q9 , Y, R) (q8 , Y, R)
q9 (q1 , Y, R)
q5 (q10 , X, L) (q5 , X, R) (q5 , Y, R)
q10 (q10 , X, L) (q10 , Y, L) (q11 , , R)
q11 (q12 , X, R) (q5 , , R)
q12 (q13 , X, R) (q12 , X, R)
q13 (q1 , X, R)
Problem 3 (3 pt) Show that if a language is not recursively enumerable then its com-
plement can not be recursive.
Because L is not recursively enumerable, no turing machine will be able to determine in a
string is in L. Lc can therefore not be recursive, because no turing machine would be able to
decide if a string is not in Lc , because that is the same as determining if a string is in L.
Problem 4 (3 pt) Is the family of recursively enumerable languages closed under in-
Yes. Consider two recursively enumerable languages L1 , L2 and the turing machines that
accept them T1 , T2 . In order to accept L1 ∩ L2 , a turing machine need only be created from
T1 , T2 , such that it will first test the string to see if T1 will accept it then see if T2 will accept
it. This is still a turing machine, so clearly the recursively enumerable languages are closed
under intersection.
Problem 5 (3 pt) Construct a Turing Machine for L(01(01)∗ ). Then use the general
construction for finding the corresponding unrestricted grammar. I have a marvelous answer
to this question but I ran out of time. Conversely I did have time to write:

S →01S|01

Problem 6 (3 pt) Show that for every unrestricted grammar there exists an equivalent
unrestricted grammar, with all productions either of the form


where u, v ∈ (V ∪ Σ)+ with |u| ≤ 2 and |v| ≤ 2, or of the form


with A ∈ V .
Given any production with 3 or more variables, the production can be broken up into smaller
parts, ie:

ABCD →xyzvB
E →xy
K →z
L →vB

Clearly, also variables can be used exclusively for λ.

Problem 7 (2 pt) Let G be an unrestricted grammar. Does there exist an algorithm
to decide whether or not L(G)R is recursively enumerable?
Yes. Because it’s simply a matter of reversing the operations of the turing machine on the
reversed string.

Total points: 20