Top Banner Ad
BCS402 · 1-Page Cheat Sheet

Theory of Automata and Formal Languages

BCS402 · YEAR 2 · SEM 4

Theory of Automata and Formal Languages — Last-Night Cheat Sheet

prephora.in

Five units move from finite automata to regular expressions/languages, grammars and normal forms, pushdown automata/CFL properties, and Turing machines/decidability. Each unit keeps its own formal model and closure/decision relation.

1. Basic Concepts and Automata Theory

Recall anchor. Automaton = states + input alphabet + transition function + start + accept states. DFA has exactly one transition per symbol; NFA may have several or ε-moves.

Scored points.

  • Alphabets, strings, and languages: alphabet Σ\Sigma is a finite symbol set, string is a finite sequence over Σ\Sigma, language L⊆Σ∗L\subseteq \Sigma^*; ϵ\epsilon is empty string.
  • DFA is M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F) with δ:Q×Σ→Q\delta:Q\times\Sigma\to Q; a string is accepted if the unique run ends in FF.
  • NFA allows δ:Q×(Σ∪{ϵ})→2Q\delta:Q\times(\Sigma\cup\{\epsilon\})\to 2^Q; acceptance means some path reaches an accepting state. DFA and NFA recognize the same regular languages.
  • NFA to DFA conversion uses subset construction: DFA states are sets of NFA states; ε-closure includes states reachable by ε-transitions.
  • Mealy and Moore machines produce output: Moore output depends on state, Mealy output depends on state and input; they are equivalent with possible state conversion.
  • Minimization of DFA uses partition refinement/equivalence classes to merge indistinguishable states, producing a minimal DFA for the same language.

Formula strip.

M=(Q,Σ,δ,q0,F),δDFA:Q×Σ→Q,δNFA:Q×(Σ∪{ϵ})→2QM=(Q,\Sigma,\delta,q_0,F),\quad \delta_{DFA}:Q\times\Sigma\to Q,\quad \delta_{NFA}:Q\times(\Sigma\cup\{\epsilon\})\to 2^Q

Micro-example. For NFA states {q0,q1}\{q_0,q_1\} with ϵ\epsilon-move q0→q1q_0\to q_1, ε-closure(q0q_0)={q0,q1}\{q_0,q_1\}. In subset construction this set becomes one DFA start state.

Examiner line. For FA questions, write the formal tuple, show transition table/diagram, trace the input string stepwise, and state accept/reject with the final state.

2. Regular Expressions and Languages

Recall anchor. Regular expressions, finite automata, and regular grammars describe the same class of languages. Use Arden's theorem or state elimination for RE conversion.

Scored points.

  • Regular expressions use union (++), concatenation, and Kleene star (∗*); identities include R+∅=RR+\emptyset=R, Rϵ=RR\epsilon=R, R∅=∅R\emptyset=\emptyset, and (R∗)∗=R∗(R^*)^*=R^*.
  • Thompson/standard constructions convert RE to ε-NFA; subset construction and minimization convert to DFA. Conversely, state elimination or Arden's theorem converts FA to RE.
  • Arden's theorem: if R=Q+RPR=Q+RP and ϵ∉P\epsilon\notin P, then R=QP∗R=QP^*; it solves regular equation systems from DFA transitions.
  • Closure properties of regular languages: closed under union, intersection, complement, concatenation, star, reversal, difference, and homomorphism.
  • Pumping Lemma for regular languages: for regular LL, any sufficiently long s=xyzs=xyz has ∣xy∣≤p|xy|\le p, ∣y∣>0|y|>0, and xyiz∈Lxy^iz\in L for all i≥0i\ge0; used to prove non-regularity.
  • Decision properties: emptiness, finiteness, membership, equivalence, and containment are decidable for regular languages using DFA/automata algorithms.

Formula strip.

R=Q+RP,  ϵ∉P⇒R=QP∗,s=xyz,  ∣xy∣≤p,  ∣y∣>0,  ∀i≥0,  xyiz∈LR=Q+RP,\;\epsilon\notin P \Rightarrow R=QP^*,\quad s=xyz,\;|xy|\le p,\;|y|>0,\;\forall i\ge0,\;xy^iz\in L

Micro-example. Equations: q1=ϵ+q1a+q2bq_1=\epsilon+q_1a+q_2b, q2=q1b+q2aq_2=q_1b+q_2a. By Arden, q2=q1ba∗q_2=q_1ba^* and substitute into q1q_1 to get RE for strings accepted at q1q_1.

Examiner line. For regular languages, state the RE/FA conversion method, apply Arden/pumping lemma with all conditions, and conclude regular or not regular explicitly.

