0% found this document useful (0 votes)
714 views56 pages

Unit 5 Toc

This document discusses the theory of computation and undecidability. It covers: 1) Three types of problems - decidable/solvable, undecidable, and semi-decidable/partially solvable. The halting problem is given as an example of an undecidable problem. 2) Properties of recursive and recursively enumerable languages. 3) The halting problem - determining if a Turing machine will halt on a given input. It is proven to be undecidable through a reduction technique involving constructing a Turing machine that contradicts itself. 4) Other undecidable problems concerning context-free languages involve determining language equivalence, ambiguity, and operations like complement
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
714 views56 pages

Unit 5 Toc

This document discusses the theory of computation and undecidability. It covers: 1) Three types of problems - decidable/solvable, undecidable, and semi-decidable/partially solvable. The halting problem is given as an example of an undecidable problem. 2) Properties of recursive and recursively enumerable languages. 3) The halting problem - determining if a Turing machine will halt on a given input. It is proven to be undecidable through a reduction technique involving constructing a Turing machine that contradicts itself. 4) Other undecidable problems concerning context-free languages involve determining language equivalence, ambiguity, and operations like complement
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 56

II CSE CS3452- Theory of Computation

UNIT V - UNDECIDABILITY
Unsolvable Problems and Computable Functions -PCP-MPCP- Recursive and recursively
enumerable languages - Properties - Universal Turing machine -Tractable and Intractable
problems - P and NP completeness - Kruskal's algorithm - Travelling Salesman Problem- 3-
CNF SAT problems.

5.1 PARTIAL SOLVABILITY


Problem types
There are basically three types of problems namely
• Decidable / solvable / recursive
• Undecidable / unsolvable
• Semi decidable / partial solvable / recursively enumerable
i. Solvable Problem
A problem is said to be solvable if there exists an algorithm that can solve it in a finite amount of time, i.e.,
for any input of the problem, the algorithm can produce the correct output in a finite number of steps. For
example, the problem of finding the sum of two integers is solvable, since there exists a simple algorithm
that can add two integers in a finite number of steps.
ii. Unsolvable Problem
A problem is said to be unsolvable if there does not exist any algorithm that can solve it in a finite amount of
time.
One well-known example of an unsolvable problem is the Halting problem, which asks whether a given
program will eventually halt or run forever.
It has been proven that there is no algorithm that can solve the Halting problem for all possible inputs.
Decidable Problem
A problem is said to be decidable if there exists an algorithm that can determine whether an instance of the
problem is a "yes" instance or a "no" instance in a finite amount of time.
In other words, the algorithm will always halt and return the correct answer, either "yes" or "no". A
problem, P is said to be decidable if there exists a Turing machine, TM that decides P.
Thus, P is said to be recursive.
Consider a Turing machine, M that halts with either “yes” or “no” after computing the input.
YES ( if W C L)

NO( if W g L)

The machine finally terminates after processing.


For example, the problem of determining whether a given number is prime is decidable, since there exists an
algorithm that can determine the primality of a number in a finite amount of time.
iv. Undecidable Problem
A problem is said to be undecidable if there is no algorithm that can determine whether an instance of the
problem is a "yes" instance or a "no" instance in a finite amount of time.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 1
II CSE CS3452- Theory of Computation
The classic example of an undecidable problem is the Halting problem, which asks whether a given
program will eventually halt or run forever.
It has been proven that there is no algorithm that can solve the Halting problem for all possible inputs.
v. Semi decidable / partial solvable / recursively enumerable
• A problem, P is said to be semi decidable, if P is recursively enumerable.
• A problem is RE if M terminates with “YES” if it accepts w C L; and doesn't halt if w $ L.
• Then the problem is said to be partial solvable / Turing acceptable.
YES ( if W E L)

Loop Forever( if W e L)

5.2 UNSOLVABLE PROBLEMS


• If a language is recursive then it is called decidable language and if the language is not recursive then such a
language is called undecidable language.
• The class of decidable problems are also called as solvable problems and the class of undecidable
problems is called unsolvable problems.
5.2.1 Decidability Problems Concerning Regular Languages
• The decidability problems concerning regular languages can be understood with the help of following
theorems.
Theorem 1: Prove that following decision problems are recursive
i. Two DFA's are equivalent or not ii. NFA accepts a word or not
Proof: (i)
• To prove that the given decision problem is recursive. We require a Turing Machine T(M) which
simulates the DFA.
• Let Ml and M2 are two DFAs. Consider the Turing machines T(M1) and T(M2). Obtain set of strings
accepted by T(MI) and rejected by T(M2). That is
So - T(Mi) n T(M2)
• Similarly obtain the set of strings which T(M2) accepts and T(M1) rejects. That is
S2 - T(M2) n T(MI)
• If these two sets are empty then it shows that L(M1) and L(M2) are equivalent and can be simulated by
Turing Machine for the set of languages as
L(M) = L(MI) n L(M2) U L(M2) n
L(M1). The L(GM) =
• This shows that two DFA's are equivalent or not is a recursive problem.
Proof: (ii)
• Let M be the NFA and input word w which decides if M accepts w. Convert this NFA to DFA. Then run the
algorithm for DFA on Turing machine T(M). The Turing Machine T(M) accepts w if and only if M reaches
a final state on w otherwise rejects. This shows that NFA accepts a word or not is recursive.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 2
II CSE CS3452- Theory of Computation
Theorem 2: Prove that following decision problem is recursive: DFA accepts a word or not.
Proof:
• Let M be the DFA and input word w which decides if M accepts w. Simulate an algorithm for DFA to run
on Turing machine T(M). The Turing Machine T(M) accepts w if and only if M reaches a final state on w
otherwise rejects. This shows that DFA accepts a word or not is recursive.
5.2.2 Decidability Problems Concerning Context Free Languages:
The undecidable problems about CFG are
i. Whether or not two different context free languages define the same language?
ii. Whether given CFL is ambiguous or not?
iii. Whether complement of given CFL is context free language?
iv. Whether the intersection of two context free languages is context free?
There is no algorithm to answer these questions. Hence these problems are known as undecidable problems.
5.3 UNSOLVABLE PROBLEM ABOUT TURING MACHINE
• The undecidable problem about Turing machine is given by halting problem. Let us understand this
5.3.1 Halting Problem:
Q1. Explain the Halting problem. Is it decidable or undecidable Problem? [Nov/DEC
2011, Nov/Dec 2012] (or) State and prove the halting problem. [Nov/Dec 2022, May/June
2016]
• The halting problem is the problem of finding if the program/machine halts or loop forever.
• The halting problem is un-decidable over Turing machines.
Description
• Consider the Turing machine, M and a given string w, the problem is to determine whether M halts by
either accepting or rejecting w, or run forever.
Example
while (1)

prinf(“Halting problem”);

• The above code goes to an infinite loop since the argument of while loop is true forever.
• Thus, if doesn't halts.
• Hence Turing problem is the example for undecidability.
• This concept of solving the halting problem being proved as undecidable was done by Alan Turing in
1936.
• The undecidability can be proved by reduction technique.
Representation of the halting set
The halting set is represented as,
1, if M halts on input w
h(M, w) = f(x) = 0, otherwise
where,
G Turing machine
M
wk Input string

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 3
II CSE CS3452- Theory of Computation
Theorem: Halting problem of Turing machine is unsolvable / undecidable.
Proof: The theorem is proved by the method of proof by contradiction. Let
us assume that Turing machine is solvable / decidable.
Construction of H1

Plaiting HALT
« machine H1
Loop Forever
• Consider, a string describing M and input string, w for M.
• Let HI generates “halt” if HI determines that the Turing machine, M stops after accepting the input, w.
• Otherwise HI loops forever when, M doesn't stops on processing w.
Construction of H2

