Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Unit 5edited

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

CS3452 THEORY OF COMPUTATION

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

Recursively Enumerable Language:


A language is recursively enumerable if there exists a TM that accepts every string of the
language, and does not accept strings that are not in the language. The strings that are not in the
language may be rejected and it may cause the TM to go to an infinite loop.

Computable functions of TM:


This TM can be viewed as a Computer of functions from integers to integers.
.Eg: String=0¹ for i > 0
Can be stored in the input tape of turing machine as,
0^i1 1 0^ i2 1 0^ i3 1 ……1 0^ ik
It is a function of k integer arguments,
f(i1,i2,i3,……ik)
If the turing machine halts for any 0^m then, the String 0^m is Accepted
Then the function with k arguments is defined as,
f(i1,i2,i3,……ik)=m
It is not in need to define k number of arguments since it accepts only m number of 0‟s. In the
function f(i1,i2,i3,……ik) if all the k arguments are defined then it is said to be Total Recursive
Function. The arguments which are computed by the TM is said to be Partial Recursive Function
Primitive Recursive Functions [Nov/Dec 15]
Recursive functions are class of functions those are turing computable. The theory of recursive functions
is just converse to church‟s hypothesis. Recursive function theory begins with some very elementary
functions that are intuitively effective. Then it provides a few methods for building more complicated
functions form simpler functions. That means the computability of given function can be proved using the
initial function and some building operations which are few in number
Initial Function: The initial function is the elementary functions whose values are independent of their
smaller argument. The following functions comprise the class of recursive functions
The Zero function Z(x) =0
The Successor function: S(x) = Successor of x (roughly,”x+1”)
The identity function: id(x) = x
The Zero function returns zero regardless of its argument. The successor function returns the successor of
its argument. Since successor ship is a more primitive notion
The Zero and Successor function take only one argument each. But the identity function is designed to
take any number of arguments. When it takes one argument, it returns its argument as its value. When it
takes more than one argument it returns one of them (ie) id(x, y) = x
id(x, y) = y
Building operations: Build more complex functions from the initial set by using only three methods that
are (i) Composition (ii) Primitive recursion (iii) Minimization
Composition: We will start with the successor function S(x) = x+1 we may replace the argument, x with
a function, if we replace the argument; x with the zero function Z(x). Then the result is the successor of
zero S (Z(x)) = 1
S(S (Z(x))) = 2 and so on
Primitive Recursion: The second building operation is called primitive recursion. It is a method of
defining new function from old function. The function h is defined through functions f and g by primitive
recursion when
Page 104
CS6503 THEORY OF COMPUTATION
h(x, 0) = f(x)
h (x, S(y)) = g(x, h(x, y))
f and g – computable functions
h‟s second argument is zero, the 1st equ applies. When it is not zero, we use the second.
To solve the function by primitive recursion
1) When the second argument of h is zero, the function is equivalent to some known function f and we
compute it
2) Otherwise, it is equivalent to some known function g and we compute it
Thus the function obtained will be computable in nature. For example, we can calculate the factorial
function using recursion as,
Initially 1! =1 and to calculate n!, if we multiply n by (n-1) then it will generate a non recursion series.
Instead of that we will multiply n by (n-1)! We can express the calculation of factorial function by
following two equations 1! =1
n! =n*(n-1)
A strict definition of the factorial function (f(n) then consists of these two equations:
f (n) = 1 when n=1 ---------------------------(1)
f (n) = n*(f(n-1)) when n>1-----------------(2)
Consider n =5 then using equation (2) we will get
f (5)= 5*f(4)
f (4)= 4*f(3)
f (3)= 3*f(2)
f (2)= 5*f(1)
By putting the value of equ (1) for calculating f (2), we will get f (2) = 2*f (1)
Then f (3) = 3*f (2) = 3*2=6
Then f (4) = 4*f (3) =4*6=24
Then f (5) = 5*f (4) =5*24 = 120
Primitive recursion is like mathematical calculation. The first equ defines the basis, and second defines
the induction step
Minimization: If g(x) is a function that compute the least x such that f(x) =0, then we know that g is
computable. And then we can say that g is produced from f by minimization. But we can build g by
minimization only if f(x) is already known to be computable
For Example: Suppose we want to obtain least x which makes f(x) =0 then we will try the natural
numbers 0, 1, 2…. Until we reach the first value that gives f(x) =0. Now if such search for x never gets
terminated, then it is called unbounded minimization. And if we obtain such x within some tests then it is
called bounded minimization. While unbounded minimization has the disadvantages of a partial function
which may never terminate, bounded minimization has the disadvantages of sometimes failing to
minimize

Partial Recursive function


The function is called partial recursive function if it can be obtained by applying composition, primitive
recursion and minimization as building operations

General Recursive function


The function is called general recursive if it is obtained by applying composition primitive recursive and
an unbounded minimization that happen to terminate. The general recursion function is a larger class than
partial recursive functions

Page 105
CS6503 THEORY OF COMPUTATION

Primitive Recursive function


If it is obtained by applying composition primitive recursion and unbounded minimization that does not
terminate. The set of general recursive function is the same as the set of turing computable function. The
example of general recursive function is an Ackermann‟s functions. The Ackermann‟s function can be
defined as follows
A (0.y) =y+1
A(x+1, 0) = A(x, 1)
A(x+1, y+1) = A(x, A(x+1, y)) Then we can calculate A(x,y) for every pair of (x,y)
Ex: Compute A (1, 1) A (1, 2) A (2, 1) A (2, 2) using Ackermann‟s function
Soln: Let A (0, y) = y+1------------------------------ (1)
A(x+1, 0) = A(x, 1) ------------------------ (2)
A(x+1, y+1) = A(x, A(x+1, y)) ----------- (3)
Be the Ackermann‟s Function, to compute A (1, 1) put x=0, y=0 then
A (1, 1) = A (0+1, 0+1) ------------------------ using (3)
=A (0, A (0+1, 0))
=A (0, A (0, 1)) --------------------------------using (2)
= A (A (0, 1)) ----------------------------------using (1)
=A (0, 2) ---------------------------------------using (1)
Hence A(1,1) = 3
To compute A (1, 2) put x=0 and y=1
A (1, 2) = A (0+1, 1+1) ------------------------------using (3)

=A (0, A (1, 1))


= (A0, 3) --------------------------------------using (1)
=4
To compute A (2, 1) put x=1 and y=0
A (2, 1) = A (1+1, 0+1)
=A (1, A (2, 0))
=A (1, A (2, 0))
=A (1, A (1, 1))
=A (1, 3)
=A (0+1, 2+1)
=A (0, A (1, 2)) = A (0, 4) = 5
To compute A (2, 2) put x=1 and y=1
A (2, 2) = A (1+1, 1+1)
=A (1, A (2, 1))
=A (1, 5)

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

Proof that Ld is not Recursively Enumerable: [Nov/Dec 15]


Theorem:
Ld is not a recursively enumerable language. That is, there is no Turning Machine that accepts Ld.
Proof: Suppose Ld were L (M) for some TM M. Since Ld is a language over alphabet {0, 1}, M would
be in the list of TM‟s we have constructed, since it includes all TM‟s with input alphabet {0, 1}. Thus,
there is at least one code for M, say „i‟, that is, M=Mi.
 If wi is in Ld, then Mi accepts wi. But then, by definition of Ld, wi is not in Ld, because Ld
contains only those wi such that Mj does not accept wj.
 Similarly, if wi is not in Ld, then Mi does not accept wi. Thus, by definition of Ld, wi is in Ld.
Since wi can neither be in Ld nor fail to be in Ld, we conclude that there is a contradiction of our
assumption that M exists. That is, Ld is not a recursively enumerable language.
Ex: Obtain the code for (M, 1011) where M = ({q1, q2, q3}, {0, 1}, {0,1,B}, δ, q1, B, {q2}), δ is,
δ (q1, 1) = (q3, 0, R) δ(q3, 1) = (q2, 0, R)
δ (q3, 0) = (q1, 1, R) δ(q3, B) = (q3, 1, L)
Soln: 1 – represented as two zero‟s
0 – represented as one zero
L – represented as one zero
R – represented as two zero‟s
B – represented as three zero‟s
(M, 1011) = 0 | 00 | 000 | 0 | 00 || 000 | 0 | 0 | 00 | 00 || 000 | 00 | 00 | 0 | 00 || 000 | 000 | 000 | 00 | 0
3. Explain about undecidable problem that is RE [Apr/May 09, 11]
Recursive Language:
A language L recursive if L=L (M) for some TM M such that;
1. If „w‟ is in L, then accepts.
2. If „w‟ is not in L, then M eventually halts, although it never enters an accepting state.
If we think of the language L as a “problem” as will be the case frequently, then problem L is
called decidable if it is a recursive language, and it is called undecidable if it is not a recursive language.
Complements of Recursive and RE languages:
Theorem: If L is a recursive language, so is L .
Proof: Let L = L(M) for some TM M that always halts. We construct a TM M such that L = L( M ) by
the construction.

That is, M behaves just like M. However, M is modified as follows to create M ;

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.

The important consequences of the properties that we have seen are,


If L and L are complementary then only one of the following should be true.
(1) Both L and L are recursive.
(2) Neither L nor L is recursively enumerable.
(3) One of the L is recursively enumerable and other is not recursively enumerable.
The Universal Language: [Apr /May 12, 14, Nov/ Dec 11, 14][May/June 16]
We define Lu, the universal language, to be the set of binary strings that encode in the pair (M,
w), where M is a TM with the binary input alphabet, and „w‟ is a string in (0, 1)*, such that „w‟ is in L
(M). That is, Lu is the set of strings representing a TM and an input accepted by that TM. We shall show
that there is a TM U, often called the universal Turing Machine such that Lu = L (U).
 It is easiest to describe U as a multitape TM.
 In the case of U, the transitions of M are stored initially on the first tape, doing with the string
„w‟.
 A second tape will be used to hold the simulated tape of M, using the same format as for the code
of M.
 That is, tape symbol Xi of M will be represented by 0i, and tape symbols will be separated by
single 1‟s.
 The third tape of U holds the state of M, with state qi represented by „i‟, 0‟s.
The operation of U can be summarized as follows;
(1) Examine the input to make sure that the code for M is a legitimate code for some TM. If not, U
halts without accepting. Since invalid codes are assumed to represent the TM with no moves, and
such a TM accepts to inputs.
(2) Initialize the second tape to contain the input „w‟, in its encoded form. That is, for each „0‟ of
„w‟, place 10 on the second tape, and for each „1‟ of „w‟, place 100 there. Note that the blanks on
the simulated tape of M, which are represented by 1000.
(3) Place „0‟, the start state of M, on the third tape, and move the head of U‟s second tape to the first
simulated cell.
(4) To simulate a move of M.
(5) If M has no transition that matches the simulated state and tape symbol, then no transition will be
found. Thus, M halts in the simulated configuration.
(6) If M enters its accepting state, then U is accepts.

Page 109
CS6503 THEORY OF COMPUTATION

Undecidability of the Universal Language: [Nov/ Dec 2014]


Theorem: Universal Language Lu is not recursive.

Proof: We know that


Ld is not recursive, by reducing Ld to L .
u

 Assume that Lu is recursive. Then


Ld must be recursive too.

 Since we know that


Ld is not recursive we can conclude that L is not recursive.
u


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

The operation of M is as follows;


(1) M takes as input a TM code Mi.
(2) Using its nondeterministic capability, M guesses an input „w‟, that Mi might accept.
(3) M test whether Mi accepts „w‟. For this part, M can simulate the Universal TM U that accepts Lu.
(4) If Mi accepts „w‟, then M accepts its own input, which is Mi.
If Mi accepts even one string M will guess that string and accept Mi. However, if L(Mi) = ф, then
no guess „w‟ leads to acceptance by Mi, so M does not accept Mi. Thus, L(M) = Lne.
Theorem: Lne is not recursive.
Proof: In this, we must design an algorithm that converts an input that is a binary coded pair (M, w) into
a TM M‟ such that L (M‟) ≠ ф if and only if M accepts input „w‟. The construction of M‟ is shown in
following fig.

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:

In this, to prove the statement “if P2 is in P, then so is P1”.


 For the proof, suppose that we can decide membership in P2 of a string of length „n‟ in time
O(nk). Then we can decide membership in P1 of a string of length „m‟ in time O (mj + (cmj) k)
time; the term mj accounts for the time to do the translation, and the term (cmj)k accounts for the
time to decide the resulting instance of P2.
 Simplifying the expression, we see that P1 can be solved in time O (mj + (cmj) k). Since c, j and k
are all constants, this time is polynomial in „m‟, and we conclude P1 is in P.
 A reduction from P1 to P2 is polynomial time if it takes time that is some polynomial in the length
of the P1 instance. Note that as a consequence, the P2 instance will be of a length that is
polynomial in the length of the P1 instance.
NP – Complete Problems:
Let L be a language (problem) in NP, we say L is NP-Complete if the following statements are
true about L;
(1) L is in NP.
(2) For every language L‟ in NP there is a polynomial – time reduction of L‟ to L.
An example of NP- Complete problem is the Travelling Salesman Problem. Since it appears that P≠NP,
all the NP-Complete problems are in NP – P, we generally view a proof of NP – Completeness for a
problem as a proof that the problem is not in P.
Theorem: If P1 is NP-Complete, and there is a Polynomial – time reduction of P1 to P2, then P2 is NP –
Complete.
Proof: To show that every language L in NP Polynomial – time reduces to P2. We know that there is a
polynomial time reduction of L to P1, this reduction takes some polynomial time P (n). Thus, a string „w‟
in L of length „n‟ is converted to a string „x‟ in P1 of length atmost P (n). Also know that there is a
polynomial time reduction of P1 to P2; Let this reduction take polynomial time q (m). Then this reduction
transforms „x‟ to some string „y‟ in P2, taking time atmost q (p (n)). Thus, the transformation of „w‟ to „y‟
takes time atmost p (n) +q (p (n)), which is a polynomial. We conclude that L is polynomial time

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,

Does this PCP have a solution?


Soln: In this case, PCP has a solution. We find, wi1, wi2…wim = xi1, xi2,………xim
Let m = 4, ie) i1 = 2, i2 = 1, i3 = 1, i4 = 3
(2) (1) (1) (3)
List A: 10111 1 1 10
List B: 10 111 111 0
ie) wi1, wi2,……..wim = xi1, xi2,………xim
101111110 = 101111110
 The solution list is {2, 1, 1, 3}