3. Regular and Non-Regular Grammars

Recall anchor. CFG generates strings by productions; parse trees expose derivation structure and ambiguity. Normal forms standardize productions for parsing and proofs.

Scored points.

  • Grammar is G=(V,Σ,P,S)G=(V,\Sigma,P,S); CFG productions have form A→αA\to \alpha where A∈VA\in V. Derivation can be leftmost or rightmost; language is L(G)={w∈Σ∗∣S⇒∗w}L(G)=\{w\in\Sigma^*\mid S\Rightarrow^* w\}.
  • Ambiguity: a CFG is ambiguous if some string has two different parse trees (or two leftmost/rightmost derivations); ambiguity can cause multiple meanings in programming languages.
  • Simplification of CFG removes useless symbols, unreachable symbols, ε-productions (as needed), and unit productions while preserving language (except possibly ε).
  • Chomsky Normal Form (CNF): productions are A→BCA\to BC or A→aA\to a; useful for CYK parsing and proofs. Greibach Normal Form (GNF): A→aαA\to a\alpha, α∈V∗\alpha\in V^*.
  • Regular grammars: right-linear A→aB∣aA\to aB\mid a or left-linear A→Ba∣aA\to Ba\mid a generate regular languages and convert to/from finite automata.
  • Chomsky hierarchy: Type 3 regular, Type 2 context-free, Type 1 context-sensitive, Type 0 recursively enumerable; each lower type is properly contained in higher.

Formula strip.

G=(V,Σ,P,S),CNF:A→BC∣a,GNF:A→aα,  α∈V∗G=(V,\Sigma,P,S),\quad \text{CNF}:A\to BC\mid a,\quad \text{GNF}:A\to a\alpha,\;\alpha\in V^*

Micro-example. Convert S→ASA∣aB,A→B∣S,B→b∣ϵS\to ASA\mid aB, A\to B\mid S, B\to b\mid \epsilon by removing ε/unit productions, then binarize/terminalize to get CNF like S→AC∣a∣...S\to AC\mid a\mid ..., C→SAC\to SA.

Examiner line. For grammar questions, write the grammar tuple, show derivation/parse tree, perform simplification/normal-form steps in order, and state the generated language.

4. Push Down Automata and Properties of Context Free Languages

Recall anchor. PDA = finite control + input + stack. Nondeterministic PDA recognizes exactly context-free languages; deterministic PDA is weaker.

Scored points.

  • PDA is P=(Q,Σ,Γ,δ,q0,Z0,F)P=(Q,\Sigma,\Gamma,\delta,q_0,Z_0,F); transition δ(q,a,X)\delta(q,a,X) may read input, pop/push stack, and change state. Acceptance by final state or empty stack is equivalent for NPDAs.
  • NPDA can guess nondeterministically, making it suitable for CFLs like {anbn}\{a^n b^n\} or palindromes; DPDA cannot recognize all CFLs.
  • CFG to PDA: construct PDA that simulates leftmost derivation using stack; PDA to CFG: create variables representing state-stack-state paths.
  • Pumping Lemma for CFL: for CFL LL, sufficiently long s=uvxyzs=uvxyz has ∣vxy∣≤p|vxy|\le p, ∣vy∣>0|vy|>0, and uvixyiz∈Luv^ixy^iz\in L; used to prove non-CFL.
  • CFL closure: closed under union, concatenation, Kleene star, reversal, homomorphism, inverse homomorphism, intersection with regular language; not closed under intersection or complement in general.
  • CFL decision properties: emptiness, membership (CYK/Earley), and finiteness are decidable; equivalence, containment, ambiguity, and universality are undecidable in general.

Formula strip.

P=(Q,Σ,Γ,δ,q0,Z0,F),s=uvxyz,  ∣vxy∣≤p,  ∣vy∣>0,  ∀i≥0,  uvixyiz∈LP=(Q,\Sigma,\Gamma,\delta,q_0,Z_0,F),\quad s=uvxyz,\;|vxy|\le p,\;|vy|>0,\;\forall i\ge0,\;uv^ixy^iz\in L

Micro-example. For L={anbn∣n≥0}L=\{a^n b^n\mid n\ge0\}, PDA pushes AA for each aa, pops AA for each bb, and accepts when stack returns to Z0Z_0. For aabbaabb, stack sequence: Z0,AZ0,AAZ0,AZ0,Z0Z_0,AZ_0,AAZ_0,AZ_0,Z_0.

Examiner line. For PDA/CFL, define the machine or grammar, show stack moves or pumping decomposition, and explicitly state the closure/decision property used.

5. Turing Machines and Recursive Function Theory

