RAPID EXAM REFERENCE · 1-PAGE SUMMARIES

Theory of Computation Cheat Sheets

One page per topic for when you have 10 minutes before an exam: the core rule, the formulas, and the traps.

Finite Automata, DFA Minimization & State Equivalence

DFA Construction, NFA Conversion & Minimization

Open Full Lesson →

A DFA has exactly one transition per symbol per state; Myhill-Nerode merges indistinguishable states where delta*(p, w) and delta*(q, w) have identical acceptance outcomes.

Must-Remember Principles:
  • —DFA 5-tuple: M = (Q, Sigma, delta, q_0, F); delta: Q x Sigma -> Q.
  • —NFA to DFA: Maximum possible states in equivalent DFA = 2^n for an n-state NFA.
  • —Modulo k Divisibility: Binary numbers divisible by k require exactly k states.
  • —DFA Minimization: Table-filling algorithm identifies distinguishable pairs in O(|Sigma| * |Q|^2).
Critical Pitfalls & Exam Traps:
  • ×Never omit the dead trap state when counting DFA states! An NFA may simply omit invalid transitions, but a DFA must explicitly route them to a non-accepting dead state.
Finite Automata, DFA Minimization & State Equivalence

Regular Expressions, Arden's Theorem & State Elimination

Open Full Lesson →

Arden's Theorem solves R = Q + RP with unique solution R = QP* provided epsilon is not in P; state elimination removes intermediate states by creating bypass composite paths.

Must-Remember Principles:
  • —Arden's Equation: R = Q + RP ==> R = QP*.
  • —If R = Q + PR ==> R = P*Q.
  • —State Elimination: Bypassing state k creates edge R_ij = R_ij + R_ik (R_kk)* R_kj.
  • —Thompson's Construction: Translates any regular expression into an epsilon-NFA with O(|r|) states.
Critical Pitfalls & Exam Traps:
  • ×Check that epsilon is not in P before claiming a unique solution with Arden's theorem; if epsilon is in P, R = QP* is still a solution, but it is not unique.
Regular Language Properties & Pumping Lemma

Pumping Lemma & Closure Properties of Regular Languages

Open Full Lesson →

Regular Pumping Lemma partitions s = xyz with |xy| <= p and |y| > 0; regular languages are closed under virtually all standard operations including complement, intersection, and reversal.

Must-Remember Principles:
  • —Pumping conditions: |xy| <= p, |y| >= 1, x y^i z in L for all i >= 0.
  • —Pump down: i = 0 (removes y); Pump up: i = 2 (duplicates y).
  • —Regular languages are closed under: Union, Intersection, Complement, Difference, Concatenation, Star, Reversal, Homomorphism, Inverse Homomorphism.
  • —If L is regular, then Prefixes(L), Suffixes(L), and Substrings(L) are all regular.
Critical Pitfalls & Exam Traps:
  • ×The Pumping Lemma cannot be used to prove a language IS regular (it is necessary, not sufficient). Use DFA construction or regular expressions to prove regularity.
Regular Language Properties & Pumping Lemma

Decision Properties & Algorithms for Regular Languages

Open Full Lesson →

All standard decision questions for regular languages (Membership, Emptiness, Finiteness, Equivalence, Subset, Totality) are completely DECIDABLE.

Must-Remember Principles:
  • —Membership w in L: Trace on DFA in O(|w|).
  • —Emptiness L = 0: Check if any final state is reachable from start state in O(V+E).
  • —Finiteness: Check for cycles on paths between start state and final states.
  • —Equivalence L1 = L2: Test if (L1 ∩ L2') ∪ (L1' ∩ L2) is empty.
Critical Pitfalls & Exam Traps:
  • ×While equivalence is decidable for Regular languages, equivalence is UNDECIDABLE for Context-Free Languages!
Context-Free Grammars, Ambiguity & Pushdown Automata

CFG Derivations, Ambiguity Proofs & Chomsky Normal Form

Open Full Lesson →

A CFG is ambiguous if some string has >= 2 distinct leftmost derivations; in CNF (A -> BC or A -> a), deriving a string of length n takes exactly 2n - 1 steps.

Must-Remember Principles:
  • —CNF form: A -> BC or A -> a.
  • —CNF Derivation Steps: 2n - 1 steps for string of length n.
  • —Testing ambiguity is UNDECIDABLE for general CFGs.
  • —CYK Algorithm parses any string of length n in O(n^3 * |P|) time using dynamic programming on CNF grammars.
