Introduction
A language is decidable (recursive) if some TM halts on every input and accepts exactly the strings in the language. It is undecidable if no such TM exists. Many natural questions about automata and grammars are decidable for regular languages, partly decidable for CFLs, and undecidable for Turing machines. The core is the standard decision table, the halting problem, reductions at a qualitative level, and Rice's theorem as a named hammer for nontrivial semantic properties of r.e. languages.
Prerequisites
- Turing Machines: recognizers, deciders, encodings .
Core concepts
Core undecidable languages
- is r.e. but undecidable (Sipser 4.2).
- is undecidable.
- is undecidable.
- is undecidable.
Reductions
To prove undecidable, reduce a known undecidable problem to : give a computable map such that . If were decidable, composing with would decide .
Direction matters: reduce from the known hard problem to the new problem.

Rice's theorem (statement)
Every nontrivial semantic property of r.e. languages is undecidable. More precisely: if is a set of r.e. languages that is nonempty and not all r.e. languages, then is undecidable. Use it to dismiss questions like "does contain ?" without a custom reduction.
Decision table by class
| Question | Regular | CFL | TM / r.e. |
|---|---|---|---|
| Membership | D | D | undecidable in general () |
| Emptiness | D | D | undecidable |
| Finiteness | D | D | undecidable |
| Equivalence | D | undecidable | undecidable |
| Regularity | trivial | undecidable | undecidable |
(D = decidable.) The finer table below adds DCFL and CSL columns and the standard problems.
| Question | REG | DCFL | CFL | CSL | REC | RE |
|---|---|---|---|---|---|---|
| Membership | D | D | D (CYK) | D (LBA) | D | undecidable |
| Emptiness | D | D | D | undecidable | undecidable | undecidable |
| Finiteness | D | D | D | undecidable | undecidable | undecidable |
| Universality | D | D (complement, then emptiness) | undecidable | undecidable | undecidable | undecidable |
| Equivalence | D | D (Senizergues) | undecidable | undecidable | undecidable | undecidable |
| Containment | D | undecidable | undecidable | undecidable | undecidable | undecidable |
| Disjointness | D | undecidable | undecidable | undecidable | undecidable | undecidable |
| Is regular? | trivially yes | D (Stearns) | undecidable | undecidable | undecidable | undecidable |
Ambiguity of a CFG is undecidable; for a right-linear grammar it is decidable (look for two accepting paths on one string in the matching NFA). Two rows are easy to confuse: DCFL equivalence is decidable, but DCFL containment is not; CFL emptiness is decidable, but CFL universality is not.

