Recall warm-up
- Minimal DFA states for “3rd from the end is 1”?
Stuck? Peek at 1.2.3 Subset construction and the 2ⁿ blow-up
- Subset construction: start {q₀} (or ECLOSE(q₀)); δ(S,a) = ⋃ δ(q,a) (then ECLOSE); accept iff S ∩ F ≠ ∅; ∅ = dead state.
- ≤ 2ⁿ states; count only reachable sets.
- ε-removal: δ'(q,a) = ECLOSE(δ(ECLOSE(q), a)); F' = {q : ECLOSE(q) ∩ F ≠ ∅}.
- k-th from end is 1: NFA k+1, DFA 2ᵏ. k-th from start: DFA k+2.
- DFA ≡ NFA ≡ ε-NFA in power.
- What three properties make an equivalence relation?
Stuck? Peek at 0.2.2 Functions, relations and equivalence classes
- Relation ⊆ A × B. Function: every input exactly one output. Partial function: some inputs have none.
- #functions A→B = |B|^|A|. #one-to-one (|A| ≤ |B|) = |B|·(|B|−1)···. #relations on n-set = 2^(n²).
- Equivalence = reflexive + symmetric + transitive. Classes partition the set; number of classes = index.
- Finer relation (refinement) ⇒ more classes; every fine class sits inside a coarse class.
- Minimal DFA states for “starts with a” over {a,b}?
Stuck? Peek at 1.1.1 States and the DFA
- DFA = (Q, Σ, δ, q₀, F), δ : Q × Σ → Q total. One step per symbol; always halts.
- Accept iff the last state ∈ F. ε accepted ⇔ q₀ ∈ F.
- Dead state: non-accepting, all self-loops. GATE counts it in minimal-DFA questions.
- Exactly one string of length k: k + 2 states. #DFAs (n states, m symbols, fixed start) = nⁿᵐ · 2ⁿ.
The Hook
Two employees in an office handle requests identically: whatever comes in, they make the same final decision. You don’t need both on the org chart — merge them. In a DFA, two states that lead to the same accept/reject verdict for every possible future input are interchangeable. Finding and merging them gives the smallest possible DFA, and “how many states in the minimal DFA?” is GATE’s favorite TOC question.
Predict First
In the DFA below, states C, D and E are all accepting, and each one goes to F (the dead state) on 1. Do you think C, D, E can be merged into one?
Core Concept
Prediction check
Answer: yes. From each of C, D, E: reading 0 keeps you in an accepting state (E), reading 1 kills you (F). Every future string gets the same verdict from all three. They are equivalent.
| state | on 0 | on 1 | accepting now? |
|---|---|---|---|
| C | E (accept) | F (dead) | yes |
| D | E (accept) | F (dead) | yes |
| E | E (accept) | F (dead) | yes |
Step 0: remove unreachable states
A state is unreachable if no input leads to it from q₀ (no path in the graph). It never affects the language. Find reachable states by BFS from q₀ (Lesson 0.2.5); delete the rest. Always do this first — an unreachable state can look “distinct” and inflate your count.
Equivalent states
“Same verdict on every future.” ≡ is an equivalence relation (reflexive, symmetric, transitive), so it partitions Q into classes (Lesson 0.2.2). Each class becomes one state of the minimal DFA.
Distinguishable states
- ε distinguishes every accepting state from every non-accepting one.
- If δ(p, a) and δ(q, a) are distinguishable by w, then p and q are distinguishable by aw. This is how distinguishability spreads backwards.
k-equivalence
p ≡ₖ q means no string of length ≤ k distinguishes them.
- ≡₀ has two classes: F and Q − F.
- p ≡ₖ₊₁ q iff p ≡ₖ q and for every symbol a, δ(p, a) ≡ₖ δ(q, a).
Each round can only split classes. When a round splits nothing, it never will again: ≡ₖ = ≡. With n states this happens within n − 2 rounds.
The minimal DFA
Merge each equivalence class into one state; transitions go class to class (well-defined because equivalent states move to equivalent states). The result is the minimal DFA: no DFA for the language has fewer states, and it is unique up to renaming states.
Putting it together
- Remove unreachable states first.
- Equivalent states have identical futures; distinguishable ones are separated by some string.
- Refine {F, Q−F} until stable; each class is one state of the unique minimal DFA.
Visual
States: A, B, C, D, E, F, G
Transitions: A>B: 0; B>A: 0; A>C: 1; B>D: 1; C>E: 0; D>E: 0; C>F: 1; D>F: 1; E>E: 0; E>F: 1; F>F: 0,1; G>A: 0; G>G: 1
Step 0 reachable from A: {A,B,C,D,E,F}. G is unreachable → delete.
≡₀ : {A,B,F} | {C,D,E} (non-accepting | accepting)
≡₁ : A: 0→B(N) 1→C(Y) B: 0→A(N) 1→D(Y) F: 0→F(N) 1→F(N)
→ split {A,B} | {F}; C,D,E: 0→E(Y) 1→F(N) → stay together
{A,B} | {F} | {C,D,E}
≡₂ : A: 0→B∈{A,B} 1→C∈{CDE}; B: 0→A∈{A,B} 1→D∈{CDE} → same
nothing splits → STOP. 3 classes = 3 states
States: AB, CDE, F
Transitions: AB>AB: 0; AB>CDE: 1; CDE>CDE: 0; CDE>F: 1; F>F: 0,1
Language: 0*10* (exactly one 1). Trace “0010”: AB→AB→AB→CDE→CDE accept. “0101”: AB→CDE→CDE→F reject.
Worked Examples
In the DFA above, find a string distinguishing A from F.
Show the full solution
“1”: A ─1→ C (accept), F ─1→ F (reject). So A and F are distinguishable by 1.
Is A distinguishable from B?
Show the full solution
No. A and B are both non-accepting; on 0 they swap; on 1 both go into {C,D,E}. Every future gives the same verdict, so A ≡ B. Intuitively A and B both mean “no 1 seen yet” — the parity of 0s is tracked but never used.
A DFA over {a} has states 0–5 in a cycle (i ─a→ i+1 mod 6), start 0, F = {0, 3}. How many states in the minimal DFA?
Show the full solution
F repeats every 3 steps, so state i ≡ state i+3. ≡₀: {0,3} | {1,2,4,5}. ≡₁: 1→2(N), 2→3(Y), 4→5(N), 5→0(Y) → {1,4} | {2,5}. ≡₂: no further split. Classes {0,3}, {1,4}, {2,5} → 3 states: the language is “length divisible by 3”.
GATE Traps
- Remove unreachable states before counting — they are never part of the minimal DFA.
- An accepting and a non-accepting state are never equivalent (ε distinguishes them).
- States that look different (different names, different arrows) may still be equivalent.
- Minimal DFA is unique (up to names); minimal NFA is not.
Memory Hook
Two states are twins if no future can tell them apart. Minimization = seating all twins on one chair.
Connect the Dots
We have the idea and the round-by-round splitting. Next lesson turns it into two exam-ready procedures — the partition method and the table-filling method — and drills the “number of states in the minimal DFA” question.
Self-Test
- MCQ
Two states p, q of a DFA are equivalent iff:
- they have the same outgoing labels
- for every w, δ̂(p,w) ∈ F ⇔ δ̂(q,w) ∈ F
- they are both accepting
- they are reachable from each other
- MSQ
Which are true?
- ε distinguishes an accepting state from a non-accepting state
- Unreachable states must be removed before minimizing
- If δ(p,a) and δ(q,a) are distinguishable then p and q are distinguishable
- Two accepting states are always equivalent
- NAT
Unary DFA: cycle 0→1→2→3→0 on a, start 0, F = {0, 2}. Minimal DFA states?
Write your answer before opening the key.
- MCQ
Partition ≡₀ always consists of:
- one class
- F and Q − F
- one class per state
- reachable and unreachable states
Rule Card
- Step 0: delete unreachable states (BFS from q₀).
- p ≡ q ⇔ ∀w: δ̂(p,w) ∈ F ⇔ δ̂(q,w) ∈ F. Distinguishable ⇔ some w separates.
- ≡₀ = {F, Q−F}; ≡ₖ₊₁ splits by where symbols lead w.r.t. ≡ₖ; stop when stable.
- Merge classes → minimal DFA, unique up to renaming.
Concept Ledger
- unreachable state
- equivalent states p ≡ q
- distinguishable states
- distinguishing string
- k-equivalence ≡ₖ
- minimal DFA (unique)
Answer Vault
Reveal answers when you’re ready
Warm-up answers
- 8.
- Reflexive, symmetric, transitive.
- 3 (including dead).
Self-test answers
- B — Definition.
- A: Labels say nothing about verdicts.
- C: Necessary for accepting pairs but not sufficient.
- D: Unrelated.
- ABC — Standard facts.
- D: They can differ in future behaviour.
- 2 — Accepts even lengths: classes {0,2}, {1,3}.
- B — Only ε (length 0) is considered.
- A: Unless F = ∅ or Q.
- C: That is the finest partition.
- D: Reachability is handled separately.
Flashcards
- First step of minimization?
Reveal answer
Remove unreachable states. - When are two DFA states equivalent?
Reveal answer
Every string leads both to acceptance or both to rejection. - ≡₀ partition?
Reveal answer
{F, Q − F} - Is the minimal DFA unique?
Reveal answer
Yes, up to renaming states.