1 / 104

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

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2012. Content Context-Free Languages Push-Down Automata, PDA NPDA: Non-Deterministic PDA Formal Definitions for NPDAs NPDAs Accept Context-Free Languages Converting NPDA to Context-Free Grammar.

wyome
Download Presentation

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 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. CDT314FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2012

  2. ContentContext-Free LanguagesPush-Down Automata, PDANPDA: Non-Deterministic PDAFormal Definitions for NPDAs NPDAs Accept Context-Free LanguagesConverting NPDA to Context-Free Grammar

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

  4. Context-Free Languages Based on C Busch, RPI, Models of Computation

  5. stack automaton Context-Free Languages Context-Free Grammars Pushdown Automata (CF grammars are defined as generalized Regular Grammars)

  6. is string of variables and terminals Definition: Context-Free Grammars Grammar Variables Terminal symbols Start variables Productions of the form:

  7. Pushdown AutomataPDAs

  8. Pushdown Automaton - PDA Input String Stack States

  9. The Stack A PDA can write symbols on stack and read them later on. POP reading symbol PUSH writing symbol All access to the stack is only on the top! (Stack top is written leftmost in the string, e.g. yxz) A stack is valuable as it can hold an unlimitedamount of information (but it is not random access!). The stack allows pushdown automata to recognize some non-regular languages.

  10. The States Pop old- reading stack symbol Push new - writing stacksymbol Input symbol

  11. input stack top Replace (An alternative is to either start and finish with empty stack or with a stack bottom symbol such as $)

  12. stack top Push input

  13. stack top Pop input

  14. input stack top No Change

  15. NPDAsNon-deterministic Push-Down Automata

  16. Non-Determinism

  17. A string is accepted if: • All the input is consumed • The last state is a final state • Stack is in the initial condition • (either: empty (when we started with empty stack), • or: bottom symbol reached, depending on convention)

  18. Example NPDA is the language accepted by the NPDA:

  19. Example NPDA NPDAM (Even-length palindromes) Example :aabaaabbblbbbaaabaa

  20. Pushing Strings Pop symbol Input symbol Push string

  21. Example input pushed string stack top Push

  22. Another NPDA example NPDAM

  23. Execution Example Time 0 Input Stack Current state

  24. Time 1 Input Stack

  25. Time 2 Input Stack

  26. Time 3 Input Stack

  27. Time 4 Input Stack

  28. Time 5 Input Stack

  29. Time 6 Input Stack

  30. Time 7 Input Stack accept

  31. Formal Definitions for NPDAs

  32. Transition function

  33. Transition function new state current state current stack top new stack top current input symbol An unspecified transition function is to the null set and represents a dead configuration for the NPDA.

  34. Final states States Input alphabet Stack start symbol Transition function Stack alphabet Formal Definition Non-Deterministic Pushdown Automaton NPDA

  35. Instantaneous Description Current stack contents Current state Remaining input

  36. Example Instantaneous Description Input Time 4: Stack

  37. Example Instantaneous Description Input Time 5: Stack

  38. We write Time 4 Time 5

  39. A computation example

  40. A computation example

  41. A computation example

  42. A computation example

  43. A computation example

  44. A computation example

  45. A computation example

  46. A computation example

  47. A computation example For convenience we write

  48. Formal Definition Language of NPDAM Initial state Final state

  49. Example NPDAM

  50. NPDAM

More Related