idaiting HALT
machine H2 Looy
• H2 is constructed with both the inputs being M.
• H2 determines M and halts if M halts otherwise loops forever.
Construction of H3
HALT
Loop
H2 Loop
Halt
• Let H3 be constructed from the outputs of H2.
• If the outputs of H2 are HALT, then H3 loops forever.
• Else, if the output of H2 is loop forever, then H3 halts.
• Thus H3 acts contractor to that of H2.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 4
II CSE CS3452- Theory of Computation
• A total function f from A to B is
a rule which assigns every
element of A to unique element
of B.
• Let the output of H3 be given as input to itself.
• If the input is loop forever, then H3 acts contradictory to it, hence 5.4.3. Constant function
halts. • A constant function f(x)
• And if the input is halt, then H3 loops by the contradiction. over n and every k
• Since the result is incorrect in both the cases, H3 doesn't exist. (Natural numbers)
• Thus H2 doesn't exist because of H3. using recursion can
• Similarly H1 doesn't exist, because of H2. be defined as f(0) =
• Thus halting problem is undecidable. k
Q2. Describe about Recursive and Recursively Enumerable languages with examples.
[Nov/Dec 2015, 2016, ARril/May 2017, 2019J (or) Compare recursive languages with
recursively enumerable languages. [Nov/Dec 2023]

f(n+1) = g(n, f(n))


5.4 COMPUTABLE FUNCTIONS:
For example
• The problem of finding out whether a given problem is solvable or
i. z(x) = 0 zero function
not is based on evaluation of function on the set of natural number
ii. f(x) = x identity function
or by a given alphabet.
• Let us start by defining three important types of functions 5.5 RECURSIVE AND
RECURSIVELY
ENUMERABLE
LANGUAGES

5.4.1. Partial function 5.5.1 Recursive


• A partial function f from A to B is a rule which assigns every • A language L is said to be
element of A to at the most one element of recursive if there exists a
Turing machine M that accepts
every string of the language L,
and goes to halt state or se
rejects those strings that are not
in the language L.
• If the input is accepted, M halts
with the answer,” YES”
• w $ L the Turing machine doesn't
accept the string.
• If w C L, then M halts with
5.4.2. Total function answer, “NO”.
UNIT V — UNDECIDAB ILITY
Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 5
II CSE CS3452- Theory of Computation
• The recursive languages are called Turing decidable languages
• Recursive language will halt on every input. Accept

Input String TM Reject

• Every recursive language is also a recursively enumerable.


• If L is recursive language, then its complement L’ is also recursive.
5.5.2 Recursively Enumerable Languages
• A language L is recursively enumerable if there exist a Turing machine, M that accepts every string of the
language L and does not accept strings that are not in the language L.
• If the input string is accepted, M halts with the answer, “YES”.
• If the string is not an element of L, then M may not halt and enters into infinite loop.
w EYES (ifW E L)
TM
Input String
Loop Forever( if W e L)

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 6
II CSE CS3452- Theory of Computation

• The Recursively Enumerable Languages is called Turing acceptable languages.


• Recursively Enumerable may not halt on every input; it may fall into an infinite loop.
• Every Recursively Enumerable language is not recursive.
• There exist Recursively Enumerable language L whose complement L’ may not be Recursively
Enumerable.
• If L and L’ both are recursively enumerable then that L is definitely a recursive language.
5.6 PROPERTIES OF RECURSIVE AND RECURSIVELY ENUMERABLE LANGUAGES
[May/June 2012] [Nov/Dec 2023]
1. The union of two recursive language is recursive.
2. The language L and its complement L are recursively enumerable, then L is recursive.
3. The complement of a recursive language is recursive.
4. The Union of two recursively enumerable languages is recursively enumerable.
5. The intersection of two recursive language is recursive.
6. The intersection of two recursively enumerable language is recursively enumerable.

Proofs on the Properties


Property — 1: The union of two recursive language is recursive.
Q4. Prove that for two recursive language L1 and L2 their union and intersection is
recursive. [Nov/Dec 2013 J
Proof:-
Let L1 and L2 be two recursive languages that are accepted by the Turing machines M1 and M2, given by
L(MI) = LI
L(M2) = L2
Let M3 be the Turing machine constructed by the union of M1 and M2. M3 is constructed as follows.
• The Turing machine M3 first simulates Ml with the input string, w.
• If w C LI, then M1 accepts and thus M3 also accepts since L(M3) = L(M1) U L(M2).
• If Ml rejects string w g L1, then M3 simulates M2. M3 halts with “YES” if M2 accepts “w”, else returns
“NO”.

NO

NO
NO

• Hence M3, M2, M1 halt with either YES or NO on all possible inputs.
• Thus, the union of two recursive languages is also recursive.
UNIT V — UNDECIDAB ILITY
Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 7
II CSE CS3452- Theory of Computation

Property - 2: A language is recursive if and only if both it and its complement are recursively enumerable.

Proof:
• Let L and L be two recursively enumerable languages accepted by the Turing machines MI and M2. If a
string, w C L, it is accepted by Ml and Ml halts with answer “YES”. Else M1 enters into infinite loop.
• If a string, w C L [w JL], then it is accepted by M2 and M2 halts with answer “YES”. Otherwise M2 loops
forever.
• The Turing machine, M3 that simulates M1 and M2 simultaneously is given as

W L Ye
E M.
s
RE
w e z• M3 Yes
No
R
eS
L
" “ ' M2

RE
• From the above design of TM, if w C L, if w C L, then M1 accepts w and halts with “YES”.
• If w C L , then M2 accepts w [w C L] and halts with “YES”.
• Since M1 and M2 are accepting the complements of each other, one of them is guaranteed to halt for
every input, w C Z*.
• Hence M3 is a Turing machine that halts for all strings.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 8
II CSE CS3452- Theory of Computation
Property — 3: The complement of a recursive language is recursive.
Proof:
• Let L be a recursive language accepted by the turning machine, MI.
• Let L be a recursive language accepted by the Turing machine M2.
• The construction of MI and M2 are given as,

M1 M2
W g La No Yes
R R
• Let w C L, then MI accepts w and halts with “YES”.
• M1 rejects w if w C Land halts with “NO”
• M2 is activated once M1 halts.
• M2 works on L and hence if M1 returns “YES”, M2 halts with “NO”.
• If Ml returns “NO”, then M2 halts with “YES”
• Thus for all w, where w C L or w $ L , M2 halts with either “YES” or “NO”
• Hence the complement of a recursive language is also recursive.
Property-4: The union of two recursively enumerable languages is recursively enumerable. Proof:
• Let LI and L2 be two recursively enumerable languages accepted by the Turing machines M1 and M2.
• If a string w C L1 then MI returns “YES”, accepting the input string: Else loops forever.
• Similarly, if a string w C L2 then M2 returns “YES”, else loops forever.
• The Turing machine M3 that performs the union of L1 and L2 is given as
Yes
M1
RE
M3 Yes
RE
Yes
M2
RE

• Here the output of Ml and M2 are written on the input tape of M3.
• The turning machine, M3 returns “YES”, if at least one of the outputs of M1 and M2 is “YES”.
• The M3 decides on L1 U L2 that halts with the answer, “YES” if w C L1 or w C L2.
• Else M3 loops forever if both MI and M2 loop forever.
• Hence the union of two recursively enumerable languages is also recursively enumerable.
II CSE CS3452- Theory of Computation

Property — 5: The intersection of two recursive language is recursive.


Q6. Prove that for two recursive language L1 and L2 their union and intersection is recursive.
[Nov/Dec 2013]
Proof:-
Let L1 and L2 be two recursive languages accepted by MI and M2 where
UNIT V — UNDECIDAB ILITY
Handled By, P.Dinesh Babu, AP / CPE, V.R.S.College of Engineering & Technology, Arasur Page 8
II CSE CS3452- Theory of Computation

Let M3 be the Turing machine that is constructed by the intersection of MI and M2, M3 is constructed as
follows.

NO

YES

L(M ) — L(Mr) mL(Mr)

YES
YES

NO

• The Turing machine M3 simulates M1 with the input string, w.


• If w $ L1, then M1 halts alongwith M3 with answer “NO”, since L(M3) = L(MI) n L(M2). If then M1
accepts with the answer “YES” and M3 simulates M2.
• If M2 accepts the string, then the answer of M2 and M3 are “YES” and halts. Else, M2 and M3 halts with
answer “NO”.
• Thus, the intersection of two recursive languages is recursive.
Property - 6: Intersection of two recursively enumerable languages is recursively enumerable.
Proof: -
• Let L1 and L2 be two recursively enumerable languages accepted by the Turing machine M1 and M2.
• If a string rejecting w C L1 then Ml returns “YES” accepting the input. Else will not halt after rejecting w C
L1
• Similarly, if a string, w C L2, then M2 returns “YES” else rejects “w” and loop forever.
• The Turing machine, M3 = Mr n M2 is given as
Rejects & Never Halts

M1
YES
YEs
M3
—F• Loop Forever

M2

w eL2 Rejects & Never Halts


• Here the output of MI and M2 are written the input tape of M3. The machine, M3 returns “YES” if both
the outputs of M1 and M2 is “YES”.
• If at least one of Mlor M2 is NO it rejects “w” and never halts.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 9
II CSE CS3452- Theory of Computation

• Thus, M3 decides on L1 n L2 that halts if and only if w C L1 and w C L2. Else M3 loops forever along
with M1 or M2 or both.
• Hence the intersection of two recursively enumerable languages is recursively enumerable.
5.7 POST CORRESPONDENCE PROBLEM
Q7. Explain briefly about Post's Correspondence Problem. [Nov/Dec-2007,2010, May 2013] (Or)
State and prove the Post's Correspondence Problem. [Dec 2012, 2014, 2019] (or)
What is a post corresponding problem (PCP)? Explain with the help of an example. [May/June
2016, Nov/Dec 2019, Apr/May 2021J
• Post Correspondence problem is an undecidable decision problem that was introduced by Emil post in 1946.
• Post correspondence problem known as PCP is an unsolvable combinatorial problem.
• "The Post's correspondence problem consists of two lists of string that are of equal length over the
input. The two lists are A = w1, W2, W3,......, Wn and B = x1, X2, X3,...Xn then there exists a non empty set of
integers ii, i2, i3, .... , In Such that, W1, W2, W3, .... W» * X1, X2, X3,...Xn".
• To solve the post correspondence problem we try all the combinations of ii, iz, Î3,..........., În CO find the w1 =
x1 then we say that PCP has a solution.
Example:
DOMINOsFORM
1. Consider the set of dominos. Does the PCP have a solution?
ab ba b abb a
aba abb ab b bab
Solution:
we need to find a sequence of dominos such that the top and bottom strings are the same.
ab a ba b abb abb b abb
aba bab abb ab b b ab b
ab a ba b abb abb b abb= aba bab abb ab b b ab b
Hence, the PCP has a solution.
TABLE FORM
1. For Z = {a,b} with A = {a, aba3, ab} and B ={a3, ab, b}. Does the PCP with A and B have a solution?
Solution:
The sequence obtained from A and B = (2, 1, 1, 3) as
A solution is 2, 1, 1, 3. That means A2A1A1A3 = &2&1 1 3
The constructed string from both lists is aba3a3b = aba6b
A2 A1 A1 A3
aba3 a a ab
B2 BI BI B3
ab a3 a3 b

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 10
II CSE CS3452- Theory of Computation

2. Let Z = {0,1} A and B are strings. Find instance of PCP.

10111 10
10
Solution:
Consider the sequence (2, 1, 1, 3)
W2W1W1W3 — X2X IX 1X3
101111110= 101111110
Thus, the PCP has (2,1,1,3) sequence as solution.
3. Consider the correspondence system as given below
A = (b, bab3, ba) and B = (b3, ba, a). The input set is = {0, 1}. Find the solution.
Solution:
A solution is 2, 1, 1, 3. That means wzwlwlW3 = X2X1X1X3
The constructed string from both lists is bab3b3a.
A2 A1 A1 A3
bab3 b b ba
B2 B1 B1 B3
ba b3 b3 a
4. Does PCP with two lists x = (b, a, aba, bb) and y = (ba, ba, ab, b) have a solution?
Solution: Now we have to find out such a sequence that strings formed by x and y are identical. Such a
sequence is 1, 2, 1, 3, 3, 4. Hence from x and y list
1 2 1 3 3 4 1 2 1 3 3 4
b a b aba aba bb = ba ba ba ab ab b
5. Obtain the solution for the following system of posts correspondence problem. A = {ba,abb,bab},
B = {bab, bb, abb}
Solution: Consider the sequence 1, 3, 2. The string obtained from A = babababb. The string obtained from B
= bababbbb. These two strings are not equal. Thus, if we try various combination from both the sets to find
the unique sequence, we could not get such a sequence. Hence there is no solution for this system
6. Let Z = {0,1} A and B are strings. Find instance of PCP.
A B

1 10 101
2 011 11
3 101 011
Solution:
Consider the sequence (1,3,2)
W1W3W2 — X 1X3X2
10101011 /10101111
Thus, the PCP has (1,3,2) sequence has no solution.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 11
II CSE CS3452- Theory of Computation

7. Obtain the solution for the following system of posts correspondence problem, X = {100, 0, 1}, Y =
{1, 100, 00}.
Solution: The solution is 1, 3, 1, 1, 3, 2, 2. The string is
J1J3J1XiX3'X2X2100 + 1 + 100 + 100 + 1 + 0 + 0 = 1001100100100
1 3 1 1 3 2 2 = 1 + 00 + 1 + 1 + 00 + 100 + 100 = 1001100100100
8. Consider the lists,
a = [b, a, aba, bb]
b = [ba, ba, ab, b]
Solution:
For these 2 lists, the sequence [1, 2, 1, 3, 3, 4] will give the solution for the Post Correspondence Problem. The
String that will be formed in both cases will be “bababaababb” by following the above sequence.
1 2 1 3 3 4 1 2 1 3 3 4
b a b aba aba bb = ba ba ba ab ab b
5.8 THE "MODIFIED" PCP
• It is easier to reduce Lu TO PCP if we first introduce an intermediate version of PCP, which we call it as
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.
• More formally, 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
wi1, wi2..... wim, = xi1, xi2,.....xim.
• Note 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.
• Also, 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 wi = xi (but those instances are rather uninteresting and will not figure in
our use of MPCP).
For example consider two lists A and B as
A B

1 11 111
2 100 001
3 111 11
Then the solution is
1 '2 3 X tX2X3
11100111 = 11100111
That means it is essential to have w1 and xi at the beginning of the list.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 12
II CSE CS3452- Theory of Computation

5.8.1 Theorem: Prove that MPCP reduces to PCP.


Q8. Prove that ”MPCP reduces to PCP”. [Nov/Dec 2015, Apr/May 2021]

Proof: To prove that modified PCP is decidable we have to show that PCP is decidable. That is MPCP reduces
to PCP.
While proving this we will consider some instance of MPCP with Z. Then we construct an instance of PCP by
introducing new symbol *. The construction PCP will be done by following method.
- Let we are given an instance of MPCP with lists A = Wl, W2, .... Wk aild B = Xl, X2,....Xk. Now we will insert
new symbols * and $ in Z.
D= z0,zi, .... zk +1 as follows
i. For i = 1, 2, 3,....k. Assign wi = yi * and xi = *zi.
For example, consider
List A List B List C List D
i we xc i yr zi
1 11 111 G 1 1*1* *1*1*1
2 100 001 2 1*0*0* *0*0*1
3 111 11 3 1*1*1* *1*1

ii. NOw assign y0 = * yi and Z0 = Z1. That means first pair and zeroth pair should be same except that zeroth
pair has extra * at the beginning of the string from first list. Whereas from the second list zeroth and first
pair must be the same.
For example, consider
List C List D List C List D
i yr zi i yr zi
0 *1*1* *1*1*1
1 1*1* *1*1*1 1 1*1* *1*1*1
2 1”0”0* *0*0*1 2 1”0”0” ”0”0*1
3 1”1”1* *1*1 3 1”1”1” ”1*1

iii. Now construct the last pair yk +1 and zk +1 put yk • i = $ and Zk • l = * $


For example,
List C List D
i yr zi
0 *1*1* *1*1*1
1 1*1* *1*1*1
2 1*0*0* *0*0*1
3 1*1*1* *1*1
4 $ *$
iv. Now suppose ii, i2, .... i+ is a solution to the given MPCP with lists A and B. Then we can replace wi, wi1,
.... Wim = x1, xi1, .... xim by * y1, yi1, .... yim= zi, zil,..zim*.
For example, if above problem has a solution (1,2,3) then * yi, y2, y3 = z1, Z2, Z3 *
i.e * 1*1*1*0*0*1*1*1* = * 1*1*1*0*0*1*1*1*

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 13
II CSE CS3452- Theory of Computation

v. But since y0 = * yi and zo = zi we can fix the initial * by replacing first index by 0 then we have
yo yr yi1 .... y; = zo zi zi1, zim*.
For example,
yo y2 y3
*1*1* 1*0*0* 1*1*1*
ZO Z2 Z3
*1*1*1 *0*0*1 *1*1
yo yz y3 = z0 Z2 Z3 *.
*1*1* 1*0*0*1*1*1* = * 1*1*1*0*0*1*1*1*
vi. Now we can take care of final * by appending the index k + 1. i.e. yk + i = $ and Zk +1 = * $. Then we have
y0 yr yi1 .... you yk + i = zo zi zi1,....zim Zk +1•
For example,
y0 y2 y3 y4
*1*1* 1*0*0* 1*1*1* $
Z0 ZZ Z3 Z4
*1*1*1 *0*0*1 *1*1 *$
yo yz y3 yr = Z0 z2 z3 Z4
*1*1* 1*0*0*1*1*1*$ = * 1*1*1*0*0*1*1*1*$
Thus 0, ii,12,....i+, k +1 has a solution to the instance of PCP.
vii. Similarly we can show that if constructed instance of PCP has a solution, then original MPCP also have a
solution. The solution of PCP must begin with index 0 and end with index k + 1. Thus solution to PCP can be
0, ii, iz, .... i+, k +1. We can claim that i1,12, i+ is a solution to the instance of PCP. (i.e. remove * $ and $
from
the strings)
So, for PCP
y0 y1 yil .... yim yk + 1 = Z0 zl zi1,......Ztm Zk + 1.
which follows that w1 Wi1 wi2 ..... Wim - X1 Xil Xi2......Xim
Thus a solution to the PCP instance implies a solution to MPCP instance. Hence reduction of MPCP to PCP
confirms that if PCP were decidable then MPCP would also be decidable.
Example:
1. Let A= {001, 0011, 11, 101} and B={01, 111, 111, 010}. Does a pair (A,B) have post correspondence (PC)
solution? Does the pair (A,B) have modified posts correspondence (MPC) solution?
Solution: The solution can be (3,4,1) ie a3 a4 a1 = b3 b4 bi 11101001
= 11101001
Consider
List A List B List C List D
i yi z;
1 001 01 1 0*0*1* *0*1
2 0011 111 2 0*0*1*1* *1*1*1
3 11 111 3 1*1* *1*1*1
4 101 010 4 1*0*1* *0*1*0

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 14
II CSE CS3452- Theory of Computation

Assign y0 = * yi and Z0 = Z1
List C List D
i yr zi
0 *0*0*1* *0*1
1 0*0*1* *0*1
2 0*0*1*1* *1*1*1
3 1*1* *1*1*1
4 1*0*1” ”0”1”0
Now construct the last pair yk • i aild Zk • i put yk + 1= $ and zk + 1= * $
List C List D
i yr zi
0 *0*0*1* *0*1
1 0*0*1* *0*1
2 0*0*1*1* *1*1*1
3 1*1* *1*1*1
4 1*0*1* *0*1*0
5 $ *$
If * y0, yi, y2, y3 ..... yk = zo,z1, Z2, Z3 ..... Zk * the MCP has solution. Consider the solution (3, 4,1,5) then
* y3 y4 yr= Z3 Z4 Z1
i.e *1*1*1*0*1*0*0*1* = *1*1*1*0*1*0*0*1* is solution.
2. State whether the instances of the post correspondence problem (PCP) have a solution. The
following are the instances with Z = {0,1} [Nov/Dec 2022]
Index List A List B
1 10 01
2 110 011
3 110 01
4 000 00
5 10 010
In case the PCP has a solution, describe the post correspondence solution with justification. Solution:
Step 1: Start with tile in which numerator and denominator are starting with same number, so we can start with
tile 4. String made by numerator and denominator is
A4 000
&4 00
Step 2: We need 0’s in denominator to match 0’s in numerator. So we will go with tile 2. String made by
numerator and denominator is
A4A2 000110
4 2 00011
Step 3: We need 0’s in denominator to match 0’s in numerator. We will go with tile 1. String made by
numerator and denominator is

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 15
II CSE CS3452- Theory of Computation

A4A2 AI 00011010
B4B2 Al 0001101
Step 4: There is extra 0’s in numerator to match this with 0 in denominator. We will add tile 5. String made by
numerator and denominator is
A4A2 A1 A5 000110 1010
B4B2 Al 5 000110 1010
Thus PCP sequence (4, 2, 1, 5) has a solution.
String made by numerator: 0001101010 String
made by denominator: 0001101010
MPCP
The solution can be (4, 2, 1, 5) ie a4 a2 a1 a5' b4 b2 bi b5
0001101010 = 0001101010
i. For i = 1, 2, 3, ... k. Assign wi = yi * and xi = *zi.
Index List A List B Index List C List B
wi x; y; z;
1 10 01 1 1*0* *0*1
2 110 011 2 1*1*0* *0*1*1
3 110 01 3 1*1*0* *0*1
4 000 00 4 0*0*0* *0*0
5 10 010 5 1*0* *0*1*0

Assign yo = * yi and zo = zi
Index List C List D
yi zi
0 *1*0* *0*1
1 1*0* *0*1
2 1*1*0* *0*1*1
3 1*1*0* *0*1
4 0*0*0* *0*0
5 1*0* *0*1*0
Now construct the last pair yk + i and zk + i put yk + i = $ arld Zk +1 = * $
Index List C List D
yr zi
0 *1*0* *0*1
1 1*0* *0*1
2 1*1*0* *0*1*1
3 1*1*0* *0*1
4 0*0*0* *0*0
5 1*0* *0*1*0
6 $ *$
If * y0, yi, y2, y3 ..... yk = zo,z1, z2, Z3..zk * the MCP has solution. Consider the solution (4, 2, 1, 5) then
* y4 y2 y1 ys= z4 Z2 Z1 z5
i.e *0*0*0*1*1*0* 1*0*1*0* = *0*0*0*1*1*0* 1*0*1*0* is solution.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 16
II CSE CS3452- Theory of Computation

5.8.2 PROOF OF UNDECIDABILITY


Q9. Define PCP and prove that PCP is undecidable. [Nov/Dec 2020]

• Undecidability of a problem means that there is no particular algorithm that can determine whether a given
problem has a solution or not.
• A common undecidable problem is a Turing problem, so its undecidability is also proved if we can
reduce the Turing problem into post Correspondence problem.
• Consider an instance of a post correspondence problem that can simulate the computation of an
arbitrary Turing Machine on random input.
• A match will occur if the Turing machine accepts the input.
• The problem of deciding whether a Turing machine will accept the given information or not is a well -
known problem.
• As the post Correspondence problem reduces to this particular problem, we can say the post
correspondence problem is undecidable, which completes our proof.
Theorem: To prove PCP is undecidable
Proof:
• It is sufficient to show that if MPCP were decidable, then PCP would be decidable whether a TM accepts a
given word.
• We reduce Lu TO MPCP, which again can be reduced to PCP.
• For each M and w1, we construct an instance of MPCP that if it has a solution has one starts with
#q0w#aiqi§i#......# akqkbk
where
- Strings between successive #’s are successive ID's in a computation of M with input w.
- qk is the final state.
Solution:
Consider a Turing machine M to simulate this PCP's input string w can be represented as <M, w>.
M = (qz,r,6,q0,qaccept,qreject)
Approach:
• Take a problem that is already proven to be undecidable and try to convert it to PCP.
• If we can successfully convert it to an equivalent PCP then we prove that PCP is also undecidable.
Acceptance Problem of a Turing Machine (This is an undecidable problem)

Convert this to PCP (Called modified PCP — MPCP)


Consider the Turing machine

q1

Z={a,b}
r ={a,b,X,B}
w=aba

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 17
II CSE CS3452- Theory of Computation

Step 1: The first pair is: q $p


0

qoaba
s q0 aba#
Step 2:
6 (q0,a)= (q1, X,R)

bra B

q1

qoa=Gxqi q0 a
x q1
Step 3:
6 (qi,b)= (q2,
X,L)

bra B a B

q2

y C r, where r =(a,b,X,B}
y qi b= q2yX
a q1 b b q1 b X q1 B q1 b
b
q2 a X q2 b X q2 X q2 B X
X

Step 4: For all possible tape symbols


r ={a,b,X,B}
a b X B

Step 5: For all possible tape symbols after reaching the accepting state q2.
a q2 q2 a b q2 q2 b X q2 B q2 q2 B
q2 X
q2 q2 q2 q2 q2 q2 q2 q2

Step 6: Strings for consuming the tape symbols at the end

# B#
UNIT V — UNDECIDAB ILITY
Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 18
II CSE CS3452- Theory of Computation

Step 7: Ending string


q2 #J

Construct the solution:

f# q0 aba# (x qlJ fbJ (a f#

f# q2 X X a#J f q2 X a f#

f#q2 X a#J f q2 a f#

# q2 ##J

Hence PCP is undecidable.


5.8.3 Theorem: Lne IS recursively enumerable.
Q10. Prove that Non emR•x language (Lne) is recursively enumerable.
Proof: The construction is based on a non deterministic Turing machine.

j,y -..-+ Yes -—> Yes


Universal
M Turing
Machine U
M for Lne
The theorem is proved as follows
i. A Turing machine code Mi is given as input to the Turing machine.
ii. A queues an input w in a right way that Mi might accept.
iii. M is simulated to the Universal Turing machine U, which tests whether Mi accepts w.
iv. If Mi accepts w, then M accepts w.
Thus Mi accepts any string that will be guessed right by the Turing machine M. If L(Mi ) = , then no guess is
made by Turing machine M. So M does not accept Mi.
Thus L(M) > Lne.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 19
II CSE CS3452- Theory of Computation

5.8.4 Theorem: Lne is not recursive.


Q11. Prove that Non emR•x language (Lne) iS not recursive.

Proof: The algorithm of this theorem should be designed in such a way that it converts an input that is
binary coded pair (M,w) into a Turing Machine Ml. Such that L(MI) = Q if and only if M accepts input w.

Yes Yes

The Turing Machine M* is designed to perform the below operation


i. M ignores its own input x rather it replaces its input by w, the input string accepted by Turing Machine M. M
is designed to accept a specific pair (M,w) whose length is n, having a sequence of n states like q0, qi, q2,
.. qn Where q0 is the start state.
a. For i=0, 1.....n-1, if the turing machine is at state qi, M writes (i+1)st bit of the code for (M,w) and goes
to state qi+l moving right.
b. In state q», M moves right by replacing any non blanks to blanks.
ii. When the Turing machine M reaches a blank in state q», it uses a similar collection of states to reposition its
head at the left end of the tape.
iii. M stimulates a Universal Turing machine U on its present tape. If U accepts, then M accepts. If U does not
accept, M never accepts. The simulation made here is by reduction Of Lu TO Lne.
Assume Lne ÎS recursive, then the algorithm for Lu lS CS fOlloWS
a. Convert (M,w) to the Turing machine Ml by reduction of Lu CO Lne.
b. By the hypothetical algorithlTl Of Lne,tell
i. if L(MI) = Q M does not accepts w
ii. if L(MI) = Q M accepts w
By the algorithITl OÊLu, thÎS is not true. Our assumption is contradictoryand conclude them Lne ÎS not recursive
5.9 THE DIAGONALIZATION LANGUAGE
Q12. Prove that the diagonalization language (L d) is not a recursively enumerable.
[April/May 2018] (or) State and prove that “Diagonalization language is not recursively
enumerable”. [Nov-Dec 2021] (or) Prove that Ld is not Recursively Enumerable [Apr/May
2004, 2005, 2006, Nov/Dec 2004, 2005, 2008J (or) Define the language Ld. Show that Ld is
not recursively enumerable?
The language La, the “diagonalization” language, is the set of strings wi such that wi is not in L(Mi).
L(Mi) = if wi is valid Turing machine code.
That is, Le consists of all strings w such that the Turing Machine M whose code in w does not accept the input

It is clear that the below table tells for all i and j, whether the Turing Machine Mi accepts input string Wjl
• if (i,j)= 1 means "yes it is accepted" and
• if (i,j)= 0 means "no it doesn't" accepted or rejected.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 20
II CSE CS3452- Theory of Computation

We may think of the ith row as the characteristic vector for the language L(Mi); that is, the 1's in this row
indicate the strings that are members of this language.

l 2 3 4 ”’

2 0 0
3 0 0
4

Figure: The table that represents acceptance of strings by Turing machines


Construction of Ld
• The diagonal values tell whether M, accepts w. To construct Ld, we complement the diagonal.
• For instance, the complemented diagonal would begin 1, 0, 0, 0, .... .
• Thus, Ld would contain w1= E, not contain w2 through w4, which are 0, 1, and 00, and so on.
• The process of complementing the diagonal to construct the characteristic vector of a language that
cannot be the language that appear in any row is called diagonalization.
• Then the complement of the diagonal cannot be the characteristic vector of any Turing machine.
5.9.1 Theorem: Ld is not a Recursively Enumerable Language. That is, there is no Turing machine that
accepts Ld.
Proof:
• Suppose Le is accepted by some Turing machine M defined by L(M). Since Ld iS a language over alphabet
{0, 1} M would be in the list of Turing machines that we have constructed. Since it includes all Turing
machine with input alphabet {0,1}. So there may be at least one code for M, say i that is M=Mi.
• Then by definition, Ld = ( wi | Mi does not accept } here we have two possibilities
w; C Ld
• This means that (i,j) entry is ‘0’ and so M; does not accept wi. But our assumption is that there exists a
Turing machine Mi which accepts wi. There is a contradiction.
wi Ld
• This means that (i,j) entry is 1’ and so Mi accept wi. But by definition of Ld, Mi does not accept wi. So
there is a contradiction.
• That it is clear, Ld is not a recursively enumerable language and Lu is not recursive too.
5.10 UNIVERSAL LANGUAGE (Lii}
' Lu <M,W> | M accepts w }
< Lu lS the set of strings representing a Turing machine and an input accepted by that TM. So there is a
Turing Machine U called Universal Turing machine.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 21
II CSE CS3452- Theory of Computation

5.10.1 UNDECIDABILITY OF THE UNIVERSAL LANGUAGE


• We can now exhibit. A problem that is Recursively Enumerable but not recursive; it is the language L u.
Knowing th£lt Lu IS undecidable (i.e., not a recursive language) is in many ways more valuable than our
previous discovery that Ld is not Recursively Enumerable.
• The reason is that the reductioll Of Lu tO another problem P can be used to show there is no algorithm to
solve P, regardless of whether or not P is Recursively Enumerable.
• However, reduction of La to P is only possible if P is not Recursively Enumerable, so Ld Cannot be used
to show undecidability for those problems that are Recursively Enumerable but not recursive.
• On the other hand, if we want to show a problem not to be Recursively Enumerable, then only L s can be
used; Lu is useless since it is Recursively Enumerable.
• The universal language Lu IS a recursively enumerable language and we have to prove that it is
undecidable (non-recursive).
5.10.2 Theorem: Lu lS Recursively Enumerable but not recursive.
Q13. Prove that the undecidability Universal language is recursively enumerable but not
recursive. (OR) Define the Language Lu. Show that Lu is recursively enumerable but not
recursive. [Nov/Dec 2003, 2005, 2006, Apr/May 2004, 2005, 2006, 2009, Nov/Dec 2019,
Apr/May 2021] (or)
Prove that the universal language Lu is recursively enumerable. [May/June 2014,
Nov/Dec 2014, Nov/ Dec 2015]
Proof:
• Consider that language Lu is recursively enumerable language.
• Assume thät Lu is recursive.
• Then the complement Of Lu Shit ÎS L“ulS also recursive.
• However, if we have a TM M to accept L“uthen we can construct a TM Lu. But Ld the diagonalization
language is not Recursively Enumerable.
• Thus our assumption th£lt Lu ÎS recursive is wrong (not Recursively Enumerable means not recursive).
• Hence we can say thät Lu lS Recursively Enumerable but not recursive.
• The construction of M for Ld is aS Shown in the following diagram:

HypotheUcal TM —> Accept


M for L'B
Yes

—> Reject

TM M' for Ld

Fig: Construction of M' for L,j

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 22
II CSE CS3452- Theory of Computation

5.11 BINARY ENCODING - DESCRIPTION OF TURING MACHINE


Universal TM
TM =(Q, J, 6, q0, F, B, r)
Encode the following TM, M <M, 1011> in binary
M = ({q0, q1}, {0, 1}, {0, 1, B}, 6(q0,0) = (q0, 0, R), 6(q0,1) = (q0, 1, R), 6(q0, B) = (q1, 1, L) ,{q0}, B,
{q1})
Encoded form of M is that, place
q0 O 0
G q1 00
G 0 0
0 1 00
G B 000
SeparatoGr (,) 1
Set separGator 11
Where, U=(M,w)
TM = (01001101001101001000110101010100101001010010010100010010010110110001100,1011)
5.12 UNIVERSAL TURING MACHINE
Q14. What is a universal Turing machine? Bring out its significance. Also construct a Turing
machine to add two numbers and encode it. [May/June 2016} (or)
Explain universal Turing Machine. [Nov/Dec 2003, 2005, 2006, 2017, Apr/May 2005, 20O6J
• A Turing machine can also compute everything that a real computer can compute.
• For example, a Turing machine can simulate any function used in a programming language.
• Some common examples include recursion and parameter passing.
• A Turing machine can also be used to simplify algorithm statements.
• Turing machines can be either halting or non-halting, depending on the algorithm and the input
associated with the algorithm.
• The model consists of an input and an output. The input is passed in binary format to the machine's
tape, and the output is the contents of the tape after the machine halts.
• The problem with the Turing machine is that a different machine must be constructed for every new
computation to be performed for every input output relation.
• This is the reason the Universal Turing machine (UTM) was introduced which along with input on the tape
takes the description of a machine M.
• The Universal Turing machine can go on then to simulate M on the rest of the content of the input tape
• Universal Turing machine can imitate behavior of an arbitrary Turing machine over any collection of input
symbols.
• By using the concept of universal Turing machine, it is possible to create a single machine to calculate any
computable sequence.
• It can be formally defined as - The Turing machine
UTM = {(M, w) | M is a Turing machine and M accepts w} is Turing recognizable.
• The input of a UTM includes:
- The description of a machine M on the tape.
- The input data w.
UNIT V — UNDECIDAB ILITY
Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 23
II CSE CS3452- Theory of Computation

• We define Lu, the universal language, to be the set of binary strings that encode, a 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). Since
the input to U is a binary string, U is in fact some M in the list of binary-input Turing machines.
• It is easiest to describe U as a multitape Turing machine.

Tape of 3f 000l00tD0I0l00Ol

Stateot M WXi ' OBB

• The transitions of M are stored initially on the first tape, along with the string w.
• A second tape 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 l's.
• The third tape holds the state of M, with state qi where i is represented by 0's.
• The UTM is a recognizer but not a decider.
The operation of U can be summarized as follows:
1. The first tape is observed carefully to check whether the code for M is Valid or not. If the code is not valid
then UTM halts without accepting.
2. Initialize the second tape for placing the tape values of M in encoded form i.e.
- for each 0 of w place 10 on 2n* tape
- for each 1 of w place 100 on 2nd tape
- for each Blank letters (B) of w place 100 on 2n* tape. (Blanks will not actually appear on that tape)
3. 3r*tape stores state of machine M, 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, U searches on its first tape for a transition 0i10j10k1010
Where
G 0i current state (tape 3)
0j current input tape symbol (tape 2)
0kO changed state

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 24
CS3452- Theory of Computation
II CSE
0lG changed input tape symbol
0 O direction in which the head is to be moved.
This transition is the one M would next make.
U should follow:
(a) Change the contents of tape 3 to 0k that is, simulate the state change of M. U first changes all the 0's on
tape 3 to blanks, and then copies 0k from tape 1 to tape 3.
(b) Replace 0j on tape 2 by 0 ; that is, change the tape symbol of M. If more or less space is needed (i.e., i =1),
use the scratch tape and the shifting-over technique to manage the spacing.
(c) Move the head on tape 2 to the position of the next 1 to the left or right, respectively, depending upon
value of M that means if m = 1 then move left (or) m= 2 then move right. Thus, U simulates the move of M
to the left or to the right.
5. If M has no transition, then no transition will be performed. Thus, M halts in the simulated configuration,
and hence U halts.
6. If M enters its accepting state, then U accepts.
7. In this manner, UTM simulates M on w. U accepts the coded pair (M,w) if and only if M accepts w.
5.12.1 Difference between Turing Machine and Universal Turing Machine:
Q15. ExR!*•’n the difference between Turing Machine and Universal Turing Machine.
Turing Machine Universal Turing Machine
1. It is a mathematical model of computation it Universal Turing Machine is like a single Turing
manipulates symbols on the tape according to Machine that has a solution to all problem that is
the rules defined computable
2. A program can be compared to a Turing Programmable Turing Machine is called Universal
Machine Turing Machine
3. Turing machine's temporary storage is tape. Universal Turing Machine contains Turing
The infinite cells of the Turing machine can Machine description as input along with an input
contain input symbols and blanks. string, runs the Turing Machine on the input and
returns the result.
4. Turing machines help us understand the Although developed for theoretical reasons, it
fundamental limitations of mechanical helped in the development of stored program
computation power computers
5. A Turing machine is a formal model of a Universal Turing Machine provides a solution to
computer with a fixed program problems that are computable
6. It does not minimize the space complexity It minimizes space complexity
7, Transition function which Turing Machine The transition function is Q T Q T {L, R},
performs is defined as: h X T -> Q X T X where Q is a finite set of states, T is the tape of the
{L,R}, alphabet
where 6 is the transition function
8. In the set theory point of view, all Turing Universal Turing Machine is a subset of all the
machines forma set of the all the device that Turing Machines
accepts type 0 grammar

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 25
CS3452- Theory of Computation
II CSE
5.13 TRACTABLE AND INTERACTABLE PROBLEMS
Q16. ExR!*•‘n Tractable and intractable problem with suitable example. [AR ’l/May 2017] (or)
What are tractable problems? COmRare it with intractable problems. [Nov/Dec 2016] (or)
Discuss about the tractable and intractable problems. [Nov/Dec 2015] (or)
Compare Tractable and intractable problems. [April/May 2018]
5.13.1 Tractable Problems/Languages
• The languages that can be recognized by a Turing machine in finite time and with reasonable space
constraint is said to be tractable.
• Example: If the language L1 C Time (f), then L is tractable and is less complex in nature
• Example: If L2 $ Time (f), L2 is complex and cannot be tractable in limited time.
• Tractable problems are those that can be solved in polynomial time period.
5.13.2 Intractable Problems
• The languages that cannot be recognized by any Turing machine with reasonable space and time
constraint is called intractable problems.
• These problems cannot be solved in finite polynomial time.
• Even problems with moderate input size cannot achieve feasible solution
5.14 P AND NP CLASS
Q17. Write a note on NP problems. (Nov/ Dec — 12) (Or)Write the classes and definition of NP
problems. [Nov/Dec-12] [Nov/Dec-2023] (or)
Explain how to measure and classify complexity. [Nov/Dec 2017, Apr/ May 2019} (or)
Wit* broker examples, explain P and NP COmRlete Problems. [Nov/Dec 2021]
• There are two groups in which a problem can be classified.
• The first group of the problems that can be solved in polynomial time. For example: searching of an
element from the list 0(logn), sorting of elements 0(logn).
• The second group consists of problem that can be solved in non-deterministic polynomial time.
• For example: Knapsack problem 0(2n/2) and travelling salesperson problem (0(n22n)).
• Any problem for which answer is either Yes or No is called decision problem. The algorithm for decision
problem is called decision algorithm.
• Any problem that involves the identification of optimal cost (minimum or maximum) is called
optimization problem. The algorithm for optimization problem is called optimization algorithm.
Definition of P
• “p” stands for polynomial.
• Problems that can be solved in polynomial time.
• The polynomial time is nothing but the time expressed in terms of polynomial.
• Examples — Kruskal problem, searching of key element, sorting of elements, All pair shortest path.
Definition of NP
• It stands for “non-deterministic polynomial time”.
• Note that NP does not stand for “non-polynomial”.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 26
CS3452- Theory of Computation
II CSE
• The NP class problems are those problems that can be solved in non deterministic polynomial time but can
be verified in polynomial time.
• Examples — Travelling Salesperson problem, graph coloring problem, Knapsack problem, Hamiltonian
circuit problems.

For example:
Consider an example of sudo-ku game. In order to solve this entire puzzle, the algorithm would have to
check each 3 X 3 matrix to see which numbers are missing then each row, then each column and then make
sure there are no repetitions of any digit from 0 — 9. This becomes more complex because the number of digits
that are missing is inconsistent in each row, column and matrix. Solving this problem is not possible in
polynomial time. But once we get the solution, then verifying this solution is possible within very less time.
Thus verification of solution of this problem is possible in polynomial time.
Computational
complexity problems

NP class

NP complete NP hard

• The NP class problems can be further categorized into NP complete and NP hard Problems.
NP

A problem D is called NP-complete if —


i) It belongs to class NP
ii) Every problem in NP can also solved in polynomial time.
• If an NP-hard problem can be solved in polynomial time then all NP-complete problems can also be
solved in polynomial time.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 27
CS3452- Theory of Computation
II CSE
• All NP-complete problems are NP-hard but all NP-hard problems cannot be NP-complete.
• The NP complete problems are intersection of NP class problems and NP hard problems.
• Normally the NP complete problems are decision problems (For example — is a graph Euler graph or not?)
• The NP hard problems are optimization problems (For example — shortest path problem)
• The NP class problems are the decision problems that can be solved by non-deterministic polynomial
algorithm.
5.14.1 Computational complexity
• The computational problem is an infinite collection of instances with a solution for every instance.
• In computational complexity the solution to the problem can be "yes" or "no" type. Such type of
problems are called decision problem. The computational problems can be function problem. The
function problem is a computational problem where single output is expected for every input. The
output of such type of problems is more complex than the decision problem.
• The computational problems also consists of a class of problems, whose output can be obtained in
polynomial time.
Complexity classes —
• The complexity classes is a set of problems of related complexity.
• It includes function problems, P classes, NP -classes, optimization problem.
Intractability -
• Problems that can be solved by taking a long time for their solutions is known as intractable
problems.
• If NP is not same as P then NP complete problems are called intractable problems.
• The P class problems are considered as tractable problems.
5.14.2 Example of P class problem
Kruskal's algorithm:
• In Kruskal's algorithm the minimum weight is obtained.
• In this algorithm also the circuit should not be formed.
• Each time the edge of minimum weight has to be selected, from the graph.
• It has edges of minimum weights to be adjacent.
• Let's solve one example by Kruskal's algorithm
Example:
1. Find the Minimum Spanning Tree for the following graph using Kruskal's algorithms.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 28
CS3452- Theory of Computation
II CSE
Solution:
Step 1: Initial configuration Step 2: Select an edge e — g
b b

a e d

Total Weight = 0 Total Weight = 1


Step 3: Select an edge a — e Step 4: Select an edge e — f
b b

Total Weight = 3 Total Weight = 5


Step 5: Select an edge e — c Step 6: Select an edge c - b
b

Total Weight = 7 Total Weight = 10


Step 7: Select an edge c -d

Total Weight = 13
Action of Kruskal's algorithm
Edge Weight Action
(e,g) 1 ACCEPTED
(a,e) 2 ACCEPTED
(e,f) 2 ACCEPTED
(e,c) 2 ACCEPTED
(b,c) 3 ACCEPTED
(c,d) 3 ACCEPTED
(d,g) 3 REJECTED

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 29
CS3452- Theory of Computation
II CSE
(a,b) 4 REJECTED
(b,e) 4 REJECTED
(a,f) 5 REJECTED
(d,e) 11 REJECTED

5.14.3 Example of NP class problem


Travelling salesman's problem (TSP) :
• This problem can be stated as “Given a set of cities and cost to travel between each pair of cities,
determine whether there is a path that visits every city once and returns to the first city.
• Such that the cost travelled is less”.
Example:

2 3

• The tour path will be a-b-d-e-c-a and total cost of tour will be 16.
• This problem is NP problem as there may exist some path with shortest distance between the cities.
• If you get the solution by applying certain algorithm then travelling salesman problem is NP com plete
problem.
• If we get no solution at all by applying an algorithm then the travelling salesman belongs to NP hard
class.
5.14.4 Difference between P and NP class
P NP
An algorithm in which for given input the An algorithm is called non deterministic
definite output gets generated is called polynomial time algorithm (NP class) when for
polynomial time algorithm (P class) given input there are more than one paths that the
algorithm can follow. Due to which one cannot
determine which path is to be followed after
particular stage.
Time is fixed. Time is not fixed.
In polynomial time, the input is fixed. In NP, the input is not fixed.
Use a deterministic Turing machine They can only be solved deterministically in
exponential time
Every problem which is a P class is also in NP Every problem which is in NP class is not in the P
class. class.
The process is fixed. The process is not fixed.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 30
CS3452- Theory of Computation
II CSE
All P problems are deterministic in nature. P All the NP problems are non-deterministic in
nature.
problems can be efficiently solved. NP problems which, given a proposed solution, we can
efficiently check if it works.
Selection sort, Linear search. TSP, Knapsack problem.
Example: Prime number is a relatively easy Example: Travelling salesman problem
problem to solve.
5.15 SAT PROBLEM
• SAT(Boolean Satisfiability Problem) is the problem of determining if there exists an interpretation that
satisfies a given boolean formula.
• It asks whether the variables ofa given boolean formula can be consistently replaced by the values TRUE or
FALSE in such a way that the formula evaluates to TRUE.
• If this is the case, the formula is called satisfiable.
• On the other hand, if no such assignment exists, the function expressed by the formula is FALSE for all
possible variable assignments and the formula is unsatisfiable.
5.15.1 The 3- SAT Problem
• Before understanding the 3 SAT problem we will get introduced with the satisfiability problem.
The Satisfiability Problem
The boolean expressions are built from
i. Variables whose values are Boolean i.e. they either have the value 1 (true) or 0 (false).
ii. Binary operators and v standing for the logical AND and OR of two expressions.
iii. Unary operator standing for logical negation.
iv. Parentheses to group operators and operands, if necessary to alter the default precedence of
operators highest, then , and finally v.
Example: An example of a Boolean expression is x (y v z). The subexpression y v z is true whenever either
variable y or variable z has the value true, but the subexpression is false whenever both y and z are false. The
larger subexpression (y v z) is true exactly when y v z is false, that is, when both y and z are false. If either y
or z or both are true, then (y v z) is false.
Finally, consider the entire expression. Since it is the logical AND of two subexpressions, it is true exactly
when both subexpressions are true. That is, x (y v z) is true exactly when x is true, y is false, and z is false.
5.15.2 CNF - SAT Problem
• This problem is based on Boolean formula. The Boolean formula has various Boolean operations such as
OR (+), AND (.) and NOT. There are some notations such as (means implies) and (means if and only
if).
• A Boolean formula is in Conjunctive Normal Form (CNF) if it formed as collection of subexpressions.
These subexpressions are called clauses.
• For example
{a + b + d + g (c + é)b + d + f + h) pa + c + e + h)
• This formula evaluates to 1, if b,c, d are 1.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 31
CS3452- Theory of Computation
II CSE
• The CNF — SAT is a problem which takes Boolean formula in CNF form and checks whether any
assignment is there to Boolean values so that formula evaluates to 1.
NP Complete Problem
• For the proof of particular problem as NP complete problem we need to apply the reduction technique.
That means there are some problems which are already proved as NP complete problems and using
these problems we can prove that the problem in hand is NP complete.
Steps for proving NP Complete
Consider that we have to prove that B is in NP
Step 1: Select an NP complete language say A.
Step 2: Construct a function f that maps the members of A to members of B. Step
3: Show that x is in A if and only if f(x) is in B.
Step 4: Now show that the function f can be computed in polynomial time.
Step 5: This if A is NP complete and it can be reduced to B in polynomial time, then B comes out to be NP
complete.
5.15.3 Prove that SAT problem is NP complete
Q18. Prove that SAT problem is NP complete.
Proof:
SAT is in NP:
• It any problem is in NP, then given a ’certificate’, which is a solution to the problem and an instance of
the problem(a boolean formula f) we will be able to check (identify if the solution is correct or not)
certificate in polynomial time. This can be do ne by checking if the given assignment of variables satisfies
the boolean formula.
SAT is NP-Hard:
• In order to prove that this problem is NP-Hard then reduce a known problem, Circuit-SAT in this case to
our problem. The boolean circuit C can be corrected into a boolean formula as:
i. For every input wire, add a new variable yi.
ii. For every output wire, add a new variable Z.
iii. An equation is prepared for each gate.
iv. These sets of equations are separated by o values and adding D Z at the end.
This transformation can be done in linear time or polynomial time.
The following propositions now hold:
If there is a set of input, variable values satisfying the circuit then it can derive an assignment for the
formula f that satisfies the formula. This can be simulated by computing the output of every gate in the
circuit.
If there is a satisfying assignment for the formula f, this can satisfy the boolean circuit after the
removal of the newly added variables.
For Example: If below is the circuit then:

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 32
CS3452- Theory of Computation
II CSE

Fig: Reducing circuit satisfiability to formula satisfiability. The formula produced by the reduction
algorithm has a variable for each wire in the circuit.
circuit would have the corresponding formula
x4 = x3
x5 = (x1 V x2)
x6 = x4
x7 = (x1 A x2 A
x4) x8 = (x5 V x6)
x9 = (x6 V x7)
x10 = (x7 A x8 A x9)
f -- x5 A x4 A x6 A x7 A x8 A x9 A x10
Thus if we could solve the Boolean satisfiability problem in polynomial time, we could solve the circuit
satisfiability problem in polynomial time (and by extension any NP problem in polynomial time). Hence SAT is
also an NP complete problem.
5.16 3-CNF SATISFIABILITY
Q19. Prove that 3 -SAT problem is NP complete. |
• If the Boolean expression consists of exactly 3 OR ’ed variables per clause with all the clauses being
AND'ed, then the expression is said to be in 3-CNF form (conjunctive normal form).
Problem
• Given a 3-CNF expression, find an assignment of the literals that satisfies the expression, i.e., causes the
expression to evaluate to 1. It can be shown that 3-CNF is also NP-complete by reducing general
Boolean satisfiability to 3-CNF.
Proof
• The reduction is performed in three steps:
Step 1: Convert clauses into a binary parse tree
• Since each Boolean operator is a binary operator, we simply construct a binary parse tree where the
nodes are the operators and the literals are leaves.
• In the case of clauses with multiple literals, we simply add associative parentheses as needed to make
binary clauses.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 33
CS3452- Theory of Computation
II CSE
• We then construct a new expression, similarly to the above reduction from circuit satisfiability to
Boolean satisfiability, by AND'ing the clauses representing each node with the final output.
Step 2: Convert each clause into CNF form
• We then construct a truth table for each clause (which contains at most 3 literals) and use the sum - of-
products method to create an equivalent Boolean expression that evaluates to 0 in which we have a set
of AND'ed clauses that consist of 0R'ed literals (this is known as DNF form - disjunctive normal form).
• Finally we negate this expression and apply DeMorgan's law to convert this expression into the
equivalent CNF form that evaluates to 1 if and only if the original expression evaluates to 1.
Step 3: Ensure each clause has exactly 3 literals
• Finally, we add auxiliary variables p and q as needed to clauses that have less than 3 literals as follows
• If the clause contains 3 literals, then keep it as is.
• If the clause contains 2 literals, then create two AND'ed clauses that contain p and p. In other words, for
the clause (xi V xj) replace it with
(xi V xj V p) A (xi V xj V p)
• Since for any assignment of p, one of the clauses will evaluate to the origin al and the other will
evaluate to 1 (thus not changing the final result of the original expression).
• If the clause contains 1 literal, then create four AND'ed clauses that contain p and p and q and q.
• In other words, for the clause (xi) replace it with
(xi V p V q) A (xi V p V q) A (xi V p V q) A (xi V p V q)
• Again, since any assignment of p and q will make one of the clauses evaluate to the original and all
the others evaluate to 1.
• This procedure can be done in polynomial time since the first step adds at most one variable and one
clause per operator in the original expression, the second step adds at most 8 clauses (since for 3
literals the truth table has 8 rows), and the third step adds at most 4 clauses.
• Thus the product of these steps remains a constant factor. Since the procedure basically applies the laws
of discrete math, the final 3-CNF expression will be satisfiable if and only if the original Boolean
expression is satisfiable.
Example
1. Consider the Boolean expression
‹p = (x1 -+ x2) V (( x1 w x3) V x4)) A x2
Solution:
Step 1: Draw binary parse tree
Parse the expression by creating the following output variables of subexpressions:
y6 = ( x1 w x3)
y5 = (y6 V
x4) y4 = (
y5)
y3 = (x1 —+ x2)
y2 = (y3 V y4)
y1 = (y2 A x2)
Making each of the above operators a node gives the following parse tree

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 34
CS3452- Theory of Computation
II CSE