Ex.2: Consider the correspondence system as given bellows,

Does this PCP have a solution?

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,

Does this PCP have a solution?


Soln: In this case, PCP has no solution. Suppose that the PCP instance has a solution, then we say, wi1,
wi2...wim = xi1, xi2,………xim. But in this case, it would not have the equal string [ wi ≠ xi]. So we find
the partial solution. ie) If i1 = 1, i2 = 3, then the two corresponding strings from lists A and B would have
to begin.
List A: 10101 …...
List B: 101011…..
ie) wi1, wi2,……..wim = xi1, xi2,………xim
10101 ≠ 101011
 The two strings can never become equal.
The Modified PCP (MPCP):
 It is easier to reduce Lu to PCP, if we first introduce an intermediate version of PCP, which we
call the Modified Post‟s Correspondence Problem or MPCP.
 In the Modified PCP, there is the additional requirement on a solution that the first pair on the A
and B lists must be the first pair in the solution.
 An instance of MPCP is two lists A = w1, w2 … wk and B = x1, x2… xk, and a solution is a list of
„0‟ or more integers i1,i2…..im such that, w1wi1wi2…wim = x1xi1xi2,………xim.
 Notice that the pair (w1, x1) is forced to be at the beginning of the two strings, even though the
index „1‟ is not mentioned at the front of the list that is the solution.
 Unlike PCP, where the solution has to have at least one integer on the solution list, in MPCP the
