Presentation is loading. Please wait.

Presentation is loading. Please wait.

Costas Busch - LSU1 Properties of Context-Free languages.

Similar presentations


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

1 Costas Busch - LSU1 Properties of Context-Free languages

2 Costas Busch - LSU2 Context-free languages are closed under: Union is context free is context-free Union

3 Costas Busch - LSU3 Example Union LanguageGrammar

4 Costas Busch - LSU4 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 Costas Busch - LSU5 Context-free languages are closed under: Concatenation is context free is context-free Concatenation

6 Costas Busch - LSU6 Example Concatenation LanguageGrammar

7 Costas Busch - LSU7 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 Costas Busch - LSU8 Context-free languages are closed under: Star-operation is context freeis context-free Star Operation

9 Costas Busch - LSU9 Example Language Grammar Star Operation

10 Costas Busch - LSU10 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 Costas Busch - LSU11 Negative Properties of Context-Free Languages

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

13 Costas Busch - LSU13 Example Context-free: NOT context-free Intersection

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

15 Costas Busch - LSU15 NOT context-free Example Context-free: Complement

16 Costas Busch - LSU16 Intersection of Context-free languages and Regular Languages

17 Costas Busch - LSU17 The intersection of a context-free language and a regular language is a context-free language context free regular context-free

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

19 Costas Busch - LSU19 transition NPDADFA transition NPDA

20 Costas Busch - LSU20 transition NPDADFA transition NPDA

21 Costas Busch - LSU21 initial state NPDADFA Initial state NPDA

22 Costas Busch - LSU22 final state final states NPDADFA final states NPDA

23 Costas Busch - LSU23 Example: NPDA context-free

24 Costas Busch - LSU24 DFA regular

25 Costas Busch - LSU25 Automaton for: NPDA context-free

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

27 Costas Busch - LSU27 Therefore: is NPDA is context-free

28 Costas Busch - LSU28 Applications of Regular Closure

29 Costas Busch - LSU29 The intersection of a context-free language and a regular language is a context-free language context free regular context-free Regular Closure

30 Costas Busch - LSU30 An Application of Regular Closure Prove that: is context-free

31 Costas Busch - LSU31 We know: is context-free

32 Costas Busch - LSU32 is regular We also know:

33 Costas Busch - LSU33 regularcontext-free is context-free (regular closure)

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

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


Download ppt "Costas Busch - LSU1 Properties of Context-Free languages."

Similar presentations


Ads by Google