Unit 5edited
Unit 5edited
Unit 5edited
UNIT – V
UNSOLVABLE PROBLRMS AND COMPUTABLE FUNCTIONS
PART - A
1. What are (a) recursively enumerable languages (b) recursive sets?( Apr/ May 13,14)
The languages that is accepted by TM is said to be recursively enumerable (r. e) languages. Enumerable
means that the strings in the language can be enumerated by the TM. The class of r. e languages includes
CFLs.The recursive sets include languages accepted by at least one TM that halts on all inputs.
2. When a recursively enumerable language is said to be recursive? [May/June 16] (or)
Is it true that the language accepted by a non-deterministic Turing machine is different from
recursively enumerable language?
A language L is recursively enumerable if there is a TM that accepts L and recursive if there is a TM that
recognizes L. Thus r.e language is Turing acceptable and recursive language is Turing decidable
languages. No, the language accepted by non-deterministic Turing machine is same as recursively
enumerable language.
3. What is Church’s Hypothesis?
The notion of computable function can be identified with the class of partial recursive functions is known
as Church-hypothesis or Church-Turing thesis. The Turing machine is equivalent in computing power to
the digital computer.
4. When we say a problem is decidable? Give an example of undecidable problem?
A problem whose language is recursive is said to be decidable. Otherwise the problem is said to be
undecidable. Decidable problems have an algorithm that takes as input an instance of the problem and
determines whether the answer to that instance is “yes” or “no”. (eg) of undecidable problems are
(1)Halting problem of the TM.
5. Give examples of decidable problems.
1. Given a DFSM M and string w, does M accept w?
2. Given a DFSM M is L (M)
3. Given two DFSMs M1 and M2 is L (M1) = L (M2)?
4. Given a regular expression _ and a string w, does generate w?
5. Given a NFSM M and string w, does M accept w?
6. Give examples of recursive languages?
i. The language L defined as L= { “M”,”w”: M is a DFSM that accepts w} is recursive.
ii. L defined as {“M1” U “M2”: DFSMs M1 and M2 and L (M1) =L (M2)} is recursive.
7. What are UTMs or Universal Turing machines? [Nov/ Dec 15]
Universal TMs are TMs that can be programmed to solve any problem that can be solved by any Turing
machine. A specific Universal Turing machine U is:
Input to U: The encoding “M “of a Tm M and encoding “w” of a string w.
Behavior: U halts on input “M” “w” if and only if M halts on input w.
8. What are the crucial assumptions for encoding a TM?
There are no transitions from any of the halt states of any given TM .Apart from the halt state, a given
TM is total.
9. What properties of recursive enumerable seta are not decidable?
Emptiness Finiteness
Regularity Context-freedom.
10. Define L .When is a trivial property?
L is defined as the set {<M> | L (M) is in.} is a trivial property if is empty or it consists of
all r.e languages.
11. What is a universal language Lu?
The universal language consists of a set of binary strings in the form of pairs (M,w) where M is TM
encoded in binary and w is the binary input string.Lu = { < M,w> | M accepts w }.
12. What is a Diagonalization language Ld?
The diagonalization language consists of all strings w such that the TM M whose code is w does not
accept when w is given as input.
Page 101
CS6503 THEORY OF COMPUTATION
13. What properties of r.e sets are recursively enumerable?
L ≠Φ
L contains at least 10 members.
W is in L for some fixed w.
L ∩ Lu ≠ Φ
14. What properties of r.e sets are not r.e?
L=Φ
L = Σ *.
L is recursive
L is not recursive.
L is singleton.
L is a regular set.
L - Lu ≠ Φ
15. What are the conditions for L to be r.e?
L is recursively enumerable iff satisfies the following properties:
i. If L is in and L is a subset of L, then L_ is in (containment property)
ii. If L is an infinite language in, then there is a finite subset of L.
iii. The set of finite languages in is enumerable.
16. What is canonical ordering?
Let Σ * be an input set. The canonical order for Σ *as follows. List words in order of size, with words of
the same size in numerical order. That is let _ ={x0, x1…x t-1} and xi is the digit i in base t.
(e.g) If _ ={ a,b } the canonical order is Σ * , a ,b , aa, ab ,……..
17. How can a TM acts as a generating device?
In a multi- tape TM, one tape acts as an output tape, on which a symbol, once written can never be
changed and whose tape head never moves left. On that output tape, M writes strings over some alphabet,
separated by a marker symbol # , G(M) ( where G(M) is the set w in Σ * ,* such that w is finally printed
between a pair of #s on the output device ).
18. What are the different types of grammars/languages?
Unrestricted or Phase structure grammar.(Type 0 grammar).(for TMs)
Context sensitive grammar or context dependent grammar (Type1)(for Linear Bounded
Automata )
Context free grammar (Type 2) (for PDA)
Regular grammar (Type 3) (for Finite Automata).This hierarchy is called as Chomsky
Hierarchy.
19. State the halting problem of TMs.
The halting problem for TMs is: Given any TM M and an input string w, does M halt on w?
This problem is undecidable as there is no algorithm to solve this problem.
20. Define PCP or Post Correspondence Problem.
An instance of PCP consists of two lists, A = w1, w2….wk and B = x1…xk of strings over some alphabet
.This instance of PCP has a solution if there is any sequence of integersi1,i2,..im with m >=1 such that
wi1, wi2,…wim = xi1,xi2 ,…xim The sequence i1 ,i2 ,…im is a solution to this instance of PCP.
21. Define MPCP or Modified PCP.
The MPCP is: Given lists A and B of K strings from _ *, say A = w1, w2 …wk and B= x1,
x2,…..xk does there exists a sequence of integers i1,i2,…ir such that w1wi1wi2…..wir =x1xi1xi2…xir
22. What is Non-deterministic polynomial time?
A language L is in the class NP if there is a Non-deterministic TM M and a polynomial time complexity
T(n) such that L = L (M). But it is true that P C NP
23. What are the concepts used in UTMs? (Nov /Dec 13)
Stored program computers.
Page 102
CS6503 THEORY OF COMPUTATION
Interpretive Implementation of Programming languages.
Computability.
24. Define post’s correspondence problem?
An instance of PCP consists of two lists, A = w1, w2, w3 . . . wk B = x1, x2, x3, . . . . .. . . . .xk of strings over
some Σ. This instance of PCP has a solution if there is any sequence of integers i1, i2 ….im with m≥1. Such
that wi1, w i2, w i3 ………………………..w im = x i1, x i2, x i3 ….x im . The sequence of i 1, i2…i m is a
solution to this instance of PCP.
25. Define modified post’s correspondence problem?
Given lists A and B, of K strings each from Σ*, say A = w1, w2, w3 . . . wk B = x1, x2, x3,. .... .xk Does
there exist a sequence of integers i 1,i 2,……………..i r such that wi1, w i2, w i3…..w im = x i1, x i2, x
i3,………….x ir The sequence of i 1,i 2,……………..i m is a solution to this instance of PCP.
26. Define problem solvable in polynomial Time?
A Turing Machine M is said to be of time complexity T(n) if whenever m given an input w of
length n, m halts after making atmost T(n) moves, regardless of whether or not m accepts.
27. Define the classes P and NP? (Apr/ May 13, 14) (Nov/Dec 15)
P consists of all those languages or problems accepted by some Turing Machine that runs in some
polynomial amount of time, as a function of its input length. NP is the class of languages or problems
that are accepted by Nondeterministic TM‟s with a polynomial bound on the time taken along any
sequence of non – deterministic choices.
28. Define NP – Complete Problem? (Nov /Dec 14)
A language L is NP – complete if the following statements are true.
a. L is in NP
b. For every language L1 in NP there is a polynomial time reduction of L1 to L
29. What are tractable problems?
The problems which are solvable by polynomial time algorithms are called tractable problems.
30. What are the properties of recursive and Recursively Enumerable Language?
1. The complement of a Recursive language is Recursive.
2. The union of two recursive languages are recursive. The union of two RE languages is RE.
3. If a language L and complement L are both RE, then L is recursive.
PART - B
1. Explain about unsolvable and computable functions. [Revised Topic]
Unsolvability
In the theory of computation we often come across such problems that are answered either yes or no. The
class of problems which can be answered as yes is called solvable or decidable, otherwise the class of
problem is said to be unsolvable or undecidable
The language accepted (or) computed by turing machine is recursively enumerable.
Enumerable→number of languages may be listed by turing machine.
Recursively enumerable includes CFL.
Decidable Problem:
If and only if there exists an algorithm to solve the problem in finite time and determine
whether the answer is „yes‟ or „no‟.
Undecidable Problem:
If and only if there exists no algorithm to solve the problem in infinite time and determine
whether the answer is „yes‟ or „no‟.
Recursive Language:
A language is recursive if there exists a TM that accepts every string of the language and
rejects every string that is not in the language.
Page 103
CS6503 THEORY OF COMPUTATION
Page 105
CS6503 THEORY OF COMPUTATION
Page 106
CS6503 THEORY OF COMPUTATION
Now we will compute A (1, 5) where in x=0 and y=4
A (1, 5) = A (0+1, 4+1)
=A (0, A1, 4))
=A (0, (A (0+1), 3+1)))
=A (0, (A (0, A (1, 3)))
=A (0, (A (0, A (0+1, (2+1))))
=A (0, (A (0, A (0, A (1, 2))))
=A (0, (A (0, A (0, (4))))
=A (0, (A (0, 5)))
=A (0, 6)
A (1, 5) =7
Hence A (2, 2) = A (1, 5)
A (2, 2) = 7
2. Explain about a language that is not recursively enumerable [Nov/Dec11, Apr/May 11, 12, 14]
A language L is recursively enumerable if L = L (M) for some TM M. Recursive or decidable
languages that are not only recursively enumerable, but are accepted by a TM.
To prove undecidable, the language consisting of pairs (M, w) such that;
(1) M is a Turing Machine (suitably coded, in binary) with input alphabet {0, 1}.
(2) „w‟ is a string of 0‟s and 1‟s.
(3) M accepts input „w‟.
If this problem with inputs restricted to the binary alphabet is undecidable, then surely the more general
problem, where TM‟s may have any alphabet, is undecidable.
Enumerating the Binary Strings:
To assign integers to all the binary strings so that each string corresponds to one integer and each
integer corresponds to one string.
Codes for Turing Machines:
A binary code for Turing Machines so that each TM with input alphabet {0, 1} may be thought of
as a binary string.
To represent a TM M = (Q, {0, 1}, Γ, , q1, B, F) as a binary string, we must first assign integers
to the states, tape symbols and directions L and R.
We shall assume the states are q1, q2… qk for some „k‟. The start state will always be „q1‟ and
„q2‟ will be the only accepting state. Note that, since we may assume the TM halts whenever it
enters an accepting state, there is never any need for more than one accepting state.
We shall assume the tape symbols are X1, X2… Xm for some „m‟. X1 always be the symbol „0‟,
X2 will be „1‟ and X3 will be B. However, other tape symbols can be assigned to the remaining
integers arbitrarily.
We shall refer to direction L as D1 and direction R as D2.
Once we have established an integer to represent each state, symbol and direction, we can encode
the transition function „δ‟. Suppose one transition rule is δ (qi, Xj) = (qk, Xl, Dm), for some integers i, j, k,
l and m. We shall code this rule by the string 0i1oj1ok1ol1om.
The Diagonalization Language (Ld):
The undecidable problem can be proved by the method of diagonalization. Construct a list of
words over (0, 1)* in canonical order, where „wi‟ is the ith word and Mj is TM. This can be represented as
a table.
Construct a language Ld using the diagonal entries. The value‟0‟ means, wi is not in L (Mj) and „1‟ means
wi is in L (Mj). To construct Ld, we complement the diagonal. For instance, the complemented diagonal
would begin 1, 0, 0, 0 … The trick of complementing the diagonal to construct the characteristic vector of
a language that cannot be the language that appears in any row, is called diagonalization.
Page 107
CS6503 THEORY OF COMPUTATION
Page 108
CS6503 THEORY OF COMPUTATION
(1) The accepting states of M are made non accepting states of M with no transitions, ie., in these
states M will halt without accepting.
(2) M has a new accepting state „r‟; there are no transitions from „r‟.
(3) For each combination of a non accepting state of M and a tape symbol of M such that M has no
transition (ie., M halts without accepting), add a transition to the accepting state „r‟.
Theroem: If L and L are recursively enumerable then L is recursive.
Proof: Let M1 be the L and M2 be the L . Construct M to simulate M1 and M2 simultaneously, since
„w‟ is either in L or L .
M accepts „w‟ if M1 accepts it and M rejects „w‟ if M2 accepts it. Thus M will always say either
“Accept” or “reject”. Since M is accepts L. Thus L is recursive.
Page 109
CS6503 THEORY OF COMPUTATION
L
Construct an algorithm for Lu which accepts (Mi, wi) if wi is in L(Mi). Thus we have an d .
This is contradiction. Hence Lu is not recursive.
4. Explain about undecidable problems about Turing Machines
Turing Machines that accept the Empty language:
In this, we are using two languages, called Le and Lne. Each consists of binary strings. If „w‟ is a
binary string, then it represents some TM, Mi.
If L(Mi) = ф, that is, Mi does not accept any input, then „w‟ is in L e. Thus, Le is the language
consisting of all those encoded TM‟s whose language is empty. On the other hand, if L (Mi) is not the
empty language, then „w‟ is in Lne. Thus, Lne is the language of all codes for Turing Machines that accept
at least one input string. Define the two languages are,
Le = {M | L(M) = ф}
Lne = {M | L(M) ≠ ф}
Theorem: Lne is recursively enumerable.
Proof: In this, a TM that accepts Lne. It is easiest to describe a non deterministic TM M.
Page 110
CS6503 THEORY OF COMPUTATION
If M does not accept „w‟, then M‟ accepts none of its input‟s, ie., L (M‟) = ф. However, if M
accepts w, then M‟ accepts every input, and thus L (M‟) surely is not ф. M‟ is designed to do the
following;
(1) M‟ ignores its own input „x‟. Rather it replaces its input by the string that represents TM M and
input string „w‟. Since M‟ is designed for a specific pair (M, w) which has some length n, we
may construct M‟ to have a sequence of states q0,q1,……,qn, where q0 is the start state.
a. In state qi, for i=0, 1… n-1, M‟ writes the (i+1), bit of the code for (M, w) goes to state
qi+1, and moves right.
b. In state qn, M‟ moves right, if necessary replacing any nonblanks by blanks.
(2) When M‟ reaches a blank in state qn, it uses a similar collection of states to reposition its head at
the left end of the tape.
(3) Now, using additional states, M‟ simulates a universal TM U on its present tape.
(4) If U accepts, then M‟ accepts. If U never accepts, then M‟ never accepts either.
Rice’s Theorem and Properties of the RE Languages:
All nontrivial properties of the RE languages are undecidable, that is, it is impossible to recognize
by a TM. The property of the RE languages is simply a set of RE languages. The property of being
empty is the set {ф) consisting of only the empty language.
A property is trivial if it is either empty, or is all RE languages. Otherwise, it is nontrivial.
Theorem: (Rice’s Theorem)
Every nontrivial property of the RE languages is undecidable.
Proof: Let P be a nontrivial property of the RE languages. Assume to begin that ф, the empty language,
is not in P. Since, P is nontrivial, there must be some nonempty language L that is in P. Let M L be a TM
accepting L.We shall reduce Lu to Lp, thus proving that Lp is undecidable, since Lu is undecidable. The
algorithm to perform the reduction takes as input a pair (M, w) and produces a TM M‟. The design of M‟
is given by the following fig.
Page 111
CS6503 THEORY OF COMPUTATION
L(M‟) is ф if M does not accept „w‟, and L(M‟) = L if M accepts „w‟. L (M‟) = L if M accepts w. The
TM M‟ is constructed to do the following;
(1) Simulate M on input „w‟. Note that „w‟ is not the input to M‟; rather M‟ writes M and „w‟ onto
one of its tapes and simulates the universal TM U on that pair.
(2) If M does not accept „w‟, then M‟ does nothing else. M‟ never accepts its own input, x, so L
(M‟) =ф. Since we assume ф is not in property P that means the code for M‟ is not in LP.
(3) If M accepts w, then M‟ begins simulating ML on its own input „x‟. Thus M‟ will accept exactly
the language L. Since L is in P, the code for M‟ is in LP.
We observe that constructing M‟ from M and „w‟ can be carried out by an algorithm. Since this
algorithm turns (M, w) into an M‟ that is in LP if and only if (M, w) is in Lu, this algorithm is a reduction
of Lu to Lp and proves that the property P is undecidable.
5. Explain about Tractable and Intractable problem [Apr /May 2015, Nov/ Dec 2014]
The class of solvable problems is known as decidable problems. That means decidable problems can be
solved I measurable amount of time or space. The tractable problems are the class of problems that can be
solved within reasonable time and space. The intractable problems are the class of problems that can be
solved within polynomial time. This has lead to two classes of solving problems P and NP class problems
(Tractable and Possibly Intractable problem)
THE CLASSES P AND NP
The classes P and NP of problems solvable in polynomial time by deterministic and
nondeterministic TM’s and the technique of polynomial time reduction. Also define the notion of “NP-
Completeness”.
Problems Solvable in Polynomial Time:
A TM M is said to be of time complexity T (n). If whenever M is given an input „w‟ of length
„n‟, M halts after making atmost T(n) moves, regardless of whether or not M accepts. Then the language
L is in class P if there is some polynomial T (n) such that L = L (M) for some deterministic TM M of time
complexity T (n).
An Example: Kruskal’s Algorithm:
Kruskal‟s algorithm focuses on finding a Minimum-Weight Spanning Tree (MWST) for a graph.
Spanning Tree: A spanning tree is a subset of the edges such that all nodes are connected through these
edges, yet there are no cycles.
MWST: A Minimum-Weight Spanning Tree has the least possible total edge weight of all spanning trees.
There is a well-known “Greedy Algorithm”, called Kruskal‟s algorithm, for finding a MWST.
Procedure:
(1) Identify the minimal edge connected component.
(2) Find the minimal edge if both the vertices belong to different connected component then add the
edge.
(3) Identify minimal edge, if that edge connects both the vertices in the same component then leave
the edge. (Otherwise it will form a cycle).
(4) Repeat the process until all the vertices are found.
Page 112
CS6503 THEORY OF COMPUTATION
Ex: Find the MWST using Kruskal‟s algorithm.
Soln: First consider the edge (1, 3) because it has the lowest weight 10.
(1) The next minimal edge is (2, 3), with weight 12. Since 2 and 3 are in different components, we
accept this edge and add the node 2 into first connected component. ie;
(2) The third edge is (1, 2) with weight 15. However, 1 and 2 are now in the same component, so we
reject this edge and proceed to the fourth edge (3. 4). ie;
(3) Now, we have three edges for the spanning tree of a 4-node graph and so may stop.
When we translate the above ideas to TM‟s, we face several issues:
When we deal with TM‟s, we may only think of problems as languages, and the only
output is Yes or No (ie. Accept or Reject). For instance, the MWST problem could be
couched as: “Given this graph G and limit weight „W‟ or less?
While we might think informally of the “size” of a graph as the number of its nodes or
edges, the input to a TM is a string over a finite alphabet. Thus, problem elements such
as nodes and edges must be encoded suitably.
Nondeterministic Polynomial Time:
A fundamental class of problems can be solved by a nondeterministic TM that runs in polynomial
time. A language L is in the class NP (Nondeterministic Polynomial) if there is a nondeterministic TM M
and a polynomial time complexity T(n) such that L = L(M), and when M is given an input of length „n‟,
there are no sequences of more than T(n) moves of M.
Page 113
CS6503 THEORY OF COMPUTATION
An NP Example: The Traveling Salesman Problem:
The input to Traveling Salesman Problem TSP) is the same as to MWST, a graph with integer
weights on the edges and a weight limit W. A Hamilton Circuit is a set of edges that connect the nodes
into a single cycle, with each node appearing exactly once. Note that the number of edges on a Hamilton
Circuit must equal the number of nodes in the graph.
Ex: Find Travelling Salesman Problem for the graph,
Soln: Hamilton Circuit: The cycle (1, 2, 4, 3, 1). The total weight of this cycle is 15+20+18+10 = 63.
Thus if „w‟ is 63 or more, the answer is “yes”, and if w<63 the answer is “no”.
Polynomial Time Reductions:
Page 114
CS6503 THEORY OF COMPUTATION
reducible to P2. Since L could be any language in NP, we have shown that all of NP polynomial – time
reduces to P2; that is, P2 is NP-Complete.
6. Explain about Post’s Correspondence Problem [Nov/ Dec 2014, Apr/ May 2015][May/June 16]
In this section, we will discuss the undecidability of strings and not of Turing Machines. The
undecidability of strings is determined with the help of Post‟s Correspondence Problem (PCP). Our
goal is to prove this problem about strings to be undecidable, and then use its undecidability to prove
other problems undecidable by reducing PCP to those.
Definition of Post’s Correspondence Problem:
An instance of Post‟s Correspondence Problem (PCP) consists of two lists of strings over some
alphabet Σ; the two lists must be of equal length. We generally refer to the A and B lists, and write
A = w1, w2 … wk and B = x1, x2… xk, for some integer „k‟. For each „i‟, the pair (wi, xi) is said to be a
corresponding pair. We say this instance of PCP has a solution, if there is a sequence of one or more
integers i1,i2…..im that, when interpreted as indexes for strings in the A and B lists, yield the same string.
That is, wi1, wi2…wim = xi1, xi2,………xim. We say the sequence i1,i2… im is a solution to this instance of
PCP.
Ex.1: Consider the correspondence system as given bellows,
Soln:
In this case, PCP has a solution. We find, wi1, wi2…wim = xi1, xi2,………xim
Let m = 6, ie) i1 = 1, i2 = 2, i3 = 1, i4 = 3, i5 = 3, i6 = 4
(1) (2) (1) (3) (3) (4)
List A: 1 0 1 010 010 11
List B: 10 10 10 01 01 1
ie) wi1, wi2,……..wim = xi1, xi2,………xim
10101001011 = 10101001011
Page 115
CS6503 THEORY OF COMPUTATION
The solution list is {1, 2, 1, 3, 3, 4}
Ex.3: Consider the correspondence system as given bellows,
Page 116
CS6503 THEORY OF COMPUTATION
Reducing MPCP to PCP:
An instance of MPCP with alphabet Σ, we construct an instance of PCP C=y0,y1,……yk+1, and
D=z0,z1,……..zk+1 as follows;
(1) First, we introduce a new symbol „*‟ that, in the PCP instance, goes between every symbol in the
strings of the MPCP instance. For i=1, 2…k, let yi be wi with a „*‟ after each symbol of wi, and
let zi be xi with a „*‟ before each symbol of xi.
(2) y0 = *y1, and z0 = z1. That is, the oth pair looks like pair1, expect that there is an extra „*‟ at the
beginning of the string from the first list.
(3) A final pair ($, *$) is added to the PCP instance, yk+1 = $ and zk+1 = *$
Ex: An instance of MPCP is defined as,
Soln:
Page 117
CS6503 THEORY OF COMPUTATION
Completion of the Proof of PCP Undecidability:
To complete the chain of reductions by reducing Lu to MPCP. That is, given a pair (M, w), we
construct an instance (A, B) of MPCP such that TM M accepts input „w‟ if and only if (A, B) has a
solution. The essential idea is that MPCP instance (A, B) simulates, in its partial solutions, the
computation of M on input „w‟. Let M = (Q, Σ, Γ, δ, q0, B, F) be a TM and let w in Σ* be an input string.
We construct an instance of MPCP as follows;
(1) The first pair is:
List A List B
# #q0w#
This pair, which must start any solution according to the rules of MPCP, begins the simulation of M
on input „w‟.Tape symbols and the separator # can be appended to both lists. The pairs,
List A List B
X X
# # for each X in Γ.
(2) To simulate a move of M, we have certain pairs that reflect those moves. For all „q‟ in Q-F, p in
Q, and X, Y and Z in Γ we have;
List A List B
qX Yp if δ(q, X) = (p, Y, R)
zqX pZY if δ(q, X) = (p, Y, L); „Z‟ is an tape symbol
q# yp# if δ(q, B) = (p, Y, R)
zq# pZY# if δ(q, B) = (p, Y, L); „Z‟ is an tape symbol
(3) If the ID at the end of the B string has an accepting state, then we need to allow the partial
solution to become a complete solution. Thus, if „q‟ is an accepting state, then for all tape
symbols „X‟ and „Y‟ there are pairs;
List A List B
XqX q
XqY q
YqX q
YqY q
Xq q
Yq q
qX q
qY q
(4) Finally, once the accepting state has consumed all tape symbols, it stands alone as the last ID on
the string. That is the remainder of the two strings is q#. We use the final pair;
List A List B
q## #
Ex: Consider the TM M and w=01, where M=({q1, q2, q3}, {0,1}, {0,1,B}, δ, q1, B,
{q3}) and δ is given by,
qi δ(qi, 0) δ(qi, 1) δ(qi, B)
→q1 (q2, 1, R) (q2, 0, L) (q2, 1, L)
q2 (q3, 0, L) (q1, 0, R) (q2, 0, R)
*q3 - - -
Reduce the above problem to PCP and find whether that PCP has a solution or not?
Page 118
CS6503 THEORY OF COMPUTATION
Soln:
Rule List A List B Source
(1) # #q101#
0 0
(2) 1 1
# #
q10 1q2 From δ(q1, 0) = (q2, 1, R)
0q11 q200 From δ(q1, 1) = (q2, 0, L)
1q11 q210 From δ(q1, 1) = (q2, 0, L)
0q1# q201# From δ(q1, B) = (q2, 1, L)
(3) 1q1# q211# From δ(q1, B) = (q2, 1, L)
0q20 q300 From δ(q2, 0) = (q3, 0, L)
1q20 q310 From δ(q2, 0) = (q3, 0, L)
q21 0q1 From δ(q2, 1) = (q1, 0, R)
q2# 0q2# From δ(q2, B) = (q2, 0, R)
0q30 q3
0q31 q3
1q30 q3
1q31 q3
(4)
0q3 q3
1q3 q3
q30 q3
q31 q3
(5) q3## #
Now find the sequence of partial solutions that mimics this computation of M and eventually leads to a
solution.
(1) A: #
B: #q101#
(2) A: #q101#
B: #q101#1q21#
(3) A: #q101#1q21#
B: #q101#1q21#10q1#
(4) A: #q101#1q21#10q1#
B: #q101#1q21#10q1#1q201#
(5) A: #q101#1q21#10q1#1q201#
B: #q101#1q21#10q1#1q201#q3101#
(6) A: #q101#1q21#10q1#1q201#q3101#
B: #q101#1q21#10q1#1q201#q3101#q301#
(7) A: #q101#1q21#10q1#1q201#q3101#q301#
B: #q101#1q21#10q1#1q201#q3101#q301#q31#
(8) A: #q101#1q21#10q1#1q201#q3101#q301#q31#
B: #q101#1q21#10q1#1q201#q3101#q301#q31#q3#
With only q3 left in the ID, we can use the pair (q3##, #) from rule (5) to finish the solution.
A: #q101#1q21#10q1#1q201#q3101#q301#q31#q3##
B: #q101#1q21#10q1#1q201#q3101#q301#q31#q3##
The PCP has a solution. Because it produces same string on list A and list B.
Page 119
CS6503 THEORY OF COMPUTATION
Theorem: Post’s Correspondence Problem is undecidable.
Proof: The construction of this section shows how to reduce Lu to MPCP. Thus, we complete
the proof of undecidability of PCP by proving that the construction is correct, that is;
M accepts „w‟ if and only if the constructed MPCP instance has a solution. If „w‟ is in L(M), then we can
start with the pair(M, w) from rule1 to rule5, allow the A string to catch up to the B string and form a
solution.
In particular, as long as M does not enter an accepting state, the partial solution is not a solution
the B string is longer than the A string. Thus, if there is a solution, M must at some point enter an
accepting state. That is M accepts w.
7. Show that the recursive languages and / or the RE languages are closed under
the following operations. [Nov / Dec 2014]
a) Union.
b) Intersection.
c) Complement
a) The union of two r.e. sets is r.e. and the union of two recursive sets is recursive.
Suppose M1 and M2 are machines accepting the r.e. languages L1 and L2. Then define a new
machine M which runs M1and M2 and accepts if either of the Mi accepts. Then clearly M
accepts exactly those strings from L1 U L2. Moreover, in the case of recursive Li, we may force
M to halt if both of the Mi has halted. This does not change acceptance so we still have L (M) =
L1 U L2 but now our machine is guaranteed to halt.
b) The intersection of two r.e. sets is r.e. and the intersection of two recursive sets
is recursive.
Suppose M1 and M2 are machines accepting (resp. deciding) the r.e. (resp. recursive) languages
L1 and L2. Then defined a new machine M which runs M1 and M2 and accepts if both of the Mi
accepts. Then clearly M accepts exactly those strings from L1∩L2. Moreover, in the case of
recursive Li, we may force M to halt if both of the Mi has halted. This does not change
acceptance so we still have L (M) = L1∩L2 but now our machine is guaranteed to halt.
Page 120
CS6503 THEORY OF COMPUTATION
c) L if L and complement of L are recursively enumerable
If language L and its complement L‟ both are recursively enumerable then L and L‟ are
recursive. To prove this consider that there are two languages L and L‟ such that L‟ such that L‟
is complement of L. Let, M and M‟ are two machines which simulate M. Then w is a string
which belongs to either L or L‟. Then on putting w to M if M1 accepts it then M accepts it. If M1
rejects w then clearly M2 accepts it, then M rejects it. Thus either M1 or M2 accepts w and
according machine M halts by accepting or rejecting w. Hence such a L is said to be recursive
Page 121