Pushdown Automata (PDA). Part 1

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Push Down Automata (PDA)
Advertisements

Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
Pushdown Automata CPSC 388 Ellen Walker Hiram College.
Pushdown Automata (PDA)
Costas Busch - RPI1 Pushdown Automata PDAs. Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States.
Courtesy Costas Busch - RPI1 Pushdown Automata PDAs.
Fall 2004COMP 3351 Pushdown Automata PDAs. Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States.
Fall 2006Costas Busch - RPI1 Pushdown Automata PDAs.
Pushdown Automaton (PDA)
Prof. Busch - LSU1 Pushdown Automata PDAs. Prof. Busch - LSU2 Pushdown Automaton -- PDA Input String Stack States.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
1 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.
CS 3240: Languages and Computation Pushdown Automata & CF Grammars NOTE: THESE ARE ONLY PARTIAL SLIDES RELATED TO WEEKS 9 AND 10. PLEASE REFER TO THE TEXTBOOK.
CSCI 2670 Introduction to Theory of Computing September 21, 2005.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Lecture Pushdown Automata. stack stack head finite control tape head tape.
Push-down Automata Section 3.3 Fri, Oct 21, 2005.
Complexity and Computability Theory I Lecture #11 Instructor: Rina Zviel-Girshin Lea Epstein.
1 Chomsky Hierarchy of Languages & Pushdown Automata (PDA) Lecture # 6-7 Muhammad Ahmad Jan.
PushDown Automata. What is a stack? A stack is a Last In First Out data structure where I only have access to the last element inserted in the stack.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Lecture 14 Push Down Automata (PDA) Topics:  Definition  Moves of the PDA  Languages of the PDA  Deterministic PDA’s June 18, 2015 CSCE 355 Foundations.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
CS 154 Formal Languages and Computability March 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
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.
CSCI 2670 Introduction to Theory of Computing September 22, 2004.
Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.
6. Pushdown Automata CIS Automata and Formal Languages – Pei Wang.
Formal Languages, Automata and Models of Computation
Closed book, closed notes
Lecture 14 Push Down Automata (PDA)
CSE 105 theory of computation
CSE 105 theory of computation
Pushdown Automata (PDA). Part 2
CIS Automata and Formal Languages – Pei Wang
Pushdown Automata PDAs
Push-down Automata Section 3.3 Wed, Oct 27, 2004.
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
CS 461 – Sept. 28 Section 2.2 – Pushdown Automata { 0n 1n }
PUSHDOWN AUTOMATA. PUSHDOWN AUTOMATA Hierarchy of languages Regular Languages  Finite State Machines, Regular Expression Context Free Languages 
Theory of Computation Lecture #27-28.
Push-down Automata.
AUTOMATA THEORY VI.
Pushdown Automata (PDA)
Pushdown Automata.
COSC 3340: Introduction to Theory of Computation
Pushdown Automata (PDA). Part 3
Pushdown Automata Reading: Chapter 6.
Course 2 Introduction to Formal Languages and Automata Theory (part 2)
Cpt S 317: Spring 2009 Reading: Chapters 1-9
Definition Moves of the PDA Languages of the PDA Deterministic PDA’s
Pushdown automata a_introduction.htm.
Pushdown Automaton (PDA)
Definition Moves of the PDA Languages of the PDA Deterministic PDA’s
CSE 105 theory of computation
… NPDAs continued.
CSE 105 theory of computation
Pushdown automata The Chinese University of Hong Kong Fall 2011
Recap lecture 37 New format for FAs, input TAPE, START, ACCEPT , REJECT, READ states Examples of New Format of FAs, PUSHDOWN STACK , PUSH and POP states,
CSE 105 theory of computation
COSC 3340: Introduction to Theory of Computation
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Pushdown Automata (PDA). Part 1 Cpt S 317: Spring 2009 Pushdown Automata (PDA). Part 1 The structure and the content of the lecture is based on http://www.eecs.wsu.edu/~ananth/CptS317/Lectures/index.htm School of EECS, WSU

