Lecture Pushdown Automata. stack stack head finite control tape head tape.

Slides:



Advertisements
Similar presentations
Restricted Machines Presented by Muhannad Harrim.
Advertisements

Chapter 5 Pushdown Automata
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Lecture 6 Nondeterministic Finite Automata (NFA)
Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
Introduction to Computability Theory
CFG => PDA Sipser 2 (pages ).
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
CFG => PDA Sipser 2 (pages ). CS 311 Fall Formally… A pushdown automaton is a sextuple M = (Q, Σ, Γ, δ, q 0, F), where – Q is a finite set.
Costas Busch - RPI1 Pushdown Automata PDAs. Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States.
Courtesy Costas Busch - RPI1 Pushdown Automata PDAs.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
Fall 2004COMP 3351 Pushdown Automata PDAs. Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States.

Fall 2006Costas Busch - RPI1 Pushdown Automata PDAs.
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
January 15, 2014CS21 Lecture 61 CS21 Decidability and Tractability Lecture 6 January 16, 2015.
Fall 2006Costas Busch - RPI1 PDAs Accept Context-Free Languages.
Prof. Busch - LSU1 Pushdown Automata PDAs. Prof. Busch - LSU2 Pushdown Automaton -- PDA Input String Stack States.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
Today Chapter 2: (Pushdown automata) Non-CF languages CFL pumping lemma Closure properties of CFL.
1 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.
Lecture 3 Graph Representation for Regular Expressions
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
CSCI 2670 Introduction to Theory of Computing September 21, 2005.
Chapter 7 PDA and CFLs.
Ding-Zhu Du Office: ECSS 3-611, M 3:15-4:30 Lecture: ECSS 2.311, MW 12:30-1:45.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Definition Moves of the PDA Languages of the PDA Deterministic PDA’s Pushdown Automata 11.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 6 Mälardalen University 2010.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Formal Languages, Automata and Models of Computation
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
1 Chapter Pushdown Automata. 2 Section 12.2 Pushdown Automata A pushdown automaton (PDA) is a finite automaton with a stack that has stack operations.
Costas Busch - LSU1 PDAs Accept Context-Free Languages.
Theory of Languages and Automata By: Mojtaba Khezrian.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
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.
Lecture # 21.
Formal Languages, Automata and Models of Computation
Theory of Computation Pushdown Automata pda Lecture #10.
CSE 105 theory of computation
CSE 105 theory of computation
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata.
CS 461 – Sept. 28 Section 2.2 – Pushdown Automata { 0n 1n }
COSC 3340: Introduction to Theory of Computation
Context-free Languages
Pushdown automata a_introduction.htm.
Chapter 2 Context-Free Language - 01
CSE 105 theory of computation
ReCap Chomsky Normal Form, Theorem regarding CNF, examples of converting CFG to be in CNF, Example of an FA corresponding to Regular CFG, Left most and.
… NPDAs continued.
Pushdown automata The Chinese University of Hong Kong Fall 2011
Teori Bahasa dan Automata Lecture 10: Push Down Automata
CS6382 Theory of Computation
COSC 3340: Introduction to Theory of Computation
Presentation transcript:

Lecture Pushdown Automata

stack stack head finite control tape head tape

The tape is divided into finitely many cells. Each cell contains a symbol in an alphabet Σ. al ph a b e t

The stack head always scans the top symbol of the stack. It performs two basic operations: Push: add a new symbol at the top. Pop: read and remove the top symbol. Alphabet of stack symbols: Γ

The head scans at a cell on the tape and can read a symbol on the cell. In each move, the head can move to the right cell. a

The finite control has finitely many states which form a set Q. For each move, the state is changed according to the evaluation of a transition function δ : Q x (Σ U {ε}) x (Γ U {ε}) → 2. Q x (Γ U {ε})

(p, u) δ(q, a, v) means that if the tape head reads a, the stack head read v, and the finite control is in the state q, then one of possible moves is that the next state is p, v is replaced by u at stack, and the tape head moves one cell to the right. p q a a v u

(p, u) δ(q, ε, v) means that this a ε-move. p q a v u a

(p, u) δ(q, a, ε) means that a push operation performs at stack. p q a a u

(p, ε) δ(q, a, v) means that a pop operation performs at stack p q a a v

There are some special states: an initial state s and a final set F of final states. Initially, the PDA is in the initial state s and the head scans the leftmost cell. The tape holds an input string. The stack is empty. s

When the head gets off the tape, the PDA stops. An input string x is accepted by the PDA if the PDA stops at a final state and the stack is empty. Otherwise, the input string is rejected. f x

The PDA can be represented by M = (Q, Σ, Γ, δ, s, F) where Σ is the alphabet of input symbols and Γ is the alphabet of stack symbols. The set of all strings accepted by a PDA M is denoted by L(M). We also say that the language L(M) is accepted by M.

The transition diagram of a PDA is an alternative way to represent the PDA. For M = (Q, Σ, Γ, δ, s, F), the transition diagram of M is an edge-labeled digraph G=(V, E) satisfying the following: V = Q (s =, f = for f F) E = { q p | (p,u) δ(q, a, v) }. a, v/u

Example 1. Construct PDA to accept L= {0 1 | n > 0} nn Solution 1. 0, ε/0 1, 0/ε

Solution 2. Consider a CFG G = ({S}, {0,1}, {S → ε | 0S1}, S). ε, ε/S ε, S/ε ε, ε/0 ε, S/1 0, 0/ε 1, 1/ε

Theorem Every CFL can be accepted by a PDA. Proof.Consider a CFL L = L(G) for a CFG G = (V, Σ, R, S). ε, ε/S a, a/ε for a in Σ ε, A/x n A → x 1 x 2 …x n in R ε, ε/x 1 Theorem

Sometimes, constructing the PDA is easier than constructing CFG.

Construct a PDA or a CFG? PDA!!! Sometimes, constructing the PDA is easier than constructing CFG. Example 2

Idea

(p, s) δ(s, ε, ε) p s a s a

(q, s) δ(p, a, s) p p a a a s s (p, a) δ(q, ε, ε)

(q1, a) δ(p, a, a) p p a a a a a (p, a) δ(q1, ε, ε)

(p, ε) δ(p, a, b) p p a a b

(p, b’) δ(p, a, b) p p a a b b’

(p, ε) δ(p, a, b’) p p a a b’

(r1, s) δ(p, b, s) p p b b b s s (p, b) δ(r1, ε, ε)

(r2, b) δ(p, b, b) p p b b b b b (p, b) δ(r2, ε, ε)

(r3, b’) δ(p, b, b’) p p b b b b’ (p, b) δ(r3, ε, ε)

(p, ε) δ(p, b, a) p p b b a

(t, ε) δ(p, b, a) p p b b a (p, ε) δ(t, ε, a) a

(t, ε) δ(p, b, a) p p b b a (u, x) δ(t, ε, x) z z≠a z b’ (p, b’) δ(u, ε, ε)

(p, ε) δ(p, ε, s) p p s

Idea Example 3

1 Solution 1 1 1

Idea Example 4

1 Solution 1 1 1