1 / 101

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

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

chick
Download Presentation

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 6 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 6 Mälardalen University 2010

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

  3. Midterm • 5 out of 13 passed… • Many failed on basic definitions • Is something wrong with the course format? • Scheduled exercises • Don’t hesitate to ask for help! • Do labs, exercises etc. • Review lecture material before lectures • Strongly recommended to get a book if you don’t have one • It doesn’t get easier…

  4. Concerning examination in the course: Exercises  are voluntary Labs are voluntary Midterms are voluntary Lectures are voluntary… All of them are recommended! JFLAP demo http://www.cs.duke.edu/csed/jflap/movies

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

  6. Context-Free Languages

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

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

  9. Pushdown AutomataPDAs

  10. Pushdown Automaton - PDA Input String Stack States

  11. 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 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 (certain kind of) information. The stack allows pushdown automata to recognize some non-regular languages.

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

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

  14. stack top Push input

  15. stack top Pop input

  16. input stack top No Change

  17. NPDAsNon-deterministic Push-Down Automata

  18. Non-Determinism

  19. 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, or similar)

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

  21. Example NPDA NPDAM (Even-length palindromes)

  22. Pushing Strings Pop symbol Input symbol Push string

  23. Example input pushed string stack top Push

  24. Another NPDA example NPDAM

  25. Execution Example Time 0 Input Stack Current state

  26. Time 1 Input Stack

  27. Time 2 Input Stack

  28. Time 3 Input Stack

  29. Time 4 Input Stack

  30. Time 5 Input Stack

  31. Time 6 Input Stack

  32. Time 7 Input Stack accept

  33. Formal Definitions for NPDAs

  34. Transition function

  35. 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.

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

  37. Instantaneous Description Current stack contents Current state Remaining input

  38. Example Instantaneous Description Input Time 4: Stack

  39. Example Instantaneous Description Input Time 5: Stack

  40. We write Time 4 Time 5

  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

  48. A computation example

  49. For convenience we write

  50. Formal Definition Language of NPDAM Initial state Final state

More Related