PDA - the automata for CFLs Cpt S 317: Spring 2009 PDA - the automata for CFLs What is? FA to Reg Lang, PDA is to CFL PDA == [  -NFA + “a stack” ] Why a stack? PDA can remember an infinite amount of information but the access is only at the top (different to Turing machines - computers) -NFA Input string Accept/reject A stack filled with “stack symbols” School of EECS, WSU

Pushdown Automata - Definition Cpt S 317: Spring 2009 Pushdown Automata - Definition A PDA P := ( Q,∑,, δ,q0,Z0,F ): Q: states of the -NFA ∑: input alphabet  : stack symbols δ: transition function q0: start state Z0: Initial stack top symbol F: Final/accepting states School of EECS, WSU

δ : The Transition Function Cpt S 317: Spring 2009 old state Stack top input symb. new state(s) new Stack top(s) δ : Q x ∑ x  => Q x  δ : The Transition Function δ(q,a,X) = {(p,Y), …} state transition from q to p a is the next input symbol X is the current stack top symbol Y is the replacement for X; it is in * (a string of stack symbols) Set Y =  for: Pop(X) If Y=X: stack top is unchanged If Y=Z1Z2…Zk: X is popped and is replaced by Y in reverse order (i.e., Z1 will be the new stack top) a X Y q p Non-determinism Y = ? Action i) Y= Pop(X) ii) Y=X Pop(X) Push(X) iii) Y=Z1Z2..Zk Push(Zk) Push(Zk-1) … Push(Z2) Push(Z1) School of EECS, WSU

Example Let Lwwr = {wwR | w is in {0,1}*} Cpt S 317: Spring 2009 Example Let Lwwr = {wwR | w is in {0,1}*} CFG for Lwwr : S==> 0S0 | 1S1 |  PDA for Lwwr : P := ( Q,∑, , δ,q0,Z0,F ) = ( {q0, q1, q2},{0,1},{0,1,Z0},δ,q0,Z0,{q2}) Z0 marks the bottom of the stack. We need to have this symbol present s.t. After we pop w from the stack and realized we have seen ww^R on the input we still have smth on the stack to permit a transition to the accepting state. Mark the botom of the stack School of EECS, WSU

PDA as a state diagram δ(qi,a, X)={(qj,Y)} Next input symbol Current Cpt S 317: Spring 2009 PDA as a state diagram δ(qi,a, X)={(qj,Y)} Next input symbol Current stack top Stack Top Replacement (w/ string Y) Current state Next state a, X / Y qi qj School of EECS, WSU

PDA for Lwwr: Transition Diagram Cpt S 317: Spring 2009 PDA for Lwwr: Transition Diagram Grow stack ∑ = {0, 1} = {Z0, 0, 1} Q = {q0,q1,q2} 0, Z0/0Z0 1, Z0/1Z0 0, 0/00 0, 1/01 1, 0/10 1, 1/11 Pop stack for matching symbols 0, 0/  1, 1/  q0 q1 q2 , Z0/Z0 , Z0/Z0 , 0/0 , 1/1 , Z0/Z0 Go to acceptance Switch to popping mode This would be a non-deterministic PDA School of EECS, WSU

How does the PDA for Lwwr work on input “1111”? Cpt S 317: Spring 2009 How does the PDA for Lwwr work on input “1111”? All moves made by the non-deterministic PDA (q0,1111,Z0) (q1,1111,Z0) Path dies… (q0,111,1Z0) Path dies… (q0,11,11Z0) (q1,111,1Z0) (q0,1,111Z0) (q1,11,11Z0) (q1,1,1Z0) (q0,,1111Z0) (q1,1,111Z0) Acceptance by final state: = empty input AND final state (q1, ,11Z0) (q1, ,Z0) (q1, ,1111Z0) Path dies… Path dies… (q2, ,Z0) School of EECS, WSU