X1 Xg

Thus the original expression can be rewritten (by traversing the parse tree) as
‹p' = y1 A ( y1 w ( y2 A x2 ))
A ( y2 w ( y3 V y4 ))
A ( y3 w ( x1 —+ x2 ))
A ( y4 w ( y5 ))
A ( y5 w ( y6 V x4 ))
A ( y6 w ( x1 w x3 ))
Step 2: Convert each clause to CNF
Constructing the truth table for the first clause ‹p'1 = (y1 w (y2 A x2)) gives
yi y2 xz (y1 w (y2 A X2))
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0
• Thus we can write ‹p'1 by simply AND'ing the literals (negating any false values) for each row that
evaluates to 0 and 0R'ing all the 0 rows (i.e. sum-of-products) giving
‹p'1 = ( y1 A y2 A x2) V ( y1 A y2 A x2) V ( y1 A y2 A x2) V ( y1 A y2 A x2)

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 35
CS3452- Theory of Computation
II CSE
Finally we can compute the CNF form ‹p"1 = ( ‹p'1 ) and using DeMorgan's laws to convert AND to OR
giving
‹p"1 = ( y1 V y2 V x2) A ( y1 V y2 V x2) A ( y1 V y2 V x2) A ( y1 V y2 V x2)
For the clause ‹p'4 = ( y4 w ( y5 )) the truth table would be
yr ys (y4 y5))
0 0 0
0 1 1
1 0 1
1 1 0
The sum-of-products for ‹p'4 gives
‹p'4 = ( y4 A y5 ) V ( y4 A y5 )
The CNF form for ‹p"4 = ( ‹p'4 ) gives
‹p"4 = ( y4 V y5 ) A ( y4 V y5 )
Step 3: Ensure each clause has exactly 3 literals
• Clearly all the clauses in ‹p"1 contain three literals, so that clause is unchanged. However for ‹p"4, the
two clauses only contain 2 literals. Thus we add an auxiliary variable p to both of them giving
‹p"'4 = ( y4 V y5 V p ) A ( y4 V y5 V p ) A ( y4 V y5 V p ) A ( y4 V y5 V p )
• Also note that the very first clause in ‹p' only contains one literal ( y1) so we expand using auxiliary
variables p and q giving
‹p"'0 = ( y1 V p V q ) A ( y1 V p V q ) A ( y1 V p V q ) A ( y1 V p V q )
• In this manner we convert the original expression into one that contains AND'ed clauses each with
exactly 3 0R'ed literals.
• Thus if we could solve 3-CNF in polynomial time we could solve general Boolean satisfiability in
polynomial time (and by extension any NP problem in polynomial time).

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 36
CS3452- Theory of Computation
II CSE
UNIT V - UNDECIDABILITY
Two Marks
1. Define Solvable.
A problem is said to be solvable if there exists an algorithm that can solve it in a finite amount of time,
i.e., for any input of the problem, the algorithm can produce the correct output in a finite number of steps. For
example, the problem of finding the sum of two integers is solvable, since there exists a simple algorithm that
can add two integers in a finite number of steps.
2. Define Unsolvability. (Or) What is unsolvable problem? Give example. [Apr. / May 2019]
A problem is said to be unsolvable if there does not exist any algorithm that can solve it in a finite
amount of time. One well-known example of an unsolvable problem is the Halting problem, which asks
whether a given program will eventually halt or run forever. It has been proven that there is no algorithm that
can solve the Halting problem for all possible inputs.
3. Define Semi decidable (or) partial solvable.
• A problem, P is said to be semi decidable, if P is recursively enumerable.
• A problem is RE if M terminates with “YES” if it accepts w C L; and doesn't halt if w C L.
• Then the problem is said to be partial solvable / Turing acceptable.
YES ( if W E L)