Recall anchor. Turing machine models effective computation with finite control and unbounded tape. Some languages are recognizable but not decidable.

Scored points.

  • TM is M=(Q,Σ,Γ,δ,q0,B,F)M=(Q,\Sigma,\Gamma,\delta,q_0,B,F) with δ:Q×Γ→Q×Γ×{L,R}\delta:Q\times\Gamma\to Q\times\Gamma\times\{L,R\}; it can read/write tape and move left/right, giving unrestricted computation power.
  • TM variants (multi-tape, nondeterministic, multi-track, universal TM) are equivalent in computational power; they may differ in convenience or time but not decidability class.
  • Recursive (decidable) languages have a TM that halts on all inputs; recursively enumerable (RE) languages have a TM that halts and accepts strings in the language but may loop otherwise.
  • Church-Turing thesis: any effectively computable function is computable by a Turing machine; it is a thesis supported by equivalence of models, not a formal theorem.
  • Halting problem is undecidable: no algorithm can decide for all TM-input pairs whether the TM halts. Reduction from halting problem proves other undecidability results.
  • Post Correspondence Problem (PCP) is undecidable; Rice's theorem states non-trivial semantic properties of RE language descriptions are undecidable.

Formula strip.

M=(Q,Σ,Γ,δ,q0,B,F),δ:Q×Γ→Q×Γ×{L,R},Decidable⊂REM=(Q,\Sigma,\Gamma,\delta,q_0,B,F),\quad \delta:Q\times\Gamma\to Q\times\Gamma\times\{L,R\},\quad \text{Decidable}\subset \text{RE}

Micro-example. Halting reduction: assume H(M,w)H(M,w) decides halting; build D(M)D(M) that loops if H(M,M)H(M,M) halts else halts. Then D(D)D(D) creates contradiction, so HH cannot exist.

Examiner line. For TM/undecidability, write the transition or reduction clearly, state whether machine halts on all inputs, and conclude decidable, RE, or undecidable with reason.

Memory map

%%{init: {'theme': 'base', 'look': 'handDrawn', 'themeVariables': {'fontFamily': "'Nunito', sans-serif", 'fontSize': '17px', 'primaryColor': '#EFEAD6', 'primaryBorderColor': '#0F766E', 'lineColor': '#23211C'}}}%%
flowchart LR
  U1["U1: Basic Concepts and Automata Theory"] --> U1a["DFA/NFA, epsilon-closure"] --> U1b["Moore/Mealy, minimization"]
  U1b --> U2["U2: Regular Expressions and Languages"] --> U2a["RE<->FA, Arden"] --> U2b["Pumping lemma, closure"]
  U2b --> U3["U3: Regular and Non-Regular Grammars"] --> U3a["CFG, derivation, ambiguity"] --> U3b["CNF/GNF, Chomsky hierarchy"]
  U3b --> U4["U4: Push Down Automata and Properties of Context Free Languages"] --> U4a["PDA stack moves"] --> U4b["CFL pumping/closure/decision"]
  U4b --> U5["U5: Turing Machines and Recursive Function Theory"] --> U5a["TM transitions, variants"] --> U5b["Halting, PCP, decidability"]

Rapid recall

  1. U1 Basic Concepts and Automata Theory — DFA has deterministic transitions; NFA/ε-NFA convert by subset construction; minimize by equivalent-state partitioning.
  2. U2 Regular Expressions and Languages — Arden: R=Q+RP⇒R=QP∗R=Q+RP\Rightarrow R=QP^*; regular languages closed under union/intersection/complement; use pumping lemma for non-regularity.
  3. U3 Regular and Non-Regular Grammars — CFG: A→αA\to\alpha; remove useless/ε/unit productions; CNF A→BC∣aA\to BC\mid a, GNF A→aαA\to a\alpha.
  4. U4 Push Down Automata and Properties of Context Free Languages — PDA uses stack for CFLs; CFLs not closed under intersection/complement; membership decidable, equivalence undecidable.
  5. U5 Turing Machines and Recursive Function Theory — TM may loop; recursive halts always, RE may not; halting problem and PCP are undecidable.

Final-answer checklist (BCS402)

  • Write the formal model first: FA tuple, RE equation, grammar, PDA tuple, or TM transition.
  • For conversions, show intermediate steps (ε-closure/subset table, Arden equations, simplification order, stack moves).
  • For pumping lemma proofs, state pp, choose string, split into required parts, pump ii, and show contradiction.
  • For closure/decision questions, name the property and give a one-line justification or counterexample.
  • End by stating acceptance/rejection, generated language, normal form, or decidability class clearly.