CS Atlas GATE 2027
TOC course
0 / 91 complete

TOC/Phase 1 · Finite Automata

Lesson 1.3.2 · Item 25 of 91

Partition and table-filling methods

Read at your own pace. Try the questions before opening the answers.

On this page

Recall warm-up

  1. How is ≡ₖ₊₁ obtained from ≡ₖ?
    Stuck? Peek at 1.3.1 Unreachable, equivalent and distinguishable states
    • 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.

    Read lesson 1.3.1

  2. Subset construction: which sets are accepting?
    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.

    Read lesson 1.2.3

  3. Minimal DFA for #a ≡ 0 (mod 2) and #b ≡ 0 (mod 3)?
    Stuck? Peek at 1.1.3 DFA design patterns
    Language (|w| = k pattern)Minimal states
    starts with wk + 2
    contains w / ends with wk + 1
    |x| ≡ r mod nn
    |x| = k, |x| ≤ kk + 2
    |x| ≥ kk + 1
    #a mod m and/or #b mod nm·n (typical)
    binary value ≡ 0 mod k, k oddk
    binary ÷ 2ʲj + 1
    k-th symbol from start fixedk + 2

    Divisibility update: r ← (base·r + digit) mod k.

    Read lesson 1.1.3

The Hook

In the exam you have about three minutes per 2-mark question. You need a procedure that never misses a merge and never merges wrongly. Two such procedures exist; both compute the same equivalence classes. Learn the partition method for speed, and the table-filling method because GATE sometimes asks about “pairs of distinguishable states”.

Predict First

A DFA has 7 states after removing unreachable ones; 3 are accepting. What is the smallest and largest number of states its minimal DFA could have?

Core Concept

Prediction check

Smallest: 2 — accepting and non-accepting states can never merge, so at least one class of each (when both exist). Largest: 7 — nothing merges.

smallest possible
2 — accepting and non-accepting states never merge
largest possible
7 — nothing merges
Bounds for 7 reachable states, 3 accepting.

Method 1 — partition refinement (Moore / Hopcroft style)

  1. Remove unreachable states.
  2. P₀ = {F, Q − F}.
  3. For each group, write every state’s “signature”: the group each symbol sends it to.
  4. Split each group by signature. That gives P₁.
  5. Repeat until a round changes nothing. The groups are the minimal DFA’s states.

Tip: write the signature as a short tuple like (II, I) meaning “0 → group II, 1 → group I”.

Partition refinement on the medium example. Press Next for each round.
Partition refinement on the medium example. Press Next for each round.

Method 2 — table filling (Myhill table)

  1. Draw a triangle table with one cell per unordered pair {p, q}.
  2. Mark every pair with exactly one accepting state (distinguished by ε).
  3. Repeat: for each unmarked pair {p, q} and each symbol a, if {δ(p,a), δ(q,a)} is marked, mark {p, q}.
  4. Stop when a full pass marks nothing. Unmarked pairs are equivalent.

Number of cells = n(n−1)/2. Marked = distinguishable pairs; unmarked = equivalent pairs.

steps illustration
Table filling on the 1.3.1 DFA. ✗ = distinguishable, · = equivalent.

Reading the minimal DFA

Each class is a state; the class containing q₀ is the start; classes inside F are accepting; transitions: pick any member, follow its arrow, see which class it lands in.

classon 0on 1
→ {A,B}{A,B}{C,D,E}
* {C,D,E}{C,D,E}{F}
{F}{F}{F}
Reading off the minimal DFA: pick any member, follow its arrow, name the class it lands in.

Counting without drawing: the “distinct futures” method

For “minimal DFA for language L” questions, list the different situations a prefix can leave you in — situations that differ in which continuations are accepted. Each different situation = one state. Don’t forget the hopeless situation (dead state) and the “already satisfied” situation.

situationexample prefixaccept now?
0 a’sbno
1 aabno
≥ 2 a’s, last aaano
≥ 2 a’s, last baabyes
“At least two a’s and ends with b”: four different futures ⇒ 4 states.

Putting it together

  • Partition method: split by signatures until a round changes nothing.
  • Table filling: mark (F, non-F), propagate marks through successor pairs; unmarked pairs merge.
  • Fast counting: list the different futures, then add a dead state if some prefix is hopeless.

Visual

Table filling on the 1.3.1 DFA (reachable states A..F, F_acc = {C,D,E})

     A    B    C    D    E
 B   ·                          ✗ = distinguishable  · = equivalent
 C   ✗    ✗                     pass 0: mark every (accepting, non-accepting) pair
 D   ✗    ✗    ·                pass 1: {A,F}: on 1 → {C,F} marked → mark ✗
 E   ✗    ✗    ·    ·                   {B,F}: on 1 → {D,F} marked → mark ✗
 F   ✗    ✗    ✗    ✗    ✗              {A,B}: on 0 → {B,A}, on 1 → {C,D}: unmarked → leave
                                pass 2: nothing new → stop
unmarked: {A,B}, {C,D}, {C,E}, {D,E}  → classes {A,B}, {C,D,E}, {F} → 3 states

Worked Examples

Easy

Minimize: states 1,2,3 over {a}; 1 ─a→ 2, 2 ─a→ 3, 3 ─a→ 3; start 1; F = {2,3}.

Show the full solution

