Theory of Computation
Turing & Decidability
The decidability questions of GATE reward a clean table in your head: which languages are recursive or RE, which problems about DFAs and CFGs are decidable, and which TM questions are undecidable by Rice’s theorem.
GATE CSE Turing machines and decidability — TM model and variants, recursive vs recursively enumerable languages, decidable problems for regular and context-free languages, classic undecidable problems (A_TM, HALT, E_TM, EQ_TM, PCP), reductions and Rice’s theorem.
Learning outcomes
- Describe the TM model and explain why multi-tape and non-deterministic TMs have the same power as the basic TM
- Distinguish recursive (decidable) from recursively enumerable languages and apply the closure properties of each class
- List decidable problems for DFAs, NFAs, regexes and CFGs and the standard undecidable problems A_TM, HALT, E_TM, EQ_TM and PCP
- Use reductions and Rice’s theorem to decide whether a property of Turing machines is decidable
Turing machine model and variants
- A Turing machine is a 7-tuple (Q, Σ, Γ, δ, q0, q_accept, q_reject): a finite control with an infinite tape, a read/write head moving left or right, δ : Q × Γ → Q × Γ × {L, R}. Σ ⊂ Γ and the blank symbol is in Γ − Σ.
- On an input w a TM has three outcomes: it accepts (reaches q_accept), rejects (reaches q_reject), or loops forever. L(M) is the set of strings M accepts.
- A language is Turing-recognisable (recursively enumerable, RE) if some TM accepts exactly its strings (it may loop on strings outside L). It is Turing-decidable (recursive) if some TM that halts on EVERY input accepts exactly the strings of L (a decider).
- Equivalent models (same languages): multi-tape TM (simulated on one tape with a quadratic slowdown), non-deterministic TM (simulated deterministically by BFS over the computation tree with exponential slowdown), two-way infinite tape TM, multi-head TM, enumerators, two-stack PDA, two-counter machines, and the lambda-calculus. Church–Turing thesis: these capture “algorithm”.
- Non-deterministic TMs are not more powerful than deterministic ones for decidability; the P vs NP question concerns efficiency, not power.
- Universal Turing machine: a TM that takes an encoding ⟨M, w⟩ and simulates M on w. Its existence makes A_TM recognisable.
- Weaker automata: a TM whose tape is bounded by the input length is a linear bounded automaton (LBA), accepting exactly the context-sensitive languages (type-1). A TM that only moves right and never writes is a finite automaton.
- Reading the figure: the finite control holds the state, the head sits on exactly one cell, and one step does three things at once — write a symbol, move the head one cell (L or R) and change state. The tape beyond the input is all blanks (B).
- A configuration (instantaneous description) is written u q v: the tape holds uv, the machine is in state q and the head is on the first symbol of v. A step is u q a v ⊢ u′ q′ v′ according to δ. Acceptance means some configuration with q_accept is reachable from q0 w.
- Halting is determined by q_accept and q_reject (no transitions leave them). Missing transitions are treated as “go to q_reject”, so you only need to describe the useful moves.
- Variants that do NOT add power: TM with a stay-in-place move, multiple tracks, a semi-infinite tape, k tapes, a k-dimensional tape, non-determinism. Variants that DO change power: limiting the tape to the input (LBA), forbidding writes (DFA), or adding only a stack (PDA).
- Complexity note: a multi-tape TM running in time t(n) is simulated by a one-tape TM in O(t(n)²); a non-deterministic TM running in time t(n) is simulated deterministically in 2^O(t(n)). These blow-ups matter only for time classes (P vs NP), not for decidability.
| Chomsky type | Grammar | Machine | Language class |
|---|---|---|---|
| Type 3 | Regular | Finite automaton | Regular |
| Type 2 | Context-free | NPDA | CFL |
| Type 1 | Context-sensitive | LBA | CSL (decidable) |
| Type 0 | Unrestricted | Turing machine | RE |
Worked example
Problem. A TM M accepts w, rejects w′ and runs forever on w″. Which languages are described?
Solution. L(M) contains w and not w′ or w″. M is a recogniser of L(M) but not a decider because it loops on w″. If some other TM decided L(M) on all inputs, L(M) would be recursive.
Worked example — a Turing machine for {0^n 1^n}
- Tape alphabet Γ = {0, 1, X, Y, B}. Idea: repeatedly mark the leftmost unmarked 0 as X, find the leftmost unmarked 1 and mark it Y, return to the left end, and repeat. Accept when no 0 and no 1 remain unmarked.
- q0: scan for the next 0. On 0 write X and go right (q1). On Y there are no more 0s, so go right to verify that only Y’s remain (q3). On B (empty input) accept.
- q1: move right over 0s and Y’s until a 1; write Y and move left (q2). If the head reaches a blank first, there are more 0s than 1s: no transition ⇒ reject.
- q2: move left over 0s and Y’s until an X; step right into q0 and repeat. q3: move right over Y’s; on B accept; on 0 or 1 reject (stray symbol).
- The machine halts on every input (each round marks one 0 and one 1, and rounds are bounded by the input length), so it is a DECIDER and {0^n 1^n} is recursive — it is also context-free.
- Time: each round scans the tape once (O(n)) and there are n rounds, so the running time is O(n²). The tape never grows beyond the input plus one blank, so it also fits in linear bounded space.
- The same marking technique decides {a^n b^n c^n} (mark a, b, c in each round); that language is context-sensitive but not context-free, which shows a TM is more powerful than a PDA.
| State | Read | Write | Move | Next state |
|---|---|---|---|---|
| q0 | 0 | X | R | q1 |
| q0 | Y | Y | R | q3 |
| q0 | B | B | accept | qaccept |
| q1 | 0 or Y | same | R | q1 |
| q1 | 1 | Y | L | q2 |
| q2 | 0 or Y | same | L | q2 |
| q2 | X | X | R | q0 |
| q3 | Y | Y | R | q3 |
| q3 | B | B | accept | qaccept |
Worked example
Problem. Trace the TM on input 0011 and on input 001.
Solution. 0011: q0 marks the first 0 (X011), q1 walks right and marks the first 1 (X0Y1), q2 walks back to X, q0 marks the second 0 (XXY1), q1 skips the Y and marks the last 1 (XXYY), q2 returns to the X, q0 reads Y and goes to q3, q3 skips Y, Y and sees B: accept. 001: after the first round the tape is X0Y; q0 marks the second 0 (XXY), q1 moves right over Y and reaches a blank with no 1 left — no transition, so the machine rejects.
Recursive vs RE languages and closure properties
- Recursive (decidable) ⊂ RE (recognisable) ⊂ all languages. A language is recursive iff both L and its complement are RE (run the two recognisers in parallel and halt when one accepts).
- Consequently if L is RE but not recursive, its complement is NOT RE. This is how A_TM and its complement are placed.
- Recursive languages are closed under union, intersection, complement, difference, concatenation, Kleene star and reversal.
- RE languages are closed under union, intersection, concatenation, Kleene star, reversal and homomorphism, but NOT under complement (and so not under set difference).
- Classes with a complement: co-RE = { L | complement of L is RE }. Recursive = RE ∩ co-RE. Some languages (such as EQ_TM) are neither RE nor co-RE.
- Context-sensitive languages are recursive; there exist recursive languages that are not context-sensitive. There are countably many TMs but uncountably many languages, so most languages are not even RE.
- The membership problem for type-0 grammars is undecidable but semi-decidable; for type-1 (CSG) grammars it is decidable.
- Dovetailing: to recognise a union or to search over all strings / all computations, run the first step of attempt 1, then two steps of attempts 1 and 2, then three steps of attempts 1–3, and so on. Any attempt that accepts is eventually found. This proves closure of RE under union and shows that “L(M) ≠ ∅” is RE.
- Enumerator view: L is RE iff some enumerator (a TM that prints strings) lists exactly its members. L is recursive iff it can be enumerated in the shortlex (length, then alphabetical) order.
- Counting argument: there are only countably many Turing machines (each has a finite description) but uncountably many languages (subsets of Σ*). So “most” languages are not RE, and the diagonal language gives an explicit example.
- The relationship chain: Regular ⊂ DCFL ⊂ CFL ⊂ CSL ⊂ Recursive ⊂ RE ⊂ all languages; each of the Venn bands in the figure has a concrete witness (A_TM is the witness for RE − Recursive).
- If both L and complement(L) are RE, L is recursive. If L is RE and NOT recursive, complement(L) is not RE. Quick check: A_TM is RE, not recursive ⇒ complement of A_TM is not RE.
| Property | Recursive | RE | co-RE |
|---|---|---|---|
| Union | Yes | Yes | Yes |
| Intersection | Yes | Yes | Yes |
| Complement | Yes | No | No |
| Concatenation, star | Yes | Yes | Yes |
| Set difference | Yes | No | No |
Worked example
Problem. If L and its complement are both recursively enumerable, what can be said about L?
Solution. L is recursive. Run recognisers M1 for L and M2 for the complement simultaneously on w; exactly one of them eventually accepts, so the combined machine always halts and decides L.
Decidable problems for regular and context-free languages
- A_DFA = {⟨B, w⟩ | DFA B accepts w} is decidable by simulation; likewise A_NFA and A_REX (convert to DFA first).
- E_DFA = {⟨A⟩ | L(A) = ∅} is decidable: check whether any final state is reachable from the start state (graph search). Finiteness of L(A) is decidable via a cycle check on useful states.
- EQ_DFA = {⟨A, B⟩ | L(A) = L(B)} is decidable: build the symmetric-difference DFA and test emptiness, or compare minimal DFAs. Universality ALL_DFA (L = Σ*) is decidable.
- A_CFG = {⟨G, w⟩ | G generates w} is decidable (CYK algorithm on CNF, or enumerating derivations of 2|w| − 1 steps). E_CFG (is L(G) empty?) is decidable (mark generating variables). Finiteness of a CFL is decidable.
- EQ_CFG (equivalence of two CFGs) and ALL_CFG (L(G) = Σ*) are UNDECIDABLE. So are ambiguity of a CFG and “is L(G1) ∩ L(G2) = ∅?”.
- Every context-free language is decidable: the TM simulates CYK on the grammar of the language, so CFL ⊂ Recursive.
- For linear bounded automata: A_LBA is decidable (finitely many configurations), but E_LBA is undecidable.
| Problem | Decidable? | Idea |
|---|---|---|
| A_DFA, A_NFA, A_REX | Yes | simulate / convert to DFA |
| E_DFA | Yes | reachability of a final state |
| EQ_DFA | Yes | symmetric difference is empty |
| A_CFG | Yes | CYK algorithm |
| E_CFG | Yes | mark generating variables |
| EQ_CFG, ALL_CFG | No | reduces from PCP / computation histories |
| A_LBA | Yes | finitely many configurations |
| E_LBA | No | computation histories |
Worked example
Problem. Show that “Does a given DFA accept at least one string?” is decidable.
Solution. Treat the DFA as a directed graph and run BFS/DFS from the start state. If some final state is reachable the language is non-empty; otherwise it is empty. The search terminates because the DFA has finitely many states.
Classic undecidable problems
- A_TM = {⟨M, w⟩ | TM M accepts w} is RE (use the universal TM) but NOT recursive: proved by diagonalisation. Its complement is not RE.
- HALT_TM = {⟨M, w⟩ | M halts on w} is RE but not recursive. Reduction: A_TM ≤m HALT_TM. Its complement is not RE.
- E_TM = {⟨M⟩ | L(M) = ∅} is undecidable; E_TM is not RE but its complement (“L(M) ≠ ∅”) is RE (dovetail over all strings).
- EQ_TM = {⟨M1, M2⟩ | L(M1) = L(M2)} is undecidable and neither RE nor co-RE. REGULAR_TM = {⟨M⟩ | L(M) is regular} is also undecidable.
- Post Correspondence Problem (PCP): given dominos (a_i / b_i), is there a sequence whose top string equals the bottom string? PCP is undecidable (but RE) and is the basis for proving undecidability of ambiguity of CFGs and EQ_CFG.
- Other undecidable results: Does a TM accept the empty string? Is L(M) finite? Is L(M) context-free? Does a TM ever write a non-blank symbol? All follow from Rice’s theorem or reductions from A_TM.
- Decidable TM questions (do not confuse): “Does M have more than 10 states?” (syntactic), “Does M halt on w within k steps?” (simulate k steps), “Is a given string w an accepting computation of M?”
- Diagonal language L_d = { ⟨M⟩ | M does not accept ⟨M⟩ } is not RE; it proves the existence of languages beyond RE.
| Language | Recursive? | RE? | Complement RE? |
|---|---|---|---|
| A_TM | No | Yes | No |
| HALT_TM | No | Yes | No |
| E_TM | No | No | Yes |
| EQ_TM | No | No | No |
| PCP | No | Yes | No |
| A_DFA, A_CFG | Yes | Yes | Yes |
Worked example
Problem. Show that HALT_TM is undecidable assuming A_TM is undecidable.
Solution. Suppose H decides HALT_TM. To decide A_TM on ⟨M, w⟩ first run H on ⟨M, w⟩; if H says M loops, reject; otherwise simulate M on w (it halts) and answer as M does. This would decide A_TM, a contradiction, so HALT_TM is undecidable.
Worked example — diagonalisation proof that A_TM is undecidable
- Assume A_TM = {⟨M, w⟩ | M accepts w} is decidable, and let H be a decider: H(⟨M, w⟩) accepts if M accepts w and rejects if M does not accept w (including looping).
- Build a new machine D that, on input ⟨M⟩, runs H on ⟨M, ⟨M⟩⟩ (feeding M its own description) and then does the OPPOSITE: D accepts if H rejects and rejects if H accepts. D is a legitimate TM because H always halts.
- Now run D on its own description ⟨D⟩. D accepts ⟨D⟩ ⇔ H rejects ⟨D, ⟨D⟩⟩ ⇔ D does not accept ⟨D⟩. This is a contradiction, so no such H exists.
- Why it is called diagonalisation: imagine a table whose rows are machines and columns are descriptions; entry (M, ⟨N⟩) = 1 if M accepts ⟨N⟩. D differs from machine M on the diagonal entry (M, ⟨M⟩), so D is not any row of the table.
- Consequence: A_TM is RE (the universal TM recognises it) but not recursive. Its complement is therefore not RE (otherwise A_TM would be recursive).
- The same style proves that the diagonal language L_d = {⟨M⟩ | M does not accept ⟨M⟩} is not RE: a TM for L_d would accept ⟨M_d⟩ exactly when it does not accept ⟨M_d⟩.
- Related: halting for a machine that is guaranteed to halt (a decider) is trivially decidable; the whole difficulty is that a general TM may loop and we cannot tell “loops” from “not yet halted”.
| Step | What happens | Why |
|---|---|---|
| 1 | Assume decider H for A_TM | for contradiction |
| 2 | Build D(⟨M⟩) = NOT H(⟨M, ⟨M⟩⟩) | D always halts |
| 3 | Run D on ⟨D⟩ | self-reference |
| 4 | D accepts ⟨D⟩ iff D does not accept ⟨D⟩ | contradiction |
| 5 | So H cannot exist | A_TM undecidable |
Worked example
Problem. Why does the proof fail if H only recognises (rather than decides) A_TM?
Solution. Then H may loop when M does not accept w, so D, which waits for H, may loop too. D would not always halt on ⟨D⟩, and the “do the opposite” step is no longer defined. That is exactly why A_TM is RE (H can exist as a recogniser) but not recursive.
Reductions and Rice’s theorem
- Mapping reduction A ≤m B: a computable function f with w ∈ A ⇔ f(w) ∈ B. Consequences: B decidable ⇒ A decidable; A undecidable ⇒ B undecidable; B RE ⇒ A RE; A not RE ⇒ B not RE.
- Direction matters: to show a new problem B is undecidable reduce a KNOWN undecidable problem (such as A_TM) TO B (A_TM ≤m B). Reducing B to A_TM proves nothing.
- Rice’s theorem: every NON-TRIVIAL property of the language recognised by a TM is undecidable. Formally, if P is a set of RE languages that is neither empty nor all RE languages, then { ⟨M⟩ | L(M) ∈ P } is undecidable.
- Examples covered by Rice (undecidable): L(M) = ∅, L(M) is finite, L(M) is regular, L(M) is context-free, L(M) contains ε, L(M) = Σ*, L(M) has at least 5 strings.
- NOT covered by Rice: properties of the machine rather than its language (number of states, whether M moves left, whether M halts within k steps), and TRIVIAL properties (true for all or for no RE languages) which are trivially decidable.
- Rice’s theorem only gives undecidability; it does not say anything about whether the property is RE. For instance “L(M) ≠ ∅” is RE, but “L(M) = ∅” is not.
- Quick recognition test: if the question is “is L(M) … ?” with a non-trivial condition on L(M), answer undecidable; if the question is about the syntactic description or a bounded simulation, it is decidable.
- Reading the figure: instances of A map to instances of B by a computable f, yes-instances to yes-instances and no-instances to no-instances. A decider for B would therefore give a decider for A, which is impossible when A is undecidable.
- Standard chain of reductions: A_TM ≤m HALT_TM, A_TM ≤m complement(E_TM) (so E_TM is undecidable), A_TM ≤m EQ_TM, A_TM ≤m REGULAR_TM. Each uses a computable construction of a new machine M′ from ⟨M, w⟩.
- Typical construction: given ⟨M, w⟩ build M′ that, on any input x, ignores x, runs M on w and accepts iff M accepts w. Then L(M′) = Σ* if M accepts w and ∅ otherwise — so any non-trivial property separating Σ* from ∅ becomes undecidable.
- Many-one vs Turing reductions: the exam-level reductions are many-one. A Turing reduction (an oracle) is more general; Rice and the closure facts above are all stated for many-one reductions.
Formulas to remember
-
A ≤m B and B decidable ⇒ A decidable -
A ≤m B and A undecidable ⇒ B undecidable -
Rice: non-trivial semantic property of L(M) ⇒ undecidable
Worked example
Problem. Is {⟨M⟩ | L(M) is finite} decidable?
Solution. No. “Finite” is a property of the language, and it is non-trivial (the empty language is finite, Σ* is not). By Rice’s theorem the problem is undecidable.
Worked example — reductions and Rice’s theorem in practice
- Goal: show ACCEPTS_ε = {⟨M⟩ | M accepts the empty string} is undecidable. Reduce A_TM to it: from ⟨M, w⟩ compute the code of a machine M′ that ignores its own input x, simulates M on w, and accepts iff M accepts w.
- Then M′ accepts ε ⇔ M accepts w (indeed M′ accepts every string or none). So ⟨M, w⟩ ∈ A_TM ⇔ ⟨M′⟩ ∈ ACCEPTS_ε, and the map ⟨M, w⟩ ↦ ⟨M′⟩ is computable (just writing down a TM).
- If a decider for ACCEPTS_ε existed, composing it with this map would decide A_TM — impossible. Hence ACCEPTS_ε is undecidable.
- Rice’s theorem gives the same conclusion in one line: the property “ε ∈ L(M)” is a non-trivial property of L(M) (true for Σ*, false for ∅). Non-trivial semantic ⇒ undecidable.
- Contrast: “M has an even number of states” is a property of the machine description, not L(M), so Rice does not apply — it is decidable by reading the code. “M halts on ε within 1000 steps” is decidable by bounded simulation.
- RE-ness still needs care: ACCEPTS_ε is RE (simulate M on ε and accept if it accepts), but its complement is not RE. Rice only tells you “undecidable”, never which side of RE it falls on.
- Checklist for a new problem: (1) is it about L(M) rather than M? (2) is the property non-trivial? If both, undecidable by Rice; if not, look for a direct algorithm (bounded simulation, syntactic check).
| Question about a TM M | Decidable? | Reason |
|---|---|---|
| L(M) = ∅ | No | Rice (non-trivial); not RE |
| L(M) ≠ ∅ | No | Rice; but RE (dovetail) |
| ε ∈ L(M) | No | Rice; RE |
| L(M) is regular | No | Rice |
| M has more than 5 states | Yes | syntactic |
| M halts on w within k steps | Yes | bounded simulation |
| L(M) = L(M) (trivial property) | Yes | always true |
Worked example
Problem. Classify EQ_TM = {⟨M1, M2⟩ | L(M1) = L(M2)} and give a reduction from E_TM.
Solution. EQ_TM is undecidable and, in fact, neither RE nor co-RE. Reduction: given ⟨M⟩, output ⟨M, M_∅⟩ where M_∅ is a fixed TM that rejects every input. Then L(M) = ∅ ⇔ L(M) = L(M_∅), so E_TM ≤m EQ_TM. Since E_TM is not RE, EQ_TM is not RE. For the other side, A_TM ≤m EQ_TM (map ⟨M, w⟩ to ⟨M′, M_Σ*⟩ where M′ is the machine built from ⟨M, w⟩ and M_Σ* accepts everything); A_TM is not co-RE, so EQ_TM is not co-RE either.
GATE exam tricks — decidability MCQs
- First ask “is the object a DFA/regex/CFG or a Turing machine?”. For DFAs all the standard questions are decidable; for CFGs membership, emptiness, finiteness are decidable and equivalence/universality/ambiguity are not; for TMs almost every semantic question is undecidable.
- Syntactic or bounded questions about a TM are decidable: “M has at most 10 states”, “M halts on w within 100 steps”, “M has a transition to q_accept”. Language-level questions are undecidable by Rice.
- Complement placement: if L is RE and not recursive, then the complement is not RE. A_TM and HALT_TM are RE, their complements are not RE. E_TM is not RE but its complement is RE.
- Use closure of recursive languages under complement and intersection to answer set questions; use “L and complement both RE ⇒ recursive” for statements about a pair of recognisers.
- All context-free languages and all context-sensitive languages are decidable. NP-complete problems are decidable but believed not solvable in polynomial time — decidable does not mean tractable.
- The halting problem is undecidable for general TMs but decidable for a fixed finite-state machine such as a DFA, or for LBAs (A_LBA).
- If two statements are “L is recursive” and “L is RE”, the first implies the second; the converse fails. Eliminate options that reverse the implication.
Worked example
Problem. Classify: (a) “M accepts at least one string”, (b) “M has 7 states”, (c) “M halts on ε within 50 steps”.
Solution. (a) is a non-trivial property of L(M) so it is undecidable (Rice) though RE. (b) is syntactic and decidable by reading the encoding. (c) is decidable by simulating M for 50 steps.
Exam tips
- Memorise the table: A_TM and HALT are RE but not recursive; E_TM is co-RE; EQ_TM is neither RE nor co-RE.
- Reduce a KNOWN undecidable problem to the new problem; the reverse direction proves nothing.
- Rice’s theorem covers non-trivial properties of L(M), not properties of the machine description.
- Recursive = RE ∩ co-RE; the complement of an RE non-recursive language is not RE.
- Every CFL and CSL is decidable; NP-complete problems are decidable too.
10 GATE-style MCQs for Turing & Decidability with full explanations. Attempt each question before revealing the answer.
Which of the following problems is decidable?
Show answer & explanation
Answer: B
E_DFA is decidable by checking reachability of a final state. HALT_TM, E_TM and EQ_TM are all undecidable.
If a language L and its complement are both recursively enumerable, then L is:
Show answer & explanation
Answer: C
Running both recognisers in parallel gives a decider, so L is recursive (decidable).
The class of recursively enumerable languages is closed under:
Show answer & explanation
Answer: B
RE languages are closed under union, intersection, concatenation and star, but not under complement or set difference.
Which property of a Turing machine M is undecidable?
Show answer & explanation
Answer: B
L(M) = ∅ is a non-trivial property of the language, so it is undecidable by Rice’s theorem. A and D are syntactic and C is checked by a 100-step simulation.
Which of the following statements about Turing machine variants is true?
Show answer & explanation
Answer: B
Multi-tape TMs are simulated by single-tape TMs (with a quadratic slowdown), so the language classes coincide. NTMs are also equivalent to DTMs, a two-stack PDA is as powerful as a TM, and LBAs accept only context-sensitive languages.
The language A_TM = {⟨M, w⟩ | M accepts w} is:
Show answer & explanation
Answer: B
A universal TM recognises A_TM, so it is RE; diagonalisation shows it is not decidable.
The complement of the halting problem HALT_TM is:
Show answer & explanation
Answer: C
HALT_TM is RE but not recursive. If its complement were RE too, HALT_TM would be recursive, a contradiction.
Which of the following problems is undecidable?
Show answer & explanation
Answer: C
EQ_CFG is undecidable. Emptiness and membership for CFGs, and finiteness for DFAs, are decidable.
Every context-sensitive language is:
Show answer & explanation
Answer: C
An LBA has finitely many configurations on an input, so membership is decidable by exhaustive search. Hence CSL ⊂ Recursive.
The Post Correspondence Problem (PCP) is:
Show answer & explanation
Answer: B
PCP is undecidable (it is RE: search for a match; but no algorithm decides every instance). It is used to prove the undecidability of CFG ambiguity and equivalence.
Extra page-specific practice beyond the GATE samples. Attempt all 10, then reveal answers to check your reasoning.
The formal definition of a Turing machine is a tuple with how many components?
Show answer & explanation
Answer: C) 7
A TM is (Q, Σ, Γ, δ, q0, q_accept, q_reject): seven components.
A Turing machine that halts on every input is called a:
Show answer & explanation
Answer: B) decider
A decider always halts, and the language it accepts is recursive.
Is {⟨M⟩ | L(M) is regular} decidable?
Show answer & explanation
Answer: B) No, by Rice’s theorem
“L(M) is regular” is a non-trivial semantic property of L(M), so it is undecidable. That each regular language is decidable does not help because the input is a TM, not a DFA.
Which of the following is decidable?
Show answer & explanation
Answer: A) Does a given DFA accept some string?
For a DFA, reachability of a final state decides it. The TM versions are undecidable.
Is EQ_DFA = {⟨A, B⟩ | A and B are DFAs with L(A) = L(B)} decidable?
Show answer & explanation
Answer: A) Yes
Build the DFA for the symmetric difference (L(A) ∩ complement of L(B)) ∪ (L(B) ∩ complement of L(A)) and test its emptiness.
The language E_TM = {⟨M⟩ | L(M) = ∅} is:
Show answer & explanation
Answer: C) not recursively enumerable, but its complement is
“L(M) ≠ ∅” is RE (dovetail M on all strings and accept if any is accepted), so E_TM is co-RE. E_TM itself is not decidable and, if it were RE, it would be recursive.
The language EQ_TM = {⟨M1, M2⟩ | L(M1) = L(M2)} is:
Show answer & explanation
Answer: D) neither RE nor co-RE
Both EQ_TM and its complement are non-RE; equivalence of TMs is undecidable in the strongest sense.
Which of the following is NOT equivalent in computational power to the standard Turing machine?
Show answer & explanation
Answer: D) A deterministic pushdown automaton
A DPDA accepts only deterministic CFLs. The other three models accept exactly the recursively enumerable languages.
Is L = {⟨M, w⟩ | M halts on w in at most |w|² steps} decidable?
Show answer & explanation
Answer: A) Yes, by simulating M for |w|² steps
The step bound is explicit, so simulating at most |w|² steps always terminates and answers the question. It is not the unbounded halting problem.
If A_TM ≤m L (A_TM mapping-reduces to L), then L is:
Show answer & explanation
Answer: B) undecidable
If L were decidable, composing the reduction with a decider for L would decide A_TM, which is impossible.
Topic FAQs
What is the difference between recursive and recursively enumerable languages?
A recursive language has a TM that always halts and decides membership. An RE language has a TM that accepts exactly its strings but may loop on strings outside it; a language is recursive iff both it and its complement are RE.
Does a non-deterministic TM recognise more languages than a deterministic TM?
No. A deterministic TM can simulate a non-deterministic one by exploring its computation tree breadth-first, at the cost of exponential time. The classes of languages are the same.
What does Rice’s theorem say?
Every non-trivial semantic property of Turing-recognisable languages is undecidable: if some but not all RE languages have the property, then the set of TM encodings whose language has the property is undecidable.
Is the halting problem decidable for finite automata?
Yes. A DFA always halts after reading its input, so the question is trivially decidable. Undecidability of halting applies to general Turing machines.
Hover a card to reveal the answer with a 3D flip. On touch devices, tap the card or use Show answer.