fall 2003costas busch - rpi1 properties of context-free languages

Download Fall 2003Costas Busch - RPI1 Properties of Context-Free languages

Post on 31-Mar-2015

217 views

Category:

Documents

5 download

Embed Size (px)

TRANSCRIPT

  • Slide 1

Fall 2003Costas Busch - RPI1 Properties of Context-Free languages Slide 2 Fall 2003Costas Busch - RPI2 Context-free languages are closed under: Union is context free is context-free Union Slide 3 Fall 2003Costas Busch - RPI3 Example Union LanguageGrammar Slide 4 Fall 2003Costas Busch - RPI4 In general: The grammar of the union has new start variable and additional production For context-free languages with context-free grammars and start variables Slide 5 Fall 2003Costas Busch - RPI5 Context-free languages are closed under: Concatenation is context free is context-free Concatenation Slide 6 Fall 2003Costas Busch - RPI6 Example Concatenation LanguageGrammar Slide 7 Fall 2003Costas Busch - RPI7 In general: The grammar of the concatenation has new start variable and additional production For context-free languages with context-free grammars and start variables Slide 8 Fall 2003Costas Busch - RPI8 Context-free languages are closed under: Star-operation is context freeis context-free Star Operation Slide 9 Fall 2003Costas Busch - RPI9 Example Language Grammar Star Operation Slide 10 Fall 2003Costas Busch - RPI10 In general: The grammar of the star operation has new start variable and additional production For context-free language with context-free grammar and start variable Slide 11 Fall 2003Costas Busch - RPI11 Negative Properties of Context-Free Languages Slide 12 Fall 2003Costas Busch - RPI12 Context-free languages are not closed under: intersection is context free not necessarily context-free Intersection Slide 13 Fall 2003Costas Busch - RPI13 Example Context-free: NOT context-free Intersection Slide 14 Fall 2003Costas Busch - RPI14 Context-free languages are not closed under: complement is context freenot necessarily context-free Complement Slide 15 Fall 2003Costas Busch - RPI15 NOT context-free Example Context-free: Complement Slide 16 Fall 2003Costas Busch - RPI16 Intersection of Context-free languages and Regular Languages Slide 17 Fall 2003Costas Busch - RPI17 The intersection of a context-free language and a regular language is a context-free language context free regular context-free Slide 18 Fall 2003Costas Busch - RPI18 for NPDA DFA Construct a new NPDA machine that accepts Machine context-free regular simulates in parallel and Slide 19 Fall 2003Costas Busch - RPI19 transition NPDADFA transition NPDA Slide 20 Fall 2003Costas Busch - RPI20 transition NPDADFA transition NPDA Slide 21 Fall 2003Costas Busch - RPI21 initial state NPDADFA Initial state NPDA Slide 22 Fall 2003Costas Busch - RPI22 final state final states NPDADFA final states NPDA Slide 23 Fall 2003Costas Busch - RPI23 Example: NPDA context-free Slide 24 Fall 2003Costas Busch - RPI24 DFA regular Slide 25 Fall 2003Costas Busch - RPI25 Automaton for: NPDA context-free Slide 26 Fall 2003Costas Busch - RPI26 simulates in parallel and accepts stringif and only if accepts string and accepts string In General: Slide 27 Fall 2003Costas Busch - RPI27 Therefore: is NPDA is context-free Slide 28 Fall 2003Costas Busch - RPI28 Applications of Regular Closure Slide 29 Fall 2003Costas Busch - RPI29 The intersection of a context-free language and a regular language is a context-free language context free regular context-free Regular Closure Slide 30 Fall 2003Costas Busch - RPI30 An Application of Regular Closure Prove that: is context-free Slide 31 Fall 2003Costas Busch - RPI31 We know: is context-free Slide 32 Fall 2003Costas Busch - RPI32 is regular We also know: Slide 33 Fall 2003Costas Busch - RPI33 regularcontext-free is context-free (regular closure) Slide 34 Fall 2003Costas Busch - RPI34 Another Application of Regular Closure Prove that: is not context-free Slide 35 Fall 2003Costas Busch - RPI35 context-freeregularcontext-free If is context-free Then Impossible!!! Therefore, is not context free (regular closure)

Recommended

View more >