5.Equivalence of NPDA and CFG§
Now we want to show that NPDA’s and CFG both represent CFL’s.
We will show that we can take any CFG and construct a NPDA, and
vice versa.
Theorem: For any CFG \(L\) not containing \(\lambda\), \(\exists\) a NPDA \(M\) such that \(L = L(M)\).
\(S \rightarrow aSbb \mid a\)
Let \(G' = (V,T,S,P), P =\) | \(S \rightarrow aSA\ |\ aAA\ |\ b\) | \(A \rightarrow bBBB\) | \(B \rightarrow b\)
QUESTION: Is this grammar in GNF?
Trace abbbbb in grammar and pda.
Theorem: Given a NPDA \(M\), \(\exists\) a NPDA \(M'\) such that all transitions have the form \(\delta(q_i, a, A) = \{c_1, c_2, \ldots c_n\}\) where\(c_i = (q_j, \lambda)\) or\(c_i = (q_j, BC)\)Each move either increases or decreases stack contents by a single symbol.
Theorem: If \(L = L(M)\) for some NPDA \(M\), then \(L\) is a CFG.