Module 5 TM Decidability
Module 5 TM Decidability
In the Theory of Computation, problems can be classified into decidable and undecidable
categories based on whether they can be solved using an algorithm. A decidable
problem is one for which a solution can be found in a finite amount of time, meaning there
exists an algorithm that can always provide a correct answer. While an undecidable
problem is one where no algorithm can be constructed to solve the problem for all possible
inputs.
Decidable Problems
A problem is said to be Decidable if we can always construct a corresponding algorithm that
can answer the problem correctly. We can intuitively understand Decidable issues by
considering a simple example. Suppose we are asked to compute all the prime numbers in the
range of 1000 to 2000. To find the solution to this problem, we can easily construct an
algorithm that can enumerate all the prime numbers in this range.
Now talking about Decidability in terms of a Turing machine, a problem is said to be a
Decidable problem if there exists a corresponding Turing machine that halts on every input
with an answer- yes or no. It is also important to know that these problems are termed Turing
Decidable since a Turing machine always halts on every input, accepting or rejecting it.
Example
We will now consider some few important Decidable problems:
Are two regular languages L and M equivalent: We can easily check this by using
Set Difference operation. L-M =Null and M-L =Null. Hence (L-M) U (M-L) = Null,
then L, M are equivalent.
Membership of a CFL: We can always find whether a string exists in a given CFL by
using an algorithm based on dynamic programming.
Emptiness of a CFL By checking the production rules of the CFL we can easily state
whether the language generates any strings or not.
Undecidable problems
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.
Example
These are few important Undecidable Problems:
Whether a CFG generates all the strings or not: As a Context Free Grammar (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
Context Free Language (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 can
not find from the production rules of the CFL whether it is regular or not.
• A language is decidable if some TM decides it. All computations of a decider TM must halt.
Decidable languages are often called also recursive languages.
• A language is Turing-recognizable (or recursively enumerable) if it is recognized by a TM.
That is, all words in the language are accepted by the TM. On words not belonging to the
language, the computation of the TM either rejects or goes on forever
Decidable Problems
Definition: A problem is decidable if there exists a Turing Machine (TM) that halts
on all inputs and correctly decides whether the input string belongs to the language or
not.
Characteristics:
o A Turing Machine always halts with either "accept" or "reject".
o Decidable languages are also called recursive languages.
o These problems are solvable by an algorithm.
Examples:
1. Determining whether a given string is a valid string in a regular language or
context-free language.
2. Testing membership for a finite automaton or a context-free grammar.
Undecidable Problems
Definition: A problem is undecidable if no Turing Machine can be constructed to
decide it for all possible inputs.
Characteristics:
o There exists no algorithm to determine the answer for every input.
o These problems may not halt for some inputs.
o Often proven undecidable by reducing them to the Halting Problem or other
known undecidable problems.
Examples:
1. The Halting Problem: Deciding whether an arbitrary Turing Machine halts on
a given input.
2. Determining equivalence of two context-free grammars.
Explanation
This program is based on the Collatz Conjecture, an unsolved mathematical
problem.
The conjecture states that for any positive integer n:
1. If n is even, divide it by 2.
2. If n is odd, multiply it by 3 and add 1.
3. Repeat until n becomes 1.
Despite extensive computational testing, no proof exists that this process will halt for all nnn.
Can we design a machine which if given a program can find out if that program will
always halt or not halt on a particular input?
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.
Statement:
o Input: A Turing Machine M and an input w.
o Output: Yes, if M halts on w; No, otherwise.
Key Results:
o Undecidability: The Halting Problem is undecidable, as proven by Alan
Turing in 1936.
o Proof Idea:
1. Assume a hypothetical TM H that decides the Halting Problem.
2. Construct a new machine D using H that leads to a contradiction.
3. This self-reference leads to an impossibility, proving H cannot exist.
Applications:
o Used to prove undecidability of other problems via reductions.
o Provides foundational insights into the limits of computation.
Hierarchy
Decidable ⊆ Recursively Enumerable ⊆ All Languages.
o Decidable Problems: Halts and gives a definite answer.
o Recursively Enumerable Problems: May not halt for certain inputs.
o Undecidable Problems: No algorithm exists to decide them.
Summary
Halts on All
Type Definition Examples
Inputs
TM halts and decides for every DFA/CFG Membership
Decidable Yes
input. Problem
No TM exists to decide the
Undecidable No Halting Problem, PCP
problem for all inputs.
Recursively TM may halt only for strings in Valid Proofs, TM Halting
No
Enumerable the language. on Input www
Halting Problem Determine if a TM halts on a No Special case of
Halts on All
Type Definition Examples
Inputs
given input; proven undecidable. Undecidability
Multi-tape Turing Machine:
Multi-tape Turing Machines have multiple tapes where each tape is accessed with a separate
head. Each head can move independently of the other heads. Initially the input is on tape 1
and others are blank. At first, the first tape is occupied by the input and the other tapes are
kept blank. Next, the machine reads consecutive symbols under its heads and the TM prints a
symbol on each tape and moves its heads.
An input is accepted if there is at least one node of the tree which is an accept configuration,
otherwise it is not accepted. If all branches of the computational tree halt on all inputs, the
non-deterministic Turing Machine is called a Decider and if for some input, all branches are
rejected, the input is also rejected.
δ is a transition function;
Γi→P(Q x Γi x(Left,right,stationary)i)
q0 is the initial state
B is the blank symbol
F is the set of final states