1 / 154

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 10

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 10 Mälardalen University 2012. Content The Pumping Lemma for CFL Applications of the Pumping Lemma for CFL Example of Midterm Exam 2 (CFL). The Pumping Lemma for Context-Free Languages.

Télécharger la présentation

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 10 Mälardalen University 2012

  2. ContentThe Pumping Lemma for CFLApplications of the Pumping Lemma for CFLExample of Midterm Exam 2 (CFL)

  3. The Pumping LemmaforContext-Free Languages Based on C Busch, RPI, Models of Computation

  4. Take an infinite context-free language. It generates an infinite number of different strings: Example:

  5. A derivation

  6. string Derivation tree

  7. string Derivation tree repeated

  8. Repeated part

  9. Another possible derivation

  10. derivation

  11. derivation

  12. derivation

  13. Therefore, the string is also generated by the grammar

  14. We know: We also know the following string is generated:

  15. We know: Therefore, the following string is also generated:

  16. We know: Therefore, the following string is also generated:

  17. We know: Therefore, the following string is also generated:

  18. Therefore, knowing that is generated by grammar We also know that is generated by

  19. We are given an infinite context-free grammar . In general Assume has no unit-productions and no -productions.

  20. Take a string with length bigger than (Number of productions) x (Largest right side of a production) > Consequence: Some variable must be repeated in the derivation of .

  21. string Last repeated variable repeated stringsof terminals

  22. Possible derivations

  23. We know: Following string is also generated:

  24. We know: This string is also generated: The original

  25. We know: This string is also generated:

  26. We know: This string is also generated:

  27. We know: This string is also generated:

  28. Therefore, any string of the form is generated by the grammar

  29. Therefore knowing that we also know that

  30. (Number of productions) x (Largest right side of a production) Observation: Since is the last repeated variable A string has length bigger than >

  31. Observation Since there are no unit or productions

  32. For infinite context-free language there exists an integer such that for any string we can write with lengths and The Pumping Lemma for CFL

  33. Applicationsof The Pumping Lemma for CFL

  34. Unrestricted grammarlanguages Non-regular languages Context-Free Languages Regular Languages

  35. Example Theorem The language is not context free. Proof Use the Pumping Lemma for context-free languages.

  36. Assume thecontrary, that is context-free. Since is context-free and infinite we can apply the pumping lemma.

  37. Pumping Lemma gives a number such that: for any string with length We can choose e.g.

  38. We can write: with lengths and

  39. Pumping Lemma says: for all

  40. We examine all the possible locations of string in

  41. Case 1: is within

  42. Case 1: and consist from only

  43. Case 1: Repeating and

  44. Case 1: From Pumping Lemma:

  45. Case 1: From Pumping Lemma: However: Contradiction!

  46. Case 2: is within

  47. Case 2: Similar analysis to case 1

  48. Case 3: is within

  49. Case 3: Similar analysis to case 1

More Related