4.6.4 · HinglishTheory of Computation

NFA to DFA conversion — subset construction

1,672 words8 min readRead in English

4.6.4 · Coding › Theory of Computation


WHAT is the problem?

WHY yeh possible hai? Kyunki NFA aur DFA dono exactly regular languages hi recognize karte hain — inki power equal hai. NFA likhne mein zyada convenient hai; DFA chalane mein zyada mechanical hai.


The two helper operations


HOW — the algorithm

Figure — NFA to DFA conversion — subset construction

Worked Example 1 (no ε)

NFA over , states , start , final : , , . (Yeh un strings ko accept karta hai jisme ek ke baad eventually ek ho… chaliye bas build karte hain.)

DFA state on on
(start)
(accept)

kyun? MOVE, koi ε nahi toh ECLOSE aise hi chhod deta hai. Naya state → ise kehte hain. accepting kyun hai? . ✔ kyun? MOVE.

Possible subsets mein se sirf 2 reachable hain — hum unreachable wale kabhi list nahi karte.


Worked Example 2 (with ε)

NFA: states , start , final , . , , .

Step 1 — start: . Kyun? se ek ε-edge par jaati hai; se koi nahi. Ise kaho.

Step 2 — on : MOVE (sirf ke paas -edge hai). Phir ECLOSE (ε-edge ). kaho.

Step 3 — on : MOVE, ECLOSE → . Self-loop.

DFA state on accept?
(start) → no
hai → yes

Toh DFA yaani accept karta hai. "aa" trace karo: (accept). ✔ "" trace karo: par rehta hai, reject. ✔



Recall Feynman: explain to a 12-year-old

Socho ek aisa maze hai jahan kuch forks par ek magic robot copies mein split ho sakta hai aur ek saath har path try karta hai. Woh NFA hai. Ek normal robot (DFA) split nahi ho sakta — woh ek path chalata hai. Toh uski jagah, normal robot ek notebook carry karta hai jisme likha hota hai "magic robot abhi kin-kin rooms mein khada ho sakta hai." Har baar jab woh ek letter padhta hai, woh poori list ek saath update karta hai. Agar list mein koi bhi room exit hai, woh "Accepted!" chilla deta hai. Notebook ka content = ek DFA state. Kyunki rooms ki sirf finite possible lists hain, robot kabhi hamesha ke liye nahi kho sakta.


Flashcards

Subset construction mein DFA ki ek state kya hoti hai?
NFA states ka ek set (subset) — woh "cloud" of states jahan NFA abhi ho sakta hai.
Ise powerset/subset construction kyun kehte hain?
DFA states ke subsets hain, power set se liye gaye.
DFA start state ka formula?
.
DFA transition ka formula?
.
DFA subset-state accepting kab hoti hai?
Jab usme kam se kam ek NFA final state ho: .
ECLOSE(S) kya hai?
Woh saari states jo S se sirf ε-transitions use karke reachable hain (S khud bhi shamil hai).
MOVE(S,a) kya hai?
par ka union — padhne par reachable states.
-state NFA se DFA states ki maximum number?
(subsets ki number); usually kam reachable hote hain.
Subset construction hamesha terminate kyun karta hai?
Sirf possible subsets hain, isliye finite number of DFA states ban sakti hain.
Empty set ka kya role hai?
Dead/trap state — koi NFA state alive nahi, toh reject karta hai aur khud par loop karta hai.
Har step mein operations ka sahi order kya hai?
Pehle MOVE, phir ECLOSE: ECLOSE(MOVE(S,a)).
Kya NFA aur DFA same languages recognize karte hain?
Haan — dono exactly regular languages recognize karte hain.

Connections

Concept Map

equal power

has

enables

converted via

produces

handles

then apply

combined into

combined into

gives start

builds edges in

seeds

accept if

NFA many states at once

DFA one state at a time

epsilon-moves

DFA state = SET of NFA states

Subset Construction

ECLOSE S: epsilon-reachable states

MOVE S,a: a-step union

Delta_D S,a = ECLOSE of MOVE

q0' = ECLOSE of q0

S intersect F not empty