Critical Pitfalls & Exam Traps:
  • ×Remember that the start symbol can derive epsilon (S -> epsilon) only if epsilon is in the language, in which case S cannot appear on the right side of any production in CNF.
Context-Free Grammars, Ambiguity & Pushdown Automata

Pushdown Automata (PDA), DPDA vs NPDA & Acceptance Modes

Open Full Lesson →

DPDA is strictly less powerful than NPDA; DCFL is closed under complement but not union; CFL is closed under union but not complement.

Must-Remember Principles:
  • —PDA 7-tuple: M = (Q, Sigma, Gamma, delta, q_0, Z_0, F).
  • —Acceptance by Final State == Acceptance by Empty Stack for NPDA.
  • —DCFL is closed under: Complement, Intersection with Regular, Inverse Homomorphism.
  • —CFL is closed under: Union, Concatenation, Kleene Star, Reversal, Homomorphism.
  • —Neither DCFL nor CFL is closed under intersection.
Critical Pitfalls & Exam Traps:
  • ×Do not assume palindromes are always non-deterministic: w c w^R has an explicit center marker and is easily recognized by a deterministic PDA.
CFL Pumping Lemma & Decision Algorithms

Pumping Lemma for CFLs & Non-Context-Free Proofs

Open Full Lesson →

CFL Pumping partitions s = uvxyz with |vxy| <= p and |vy| >= 1; for CFGs, Emptiness, Finiteness, and Membership are Decidable, but Equivalence and Universality are Undecidable.

Must-Remember Principles:
  • —CFL Pumping conditions: |vxy| <= p, |vy| >= 1, u v^i x y^i z in L for all i >= 0.
  • —Classic Non-CFLs: a^n b^n c^n, a^n b^n c^n d^n, w w, a^(n^2), a^prime.
  • —Decidable for CFG: Membership, Emptiness, Finiteness.
  • —Undecidable for CFG: Equivalence, Universality (L = Sigma*), Inclusion, Disjointness, Ambiguity.
Critical Pitfalls & Exam Traps:
  • ×Do not confuse grammar ambiguity with language inherent ambiguity: a language may have an ambiguous grammar yet still be unambiguous if an alternative unambiguous grammar exists.
Turing Machines, Computability & Rice's Theorem

Turing Machines, Undecidability & Rice's Theorem

Open Full Lesson →

A language is Recursive iff both it and its complement are RE; any non-trivial semantic property of the language of a TM is undecidable by Rice's theorem.

Must-Remember Principles:
  • —Recursive (REC): Decider halts on ALL inputs (never loops).
  • —Recursively Enumerable (RE): TM halts and accepts on valid inputs; may loop on invalid inputs.
  • —Halting Problem is RE but NOT Recursive; its complement is NOT RE.
  • —Rice's Theorem applies to ANY non-trivial semantic property of L(M).
  • —Syntactic properties of M (state count, step bounds) are DECIDABLE.
Critical Pitfalls & Exam Traps:
  • ×Do not apply Rice's theorem to questions about whether M halts on a specific input string w (that is the Halting Problem directly, not a pure language property).
Turing Machines, Computability & Rice's Theorem

Mapping Reductions, Post Correspondence Problem & Chomsky Hierarchy

Open Full Lesson →

In reduction A <=_m B: if B is decidable, A is decidable; if A is undecidable, B is undecidable; PCP is undecidable for alphabet size >= 2.

Must-Remember Principles:
  • —A <=_m B: Decidability flows LEFT (B decidable => A decidable).
  • —A <=_m B: Undecidability flows RIGHT (A undecidable => B undecidable).
  • —PCP over unary alphabet (|Sigma| = 1) is DECIDABLE.
  • —Chomsky Hierarchy: Type 3 (Regular) ⊂ Type 2 (CFL) ⊂ Type 1 (CSL) ⊂ Recursive ⊂ Type 0 (RE).
  • —Context-Sensitive Languages (Type 1) are recognized by Linear Bounded Automata (LBA) and are completely DECIDABLE.
Critical Pitfalls & Exam Traps:
  • ×Context-Sensitive Languages are recursive (decidable). Do not confuse CSL with Recursively Enumerable languages.