Undecidability Document
Undecidability Document
A problem is undecidable if there is no Turing machine which will always halt in finite amount
of time to give answer as 'yes' or 'no'. An undecidable problem has no algorithm to determine
the answer for a given input.
A decision problem (or language) is decidable if there is a Turing machine that solves a problem.
The problems for which we can’t construct an algorithm that can answer the problem correctly in
finite time are termed as Undecidable Problems. These problems may be partially decidable but
they will never be decidable. That is there will always be a condition that will lead the Turing
Machine into an infinite loop without providing an answer at all.
We can understand Undecidable Problems intuitively by considering Fermat’s Theorem, a
popular Undecidable Problem which states that no three positive integers a, b and c for any n>2
can ever satisfy the equation: a^n + b^n = c^n.
If we feed this problem to a Turing machine to find such a solution which gives a contradiction
then a Turing Machine might run forever, to find the suitable values of n, a, b and c. But we are
always unsure whether a contradiction exists or not and hence we term this problem as
an Undecidable Problem.
Examples – These are few important Undecidable Problems:
Whether a CFG generates all the strings or not?
As a CFG generates infinite strings, we can’t ever reach up to the last string and hence it is
Undecidable.
Whether two CFG L and M equal?
Since we cannot determine all the strings of any CFG, we can predict that two CFG are
equal or not.
Ambiguity of CFG?
There exist no algorithm which can check whether for the ambiguity of a CFL. We can
only check if any particular string of the CFL generates two different parse trees then the
CFL is ambiguous.
Is it possible to convert a given ambiguous CFG into corresponding non-ambiguous CFL?
It is also an Undecidable Problem as there doesn’t exist any algorithm for the conversion of
an ambiguous CFL to non-ambiguous CFL.
Is a language learning which is a CFL, regular?
This is an Undecidable Problem as we cannot find from the production rules of the CFL
whether it is regular or not.
2|Page
Decidable Problems
A problem is decidable if we can construct a Turing machine which will halt in finite amount of
time for every input and give answer as ‘yes’ or ‘no’. A decidable problem has an algorithm to
determine the answer for a given input.
Examples
Equivalence of two regular languages: Given two regular languages, there is an
algorithm and Turing machine to decide whether two regular languages are equal or not.
Finiteness of regular language: Given a regular language, there is an algorithm and
Turing machine to decide whether regular language is finite or not.
Emptiness of context free language: Given a context free language, there is an algorithm
whether CFL is empty or not.
Undecidable Problems
A problem is undecidable if there is no Turing machine which will always halt in finite amount
of time to give answer as ‘yes’ or ‘no’. An undecidable problem has no algorithm to determine
the answer for a given input.
Examples
Ambiguity of context-free languages: Given a context-free language, there is no Turing
machine which will always halt in finite amount of time and give answer whether language
is ambiguous or not.
Equivalence of two context-free languages: Given two context-free languages, there is no
Turing machine which will always halt in finite amount of time and give answer whether
two context free languages are equal or not.
Everything or completeness of CFG: Given a CFG and input alphabet, whether CFG will
generate all possible strings of input alphabet (∑*)is undecidable.
Regularity of CFL, CSL, REC and REC: Given a CFL, CSL, REC or REC, determining
whether this language is regular is undecidable.
Note: Two popular undecidable problems are halting problem of TM and PCP (Post
Correspondence Problem). Semi-decidable Problems
A semi-decidable problem is subset of undecidable problems for which Turing machine will
always halt in finite amount of time for answer as ‘yes’ and may or may not halt for answer as
‘no’.
3|Page
Rice’s Theorem
Every non-trivial (answer is not known) problem on Recursive Enumerable languages is
undecidable.e.g.; If a language is Recursive Enumerable, its complement will be recursive
enumerable or not is undecidable.
Reducibility and Undecidability
Language A is reducible to language B (represented as A≤B) if there exists a function f which
will convert strings in A to strings in B as:
w ɛ A <=> f(w) ɛ B
Theorem 1: If A≤B and B is decidable then A is also decidable.
Theorem 2: If A≤B and A is undecidable then B is also undecidable.
Solution: Let us assume that we can design that kind of machine called as HM(P, I) where HM
is the machine/program, P is the program and I is the input. On taking input the both arguments
the machine HM will tell that the program P either halts or not.
If we can design such a program this allows us to write another program we call this program
CM(X) where X is any program(taken as argument) and according to the definition of the
program CM(X) shown in the figure.
In the program CM(X) we call the function HM(X), which we have already defined and to HM()
we pass the arguments (X, X), according to the definition of HM() it can take two arguments i.e
one is program and another is the input.Now in the second program we pass X as a program and
X as input to the function HM().We know that the program HM() gives two output either “Halt”
or “Not Halt”.But in case second program, when HM(X, X) will halt loop body tells to go in
loop and when it doesn’t halt that means loop, it is asked to return.
Now we take one more situation where the program CM is passed to CM() function as an
argument. Then there would be some impossibility, i.e., a condition arises which is not possible.
It is impossible for outer function to halt if its code (inner body) is in loop and also it is
impossible for outer non halting function to halt even after its inner code is halting. So the both
condition is non halting for CM machine/program even we had assumed in the beginning that it
would halt.So this is the contradiction and we can say that our assumption was wrong and this
problem, i.e., halting problem is undecidable.
This is how we proved that halting problem is undecidable.