1 / 57

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University

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

kirby
Télécharger la présentation

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University

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 9 Mälardalen University 2012

  2. ContentLanguage HierarchyDeterministic PDAs (DPDAs)Non-DPDA (NPDA)NPDAs Have More Power than DPDAsPositive Properties of Context Free Languages Negative Properties of Context Free Languages Intersection of CFL and RL (Regular Closure)

  3. LanguageHierarchy

  4. Non-regular languages Context-Free Languages Regular Languages

  5. Deterministic PDAs (DPDAs) Based on C Busch, RPI, Models of Computation

  6. DPDAs Allowed

  7. Not allowed

  8. Allowed In l -transitions something must be matched from the stack

  9. Not allowed

  10. DPDA example

  11. The language is deterministic context-free.

  12. Definition A language is deterministic context-free if some DPDA accepts it.

  13. Example of Non-DPDA (NPDA)

  14. Not allowed in DPDAs

  15. NPDAs Have More Power thanDPDAs

  16. We will show: There is a context-free language (accepted by a NPDA) which is notdeterministic context-free (not accepted by a DPDA).

  17. The language is:

  18. The language is context-free Context-free grammar for there is an NPDA that accepts

  19. Theorem The language is notdeterministic context-free (i.e., there is no DPDA that accepts ). (Each a is to be matched by either one or two b. An initial choice must be made.) NDPA are more expressive than DPDA.There exist languages accepted by NDPA for which no DPDAexists. Example

  20. there is a DPDA that accepts Proof (by contradiction) Assume the opposite, i.e. that is deterministic context free. Therefore:

  21. DPDA with accepts accepts

  22. The language is not context-free. Fact 1 (we will prove it later on using Pumping Lemma for CFL)

  23. Fact 2 The language is not context-free (we will prove later on that the union of two context-free languages is context-free)

  24. This will lead to contradiction, as is not context-free! We will construct a NPDA that accepts:

  25. Replace with Modified We modify

  26. Modified Original The NPDA that accepts

  27. Since is accepted by a NPDA it is context-free. Contradiction!

  28. Therefore: There is no DPDA that accepts Notdeterministic context free. END OF PROOF

  29. Positive Properties of Context-Free Languages

  30. is context free is context-free is context free Union Context-free languages are closed under Union

  31. Example Language Grammar Union

  32. For context-free languages with context-free grammars and start variables The grammar of the union has new start variable and additional production In general:

  33. Context-free languages are closed under Concatenation is context free is context-free is context free Concatenation

  34. Example Language Grammar Concatenation

  35. For context-free languages with context-free grammars and start variables The grammar of the concatenation has new start variable and additional production In general:

  36. is context free is context free Star Operation Context-free languages are closed under star-operation

  37. Example Language Grammar Star Operation

  38. For context-free language with context-free grammar and start variable The grammar of the star operation has new start variable and additional production In general:

  39. Negative Properties of Context-Free Languages

  40. is context free is context free Intersection Context-free languages are not closed under intersection notnecessarily context-free

  41. Example Context-free: Context-free: Intersection NOT context-free

  42. is context free not necessarily context-free Complement Context-free languages are not closed under complement

  43. Example Context-free: Context-free: Complement NOT context-free

  44. Intersection of Context-Free Languagesand Regular Languages (Regular Closure)

  45. context free regular context-free The intersection of a context-free language and a regular language is a context-free language

  46. Machine Machine DFA for NPDA for regular context-free Construct a new NPDA machine that accepts simulates in parallel and

  47. DFA NPDA transition transition NPDA transition

  48. NPDA DFA initial state initial state NPDA initial state

  49. NPDA DFA final state final states NPDA final states

  50. simulates in parallel and accepts string if and only if accepts string and accepts string

More Related