Woh ek resource kaunsa hai jo CFGs aur PDAs dono ko equivalent banata hai? → ==a stack (= recursion/nesting)==.
CFG→PDA mein, stack mein kya hota hai? → the unmatched suffix of the current sentential form.
CFG→PDA input kab padhta hai? → only when matching a terminal on top of the stack.
Apq⇒∗w ka kya matlab hai? → ==M goes p→q on input w with net-zero (balanced) stack usage==.
PDA→CFG mein exactly do rule schemas kyun hain? → the first pushed symbol is popped either at the very end (match) or earlier (split).
Recall Feynman: ek 12-saal ke bacche ko samjhao
Socho tum nesting boxes se khel rahe ho. Ek grammarrecipe hai: "ek badi box banane ke liye, ek choti box andar rakho, phir lid band karo." Ek PDA ek bachcha hai jiske paas plates ka ek stack hai: jab bhi recipe kehti hai "box kholo" bachcha ek plate neeche rakhta hai; har "box band karo" bachcha ek plate utha leta hai. Agar bachcha koi plate nahi bachi ke saath khatam hota hai aur pura sentence padh chuka hai, toh sentence recipe ke hisaab se tha. Recipes aur plate-bachcha exactly same set of patterns kar sakte hain — yahi poora theorem hai. (Sirf plates ka ek dher! Bachche ko do dher do aur woh achanak sab kuch kar sakta hai jo ek full computer kar sakta hai.)
Ek language context-free hai tab aur sirf tab jab
it is accepted by some (nondeterministic) pushdown automaton.
CFGs aur PDAs ke peeche shared structural resource
a single stack (grammar recursion ↔ machine stack).
CFG→PDA mein kitni states chahiye
one state; all information lives on the stack.
Rule A→α ke liye CFG→PDA transition
δ(q, ε, A) ∋ (q, α) — read nothing, pop A, push α.
Terminal a ke liye CFG→PDA transition
δ(q, a, a) ∋ (q, ε) — read a, pop a, push nothing (match).
CFG→PDA construction ka maintain kiya gaya invariant
(input read so far) · (stack contents) = current sentential form of a leftmost derivation.
PDA→CFG mein variable A_pq ka matlab
strings taking M from state p to q with net-zero (balanced) stack change, never dipping below start height.
PDA→CFG split rule
A_pq → A_pr A_rq (stack returns to start height at intermediate state r).
PDA→CFG match rule
A_pq → a A_rs b, when reading a pushes t (p→r) and reading b pops the same t (s→q).
PDA→CFG base rule
A_pp → ε.
Do PDA→CFG schemas kyun kaafi hain
first pushed symbol is popped either at the very end (match) or strictly before (split) — exhaustive.
Nondeterminism kyun zaruri hai
deterministic PDAs accept only DCFLs, a strict subset; the PDA must guess the rule/derivation.
PDA ko doosra stack dene se kya hota hai
it becomes as powerful as a Turing machine (no longer just context-free).