1 / 12

Pushdown Automata

[Section 7.1]. Pushdown Automata. like NFA-  but also has a stack transition takes the current state, the current input symbol, and the top-of-the-stack symbol (which is removed from the stack) and returns a state and a string to place in the stack

cmoody
Download Presentation

Pushdown Automata

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. [Section 7.1] Pushdown Automata • like NFA- but also has a stack • transition takes the current state, the current input symbol, and the top-of-the-stack symbol (which is removed from the stack) and returns a state and a string to place in the stack • the automaton starts in the initial state, reading the first symbol on the tape, and having a special initial symbol on the stack • automaton accepts a string x if, after reading all of x, it can get to an accepting state (the stack content does not matter) • if the stack is empty, the automaton is stuck

  2. [Section 7.1] Pushdown Automata Example: L = { akbk | k ¸ 0 }

  3. [Section 7.1] Pushdown Automata Example: L = { w 2 {a,b}* | w is an even-length palindrome }

  4. [Section 7.1] Pushdown Automata • Def: A pushdown automaton (PDA) is a 7-tuple (Q,,,q0,Z0,A,) where • Q is a finite set of states •  is a finite input alphabet •  is a finite stack alphabet • q02 Q is the initial state • Z02 is the initial stack symbol • A µ Q is the set of accepting states •  is the transition function from ______________ to finite subsets of Q £*

  5. [Section 7.1] Pushdown Automata Def: Let M = (Q,,,q0,Z0,A,) be a PDA. A configuration is a triple (p,x,) where p is the current state, x is the rest of the input (the yet-unread part), and  is the content of the stack (the top is on the left). We write (p,x,) `M (q,y,) if we can get from the configuration (p,x,) to the configuration (q,y,) using one transition of M. Similarly we write (p,x,) `M* (q,y,) if we can get from (p,x,) to (q,y,) through a finite sequence of transitions of M. The language accepted by M : L(M) = { x 2* | ________________________ }

  6. [Section 7.2] Deterministic Pushdown Automata Def: Let M = (Q,,,q0,Z0,A,) be a PDA. M is deterministic (DPDA) if A language L is a deterministic context-free language (DCFL) if there exists a DPDA accepting L.

  7. [Section 7.2] Deterministic Pushdown Automata Example: Give a DPDA for L = { akbk | k ¸ 1 }. Can you give a DPDA for L2 = { akbk | k ¸ 0 } ?

  8. [Section 7.2] Determinism vs. Nondeterminism For finite automata : For PDA : There exists a language which can be accepted by a PDA but not by a DPDA !

  9. [Section 7.2] Determinism vs. Nondeterminism Example: Is the language given by S  SS | (S) |  a DCFL ?

  10. [Section 7.2] Determinism vs. Nondeterminism Example: { x 2 {a,b}* | number of a’s in x = number of b’s in x }

  11. [Section 7.3] CFG vs. PDA It is possible to show that every language generated by a CFG can be accepted by a PDA and vice versa. Thm: Let G = (V,G,S,P) be a CFG. Then there exists a PDA M = (Q,M,,q0,Z0,A,) such that L(M) = L(G). Thm: Let M = (Q,M,,q0,Z0,A,) be a PDA. Then there exists a CFG G = (V,G,S,P) such that L(G) = L(M). Which one is easier to prove ?

  12. [Section 7.3] CFG vs. PDA Thm: Let G = (V,G,S,P) be a CFG. Then there exists a PDA M = (Q,M,,q0,Z0,A,) such that L(M) = L(G). Example: S  S + T | T T  T * R | R R  (S) | x

More Related