Teori Bahasa dan Automata Lecture 10: Push Down Automata

Slides:



Advertisements
Similar presentations
Restricted Machines Presented by Muhannad Harrim.
Advertisements

Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
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.
CS21 Decidability and Tractability
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
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.
January 14, 2015CS21 Lecture 51 CS21 Decidability and Tractability Lecture 5 January 14, 2015.
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.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
Lecture 3 Graph Representation for Regular Expressions
CSCI 2670 Introduction to Theory of Computing September 21, 2005.
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)
Lecture Pushdown Automata. stack stack head finite control tape head tape.
CSCI 2670 Introduction to Theory of Computing September 22, 2005.
CSCI 2670 Introduction to Theory of Computing September 23, 2004.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
Costas Busch - LSU1 PDAs Accept Context-Free Languages.
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.
Finite Automata.
Lecture # 21.
Design and Analysis of Approximation Algorithms
Formal Languages, Automata and Models of Computation
Pushdown Automata.
Theory of Computation Pushdown Automata pda Lecture #10.
Lecture 14 Push Down Automata (PDA)
Part VI NP-Hardness.
CSE 105 theory of computation
CSE 105 theory of computation
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
Pushdown Automata.
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 
Chapter 7 PUSHDOWN AUTOMATA.
Lecture 17 Oct 25, 2011 Section 2.1 (push-down automata)
Pushdown Automata.
Post Machine.
Chapter 9 TURING MACHINES.
Non-Deterministic Finite Automata
Nondeterministic Finite Automata
Finite Automata Reading: Chapter 2.
Definition Moves of the PDA Languages of the PDA Deterministic PDA’s
CSCE 531 Compiler Construction
Pushdown automata a_introduction.htm.
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.
CSE 105 theory of computation
Teori Bahasa dan Automata Lecture 4: Non-deterministic Finite Automata
CS6382 Theory of Computation
CSE 105 theory of computation
Teori Bahasa dan Automata Lecture 6: Regular Expression
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Teori Bahasa dan Automata Lecture 10: Push Down Automata By: Nur Uddin, Ph.D

tape tape head stack head finite control stack

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

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: Γ

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

δ : Q x (Σ U {ε}) x (Γ U {ε}) → 2 . 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 {ε})

a a q p u v (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, u) δ(q, ε, v) means that this a ε-move.

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

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

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

Otherwise, the input string is rejected. x f 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.

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} Solution 1. 1, 0/ε 0, ε/0 1, 0/ε

Solution 2. Consider a CFG G = ({S}, {0,1}, {S → ε | 0S1}, S). ε, S/1 ε, ε/0 ε, S/ε 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). ε, A/xn A → x1 x2 …xn in R ε, ε/S ε, ε/x1 a, a/ε for a in Σ Theorem

Sometimes, constructing the PDA is easier than constructing CFG.

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

Idea

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

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

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

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

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

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

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

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

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

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

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

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

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

Example 3 Idea

Solution 1 1 1 1

Example 4 Idea

Solution 1 1 1 1