WHY: CNF lets the start symbol have ε. If S also appears on the right of some rule, deleting/transforming gets tangled. A fresh S0 that only points to old S keeps the start "clean."
WHY:A→ε (for non-start A) is illegal. HOW: find all nullable variables (those that can derive ε), then for every rule, add versions with each subset of the nullable occurrences omitted (but never delete the entire RHS down to nothing — that would re-create an ε-rule).
WHY:A→B produces no terminal and no branching — it just renames. HOW: for every unit pair (A,B) (meaning A⇒∗B using only unit rules), and every non-unit rule B→γ, add A→γ. Then drop all unit rules.
START. Add S0→S.
Why this step? So the start never sits on a right side.
Rules: S0→S; S→ASA∣aB; A→B∣S; B→b∣ε.
DEL. Nullable set: B→ε⇒B nullable. A→B with B nullable ⇒A nullable. No other all-nullable RHS. So N={A,B}.
Patch each rule over all subsets of nullable positions (never down to empty):
S→ASA: nullable positions are the two A's. Drop subsets ⟹ add S→SA∣AS∣S. So S→ASA∣SA∣AS∣S.
S→aB: B nullable ⟹ add S→a. So S→aB∣a.
A→B: B nullable ⟹ would add A→ε — drop it (not S0). Keep A→B.
A→S: keep (no nullable symbol).
B→b: keep. Delete B→ε.
After DEL:
S0→S; S→ASA∣SA∣AS∣S∣aB∣a; A→B∣S; B→b.
UNIT. Find unit pairs (reflexive + transitive closure over unit rules S→S, A→B, A→S, S0→S):
(S0,S), and via S none further (S's only unit rule is S→S). S→S is a trivial self-unit, removed.
(A,S), (A,B).
Now, for each variable, collect non-unit bodies of every variable it reaches:
Non-unit bodies of S: {ASA,SA,AS,aB,a}.
Non-unit bodies of A: from A⇒∗B gives {b}; from A⇒∗S gives {ASA,SA,AS,aB,a}.
What two production forms are allowed in CNF (ignoring start-ε)?
A→BC (two variables) and A→a (one terminal).
Which single rule may legally produce ε in CNF?
Only the start symbol: S0→ε, and only if ε is in the language.
What is Sipser's order of the 5 CNF conversion steps?
START, DEL, UNIT, TERM, BIN.
Why does DEL/UNIT come before TERM/BIN in Sipser?
ε- and unit-removal only shrink/rename RHSs, so doing them first means TERM/BIN never get undone.
Define a nullable variable.
A variable A with A⇒∗ε (derives the empty string).
In DEL, how do you patch A→XYZ where X,Z are nullable?
Add a rule for every subset of {X,Z} omitted: A→XYZ∣YZ∣XY∣Y (never empty).
What is a unit production and how is it removed?
A rule A→B (B a variable); remove by adding A→γ for every non-unit body γ reachable as a unit pair (A,B).
Why is CNF useful?
Parse trees become binary ⟹ enables CYK O(n3) membership and the CFL pumping lemma.
In BIN, converting A→B1B2B3, what do you get?
A→B1X1, X1→B2B3 (one fresh variable).
Why add a new start symbol S0 first?
So the start symbol never appears on any right-hand side, keeping later steps clean.
Recall Feynman: explain to a 12-year-old
Imagine LEGO instructions where each step can only do ONE of two things: snap two big blocks together, or place one single colored tile. No giant complicated steps allowed. CNF rewrites a messy building manual into this baby-simple style. The finished tower is exactly the same — but now a robot can follow the steps super fast and even check whether a given tower is buildable. We clean up by: giving a fresh "start" block, removing "build nothing" steps, removing lazy "call this block by another name" steps, then swapping loose colored tiles for named blocks, and finally chopping long steps into pairs.
Dekho, Chomsky Normal Form ka matlab hai grammar ko ek bilkul fixed "saaf-suthri" shape me laana. Isme har rule sirf do tarah ka ho sakta hai: ya toh ek variable se do variables (A→BC), ya ek variable se ek terminal (A→a). Bas. Mixed cheezein jaise A→aB, lambi rules A→BCD, khaali wali A→ε, aur rename wali A→B — sab ban hain (start symbol ka chhota exception chhod ke).
Faayda kya hai? Jab har rule do hisson me todta hai, toh parse tree ek binary tree ban jaata hai. Isse CYK algorithm se hum O(n3) me check kar sakte hain ki koi string language me hai ya nahi, aur CFL ka pumping lemma bhi clean prove hota hai. Isliye CNF ko grammar ka "assembly language" bolte hain.
Conversion ka Sipser order yaad rakhna zaruri hai: START, DEL, UNIT, TERM, BIN (mnemonic: "Some Dogs Understand Tricky Behaviour"). Pehle naya start symbol S0, phir nullable (khaali derive karne wale) variables hatao (DEL), phir unit/rename rules hatao (UNIT), phir terminals ko alag variable me daalo (TERM), aur aakhir me lambi rules ko do-do me chop karo (BIN). DEL aur UNIT pehle isliye, kyunki ye sirf RHS chhota ya rename karte hain — agar baad me kiya toh TERM/BIN ka kaam dobara karna pad jaata hai.
Ek important point DEL me: agar ek rule me kai nullable symbols hain, toh har subset ko drop karke alag-alag rule banao.