Push-down Automata.

Slides:



Advertisements
Similar presentations
1 Pushdown Automata (PDA) Informally: –A PDA is an NFA-ε with a stack. –Transitions are modified to accommodate stack operations. Questions: –What is a.
Advertisements

Pushdown Automata Chapter 12. Recognizing Context-Free Languages We need a device similar to an FSM except that it needs more power. The insight: Precisely.
YES-NO machines Finite State Automata as language recognizers.
CS21 Decidability and Tractability
Costas Busch - RPI1 Pushdown Automata PDAs. Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
1 Languages and Finite Automata or how to talk to machines...
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
Pushdown Automata Part I: PDAs Chapter Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2)
Push-down Automata Section 3.3 Fri, Oct 21, 2005.
Finite Automata – Definition and Examples Lecture 6 Section 1.1 Mon, Sep 3, 2007.
Chapter 7 Pushdown Automata
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.
Lecture 11UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
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.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
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.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Formal Languages, Automata and Models of Computation
Theory of Computation Pushdown Automata pda Lecture #10.
Languages.
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz
CSE 105 theory of computation
Pushdown Automata PDAs
Push-down Automata Section 3.3 Wed, Oct 27, 2004.
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
PUSHDOWN AUTOMATA. PUSHDOWN AUTOMATA Hierarchy of languages Regular Languages  Finite State Machines, Regular Expression Context Free Languages 
Theory of Computation Lecture #27-28.
Chapter 7 PUSHDOWN AUTOMATA.
AUTOMATA THEORY VI.
Deterministic Finite Automata
Discrete Math II Howon Kim
COSC 3340: Introduction to Theory of Computation
Pushdown Automata Reading: Chapter 6.
Deterministic Finite Automata
REGULAR LANGUAGES AND REGULAR GRAMMARS
Chapter Thirteen: Stack Machines
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Nondeterministic Finite Automata
Intro to Data Structures
Non Deterministic Automata
Pushdown automata a_introduction.htm.
Definition Moves of the PDA Languages of the PDA Deterministic PDA’s
Principles of Computing – UFCFA3-30-1
… NPDAs continued.
CSE 105 theory of computation
Chapter 1 Regular Language
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,
More About Nondeterminism
COSC 3340: Introduction to Theory of Computation
LECTURE # 07.
CSE 105 theory of computation
Presentation transcript:

Push-down Automata

Push-Down Automata Recall that DFAs accept regular languages. We want to design machines similar to DFAs that will accept context-free languages. These machines will need to be more powerful. To handle a language like {anbn | n  0}, the machine needs to “remember” the number of as. To do this, we use a stack. A push-down automaton (PDA) is essentially an NFA with a stack.

Definition of a Push-Down Automaton A push-down automaton (PDA) is a sextuple (K, Σ, Γ, Δ, s, F) where K is a finite set of states. Σ is a finite alphabet of tape symbols. Γ is a finite alphabet of stack symbols. s  K is the start state. F  K is the set of final states. Δ is the transition relation, i.e., Δ is a finite subset of (K  (Σ  {e})  Γ*)  (K  Γ*).

Transitions Let ((p, a, β), (q, γ))  Δ be a transition. It means that we Move from state p. Read a from the tape, Pop the string β from the stack, Move to state q, Push string γ onto the stack. The first three (p, a, β), are “input.” The last two (q, γ) are “output.”

Transitions We will draw it as p q a /

Pushing and Popping When we push β, we push the symbols of β as we read them right to left. When we push the string abc, we push c, then push b, then push a. When we pop γ, we pop the symbols of γ as we read them from left to right (reverse order). When we pop the string abc, we pop a, then pop b, then pop c.

Pushing and Popping Thus, if we push the string abc and then pop it, we will get back abc, not cba. If we wanted to reverse the order, we would use three separate transitions: Push a Push b Push c

Configurations A configuration fully describes the current “state” of the PDA. The current state p. The remaining input w. The current stack contents . Thus, a configuration is a triple (p, w, )  (K, *, *).

Computations A configuration (p, w, ) yields a configuration (p', w', ') in one step, denoted (p, w, ) ├ (p', w', '), if there is a transition ((p, a, ), (p', ))  Δ such that w = aw',  = , and ' =  for some   *. The reflexive, transitive closure of ├ is denoted ├ *.

Accepting Strings After processing the string on the tape, The PDA is in either a final or a nonfinal state, and The stack is either empty or not empty. The input string is accepted if The ending state is a final state, and The stack is empty. That is, the string w  * is accepted if (s, w, e) * (f, e, e) for some f  F.

Accepting Strings One may define acceptance “by final state” only. The input is accepted if and only if the last state is a final state, regardless of whether the stack is empty. One may define acceptance “by empty stack” only. The input is accepted if and only if the stack is empty once the input is processed, regardless of which state the PDA is in.

Example of a PDA Run the following PDA on the input string aaabbb. s p q a e/AAA b AA/e

Example of a PDA The steps in the processing are (s, aaabbb, e) ├ (p, aabbb, A) ├ (p, abbb, AA) ├ (p, bbb, AAA) ├ (p, bb, AA) ├ (p, b, A) ├ (q, e, e).

L(A) = {w  *A accepts w}. The Language of a PDA The language of a PDA A is L(A) = {w  *A accepts w}. What is the language of the PDA in the previous example?

Example of a PDA What is the language of the following PDA? s p e e/e b A/e a e/A

Examples of PDAs Let  = {a, b}. Design a PDA that accepts the language {wcwR | w  *}. {wwR | w  *}.

Examples of PDAs Design a PDA whose language is {ambn  0  m < n}. {ambn  0  n < m}.

Examples of PDAs Design a PDA whose language is {ambncndm | m  0, n  0}. {ambmcndn | m  0, n  0}. {ambncpdq | m + n = p + q}. {ambnck | m = n or m = k}.