← Student tools · Problem 12 · Lecture 7 · Round 1 (30 pts)

ADFA, EDFA, ACFG are all decidable

Three poly-time deciders side by side: simulation, reachability, CYK.

CLO-1CLO-2R1·30 ptsL7
🔊 Listen

Three apparently-similar yes/no questions, all polynomial-time decidable. The TM versions of these same questions — ATM, ETM, equivalence — are undecidable. Understanding what changes is the entire point of the comparison.

ADFA = {⟨B, w⟩ : DFA B accepts w}

On input ⟨B, w⟩: simulate B on w. Track the current state, read each symbol of w, follow the transition. After |w| symbols, accept iff the state is in F. Runs in O(n) where n = |w| (each step is constant-time table lookup).

EDFA = {⟨B⟩ : L(B) = ∅}

L(B) is non-empty iff some accept state is reachable from the start state through B's transition graph. So: do a graph BFS/DFS from q0; check if any visited state is in F. Runs in O(|Q|·|Σ|) — linear in the size of B's transition table.

ACFG = {⟨G, w⟩ : CFG G generates w}

Convert G to Chomsky Normal Form; run the CYK dynamic-programming algorithm. CYK fills an n × n table where entry T[i, j] = {variables that derive the substring wi…wj}. Accept iff S ∈ T[1, n]. Runs in O(n³ · |G|) time.

🔊 Listen
The decidability boundary · what changes from DFA/CFG to TM DFA & CFG world · DECIDABLE • Finite control state set Q • At most |Q||w|+1 distinct config trajectories on input w • Derivation length bounded (2n−1 for CNF) • Reachability = finite graph problem → "all paths" is a finite search. ADFA, EDFA, EQDFA ACFG, ECFG, ANFA, AREX TM world · UNDECIDABLE • Unbounded tape, infinitely many configs • Computation can loop forever • "Reachable" requires deciding halting first • Diagonalisation contradicts any candidate decider → "all paths" is infinite. ATM, ETM, EQTM, HALTTM EQCFG (the one CFG question that's TM-flavoured)

The line between the two columns is sharper than students expect. EQCFG — equivalence of context-free grammars — falls on the undecidable side, even though ACFG and ECFG are decidable. That single fact is the warning shot: small changes in the question can flip decidability. EQCFG is undecidable because comparing two CFGs requires checking every string in Σ*, and that quantifier-over-Σ* pushes you out of "bounded search" land.

🔊 Listen

Take grammar G in CNF: S → AB | BC, A → BA | a, B → CC | b, C → AB | a. Input w = "baaba".

CYK builds a table T where T[i, j] holds the set of variables that derive the substring of length j starting at position i.

The table has O(n²) cells, each computed in O(n·|G|) time → total O(n³·|G|).

🔊 Listen
Three deciders, three patterns Auto-plays
🔊 Listen
🔊 Listen

Sipser: §4.1, Theorems 4.1–4.7 (the full decidability table). Lecture notes: Module 1 covers all three constructions slide-by-slide. Companion problems: P02 (universal TM, contrast), P14 (Rice's theorem, contrast).