Loop Forever( if W g L)

4. When a problem is said to be decidable and give an example of undecidable problem. [Nov/Dec-
2003,20 12, 2015, May-06,05]
A problem whose language is recursive is said to be decidable. Otherwise, the problem is undecidable. The
class of problems which can be answered as “Yes” are called solvable or decidable. The class of problems which
can be answered as “No” are called undecidable problems.
Following are undecidable problems.
i)Whether the language accepted by a TM is empty.
ii) Whether the language accepted by a TM is regular language.
iii)Whether the language accepted by a TM is context free language.
5. When we say a problem is decidable (Or) Define Decidable 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”.
6. Mention the example of Decidable Problems.
Here are some examples of decidable problems:
• Given a mathematical statement, determine whether it is true or false.
• Checking whether a given string is a palindrome.
• Determining whether a number is even or odd.
• Checking whether a given graph is connected.
• Verifying whether a given regular expression matches a string.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 37
CS3452- Theory of Computation
II CSE
• Checking whether a given number is prime.
• Determining whether a given Turing machine halts on a given input.
7. Check whether the context-free language is decidable?
There is a context-free grammar G for a context-free language L, and an input string w. The Turning
Machine M decides on input (G,w). If it accepts, then in accept state and if it rejects, then in reject state. So,
context-free language is decidable.
8. Define Undecidable language?
The problem is Undecidable if there is no algorithm and we cannot predict whether the input is
accepted by Turing machine or not. Undecidable problem exists if and only if there exists no algorithm to
solve the problem in finite time.
(or)
If a problem is not a recursive language, then it is called undecidable problem.
9. Give an example of undecidable problem.
The undecidable problems are
• Halting problem of the TM.
• Undecidability of ambiguity of CFG's
• Complement of a list language
• Problems about problem
10. Mention the difference between decidable and undecidable problems. [Nov/Dec 2010] (or) How
to distinguish the difference between decidable and undecidable problem? (or)
What is the main difference between Decidability and Undecidability problems?
Decidability problems are problems that can be solved using an algorithm, while undecidability
problems cannot be solved by any algorithm, often due to complexity, ambiguity, or inherent limitations in
computation or lack of a clear solution.
11. Can undecidable problems be solved by an algorithm?
Undecidable problems cannot be solved by any algorithm because they lack a well-defined solution that
can be computed using a finite sequence of steps. These problems are typically too complex or exhibit
fundamental limitations in computation.
12. Why is Decidability important?
Decidability is important because it allows us to determine whether a problem can be solved
algorithmically, providing insight into the nature of computation and helping us to identify the limits of what can
be computed.
13. What is the halting problem?
• The halting problem is the problem of finding if the program (or) Turing machine halts or loop forever.
• The halting problem is un-decidable over Turing machines.
• In Automata, a halting problem is defined as -

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 38
CS3452- Theory of Computation
II CSE

