# Decidability and Undecidability in TOC

Identifying languages (or problems*) as decidable, undecidable or partially decidable is a very common question in GATE. With correct knowledge and ample experience, this question becomes very easy to solve.

Decidable language -A decision problem P is said to be decidable (i.e., have an algorithm)
if the language L of all yes instances to P is decidable.
Example- (I) (Acceptance problem for DFA) Given a DFA does it accept a given
word?

(II) (Emptiness problem for DFA) Given a DFA does it accept any word?

(III) (Equivalence problem for DFA) Given two DFAs, do they accept the
same language?

Undecidable language -– A decision problem P is said to be undecidable if the language L of all
yes instances to P is not decidable or a language is undecidable if it is not decidable. An undecidable language maybe a partially decidable language or something else but not decidable. If a language is not even partially decidable , then there exists no Turing machine for that language.

Partially decidable or Semi-Decidable Language -– A decision problem P is said to be semi-decidable (i.e., have a semi-algorithm) if the language L of all yes instances to P is RE. A language ‘L’ is partially decidable if ‘L’ is a RE but not REC language.

Recursive language(REC) – A language ‘L’ is said to be recursive if there exists a Turing machine which will accept all the strings in ‘L’ and reject all the strings not in ‘L’. The Turing machine will halt every time and give an answer(accepted or rejected) for each and every string input. A language ‘L’ is decidable if it is a recursive language. All decidable languages are recursive languages and vice-versa.

Recursively enumerable language(RE) – A language ‘L’ is said to be a recursively enumerable language if there exists a Turing machine which will accept (and therefore halt) for all the input strings which are in ‘L’ but may or may not halt for all input strings which are not in ‘L’. By definition , all REC languages are also RE languages but not all RE languages are REC languages.

Now lets solve some examples –

One way to solve decidability problems is by trying to reduce an already known undecidable problem to the given problem. By reducing a problem P1 to P2, we mean that we are trying to solve P1 by using the algorithm used to solve P2.

If we can reduce an already known undecidable problem P1 to a given problem P2 , then we can surely say that P2 is also undecidable. If P2 was decidable, then P1 would also be decidable but that becomes a contradiction because P1 is known to be undecidable.

For eg.

1. Given a Turing machine ‘M’, we need to find out whether a state ‘Q’ is ever reached when a string ‘w’ is entered in ‘M’. This problem is also known as the ‘State Entry problem’.

Now lets try to reduce the Halting problem to the State Entry problem. A Turing machine only halts when a transition function ? (qi , a) is not defined. Change every undefined function ?(qi,a) to ?(qi,a) = (Q, a, L or R). Note that the state Q can only be reached when the Turing machine halts.

Suppose we have have an algorithm for solving the State Entry problem which will halt every time and tell us whether state Q can be reached or not. By telling us that we can or cannot reach state Q every time, it is telling us that the Turing machine will or will not halt, every time. But we know that is not possible because the halting problem is undecidable. That means that our assumption that there exists an algorithm which solves the State Entry problem and halts and gives us an answer every time, is false. Hence, the state entry problem is undecidable.

2. Given two regular languages L1 and L2, is the problem of finding whether a string ‘w’ exists in both L1 and L2, a decidable problem or not.

First we make two Turing machines TM1 and TM2 which simulate the DFAs of languages L1 and L2 respectively. We know that a DFA always halts, so a Turing machine simulating a DFA will also always halt. We enter the string ‘w’ in TM1 and TM2. Both Turing machines will halt and give us an answer. We can connect the outputs of the Turing machines to a modified ‘AND’ gate which will output ‘yes’ only when both the Turing machines answer ‘yes’. Otherwise it will output ‘no’.

Since this system of two Turing machines and a modified AND gate will always stop, this problem is a decidable problem.

There are a lot of questions on this topic. There is no universal algorithm to solve them. Most of the questions require unique and ingenious proofs. Here is where experience is needed. By solving a lot of these problems, one can become very quick in coming up with proofs for these problems on the spot. So, keep practicing.

*The words ‘language’ and ‘problem’ can be used synonymously in Theory of computation. For eg. The ‘Halting problem’ can also be written as ‘L = {<M, w> | Turing machine ‘M’ halts on input ‘w’}’. Here ‘L’ is a language.

My Personal Notes arrow_drop_up

Improved By : VaibhavRai3

Article Tags :

8

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.