Professional Documents
Culture Documents
Tutorial 1: Decidability
August 3, 2015
Submission Guidelines Problems 1, 2 and 3 have to be submitted in class today. Problem 4 has
to be submitted in the next tutorial class. Submissions should be done in plain paper clearly mentioning
your name and roll number.
1. Given two sequences u = (u1 , u2 , , um ) and v = (v1 , v2 , , vm ) of strings ui , vi ( is the
alphabet), the problem is to find whether there is a finite sequence (i1 , , ip ), with ij 1, m for
j = 1, , p so that, ui1 ui2 uip = vi1 vi2 vip (any number of repetitions of a string is allowed).
For example, an instance of the problem can be represented as
u1
um
, ,
v1
vm
For example, consider the following instance
abab
aaabbb
aab
ba
ab
aa
,
,
,
,
,
ababaaa
bb
baab
baa
ba
a
The solution is 1234556.
abab
ababaaa
aaabbb aab
bb
baab
ba ab ab aa
baa ba ba a
In order to prove this claim we assume t be the shortest string on which the two languages differ
such that |t| = l > n1 n2 . Consider the sequence of states q0 , , ql and r0 , , rl that M1 and M2
enters respectively on input t. As M1 has n1 states and M2 has n2 states, only n1 n2 distinct pairs
hq, ri exist where q is a state in M1 and r is a state in M2 . By the pigeon hole principle, two pairs
of states hqi , ri i and hqj , rj i must be identical because l > n1 n2 . If we remove the portion of t from
i to j 1, we obtain a shorter string on which M1 and M2 differs even though t was supposed to
be the shortest. This is a contradiction and thus our assumption |t| > n1 n2 is false.
3. Let J = {w| either w = 0x for some x AT M , or w = 1y for some y AT M }. Show that neither
J nor J is Turing-recognizable.
Solution We can reduce AT M to J. To determine if w AT M , prepend a 1 to w and check if
1w J. AT M is not Turing recognizable; therefore, J is not Turing recognizable either. Likewise,
we can reduce AT M to J by prepending a 0 to the input string which shows that J is not Turing
recognizable either.
4. Let C = {hG, xi|G is a CFG, x is a substring of some y L(G)}. Show that C is decidable.
Solution Consider the following Turing machine
M = On input hG, xi, where G is a CFG
(a) Let R be the following RE R = x
(b) Create the CFG H such that L(H) = L(G) L(R)
(c) Submit hGi to the decider for ECF G
(d) If it accepts, then reject
(e) Else, accept.
M is clearly a decider since it halts. Also, M accepts hG, xi iff G generates some string in x
i.e., some string with x as a substring.