www.csetube.
in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 1
.c
se
tu
be
.in
Design a Turing machine to add two given integers.
Solution:
Some unsolvable Problems are as follows:
(i) Does a given Turing machine M halts on all input?
(ii) Does Turing machine M halt for any input?
(iii) Is the language L(M) finite?
(iv) Does L(M) contain a string of length k, for some given k?
(v) Do two Turing machines M1 and M2 accept the same language?
It is very obvious that if there is no algorithm that decides, for an arbitrary given Turing machine M
and input string w, whether or not M accepts w. These problems for which no algorithms exist are
called UNDECIDABLE or UNSOLVABLE.
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 2
.c
se
tu
be
.in
Code for Turing Machine:
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 3
.c
se
tu
be
.in
Diagonalization language:
This table represents language acceptable by Turing machine
Proof that Ld is not recursively enumerable:
www.csetube.in
.c
se
tu
be
.in
www.csetube.in
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 4
.c
se
tu
be
.in
Recursive Languages:
www.csetube.in
.c
se
tu
be
.in
www.csetube.in
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 5
be
.in
Universal
Language:
.c
se
tu
Undecidability of Universal Language:
www.csetube.in
www.csetube.in
.c
se
tu
be
.in
Problem -Reduction :
If P1 reduced to P2,
Then P2 is at least as hard as P1.
Theorem: If P1 reduces to P2 then,
If P1 is undecidable the so is P2.
If P1 is Non-RE then so is P2.
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 6
Post's Correspondence Problem (PCP)
A post correspondence system consists of a finite set of ordered pairs
.in
for some alphabet
where
be
Any sequence of numbers
is called a solution to a Post Correspondence System.
tu
The Post's Correspondence Problem is the problem of determining whether a
Post Correspondence system has a solutions.
se
Example 1 : Consider the post correspondence system
The list 1,2,1,3 is a solution to it.
.c
Because
xi
2
3
(A post correspondence system is also denoted as an instance of the PCP)
Example 2 : The following PCP instance has no solution
i
xi
yi
1
2
www.csetube.in
yi
www.csetube.in
This can be proved as follows.
differ in the first symbol (
cannot be chosen at the start, since than the LHS and RHS would
in RHS). So, we must start with
in LHS and
. The next pair must be
so that the 3 rd symbol in the RHS becomes identical to that of the LHS, which is a
is selected next, then would be mismatched in the 7 th symbol
step, LHS and RHS are not matching. If
( in LHS and
the next step.
in RHS). If
. After this
is selected, instead, there will not be any choice to match the both side in
xi
yi
101
10
00
011
11
The following properties can easily be proved.
be
Proposition The Post Correspondence System
.in
Example3 : The list 1,3,2,3 is a solution to the following PCP instance.
se
tu
has solutions if and only if
Corollary : PCP over one-letter alphabet is decidable.
with
Proof : Let
Consider
with
is equivalent to a PCP instance over an
alphabet
.c
Proposition Any PCP instance over an alphabet
We can now encode every
as
any PCP instance over
have only two symbols, 0 and 1 and, hence, is equivalent to a PCP instance over
www.csetube.in
will now
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 6
Theorem : PCP is undecidable. That is, there is no algorithm that determines whether an arbitrary Post
Correspondence System has a solution.
.in
Proof: The halting problem of turning machine can be reduced to PCP to show the undecidability of PCP. Since
halting problem of TM is undecidable (already proved), This reduction shows that PCP is also undecidable. The
proof is little bit lengthy and left as an exercise.
Some undecidable problem in context-free languages
be
We can use the undecidability of PCP to show that many problem concerning the context-free languages are
undecidable. To prove this we reduce the PCP to each of these problem. The following discussion makes it
clear how PCP can be used to serve this purpose.
. We construct
tu
be a Post Correspondence System over the alphabet
Let
two CFG's Gx and Gy from the ordered pairs x,y respectively as follows.
se
and
.c
where
and
generates the strings that can appear in the LHS of a sequence while solving
it is clear that the grammar
the PCP followed by a sequence of numbers. The sequence of number at the end records the sequence of
generates the strings
strings from the PCP instance (in reverse order) that generates the string. Similarly,
that can be obtained from the RHS of a sequence and the corresponding sequence of numbers (in reverse
order).
Now, if the Post Correspondence System has a solution, then there must be a sequence
www.csetube.in
www.csetube.in
According to the construction of
and
Hence ,
.in
In this case
implying
be
and
tu
Conversely, let
Hence, w must be in the form w1w2 where
(since, only that kind of
se
strings can be generated by each of
and w2 in a sequence
and
).
is a solution to the Post Correspondence System.
.c
Now, the string
It is interesting to note that we have here reduced PCP to the language of pairs of CFG,s whose intersection is
nonempty. The following result is a direct conclusion of the above.
Theorem : Given any two CFG's G1 and G2 the question "Is
" is undecidable.
Proof: Assume for contradiction that there exists an algorithm A to decide this question. This would imply that
PCP is decidable as shown below.
For any Post Correspondence System, P construct grammars
and
elaborated already. We can now use the algorithm A to decide whether
by using the constructions
and
Thus, PCP is decidable, a contradiction. So, such an algorithm does not exist.
If
and
are CFG's constructed from any arbitrary Post Correspondence System, than it is not difficult to
are also context-free, even though the class of context-free languages are not
and
show that
closed under complementation.
and their complements can be used in various ways to show that many other questions
related to CFL's are undecidable. We prove here some of those.
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
Period: 7
Theorem : Foe any two arbitrary CFG's
ii.
Is
iii.
Is
.in
Is
the following questions are undecidable
be
i.
Proof :
then,
If
and
Since,
" is undecidable.
se
Hence, it suffice to show that the question Is
tu
i.
of
are CFl's and CFL's are closed under union,
.c
free. By DeMorgan's theorem,
we can use it to decide whether
If there is an algorithm to decide whether
is also context-
or not. But this problem has already been proved to be undecidable.
Hence there is no such algorithm to decide or not.
ii.
Let P be any arbitrary Post correspondence system and
strings.
and
are CFg's constructed from the pairs of
must be a CFL and let G1generates L1. That is,
by De Morgan's theorem, as shown already, any string,
PCP. Hence,
represents a solution to the
contains all but those strings representing the solution to the PCP.
www.csetube.in
www.csetube.in
for same CFG G2.
Let
It is now obvious that
if and only if the PCP has no solutions, which is already proved to be
undecidable. Hence, the question Is
?" is undecidable.
iii.
Let
and G2 be a CFG generating
be a CFG generating the language
where
and
are CFG.s constructed from same arbitrary instance of PCP.
.in
iff
i.e. iff the PCP instance has no solutions as discussed in part (ii).
.c
se
tu
be
Hence the proof.
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 8
Theorem : It is undecidable whether an arbitrary CFG is ambiguous.
and
as follows.
se
and
tu
where
is same as that of
from the ordered pairs of
be
We construct a new grammar G from
and
.in
Proof : Consider an arbitrary instance of PCP and construct the CFG's
strings.
Only if Assume that
.c
This constructions gives a reduction of PCP to the -------- of whether a CFG is ambiguous, thus leading to the
undecidability of the given problem. That is, we will now show that the PCP has a solution if and only if G is
ambiguous. (where G is constructed from an arbitrary instance of PCP).
is a solution sequence to this instance of PCP.
Consider the following two derivation in
www.csetube.in
www.csetube.in
But ,
has two derivations. Both these
is a solution to the PCP. Hence the same string of terminals
derivations are, clearly, leftmost. Hence G is ambiguous.
If It is important to note that any string of terminals cannot have more than one derivation in
and
Because, every terminal string which are derivable under these grammars ends with a sequence of integers
This sequence uniquely determines which productions must be used at every step of the derivation.
Hence, if a terminal string,
step.
.in
, has two leftmost derivations, then one of them must begin with the
be
then continues with derivations under
The reverse of
for same
In both derivations the resulting string must end with a sequence
this sequence must be a solution to the PCP, because the string that precede in one case is
in the other case. Since the string derived in both cases are identical, the
tu
and
sequence
se
must be a solution to the PCP.
.c
Hence the proof
www.csetube.in
www.csetube.in
R/TP/02
Lecture Plan
Code & Name of Subject: CS2303, Theory of Computation
Issue: C Rev.01
Page
Unit No: 5
Name: Undecidability
of
Period: 9
be
.in
Class p-problem solvable in polynomial time:
.c
se
tu
Non deterministic polynomial time:
A nondeterministic TM that never makes more than p(n) moves in any sequence of choices for some
polynomial p is said to be non polynomial time NTM.
NP is the set of languags that are accepted by polynomial time NTMs
Many problems are in NP but appear not to be in p.
One of the great mathematical questions of our age: is there anything in NP that is not in p?
NP-complete problems:
If We cannot resolve the p=np question, we can at least demonstrate that certain problems in NP are
the hardest , in the sense that if any one of them were in P , then P=NP.
These are called NP-complete.
Intellectual leverage: Each NP-complete problems apparent difficulty reinforces the belief
that they are all hard.
Methods for proving NP-Complete problems:
Polynomial time reduction (PTR): Take time that is some polynomial in the input size to
convert instances of one problem to instances of another.
If P1 PTR to P2 and P2 is in P1 the so is P1.
Start by showing every problem in NP has a PTR to Satisfiability of Boolean formula.
Then, more problems can be proven NP complete by showing that SAT PTRs to them
directly or indirectly.
www.csetube.in