M halts on w
Input AC £!'

String(w) ’ "
Turning
M doesnot halt on W
Machine Reject

• There is a Turning Machine (M), over an alphabet Z(a,b), the problem is : does M halt when it is given w
as an input string.
• A halting problem is undecidable.
14. What are some other well-known undecidable problems related to a Turing Machine?
The Membership, Finiteness, and Emptiness of a Turing Machine are all well-known undecidable
problems related to a Turing Machine.
15. When a language is said to be recursive? Is it true that every regular set is not recursive?
[Nov/Dec 2005, Apr/May 2021]
• A language L is said to be recursive if there exists a Turing machine M that accepts every string of the
language L, and goes to halt state or else rejects those strings that are not in the language L.
• If the input is accepted, M halts with the answer,” YES”
• w C L the Turing machine doesn't accept the string.
• If w C L, then M halts with answer, “NO”.
• The recursive languages are called Turing decidable languages
• Recursive language will halt on every input.

TM Accept
Input String
Reject

16. What is recursively enumerable? [May-12,Nov/Dec-13] (or)


When a language is said to be recursively enumerable? [Nov/Dec 2010, 2012, 2013, April / May 2012,
2013, 2014,2018]
• A language L is recursively enumerable if there exist a Turing machine, M that accepts every string of
the language L and does not accept strings that are not in the language L.
• If the input string is accepted, M halts with the answer, “YES”.
• If the string is not an element of L, then M may not halt and enters into infinite loop.

