notes25 Closure Properties of CFLs

notes25 Closure Properties of CFLs - CS 373: Theory of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

This note was uploaded on 10/04/2011 for the course CS 373 taught by Professor Viswanathan,m during the Fall '08 term at University of Illinois, Urbana Champaign.

Page1 / 5

notes25 Closure Properties of CFLs - CS 373: Theory of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online