Unit V Undecidability
Unit V Undecidability
Unit V Undecidability
UNIT V
UNDECIDABILITY
A language that is not Recursively Enumerable (RE) – An undecidable
problem that is RE – Undecidable problems about Turing Machine – Post’s
Correspondence Problem - The classes P and NP.
PROBLEM:
Ex:
Obtain the code for (M, 1011) where M = ({q1, q2, q3}, {0, 1}, {0,1,B},
δ, q1, B, {q2}), δ is,
128
Theroem:
If L and L are recursively enumerable then L is recursive.
Proof:
Let M1 be the L and M2 be the L . Construct M to simulate M1 and M2
simultaneously, since ‘w’ is either in L or L .
M accepts ‘w’ if M1 accepts it and M rejects ‘w’ if M2 accepts it. Thus
M will always say either “Accept” or “reject”. Since M is accepts L. Thus L is
recursive.
representing a TM and an input accepted by that TM. We shall show that there is
a TM U, often called the universal Turing Machine such that Lu = L(U).
• It is easiest to describe U as a multitape TM.
• In the case of U, the transitions of M are stored initially on the first tape,
doing with the string ‘w’.
• A second tape will be used to hold the simulated tape of M, using the
same format as for the code of M.
• That is, tape symbol Xi of M will be represented by 0i, and tape symbols
will be separated by single 1’s.
• The third tape of U holds the state of M, with state qi represented by ‘i’,
0’s.
(5) If M has no transition that matches the simulated state and tape symbol,
then no transition will be found. Thus, M halts in the simulated
configuration.
(6) If M enters its accepting state, then U is accepts.
Proof:
We know that Ld is not recursive, by reducing Ld to Lu.
Theorem:
Lne is not recursive.
Proof:
In this, we must design an algorithm that converts an input that is a
binary coded pair(M, w) into a TM M’ such that L(M’) ≠ if and only if M
accepts input ‘w’. The construction of M’ is shown in following fig.
If M does not accept ‘w’, then M’ accepts none of its input’s, ie., L(M’)
= . However, if M accepts w, then M’ accepts every input, and thus L(M’)
surely is not . M’ is designed to do the following;
(1) M’ ignores its own input ‘x’. Rather it replaces its input by the string
that represents TM M and input string ‘w’. Since M’ is designed for a
specific pair (M, w) which has some length n, we may construct M’ to
have a sequence of states q0,q1,……,qn, where q0 is the start state.
a. In state qi, for i=0, 1, ……, n-1, M’ writes the (i+1), bit of the
code for (M, w) goes to state qi+1, and moves right.
b. In state qn, M’ moves right, if necessary replacing any nonblanks
by blanks.
(2) When M’ reaches a blank in state qn, it uses a similar collection of states
to reposition its head at the left end of the tape.
(3) Now, using additional states, M’ simulates a universal TM U on its
present tape.
(4) If U accepts, then M’ accepts. If U never accepts, then M’ never accepts
either.
Ex.1:
Consider the correspondence system as given bellows,
Ex.2:
Consider the correspondence system as given bellows,
Does this PCP have a
solution?
Soln:
In this case, PCP has a solution. We find, wi1, wi2,……..wim = xi1,
xi2,………xim
Let m = 6, ie) i1 = 1, i2 = 2, i3 = 1, i4 = 3, i5 = 3, i6 = 4
(1) (2) (1) (3) (3) (4)
List A: 1 0 1 010 010 11
List B: 10 10 10 01 01 1
ie) wi1, wi2,……..wim = xi1, xi2,………xim
10101001011 = 10101001011
∴ The solution list is {1, 2, 1, 3, 3, 4}
Ex.3:
Consider the correspondence system as given bellows,
Soln:
In this case, PCP has no solution. Suppose that the PCP instance has a
solution, then we say, wi1, wi2,……..wim = xi1, xi2,………xim. But in this case,
it would not have the equal string [∴ wi ≠ xi]. So we find the partial solution.
ie) If i1 = 1, i2 = 3, then the two corresponding strings from lists A and B would
have to begin.
List A: 10101 …...
List B: 101011…..
ie) wi1, wi2,……..wim = xi1, xi2,………xim
10101 ≠ 101011
∴ The two strings can never become equal.
Ex:
Consider the correspondence system as given bellows,
Ex:
An instance of MPCP is defined as,
The essential idea is that MPCP instance (A, B) simulates, in its partial
solutions, the computation of M on input ‘w’. Let M = (Q, Σ, Γ, δ, q0, B, F) be a
TM and let w in Σ* be an input string. We construct an instance of MPCP as
follows;
(1) The first pair is:
List A List B
# #q0w#
This pair, which must start any solution according to the rules of MPCP,
begins the simulation of M on input ‘w’.
(2) Tape symbols and the separator # can be appended to both lists. The pairs,
List A List B
X X
# # for each X in Γ.
(3) To simulate a move of M, we have certain pairs that reflect those moves.
For all ‘q’ in Q-F, p in Q, and X, Y and Z in Γ we have;
List A List B
qX Yp if δ(q, X) = (p, Y, R)
zqX pZY if δ(q, X) = (p, Y, L); ‘Z’ is an tape
symbol
q# yp# if δ(q, B) = (p, Y, R)
zq# pZY# if δ(q, B) = (p, Y, L); ‘Z’ is an tape
symbol
(4) If the ID at the end of the B string has an accepting state, then we need to
allow the partial solution to become a complete solution. Thus, if ‘q’ is an
accepting state, then for all tape symbols ‘X’ and ‘Y’ there are pairs;
List A List B
XqX q
XqY q
YqX q
YqY q
Xq q
Yq q
qX q
qY q
(5) Finally, once the accepting state has consumed all tape symbols, it stands
alone as the last ID on the string. That is the remainder of the two strings
is q#. We use the final pair;
141
List A List B
q## #
Ex:
Consider the TM M and w=01, where M=({q1, q2, q3}, {0,1}, {0,1,B}, δ,
q1, B, {q3}) and δ is given by,
qi δ(qi, 0) δ(qi, 1) δ(qi, B)
→q1 (q2, 1, R) (q2, 0, L) (q2, 1, L)
q2 (q3, 0, L) (q1, 0, R) (q2, 0, R)
*q3 - - -
Reduce the above problem to PCP and find whether that PCP has a solution or
not?
Soln:
Rule List A List B Source
(1) # #q101#
0 0
(2) 1 1
# #
q10 1q2 From δ(q1, 0) = (q2, 1, R)
0q11 q200 From δ(q1, 1) = (q2, 0, L)
1q11 q210 From δ(q1, 1) = (q2, 0, L)
0q1# q201# From δ(q1, B) = (q2, 1, L)
(3) 1q1# q211# From δ(q1, B) = (q2, 1, L)
0q20 q300 From δ(q2, 0) = (q3, 0, L)
1q20 q310 From δ(q2, 0) = (q3, 0, L)
q21 0q1 From δ(q2, 1) = (q1, 0, R)
q2# 0q2# From δ(q2, B) = (q2, 0, R)
0q30 q3
0q31 q3
1q30 q3
(4) 1q31 q3
0q3 q3
1q3 q3
q30 q3
q31 q3
(5) q3## #
Now find the sequence of partial solutions, that mimics this computation
of M and eventually leads to a solution.
(1) A: #
B: #q101#
(2) A: #q101#
B: #q101#1q21#
(3) A: #q101#1q21#
B: #q101#1q21#10q1#
(4) A: #q101#1q21#10q1#
B: #q101#1q21#10q1#1q201#
(5) A: #q101#1q21#10q1#1q201#
B: #q101#1q21#10q1#1q201#q3101#
(6) A: #q101#1q21#10q1#1q201#q3101#
B: #q101#1q21#10q1#1q201#q3101#q301#
(7) A: #q101#1q21#10q1#1q201#q3101#q301#
B: #q101#1q21#10q1#1q201#q3101#q301#q31#
(8) A: #q101#1q21#10q1#1q201#q3101#q301#q31#
B: #q101#1q21#10q1#1q201#q3101#q301#q31#q3#
With only q3 left in the ID, we can use the pair (q3##, #) from rule(5) to finish the
solution.
A: #q101#1q21#10q1#1q201#q3101#q301#q31#q3##
B: #q101#1q21#10q1#1q201#q3101#q301#q31#q3##
∴ The PCP has a solution. Because it produces same string on
list A and list B.
Theorem:
Post’s Correspondence Problem is undecidable.
Proof:
The construction of this section shows how to reduce Lu to MPCP. Thus,
we complete the proof of undecidability of PCP by proving that the construction
is correct, that is;
M accepts ‘w’ if and only if the constructed MPCP instance has a
solution. If ‘w’ is in L(M), then we can start with the pair(M, w) from rule1 to
rule5, allow the A string to catch up to the B string and form a solution.
In particular, as long as M does not enter an accepting state, the partial
solution is not a solution the B string is longer than the A string. Thus, if there is
a solution, M must at some point enter an accepting state. That is M accepts w.
MWST:
A Minimum-Weight Spanning Tree has the least possible total edge
weight of all spanning trees. There is a well-known “Greedy Algorithm”, called
Kruskal’s algorithm, for finding a MWST.
Procedure:
(1) Identify the minimal edge connected component.
(2) Find the minimal edge if both the vertices belong to different connected
component then add the edge.
(3) Identify minimal edge, if that edge connects both the vertices in the same
component then leave the edge. (Otherwise it will form a cycle).
(4) Repeat the process until all the vertices are found.
Ex:
Find the MWST using Kruskal’s algorithm.
Soln:
(1) First consider the edge (1, 3) because it has the lowest weight 10.
(2) The next minimal edge is (2, 3), with weight 12. Since 2 and 3 are in
different components, we accept this edge and add the node 2 into first
connected component. ie;
(3) The third edge is (1, 2) with weight 15. However, 1 and 2 are now in the
same component, so we reject this edge and proceed to the fourth edge
(3. 4). ie;
(4) Now, we have three edges for the spanning tree of a 4-node graph and so
may stop.
Theorem:
If P1 is NP-Complete, and there is a Polynomial – time reduction of P1 to
P2, then P2 is NP – Complete.
Proof:
To show that every language L in NP Polynomial – time reduces to P2.
We know that there is a polynomial time reduction of L to P1, this reduction
takes some polynomial time P(n). Thus, a string ‘w’ in L of length ‘n’ is
converted to a string ‘x’ in P1 of length atmost P(n).
Also know that there is a polynomial time reduction of P1 to P2; Let this
reduction take polynomial time q(m). Then this reduction transforms ‘x’ to some
string ‘y’ in P2, taking time atmost q(p(n)).
Thus, the transformation of ‘w’ to ‘y’ takes time atmost p(n)+q(p(n)),
which is a polynomial. We conclude that L is polynomial time reducible to P2.
Since L could be any language in NP, we have shown that all of NP polynomial –
time reduces to P2; that is, P2 is NP-Complete.