1 / 49

A Non Context-Free Language

A Non Context-Free Language. (We will prove it at the next class). Non Context-free languages. Context-free languages. Regular languages. Deterministic PDAs DPDAs. DPDAs. Allowed:. Not allowed:. Allowed:. Something must be matched from the stack. Not allowed:. DPDA example.

amadis
Télécharger la présentation

A Non Context-Free Language

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. A Non Context-Free Language (We will prove it at the next class)

  2. Non Context-free languages Context-free languages Regular languages

  3. Deterministic PDAsDPDAs

  4. DPDAs • Allowed:

  5. Not allowed:

  6. Allowed: Something must be matched from the stack

  7. Not allowed:

  8. DPDA example

  9. The language is deterministic context-free

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

  11. Example of Non-DPDA (NPDA)

  12. Not allowed in DPDAs

  13. NPDAs Have More Power thanDPDAs

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

  15. The language is:

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

  17. Theorem: The language is not deterministic context-free (there is no DPDA that accepts )

  18. Proof: Assume for contradiction that is deterministic context free Therefore: there is a DPDA that accepts

  19. DPDA with accepts accepts

  20. Fact 1: The language is not context-free (we will prove it at the next class)

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

  22. We will construct a NPDA that accepts: Contradiction!

  23. We modify Replace with Modified

  24. The NPDA that accepts Modified Original

  25. Since is accepted by a NPDA it is context-free Contradiction! (since is not context-free)

  26. Therefore: There is no DPDA that accepts Not deterministic context free End of Proof

  27. Positive Propertiesof Context-Free languages

  28. Union Context-free languages are closed under: Union is context free is context free is context-free

  29. Example Language Grammar Union

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

  31. Concatenation Context-free languages are closed under: Concatenation is context free is context free is context-free

  32. Example Language Grammar Concatenation

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

  34. Star Operation Context-free languages are closed under: Star-operation is context free is context-free

  35. Example Language Grammar Star Operation

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

  37. Negative Propertiesof Context-Free Languages

  38. Intersection Context-free languages are not closed under: intersection is context free is context free not necessarily context-free

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

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

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

  42. Intersectionof Context-free languagesand Regular Languages

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

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

  45. NPDA DFA transition transition NPDA transition

  46. NPDA DFA initial state initial state NPDA Initial state

  47. NPDA DFA final state final states NPDA final states

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

  49. Therefore: is context-free (since is NPDA) is context-free

More Related