0% found this document useful (0 votes)
4 views

Module 5 TM Decidability

Uploaded by

Manav Shree
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Module 5 TM Decidability

Uploaded by

Manav Shree
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Decidable problem, undecidable problem and Variations in Turing machine

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.

Recursively Enumerable (RE) Problems


 Definition: A language is recursively enumerable if there exists a Turing Machine
that enumerates the strings of the language.
o Alternatively, the TM accepts all strings in the language but may not halt for
strings not in the language.
 Characteristics:
o If a string belongs to the language, the TM will eventually accept it.
o If a string does not belong, the TM may run indefinitely without halting.
o All decidable problems are RE, but not all RE problems are decidable.
 Examples:
1. The language of all Turing Machines that halt on a specific input.
2. The set of valid proofs in first-order logic.
Halting Problem
 Definition: The problem of deciding whether a given Turing Machine M halts on a
specific input w.
Given a program/algorithm will ever halt or not? Halting means that the program on
certain input will accept it and halt or reject it and halt and it would never go into an
infinite loop. Basically halting means terminating. So can we have an algorithm that
will tell that the given program will halt or not. In terms of Turing machine, will it
terminate when run on some machine with some particular given input string. The
answer is no we cannot design a generalized algorithm which can appropriately say
that given a program will ever halt or not? The only way is to run the program and
check whether it halts or not. We can refrain the halting problem question in such a
way also: Given a program written in some programming language(c/c++/java) will it
ever get into an infinite loop(loop never stops) or will it always terminate(halt)? This
is an undecidable problem because we cannot have an algorithm which will tell us
whether a given program will halt or not in a generalized way i.e by having specific
program/algorithm. In general we can’t always know that’s why we can’t have a
general algorithm. The best possible way is to run the program and see whether it
halts or not. In this way for many programs we can see that it will sometimes loop and
always halt.

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.

There are k tapes, each divided into cells.


δ is a partial function from Q x Гk into Q x Гk x {L, R, S}k

Non-Deterministic Turing Machine:


In a Non-Deterministic Turing Machine, for every state and symbol, there are a group of
actions the TM can have. So, here the transitions are not deterministic. a nondeterministic
Turing machine (NTM) is a theoretical model of computation whose governing rules specify
more than one possible action when in some given situations. That is, an NTM's next state is
not completely determined by its action and the current symbol it sees, unlike a deterministic
Turing machine. The computation of a non-deterministic Turing Machine is a tree of
configurations that can be reached from the start configuration.

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.

A non-deterministic Turing machine can be formally defined as a 6-tuple (Q, X, ∑, δ, q0, B,


F) where −
Q is a finite set of states
Γ is the tape alphabet
∑ is the input alphabet

δ 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

You might also like