EYES (i fW E L)
Input String TM
Loop Forever( if w e L)

• The Recursively Enumerable Languages is called Turing acceptable languages.


• Recursively Enumerable may not halt on every input; it may fall into an infinite loop.
• Every Recursively Enumerable language is not recursive.
17. Give two properties of Recursively Enumerable Sets which are undecidable.
The languages accepted by Turing machines are called recursively enumerable (RE) language. Every
UNIT V — UNDECIDAB ILITY
Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 39
CS3452- Theory of Computation
II CSE
non-trivial property of RE is undecidable. Here are two such properties.
i)Whether the language accepted by a TM is regular language.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 40
CS3452- Theory of Computation
II CSE
ii) Whether the language accepted by a TM is context free language.
These are the two properties that are undecidable.
18. Differentiate between recursive and recursively enumerable languages. [Apr/May-07]
Comparison Recursive Language Recursively enumerable language
Also Known Turing decidable languages Turing recognizable languages
as
Definition In Recursive Languages, the Turing In Recursively enumerable languages, the
machine accepts all valid strings that Turing machine accepts all valid strings
are part of the language and rejects all that are part of the language and rejects all
the strings that are not part of a given the strings that are not part of the given
language and halt. language but do not halt and starts an
infinite loop.
States (1) Halt and accept (1) Halt and accept
(2) Halt and Reject (2) Halt and Reject
(3) Never Halt (Infinite loop)
Loop Finite Loop Infinite loops of machine are possible
Halting Halting Turing Machine Non Halting Turing Machine
Accept/ Accept (Turing machine) = L Accept (Turing machine) = LReject
Reject Reject (Turing machine) = L’ (Turing machine) + Loop (Turing
Loop (Turing machine) = ‹p‹p machine) = L’
‹p = null
Closed under Closed under all except Closed under all except set difference, and
homomorphism, substitution, GSM complementation.
mapping, and rational transduction
19. When is a Recursive Languages are also recursive enumerable?
Proof — If L is a recursive then there is TM which decides a member in language then — M
accepts on x if x is in language L.
M rejects on x if x is not in language L.
According to the definition, M can recognize the strings in language that are accepted on those strings.
20. When a recursively enumerable language is said to be recursive? Is it true that the language
accepted by a non-deterministic Turing machine is different from recursively enumerable language?
[May/June 2016]
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, recursively enumerable 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.
21. When is a Recursively Enumerable language said to be Recursive? [May-June2016, 2005, 2013,
2014]
A recursively enumerable language is the language which accepts every string otherwise not. If a
language halt on every string, it is called a recursive language.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 41
CS3452- Theory of Computation
II CSE
The recursive enumerable language is generated by Unrestricted Grammar or type -0 language.
A language L is a recursive enumerable language and M is a Turning machine that accepts the input
string w :
If w e L, M halts for the final state
if w $ L, M halts in a non-final state, loop forever.
22. Define “Non-Recursive” languages. [Nov/Dec 2022]
A language L is non recursive, if L is the set of strings not accepted by Turing Machine.
23. Differentiate Recursive and Non-recursive language. [April/May201 5]
Recursive
• A language L is said to be recursive if there exists a Turing machine M that accepts every string of the
language L, and goes to halt state or else rejects those strings that are not in the language L.
• If the input is accepted, M halts with the answer,” YES”
• w $ L the Turing machine doesn't accept the string.
• If w $ L, then M halts with answer, “NO”.
• The recursive languages are called Turing decidable languages
• Recursive language will halt on every input.

