Decidability and Undecidability in TOC
Last Updated :
03 Aug, 2023
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. Lets start with some definitions:-
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 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.
This article has been contributed by Nitish Joshi.
Similar Reads
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. Lets start with some definitions:- Decidable language -A decision problem P is said to be de
5 min read
Undecidability and Reducibility in TOC
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: Giv
5 min read
Decidability, Semi-Decidability, and Undecidability in TOC
We know about Decidable, Semi-decidable, and Undecidable problems and in this article, we will briefly define these problems and provide the most commonly asked questions on these problems and classify them accordingly. Prerequisite - https://www.geeksforgeeks.org/decidable-and-undecidable-problems-
3 min read
Decidability Table in Theory of Computation
Prerequisite - Undecidability, Decidable and undecidable problems 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. A language is undecidable
2 min read
Decidable and Undecidable Problems in Theory of Computation
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 provid
6 min read
Difference Between Decidability and Computability
While solving a particular problem it becomes really important for us to figure out if the problem is solvable or not. Determining both computability and decidability is thus very important to figure out if the problem can be solved in a finite amount of time. Even though both of them sound quite si
5 min read
Determining Countability in TOC
Countable Set is a set having cardinality same as that of some subset of N the set of natural numbers . A countable set is the one which is listable. Cardinality of a countable set can be a finite number. For example, B: {1, 5, 4}, |B| = 3, in this case its termed countably finite or the cardinality
3 min read
L-graphs and what they represent in TOC
Prerequisite - Finite automata introduction All programming languages can be represented as a finite automata. C, Paskal, Haskell, C++, all of them have a specific structure, grammar, that can be represented by a simple graph. Most of the graphs are NFA’s or DFA’s. But NFA’s and DFA’s determine the
5 min read
Halting Problem in Theory of Computation
To understand better the halting problem, we must know Decidability , Undecidability and Turing machine , decision problems and also a theory named as Computability theory and Computational complexity theory. Some important terms: Computability theory - The branch of theory of computation that studi
4 min read
Dovetailing in Turing Machines
In the carpentry industry, dovetailing is a technique of joining two pieces of wood together by interleaving them. Similarly in the case of Turing Machines dovetailing is the technique by which we can simulate multiple Turing Machines, in some cases an infinite number of Turing Machines together. Th
4 min read
Recursive and Recursive Enumerable Languages in TOC
Recursive Enumerable (RE) or Type -0 Language RE languages or type-0 languages are generated by type-0 grammars. An RE language can be accepted or recognized by Turing machine which means it will enter into final state for the strings of language and may or may not enter into rejecting state for the
5 min read
Reduction Theorem in TOC
Reduction Theorem :A reduction from A to B is a function f : Σ1* → Σ2* such that For any w ∈ Σ1*, w ∈ A if f(w) ∈ B Every w ∈ A maps to some f(w) ∈ B.Every w ∉ A maps to some f(w) ∉ B.f does not have to be injective or surjective. Why Reductions Matter?If language A reduces to language B, we can use
5 min read
Designing Deterministic Finite Automata (Set 7)
Prerequisite: Designing finite automata In this article, we will see some designing of Deterministic Finite Automata (DFA). Problem-1: Construction of a minimal DFA accepting set of strings over {a, b} in which a n b m c l , where n, m and l is greater than or equal to 0. Explanation: The desired la
6 min read
Designing Deterministic Finite Automata (Set 9)
Prerequisite: Designing finite automata In this article, we will see some designing of Deterministic Finite Automata (DFA). Problem-1: Construction of a minimal DFA accepting a set of strings over {a, b} in which {abwa / wε{a, b}*}. Here 'w' is the substring containing alphabets over any num
4 min read
Designing Deterministic Finite Automata (Set 6)
Prerequisite: Designing finite automata In this article, we will see some designing of Deterministic Finite Automata (DFA). Problem-1: Construction of a minimal DFA accepting set of strings over {a, b} in which anbm, where n and m is greater than or equal to 1. Explanation: The desired language will
3 min read
Modifications to standard Turing Machine
A standard Turing Machine is a machine which on providing an input moves either to the left or right and it may overwrite the existing symbol. A standard TM can be described as a 7-tuple: (Q, X, *, f, q0, B, F) where Q is a finite set of states X is the tape alphabet * is the input alphabet f is a t
4 min read
Detailed Study of PushDown Automata
According to the Chomsky Hierarchy, the requirement of a certain type of grammar to generate a language is often clubbed with a suitable machine that can be used to accept the same language. When the grammar is simple, the language becomes more complex, hence we require a more powerful machine to un
3 min read
Conflict Driven Clause Learning (CDCL)
In the field of computer science, a technique for resolving the Boolean satisfiability problem is referred to as conflict-driven clause learning (CDCL) (SAT). The problem on the SAT presents students with a Boolean formula and asks them to assign variables in such a way that the formula as a whole e
3 min read
Introduction of Finite Automata
Finite automata are abstract machines used to recognize patterns in input sequences, forming the basis for understanding regular languages in computer science. They consist of states, transitions, and input symbols, processing each symbol step-by-step. If the machine ends in an accepting state after
4 min read
Relationship between grammar and language in Theory of Computation
A grammar is a set of production rules which are used to generate strings of a language. In this article, we have discussed how to find the language generated by a grammar and vice versa as well. Language generated by a grammar - Given a grammar G, its corresponding language L(G) represents the set
4 min read