P₀: {1} | {2,3}. Signatures in {2,3}: 2 → 3 ∈ {2,3}, 3 → 3 ∈ {2,3}: same. Stable. 2 states: language a⁺.

Medium

DFA over {0,1}, start A, F = {E}. A: 0→B, 1→C. B: 0→B, 1→D. C: 0→B, 1→C. D: 0→B, 1→E. E: 0→B, 1→C. Minimize.

Show the full solution

P₀: {A,B,C,D} | {E}. Signatures (0,1): A (I,I), B (I,I), C (I,I), D (I,II) → {A,B,C} | {D} | {E}. Next: A: 0→B∈{ABC}, 1→C∈{ABC}; B: 0→B, 1→D∈{D} ✗ differs; C: 0→B, 1→C → {A,C} | {B} | {D} | {E}. Next: A: 0→B{B}, 1→C{AC}; C: 0→B{B}, 1→C{AC} → same. Stable: 4 states {A,C}, {B}, {D}, {E}. Language: strings ending in 011. (k + 1 = 4 ✓.)

GATE-level

Minimal DFA states over {a,b} for L = { w : w contains at least two a’s and ends with b }?

Show the full solution

Situations: count of a’s seen so far capped at 2 (0, 1, ≥2) and, once ≥2, whether the last symbol is b. For counts 0 and 1, the last symbol doesn’t matter yet (we will need more a’s, which changes the last symbol anyway). States: “0 a’s”, “1 a”, “≥2 a’s, last is a”, “≥2 a’s, last is b” (accepting). Note after the second a the last symbol is a. Total 4. Check: “aab” → 0→1→(≥2,a)→(≥2,b) accept; “aba” → 0→1→1→(≥2,a) reject; “ab” → 0→1→1 reject ✓.

GATE Traps

  • Forgetting to delete unreachable states first — they never merge into the minimal count.
  • Comparing signatures against the OLD partition, not the one you are building.
  • Stopping one round too early: always do a full pass that changes nothing.
  • Counting the dead state: if the language makes some prefixes hopeless, the minimal DFA has one. If it doesn’t (like “contains ab”), it has none.

Memory Hook

Partition method = sorting students into classrooms by which classrooms their friends are in, again and again, until nobody has to move.

Connect the Dots

We now minimize any given DFA. But what if you’re given only a language? The next lesson defines the equivalence classes directly on strings — no machine needed — and it gives the deepest characterization of regular languages: finite memory = finitely many classes.

Self-Test

  1. NAT

    Table filling on an n-state DFA uses how many cells when n = 6?

    Write your answer before opening the key.

  2. NAT

    Minimal DFA states over {a,b} for strings with at least 2 a’s?

    Write your answer before opening the key.

  3. NAT

    Minimal DFA states over {a,b} for strings with exactly 2 a’s?

    Write your answer before opening the key.

  4. MCQ

    In the partition method, P₀ is:

    1. {Q}
    2. {F, Q − F}
    3. one block per state
    4. { {q₀}, Q − {q₀} }
  5. MSQ

    Over {a,b}, which languages have a minimal DFA with exactly 4 states?

    1. strings with at most 2 a’s
    2. strings with exactly 2 a’s
    3. strings ending in aba
    4. strings of length ≡ 0 mod 4

Rule Card

  • Partition: remove unreachable; P₀ = {F, Q−F}; split by signatures w.r.t. previous partition; stop when stable.
  • Table filling: n(n−1)/2 cells; mark (F, non-F); propagate “successor pair marked ⇒ mark”; unmarked = equivalent.
  • Count by distinct futures: list situations with different accepted continuations, include dead / satisfied states.
  • Exactly k of a symbol: k + 2 states; at least k: k + 1; at most k: k + 2.

Concept Ledger

  • partition refinement method
  • signature of a state
  • table-filling (Myhill) method
  • distinguishable pair
  • distinct futures counting

Answer Vault

Reveal answers when you’re ready

Warm-up answers

  1. Two states stay together iff they were together in ≡ₖ and every symbol sends them into the same ≡ₖ class.
  2. Those containing an NFA accepting state.
  3. 6.

Self-test answers

  1. 15 — n(n−1)/2.
  2. 3 — 0 a’s, 1 a, ≥2 a’s (accept sink).
  3. 4 — 0, 1, 2 (accept), ≥3 (dead).
  4. B — Split by acceptance only.
    • A: Too coarse unless F = ∅ or Q.
    • C: That is the finest partition, the end of the worst case.
    • D: The start state is not special here.
  5. ABCD — A: 0,1,2 accept + dead. B: 0,1,2 + dead. C: k+1. D: 4 remainders.

Flashcards

  1. Minimal DFA for “exactly k a’s” over {a,b}?
    Reveal answerk + 2 states (0..k and dead).
  2. Minimal DFA for “at least k a’s”?
    Reveal answerk + 1 states.
  3. Minimal DFA for “at most k a’s”?
    Reveal answerk + 2 states (0..k accepting, plus dead).
  4. How many cells in a table-filling table for n states?
    Reveal answern(n−1)/2
  5. When do you stop the partition method?
    Reveal answerAfter a full round in which no group splits.

Exam shortcuts

  • Count “situations”, not arrows: write the list of different futures a prefix can have. Each = one state. Then ask: is there a hopeless situation? (+1 dead.)
  • Exactly k → k+2, at least k → k+1, at most k → k+2. “Exactly” and “at most” both need the dead state.

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.