Equivalence of PDAs and CFGs (Proof)
Equivalence of PDAs and CFGs (Proof)
Equivalence of PDAs and CFGs (Proof)
We will now show that pushdown automata and context-free grammars are equivalent in
expressive power, that is, the language accepted by PDAs are exactly the context-free
languages. To show this, we have to prove each of the following:
i) Given any arbitrary CFG G there exists some PDA M that accepts exactly the same language
generated by G.
ii) Given any arbitrary PDA M there exists a CFG G that generates exactly the same language
accpeted by M.
We will first prove that the first part i.e. we want to show to convert a given CFG to an equivalent
PDA.
Let the given CFG is . Without loss of generality we can assume that G is in
Greibach Normal Form i.e. all productions of G are of the form .
where and .
From the given CFG G we now construct an equivalent PDA M that accepts by empty stack.
Note that there is only one state in M. Let
, where
We now want to show that M and G are equivalent i.e. L(G)=N(M). i.e. for any
. iff .
If , then by definition of L(G), there must be a leftmost derivation starting with S and
deriving w.
i.e.
Again if , then one sysmbol. Therefore we need to show that for any .
iff .
But we will prove a more general result as given in the following lemma. Replacing A by S (the
start symbol) and by gives the required proof.
Basis : n = 0
iff
iff
Induction Step :
First, assume that via a leftmost derivation. Let the last production applied in their
where and
.............................................................................(1)
Again by the construction of M, we get
and let
, and
where and .
i.e.