This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Regular operations Union of CFLs Let L 1 be language recognized by G 1 = ( V 1 , Σ 1 ,R 1 ,S 1 ) and L 2 the language recognized by G 2 = ( V 2 , Σ 2 ,R 2 ,S 2 ) Is L 1 ∪ L 2 a context free language? Yes. Just add the rule S → S 1  S 2 But make sure that V 1 ∩ V 2 = ∅ (by renaming some variables). Closure of CFLs under Union G = ( V, Σ ,R,S ) such that L ( G ) = L ( G 1 ) ∪ L ( G 2 ): • V = V 1 ∪ V 2 ∪ { S } (the three sets are disjoint) • Σ = Σ 1 ∪ Σ 2 • R = R 1 ∪ R 2 ∪ { S → S 1  S 2 } Concatenation, Kleene Closure Proposition 1. CFLs are closed under concatenation and Kleene closure Proof. Let L 1 be language generated by G 1 = ( V 1 , Σ 1 ,R 1 ,S 1 ) and L 2 the language generated by G 2 = ( V 2 , Σ 2 ,R 2 ,S 2 ) • Concatenation: L 1 L 2 generated by a grammar with an additional rule S → S 1 S 2 • Kleene Closure: L * 1 generated by a grammar with an additional rule S → S 1 S  As before, ensure that V 1 ∩ V 2 = ∅ . S is a new start symbol. (Exercise: Complete the Proof!) Intersection Let L 1 and L 2 be context free languages. L 1 ∩ L 2 is not necessarily context free! Proposition 2. CFLs are not closed under intersection Proof. • L 1 = { a i b i c j  i,j ≥ } is a CFL – Generated by a grammar with rules S → XY ; X → aXb  ; Y → cY  ....
View
Full Document
 Fall '08
 Viswanathan,M
 Formal language, Regular expression, L1 L2, inverse homomorphism, Gul Agha Mahesh Viswanathan

Click to edit the document details