TM Accept
Input String
Reject
Non Recursive language
A language L is non recursive, if L is the set of strings not accepted by Turing Machine.
24. Define Non Recursively enumerable language.
If the language L is not recursively enumerable, then there is no algorithm for listing the members of
L. It might be possible to define L by specifying some property that all its members satisfy, but that property can't
be computable.
25. What are Recursive sets? [Nov/Dec-13]
A language is said to be recursive if there exists a turing machine that accepts the strings belonging to
that language and rejects on every string that are not belonging to that language. Every regular set is not
recursive.
26. What properties of recursive enumerable sets are not decidable?
What are the properties of recursively enumerable sets which are undecidable?
o Emptiness
o Finiteness
o Regularity
o Context-freedom.
27. Sate two languages, which are not recursively enumerable. [Dec-09]
Diagonalization language is not recursively enumerable.
The partially decidable languages or undecidable languages are not recursively enumerable.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 42
CS3452- Theory of Computation
II CSE
4 For instance: for given input whether the TM will eventually halt is or not? This is undecidable and
hence is not recursively enumerable.
28. What are the properties of recursive and recursively enumerable language? [Nov-Dec20 17]
1. The union of two recursive language is recursive.
2. The language L and its complement L are recursively enumerable, then L is recursive.
3. The complement of a recursive language is recursive.
4. The Union of two recursively enumerable languages is recursively enumerable.
5. The intersection of two recursive language is recursive.
6. The intersection of two recursively enumerable language is recursively enumerable.
29. Show that the complement of a recursive language is recursive. [Dec-04, may-05]
Proof
• Let L be a recursive language accepted by the turning machine, M1.
• Let L be a recursive language accepted by the Turing machine M2.
• The construction of M1 and M2 are given as,

M1 M2
W e La No Yes
R R
• Let w C L, then Ml accepts w and halts with “YES”.
• Ml rejects w if w $ Land halts with “NO”
• M2 is activated once M1 halts.
• M2 works on L and hence if M1 returns “YES”, M2 halts with “NO”.
• If Ml returns “NO”, then M2 halts with “YES”
• Thus for all w, where w C L or w $ L , M2 halts with either “YES” or
“NO” Hence the complement of a recursive language is also recursive
30. 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.
31. State Post's correspondence problem. [Nov-Dec 2021] (or)
Define PCP or Post Correspondence Problem.
• "The Post's correspondence problem consists of two lists of string that are of equal length over the input
The two lists are A = w1, W2, W3,....., Wn aild B = Xl, X2, X3,..Xn then there exists a non empty set of integers
11, 12, 13, .... , In Such that, W1, W2, W3, .... Wn * X1, X2, X3,...Xn".
• To solve the post correspondence problem we try all the combinations of i1, 12, 13,..........., ln TO find the w1 =
x1 then we say that PCP has a solution.
32. Define MPCP or Modified PCP.
• It is easier to reduce Lu TO PCP if we first introduce an intermediate version of PCP, which we call it as
Modified Post's Correspondence Problem, or MPCP.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 43
CS3452- Theory of Computation
II CSE
• 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.
• More formally, 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
wi1, wi2..... wim, = xi1, xi2,. xim.
• Note 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.
• Also, 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 wi = xi (but those instances are rather uninteresting and will not figure in
our use of MPCP).
33. What is the difference between PCP and MPCP?
• Identifying whether a set of dominoes has a match or not is the Post's Correspondence Problem
(PCP).
• Similar to PCP, the modified Post's Correspondence Problem (MPCP) just requires that we specify the
set of tiles as well as a particular tile.
• The difference between MPCP and PCP is that in the MPCP, a solution is required to start with the
first string on each list.
34. What is post correspondence problem in automata?
Post correspondence problem is an undecidable problem in automata. Here in this problem, there is N
number of dominos, i.e., tiles. And we have to arrange the dominos in such a way that the string produced by
the denominators and the numerators is same.
35. Why is post correspondence problem undecidable?
Because no specific method can tell whether a post correspondence problem has a solution or not, the
postman correspondence problem is intractable. The technique for proving the theorem can be done in a
number of ways, but they are all essentially the same.
36. What is silly post correspondence problem?
A set of dominoes S is in the silly Post Correspondence Problem (SPCP) if and only if S contains a
piece whose top string perfectly matches the bottom string. As a result, SPCP is decidable in nature.
37. What is a Diagonalization language Ld?
The language Le, the “diagonalization” language, is the set of strings w; such that wi is not in L(Mi).
L(Mi) = 4 if wi is valid Turing machine code.
That is, La consists of all strings w such that the Turing Machine M whose code in w does not accept the input

It is clear that the below table tells for all i and j, whether the Turing Machine Mi accepts input strifl Wj:
• if (i,j)= 1 means "yes it is accepted" and
• if (i,j)= 0 means "no it doesn't" accepted or rejected.
We may think of the ith row as the characteristic vector for the language L(M;); that is, the 1's in this row
indicate the strings that are members of this language.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 44
II CSE CS3452- Theory of Computation

38. Define diagonalization.


• The process of complementing the diagonal to construct the characteristic vector of a language that
cannot be the language that appear in any row is called diagonalization.
39. Define universal language.
The language Lu lS the set of binary strings that consist of encoded pairs (M, w) such that M is an encoding of
a Turing machine and w is an encoding of a binary input string accepted by that Turing machine.
40. What is a universal language L«? (Nov/Dec 2015)
The language Lu lS the set of binary strings that consist of encoded pairs (M, w) such that M is an
encoding of a Turing machine and w is an encoding ofa binary input string accepted by that Turing machine.
Thus, the binary string belongs to a universal language.
41. Define Universal Turing machines. [Nov/Dec 2016] (or)
What do you mean by Universal Turing machine? [Nov/Dec 2005, 2013, April/May 2018] (or)
What is Universal Turing Machine(UTM)?
• Universal Turing machine is a type of TM which is capable of doing anything that any other TM can do.
That means universal TM is a TM that imitates any TMT.
• A Universal Turing Machine is a machine that can simulate an arbitrary Turing machine over any
collection of input symbols. It takes two inputs. The first is the description of the machine, and the other is
the input data.
42. Why do we need a Universal Turing Machine?
A Universal Turing Machine, in more specific terms, can imitate the behavior of any Turing machine
over any set of input symbols. Hence, we needed to build a single machine that could be used to calculate
any computable sequence.
43. What is the input of Universal Turing machine?
To use a Universal Turing Machine, you need to write some input on its tape and start the machine.
When the machine computes and halts, the value on the tape is the output. The input of a UTM includes the
description of a machine M and its input data.
44. Why is the Universal Turing Machine important?
The Universal Turing Machine is important because it demonstrates the power of a single, general -
purpose computing device and is the theoretical foundation of modern computing. It also shows that any
algorithmic computation that can be carried out by any Turing Machine can be simulated by a Universal
Turing Machine.
45. Can a Universal Turing Machine solve any problem?
A Universal Turing Machine can compute any algorithmic computation that can be carried out by any
Turing Machine. However, there are some problems that are not algorithmically computable and cannot be
solved by any Turing Machine, including the halting problem.
46. Is a Universal Turing Machine a physical machine?
The Universal Turing Machine is a theoretical construct that exists only in the realm of mathematics and
computer science. While there have been attempts to build physical machines that simulate Turing
Machines, a true Universal Turing Machine cannot be built in the physical world.

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 44
II CSE CS3452- Theory of Compoutation

47. What are the features of Universal Turing machine? [May 2007]
Following are the features of Universal Turing machine (UTM).
Universal Turing machine is a kind of turing machine can simulate any other turing machine. In other
words, UTM is a single machine used to compute any computable sequence.
Another interesting feature of UTM is that it has an ability to manipulate an unbounded amount of data
in finite amount of time.
48. What are the concepts used in UTMs?
• Stored program computers.
• Interpretive Implementation of Programming languages.
• Computability.
49. What are the two classes of problems that are solved by the Turing machine?
The two classes of problems that can be solved by the Truing machines are as follows.
1. Those problems that have an algorithm
2. Those that are only solved by Turing machine.
50. What is the weak-form of Turing thesis?
A Turing Machine can compute anything that can be computed by a general purpose digital computer.
51. What is the strong-form of Turing thesis?
A Turing Machine can compute anything that can be computed. This is the strong form of Turing thesis.
52. What are the reasons for a TM not accepting its input?
i) The TM may halt in a non final state.
ii) The TM may enter into an indefinite loop.
53. Give the difference between Turing Machine and Universal Turing Machine.
Turing Machine Universal Turing Machine
1. It is a mathematical model of computation it Universal Turing Machine is like a single Turing
manipulates symbols on the tape according Machine that has a solution to all problem that is
to the rules defined computable
2. A program can be compared to a Turing Programmable Turing Machine is called Universal
Machine Turing Machine
3. Turing machine's temporary storage is tape. Universal Turing Machine contains Turing Machine
The infinite cells of the Turing machine can description as input along with an input string, runs
contain input symbols and blanks. the Turing Machine on the input and returns the
result.
4. Turing machines help us understand the Although developed for theoretical reasons, it
fundamental limitations of mechanical helped in the development of stored program
computation power computers
5. A Turing machine is a formal model of a Universal Turing Machine provides a solution to
computer with a fixed program problems that are computable
6. It does not minimize the space complexity It minimizes space complexity

UNIT V — UNDECIDAB ILITY


Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 45
II CSE CS3452- Theory of Computation
7, Transition function which Turing Machine The transition function is Q T —r Q T {L, R},
performs is defined as: ó X T -> Q X T X {L,R}, where Q is a finite set of states, T is the tape of
the where ó is the transition function alphabet
8. In the set theory point of view, all Turing Universal Turing Machine is a subset of all the
machines forma setof the all the device that Turing Machines
accepts type 0 grammar

54. Define Tractable and Intractable problems.


Tractable Problems/Languages
• The languages that can be recognized by a Turing machine in finite time and with reasonable space
constraint is said to be tractable.
• Example: If the language L1 C Time (f), then L is tractable and is less complex in nature
• Example: If L2 $ Time (f), L2 is complex and cannot be tractable in limited time.
• Tractable problems are those that can be solved in polynomial time period.
Intractable Problems
• The languages that cannot be recognized by any Turing machine with reasonable space and time
constraint is called intractable problems.
• These problems cannot be solved in finite polynomial time.
• Even problems with moderate input size cannot achieve feasible solution
55. What are tractable problems? Nov-Dec20 17
The problems which are solvable by polynomial time algorithm is called tractable problems. For Eg.
The complexity of the Kruskal ’s algorithm is 0(e(e+m)) where e the number of edges and m the number of
nodes.
56. What are the Types of Complexity Classes?
P Class
NP
Class
CoNP
Class NP-
hard
NP-complete
57. What is computational complexity theory?
Computational complexity theory is a branch of theoretical computer science. It's main goal is to
classify and compare the practical difficulty involved in solving computational problems about finite
combinatorial objects.
Computational complexity theory seeks to determine the amount of resources that it will take to solve
a specific problem. It also aims to explain why some problems are undecidable or intractable.
58. What are computational problems?
The types of computational problems are:
1. Decision problems
In a decision problem, the answer for every question is either ‘yes’ or ‘no’. These problems are usually
presented as the sets of all the instances for which the answer is ‘yes.’

UNIT V — UNDECIDAB ILITY