empty list could be a solution, if w1 = x1.
Ex: Consider the correspondence system as given bellows,

Does this MPCP have a solution?


Soln:
In this case, MPCP has no solution. In proof, observe that any partial solution has to begin with index 1,
so the two strings of a solution would begin;
List A: 1 …...
List B: 111…..
Thus, the next index would have to be „1‟ yielding;
List A: 11 …...
List B: 111111 …..
ie) wi1, wi2…wim = xi1, xi2,………xim
11 ≠ 111111
 The solution list is {1, 1}
 The B string remains three times as long as the A string, and the two strings can never become equal.

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,

Construct an instance of PCP?

Soln:

Theorem: MPCP reduces to PCP.


Proof: First, suppose that i1,i2…..im is a solution to the given MPCP instance with lists A and B. Then
we know w1wi1wi2…wim = x1xi1xi2,………xim. If we were to replace the w‟s by y‟s and the x‟s by z‟s, we
would have two strings that were almost the same, y1,yi1, yi2,……yim, and z1,zi1, zi2,……..zim.
The difference is that the first string would be missing a „*‟ at the beginning, and the second
would be missing a „*‟ at the end. That is,
*y1,yi1, yi2,……yim = z1,zi1, zi2,……..zim*
However, y0 = *y1 and z0 = z1, so we can fix the initial „*‟ by replacing the first index by „0‟.
*y0,yi1, yi2,……yim = z0,zi1, zi2,……..zim*
We can take care of the final „*‟ by appending the index k+1. Since yk+1 = $, and zk+1 = *$, we
have:
y0,yi1, yi2,…… yim, yk+1 = z0,zi1, zi2,…….. zim, zk+1
We show that 0,i1,i2, ….. im,k+1 is a solution to the instance of PCP. We claim that i 1,i2…..im is a
solution to the MPCP instance. The reason is that if we remove the *‟s and the final $ from the strings,
y0yi1 yi2,…… yimyk+1 = z0zi1 zi2,…….. zim zk+1
we get w1wi1wi2,……..wim = x1xi1xi2,………xim.

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

You might also like