How it works
Diagonalization sketch for
Assume a decider for . Build that on runs and does the opposite. Then on contradicts. Hence cannot exist. is still r.e. via a universal simulator that accepts when the simulated machine accepts.
From to HALT
Reduce: given , build that runs on and accepts if that accepts; if would reject, loops. Then accepts iff halts on .
Algorithms and pseudocode
Deciders exist for regular and many CFL problems (earlier notes). For TMs, the "algorithm" is often a proof that none exists. A recognizer for :
U(<M,w>) // universal recognizer
1 simulate M on w
2 if M accepts: accept
3 if M rejects: reject
4 // if M loops, U loopsMathematical explanation
Recursive vs r.e.
decidable and both r.e. Consequently, r.e. and undecidable implies is not even r.e.
Why CFG equivalence is undecidable
For a TM , write an accepting computation as . The set of strings that are not such a history for on blank input is a CFL: a PDA guesses one local defect (wrong start, no accept at the end, or one pair that does not follow by ; the reversal of every second configuration lets the stack compare them). This CFL is iff has no accepting computation. So CFG universality is undecidable, and equivalence follows by comparing with a fixed grammar for .
Post's correspondence problem
An instance is a list of dominoes of strings; a solution is a nonempty index sequence with . PCP is undecidable (it encodes TM computations), but it is RE: try all sequences in order of length. PCP over a one-letter alphabet is decidable. PCP reduces to CFG ambiguity and to CFG intersection-emptiness, which is how those two problems are shown undecidable.
Worked examples
Example 1: table lookup
Emptiness of DFA: decidable. Emptiness of TM: undecidable. Equivalence of CFG: undecidable. Membership in CFG: decidable.
Example 2: Rice application
"Does contain at least one even-length string?" Nontrivial semantic property undecidable by Rice.
Example 3: not Rice
"Does have more than 10 states?" is a syntactic property of the description, decidable by reading . Rice does not apply.
Example 4: reduction direction
Wrong: "reduce HALT to my easy problem." Right: reduce HALT (hard) to the problem you claim is hard. For a mapping reduction :
| Known fact | Conclusion |
|---|---|
| decidable | decidable |
| RE | RE |
| undecidable | undecidable |
| not RE | not RE |
| (same ) |
Nothing follows from " decidable" or " undecidable". Since is not RE, any with is not RE; this is how and are shown not RE.
Example 5: decidable TM special cases
Some questions about TMs are decidable because they bound the run or ignore the language:
- "Does halt on within 100 steps?" Decidable: simulate 100 steps.
- "Does ever move left on input ?" Decidable: if after right moves it has not moved left, it is in the blanks and some state has repeated, so it moves right forever.
- "Does have more than 10 states?" Decidable (syntax).
- "Does ever enter state on input ?" Undecidable: reduce with .
Example 6: Rice, and how far up the ladder
Rice's theorem says only "undecidable"; the finer question is whether the set of machine codes is RE, co-RE, or neither.
| Set of | Status |
|---|---|
| ; ; | RE, not decidable (search for accepted strings by dovetailing) |
| () | co-RE, not RE |
| halts on | RE, not decidable |
| finite; ; regular; | neither RE nor co-RE |
| has an even number of states | decidable (not a property of ) |
A test for "not RE" (Rice-Shapiro theorem): if the set is RE, then (a) whenever has the property so does every RE superset of , and (b) has the property only if some finite subset of has it. "" fails (a), since has it and does not; " is infinite" fails (b). Both sets are therefore not RE.
Example 7: a PCP instance
Dominoes , , , . The sequence gives top and bottom , a solution, and no shorter sequence works. The instance has no solution: every top is shorter than its bottom, so the top string can never catch up.
Important properties and observations
- Undecidable does not mean "unknown"; it means "no algorithm exists".
- r.e. languages are closed under union and intersection, not under complement.
- Recursive languages are closed under complement, union, intersection.
- Always mark whether a TM problem is about syntax of or about .
Common misconceptions.
- Reversing reduction arrows.
- Applying Rice to syntactic properties.
- Applying Rice to a property of a restricted model (DFAs, CFGs); Rice is about TMs and RE languages only, and emptiness of a DFA is decidable.
- Using Rice for trivial properties (" is RE" is true for every , so it is decidable).
- Thinking CFL universality is decidable because CFL emptiness is.
- Saying is not r.e. (it is r.e., but undecidable).
GATE examination perspective
- TABLE FIRST. Regular / CFL / TM columns.
- RICE OR REDUCE. Pick the shorter tool.
- RECOGNIZER EXISTS IS NOT DECIDER EXISTS.
- DIRECTION OF REDUCTION. From known undecidable to target.
- FINE TABLE. CFL: membership, emptiness, finiteness D; universality, equivalence, ambiguity, regularity, disjointness undecidable. DCFL equivalence D.
- RE / CO-RE. " nonempty" is RE; " empty" is co-RE; "finite", "regular", "equal" are neither.
- PCP. Undecidable in general, decidable over a unary alphabet, RE by enumeration.
Summary
Sources
- M. Sipser, Introduction to the Theory of Computation, 3rd ed., Cengage Learning, Section 4.1 (decidable problems concerning regular and context-free languages), Section 4.2 (undecidability; a Turing-unrecognizable language), Section 5.1 (undecidable problems from language theory; reductions via computation histories), Section 5.2 (a simple undecidable problem: PCP), Section 5.3 (mapping reducibility).
- J. E. Hopcroft, R. Motwani, J. D. Ullman, Introduction to Automata Theory, Languages, and Computation, 3rd ed., Pearson Addison-Wesley, Section 9.2 (an undecidable problem that is RE), Section 9.3 (undecidable problems about TMs; Rice's theorem), Section 9.4 (Post's correspondence problem), Section 9.5 (other undecidable problems; ambiguity of CFGs).
- P. Linz, An Introduction to Formal Languages and Automata, 6th ed., Jones & Bartlett Learning, Section 12.1 (the halting problem; reducing one undecidable problem to another), Section 12.2 (undecidable problems for RE languages), Section 12.3 (the Post correspondence problem), Section 12.4 (undecidable problems for context-free languages).