II CSE CS3452- Theory of Computation
Handled By, P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 46
II CSE CS3452- Theory of Computation
2. Search problems
The answers in a search problem can be arbitrary strings. Search problems can be represented as search
relations (relations that consist of all the instance -solution pairs).
3. Counting problems
These problems ask for the number of solutions for a particular search problem. They are represented by a
function f from {0,1}* to the nonnegative integers.
4. Optimization problems
Such problems seek to find the best possible solution from the set of all the possible solutions to a search
problem. These problems can be represented by their search relations.
5. Function problems
In these problems, for every input, there is a single output expected. These outputs are far more co mplex than
the outputs for decision problems. The answer can't just be ’yes’ or ’no’.
59. What is meant by computational complexity?
• Computational complexity refers to the complexity of an algorithm. It is the amount of resources that are
needed to run the algorithm and specifically focuses on time and memory requirements.
• The computational complexity of a problem is essentially the complexity of the best algorithms that
make it possible to solve the problem.
60. What are complexity classes?
Complexity classes are sets of problems of related complexity. Simple complexity classes are defined by
the type of computational problem, the model of computation, and the resource or resources that are being
bounded, and the bound.
61. Why is computational complexity theory important?
Computational complexity theory is a vital topic in theoretical computer science. It has direct
applications to computability theory and makes use of computation models like Turing machines to
assist in testing complexity.
One of the reasons why computational complexity theory is important is that it aids computer
scientists in relating and grouping problems together into complexity classes. Sometimes, if you can
solve one problem in a complexity class, you can find a way to solve other problems in its complexity
class as well.
Computational complexity also assists in determining the difficulty of a problem, which is usually
measured in terms of the amount of time and space (memory) that it takes to solve a specific problem. As
an example, some problems can be solved in polynomial amounts of time and others take exponential
amounts of time, with respect to the input size.
62. Define the classes P and NP problems. [May- 2013, 2014, Nov-Dec 2019] (or) Define the
classes P and NP problem. Give example problems for both. [Apr/May 2021]
P class problems - problems that can be solved in “polynomial time” are called P class problems. For example
— The sorting and searching problems.
NP class problems - problems that can be solved in non-deterministic polynomial time. For example —
Traveling salesperson problems, graph coloring problem. The NP class problems can be NP -Complete and NP
— hard problems.

UNIT V — UNDECIDAB ILITY


Handled By,P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 47
II CSE CS3452- Theory of Computation
63. Mention the features of P class.
The solution to P problems is easy to find.
P is often a class of computational problems that are solvable and tractable. Tractable means that the
problems can be solved in theory as well as in practice. But the problems that can be solved in theory but
not in practice are known as intractable.
64. Define the class NP problem. [Nov/Dec-13, Nov-Dec 2019]
The NP stands for non-deterministic polynomial time. That means all the problems in this class are
solved in non deterministic polynomial time. The problems belonging to this class are - Traveling
salesperson problems, graph coloring problem and Knapsack problem.
65. Give examples for NP-complete Problems.
The NP- complete problems are — Traveling salesperson problems, graph coloring problem, 0/1
knapsack problem, Hamiltonian circuit problem.
66. Mention the features of NP class.
The solutions of the NP class are hard to find since they are being solved by a non -deterministic
machine but the solutions are easy to verify.
Problems of NP can be verified by a Turing machine in polynomial time.
67. Mention the difference between P and NP problems. [May-2012, Apr/May 2021]
P NP
An algorithm in which for given input the An algorithm is called non deterministic polynomial
definite output gets generated is called time algorithm (NP class) when for given input there are
polynomial time algorithm (P class) more than one paths that the algorithm can follow. Due
to which one can not determine which path is to be
followed after particular stage.
Time is fixed. Time is not fixed.
In polynomial time, the input is fixed. In NP, the input is not fixed.
Use a deterministic Turing machine They can only be solved deterministically in exponential
time
Every problem which is a P class is also in Every problem which is in NP class is not in the P class.
NP class.
The process is fixed. The process is not fixed.
All P problems are deterministic in nature. All the NP problems are non-deterministic in nature.
P problems can be efficiently solved. NP problems which, given a proposed solution, we can
efficiently check if it works.
Selection sort, Linear search. TSP, Knapsack problem.
Example : Prime number is a relatively easy Example: Travelling salesman problem
problem to solve.

68. Define NP - Complete Problem. [Nov/Dec2016] A


problem D is called NP-complete if -
i) It belongs to class NP

UNIT V — UNDECIDAB ILITY


Handled By,P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 48
II CSE CS3452- Theory of Computation
ii) Every problem in NP can also solved in polynomial time.
69. Write the significance of NP problems. [Nov/Dec 2022]
• NP- problems are significant because all NP- problems are thought of having similar hardness, in that
process solving one implies that others are solved as well.
• If some NP- problems are proven to be in P, then all of NPs are proven to be in P.
• Because, note that any NP language can be reduced to an NP -complete language. Use this reduction
and the algorithm for the given NP-complete problem to solve any problem in NP. Hence all of them
will have polynomial time solutions.
70. What is an NP-complete problem?
• An NP-hard problem also in NP is called NP-complete. That is, one of the NP problems is as hard as every
other problem in NP, and solving that problem will solve all NP problems.
• All NP-complete problems are NP-hard but all NP-hard problems cannot be NP-complete.
• The NP complete problems are intersection of NP class problems and NP hard problems.
71. Define NP Complete class.
A problem is NP-complete if it is both NP and NP-hard. NP-complete problems are the hard problems
in NP.
72. What are the features of NP Complete?
NP-complete problems are special as any problem in NP class can be transformed or reduced into NP-
complete problems in polynomial time.
If one could solve an NP-complete problem in polynomial time, then one could also solve any NP
problem in polynomial time.
73. Give examples for NP — Complete Problem. [Nov/Dec 2014]
Some example problems include: Decision
version of 0/1 Knapsack.
Hamiltonian Cycle.
Satisfiability.
Vertex cover.
74. Give the difference between NP hard and NP complete.
NP hard NP complete
In NP-Hard, Time is unknown. In NP-Complete Time is not fixed.
The input in the NP-hard problem is undefined. The input in the NP-complete problem is not
fixed.
Not all NP-hard problems are NP-complete. All NP-complete problems are NP-hard.
The process is undefined. The process is not fixed.
NP-hard problems that are, in a certain sense, are NP-complete problems are the toughest
atleast as difficult to solve as any other NP-problem problems that are in NP.
Example: Vertex cover problem,Halting problem. Example: Determine whether a Boolean
formula is satisfiable or not, Circuit-
satisfiability problem

UNIT V — UNDECIDAB ILITY


Handled By,P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 49
II CSE CS3452- Theory of Computation
NP HARD is not a decision problem. NP COMPLETE is exclusively a decision
problem.

75. When do you say a problem is NP-hard? [Dec-09]


A problem is said to be NP-hard is an algorithm for solving it can be translated into a problem which is
a NP problem. Thus NP-hard is a algorithm for a problem which is at least as hard as any NP-problem. For
example — Sum of subset problem, travelling salesperson problem.
76. Define NP-hard class. [Nov/Dec 2016]
An NP-hard problem is at least as hard as the hardest problem in NP and it is a class of problems such
that every problem in NP reduces to NP-hard.
77. What are the features of NP-hard class?
All NP-hard problems are not in NP.
It takes a long time to check them. This means if a solution for an NP -hard problem is given then it
takes a long time to check whether it is right or not.
A problem A is in NP-hard if, for every problem L in NP, there exists a polynomial-time reduction from
L to A.
78. List some of the examples of Np-hard.
Halting problem.
Qualified Boolean formulas. No
Hamiltonian cycle.
79. Define Complexity classes.
• The complexity classes is a set of problems of related complexity.
• It includes function problems, P classes, NP -classes, optimization problem.
80. Define Co-NP Class.
Co-NP stands for the complement of NP Class. It means if the answer to a problem in Co -NP is No,
then there is proof that can be checked in polynomial time.

81. What are the features of Co-NP Class?


If a problem X is in NP, then its complement X’ is also in CoNP.
For an NP and CoNP problem, there is no need to verify all the answers at once in polynomial time,
there is a need to verify only one particular answer “yes” or “no” in polynomia l time for a problem to be
in NP or CoNP.
82. Give some examples of Co-NP class.
To check prime number.
Integer Factorization.
83. Define NP completeness. [April/May 2017]
A problem is NP-complete if answers can be verified quickly, and a quick algorithm to solve this
problem can be used to solve all other NP problems quickly.

UNIT V — UNDECIDAB ILITY


Handled By,P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 50
II CSE CS3452- Theory of Computation
84. What is meant by Reduction.
A reduction is a way of converting one problem into another problem such that a solution to the second
problem can be used to solve the first problem. We say the first problem reduces to the second problem.
85. What is primitive recursive function? [May-June 2017] (or) Define the primitive recursion
operation. [Nov-Dec 2018]
Function is considered primitive recursive if it can be obtained from initial functions and through
finite number of composition and recursion steps.
86. Identify whether 'Tower of Hanoi' problem is tractable or intractable. Justify your answer.
[May-June 2016]
'Tower of Hanoi' problem is intractable.
Intractable Problem: a problem that cannot be solved by a polynomial-time algorithm. The lower bound is
exponential.
Towers of Hanoi: we can prove that any algorithm that solves this problem must have a worst-case running
time that is at least 2n_J,
87. Show that AMBIGUITY problem is undecidable.
Consider the ambiguity problem for CFGs. Use the “yes -no” version of AMBIGUITY. An algorithm
for FIND is used to solve AMBIGUITY. FIND requires producing a word with two or more parses if one
exists and answers “no” otherwise. By the reduction of AMBIGUITY to FIND we conclude there is no
algorithm for FIND and Hence no algorithm for AMBIGUITY.
88. 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.
89. What are the major problems in Computational Complexity?
There are several major problems in computational complexity theory that remain open and actively
researched. Here are a few examples:
• P versus NP problem
• Complexity of specific problems
• Circuit lower bounds
• De-randomization
• Quantum complexity theory
90. Define trivial property.
A property is trivial if it is either empty of is all RE languages.
91. Define Rice Theorem.
Rice's Theorem: Any non trivial property of the languages accepted by Turing machines is undecidable. Fc
instance, the net of codes for Turing machines whose language is empty is undecidable by Rice's theorem. I
fact, this language is not RE, although its complement — the set of codes for TM's that accepts at least on
string — is RE but not recursive

UNIT V — UNDECIDAB ILITY


Handled By,P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 51
II CSE CS3452- Theory of Computation
92. What do you mean SAT problem?
• SAT(Boolean Satisfiability Problem) is the problem of determining if there exists an interpretation that
satisfies a given Boolean formula.
• It asks whether the variables of a given Boolean formula can be consistently replaced by the values
TRUE or FALSE in such a way that the formula evaluates to TRUE.
• If this is the case, the formula is called satisfiable.
• On the other hand, if no such assignment exists, the function expressed by the formula is FALSE for all
possible variable assignments and the formula is unsatisfiable.
93. What is meant by CNF - SAT Problem?
• This problem is based on Boolean formula. The Boolean formula has various Boolean operations such as
OR (+), AND (.) and NOT. There are some notations such as (means implies) and (means if and only
if).
• A Boolean formula is in Conjunctive Normal Form (CNF) if it formed as collection of subexpressions.
These subexpressions are called clauses.
• For example
{a + b + d + g (c + é)b + d + f + h) pa + c + e + h)
• This formula evaluates to 1, if b,c, d are 1.
• The CNF — SAT is a problem which takes Boolean formula in CNF form and checks whether any
assignment is there to Boolean values so that formula evaluates to 1.
94. What are the steps for proving NP Complete?
Consider that we have to prove that B is in NP
Step 1: Select an NP complete language say A.
Step 2: Construct a function f that maps the members of A to members of B. Step
3: Show that x is in A if and only if f(x) is in B.
Step 4: Now show that the function f can be computed in polynomial time.
Step 5: This if A is NP complete and it can be reduced to B in polynomial time, then B comes out to be NP
complete.
95. How to prove SAT is NP-Hard?
• In order to prove that this problem is NP-Hard then reduce a known problem, Circuit-SAT in this case to
our problem. The boolean circuit C can be corrected into a boolean formula as:
i. For every input wire, add a new variable yi.
ii. For every output wire, add a new variable Z.
iii. An equation is prepared for each gate.
iv. These sets of equations are separated by D values and adding D Z at the end.
This transformation can be done in linear time or polynomial time.

UNIT V — UNDECIDAB ILITY


Handled By,P.Dinesh Babu, AP / CSE, V.R.S.College of Engineering & Technology, Arasur Page 52

You might also like