Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Fall 2003Costas Busch - RPI1 Properties of Context-Free languages."— Presentation transcript:

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

2 Fall 2003Costas Busch - RPI2 Context-free languages are closed under: Union is context free is context-free Union

3 Fall 2003Costas Busch - RPI3 Example Union LanguageGrammar

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

5 Fall 2003Costas Busch - RPI5 Context-free languages are closed under: Concatenation is context free is context-free Concatenation

6 Fall 2003Costas Busch - RPI6 Example Concatenation LanguageGrammar

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

8 Fall 2003Costas Busch - RPI8 Context-free languages are closed under: Star-operation is context freeis context-free Star Operation

9 Fall 2003Costas Busch - RPI9 Example Language Grammar Star Operation

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

11 Fall 2003Costas Busch - RPI11 Negative Properties of Context-Free Languages

12 Fall 2003Costas Busch - RPI12 Context-free languages are not closed under: intersection is context free not necessarily context-free Intersection

13 Fall 2003Costas Busch - RPI13 Example Context-free: NOT context-free Intersection

14 Fall 2003Costas Busch - RPI14 Context-free languages are not closed under: complement is context freenot necessarily context-free Complement

15 Fall 2003Costas Busch - RPI15 NOT context-free Example Context-free: Complement

16 Fall 2003Costas Busch - RPI16 Intersection of Context-free languages and Regular Languages

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

18 Fall 2003Costas Busch - RPI18 for NPDA DFA Construct a new NPDA machine that accepts Machine context-free regular simulates in parallel and

19 Fall 2003Costas Busch - RPI19 transition NPDADFA transition NPDA

20 Fall 2003Costas Busch - RPI20 transition NPDADFA transition NPDA

21 Fall 2003Costas Busch - RPI21 initial state NPDADFA Initial state NPDA

22 Fall 2003Costas Busch - RPI22 final state final states NPDADFA final states NPDA

23 Fall 2003Costas Busch - RPI23 Example: NPDA context-free

24 Fall 2003Costas Busch - RPI24 DFA regular

25 Fall 2003Costas Busch - RPI25 Automaton for: NPDA context-free

26 Fall 2003Costas Busch - RPI26 simulates in parallel and accepts stringif and only if accepts string and accepts string In General:

27 Fall 2003Costas Busch - RPI27 Therefore: is NPDA is context-free

28 Fall 2003Costas Busch - RPI28 Applications of Regular Closure

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

30 Fall 2003Costas Busch - RPI30 An Application of Regular Closure Prove that: is context-free

31 Fall 2003Costas Busch - RPI31 We know: is context-free

32 Fall 2003Costas Busch - RPI32 is regular We also know:

33 Fall 2003Costas Busch - RPI33 regularcontext-free is context-free (regular closure)

34 Fall 2003Costas Busch - RPI34 Another Application of Regular Closure Prove that: is not context-free

35 Fall 2003Costas Busch - RPI35 context-freeregularcontext-free If is context-free Then Impossible!!! Therefore, is not context free (regular closure)


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

Similar presentations


Ads by Google