Chapter 3 Context-Free Grammars, Context-Free Languages, Parse ...
Chapter 3 Context-Free Grammars, Context-Free Languages, Parse ...
Chapter 3 Context-Free Grammars, Context-Free Languages, Parse ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3.8. CONTEXT-FREE LANGUAGES AS LEAST FIXED-POINTS 55<br />
and<br />
It is easy to verify that<br />
Φ n+1<br />
G,A (∅, ∅) =Φn G,B(∅, ∅)Φ n G,B(∅, ∅) ∪{ab},<br />
Φ n+1<br />
G,B (∅, ∅) =aΦn G,B(∅, ∅)b ∪{ab}.<br />
Φ 1 G,A(∅, ∅) ={ab},<br />
Φ 1 G,B(∅, ∅) ={ab},<br />
Φ 2 G,A(∅, ∅) ={ab, abab},<br />
Φ 2 G,B(∅, ∅) ={ab, aabb},<br />
Φ 3 G,A(∅, ∅) ={ab, abab, abaabb, aabbab, aabbaabb},<br />
Φ 3 G,B(∅, ∅) ={ab, aabb, aaabbb}.<br />
By induction, we can easily prove that the two components of the least fixed-point are<br />
the languages<br />
LA = {a m b m a n b n | m, n ≥ 1}∪{ab} and LB = {a n b n | n ≥ 1}.<br />
Letting GA =({A, B, a, b}, {a, b},P,A)andGB =({A, B, a, b}, {a, b},P,B), it is indeed<br />
true that LA = L(GA) andLB = L(GB) .<br />
We have the following theorem due to Ginsburg and Rice:<br />
Theorem 3.8.3 Given a context-free grammar G =(V,Σ,P,S) with m nonterminals A1,<br />
..., Am, the least fixed-point of the map ΦG is the m-tuple of languages<br />
where GAi =(V,Σ,P,Ai).<br />
Proof . Writing G as<br />
(L(GA1),...,L(GAm)),<br />
A1 → α1,1 + ···+ α1,n1,<br />
···→···<br />
Ai → αi,1 + ···+ αi,ni ,<br />
···→···<br />
Am → αm,1 + ···+ αm,nn,<br />
let M =max{|αi,j|} be the maximum length of right-hand sides of rules in P .Let<br />
Φ n G(∅,...,∅) =(Φ n G,1(∅,...,∅),...,Φ n G,m(∅,...,∅)).