Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Properties OfCFL

Properties OfCFL

Ratings: (0)|Views: 4 |Likes:
Published by Bhaskar Rao P
FLAT complete theory
FLAT complete theory

More info:

Published by: Bhaskar Rao P on Dec 06, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/24/2014

pdf

text

original

 
Closure Properties of Context Free Languages
Union of CFLs
Let L1 be language recognized by G1 = (V1, T1, S1, P1) and L2 the language recognized by G2 = (V2, T2, S2, P2)Is L1
U
L2 a context free language? Yes.Just add the rule S → S1|S2But make sure that V1 ∩ V2 =
(by renaming some variables). So formally G has• V = V1 U V2 U {S}• T = T1 U T2• P = P1 U P2 U {S → S1|S2}
Concatenation
Let L1 be language recognized by G1 = (V1, T1, S1, P1) and L2 the language recognized by G2 = (V2, T2, S2, P2)Concatenation: L1L2 generated by adding S → S1S2Ie.,• V = V1 U V2 U {S}• T = T1 U T2• P = P1 U P2 U{S → S1S2}As before, ensure that V1 ∩ V2 =
, S is a new start symbol.
Kleene Closure
Let L1 be language recognized by G1 = (V1, T1, S1, P1) and L2 the language recognized by G2 = (V2, T2, S2, P2)Kleene Closure: L
generated by adding S → S1S|
ǫ
Ie.,• V = V1 U V2 U {S}• T = T1 U T2• P = P1 U P2 U { S → S1S|
ǫ
}As before, ensure that V1 ∩ V2 =
, S is a new start symbol.
Homomorphism
Proposition: Context free languages are closed under homomorphisms.Let G = (V, T, S, P) be the grammar generating L, and let h : T
Σ
be ahomomorphism.h(G) is a new grammar over terminals Σ, where the productions are obtained by takingthe productions of G and replacing each symbol a
ε
Σ by h(a).h(G) generates h(L).Example: S → 0S0|1S1|
ǫ
and h(0) = aba and h(1) = bb. The h(G) has the following rules:S → abaSaba|bbSbb|
ǫ
Substitution
 
Recall, Substitution means we associate each symbol a with a language La and the imageof L under the substitution is defined as {w1w2 …wn | ¥ a1a2 …an Є L and wi Є Lai}• Regular substitution: Every La is a regular language• CFL Substitution: Every La is a CFL• Homomorphism is a special case of substitutionProposition: Every CFL L is closed under CFL substitution.Proof: Let L be generated by G, and let La be generated byGa = (Va, Ta, Sa, Pa). Then in each production of G, replace the symbol a by Sa• This allows any word in La to substitute symbol a• It must be the case that the sets Va and V (variables of G) are all disjoint.
Intersection
Let L1 and L2 be context free languages. L1 ∩ L2 is not context free!!L1 = {aibicj | i, j ≥ 0} is CFLS → XYX → aXb|
ǫ
Y → cY |
ǫ
L2 = {aibjcj | i, j ≥ 0} is a CFLS → XYX → aX|
ǫ
Y → bY c|
ǫ
But L1 ∩ L2 = {anbncn | n ≥ 0} is not context free.
Intersection with Regular Languages
Proposition: If L is a CFL and R is a regular language then L ∩ R is a CFL.Proof: Let P be the PDA that accepts L by final state, and let M be the DFA that acceptsR. The PDA recognizing L ∩ R simulates P and R simultaneously, and accepts if both Pand M accept the input.
Like in the “cross-product” construction, states of the new machine are pairs of states, where one element of the pair corresponds to the state of P and the other corresponds to the state of M.
Whenever, an input symbol is read, both P and M are simulated; if P needs tomake an (null)
ǫ
move then M remains stationary.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->