Chap. 6 Pushdown Automata

Σχετικά έγγραφα
Homomorphism in Intuitionistic Fuzzy Automata

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

2 Composition. Invertible Mappings

Fractional Colorings and Zykov Products of graphs

Syntax Analysis Part IV

5. Choice under Uncertainty

Sequent Calculi for the Modal µ-calculus over S5. Luca Alberucci, University of Berne. Logic Colloquium Berne, July 4th 2008

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Every set of first-order formulas is equivalent to an independent set

Example Sheet 3 Solutions

Reminders: linear functions

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER

Congruence Classes of Invertible Matrices of Order 3 over F 2

Elements of Information Theory

A Note on Intuitionistic Fuzzy. Equivalence Relation

Tridiagonal matrices. Gérard MEURANT. October, 2008

Lecture 2. Soundness and completeness of propositional logic

C.S. 430 Assignment 6, Sample Solutions

EE512: Error Control Coding

Chapter 3: Ordinal Numbers

LECTURE 2 CONTEXT FREE GRAMMARS CONTENTS

MINIMAL INTUITIONISTIC GENERAL L-FUZZY AUTOMATA

THE SECOND ISOMORPHISM THEOREM ON ORDERED SET UNDER ANTIORDERS. Daniel A. Romano

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

Finite Field Problems: Solutions

Generating Set of the Complete Semigroups of Binary Relations

From the finite to the transfinite: Λµ-terms and streams

Uniform Convergence of Fourier Series Michael Taylor

Homework 8 Model Solution Section

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

Bounding Nonsplitting Enumeration Degrees

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Models for Probabilistic Programs with an Adversary

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

A Lambda Model Characterizing Computational Behaviours of Terms

Affine Weyl Groups. Gabriele Nebe. Summerschool GRK 1632, September Lehrstuhl D für Mathematik

Statistical Inference I Locally most powerful tests

Homework 3 Solutions

A Bonus-Malus System as a Markov Set-Chain. Małgorzata Niemiec Warsaw School of Economics Institute of Econometrics

ST5224: Advanced Statistical Theory II

Srednicki Chapter 55

Example of the Baum-Welch Algorithm

The Simply Typed Lambda Calculus

MINIMAL CLOSED SETS AND MAXIMAL CLOSED SETS

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

Other Test Constructions: Likelihood Ratio & Bayes Tests

How to register an account with the Hellenic Community of Sheffield.

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

The challenges of non-stable predicates

TMA4115 Matematikk 3

( y) Partial Differential Equations

Intuitionistic Fuzzy Ideals of Near Rings

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018

Abstract Storage Devices

Cyclic or elementary abelian Covers of K 4

Syntax Analysis Part V

Inverse trigonometric functions & General Solution of Trigonometric Equations

Affiliations: Address: Electronics and Communication Sciences Unit, Indian Statistical Institute, Kolkata-108. Telephone Number:

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

CRASH COURSE IN PRECALCULUS

4.6 Autoregressive Moving Average Model ARMA(1,1)

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Capacitors - Capacitance, Charge and Potential Difference

Space-Time Symmetries

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Αλγόριθμοι και πολυπλοκότητα NP-Completeness

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 10η: Basics of Game Theory part 2 Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

Problem Set 3: Solutions

Math 446 Homework 3 Solutions. (1). (i): Reverse triangle inequality for metrics: Let (X, d) be a metric space and let x, y, z X.

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

Section 8.3 Trigonometric Equations

F19MC2 Solutions 9 Complex Analysis

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

Commutative Monoids in Intuitionistic Fuzzy Sets

Partial Differential Equations in Biology The boundary element method. March 26, 2013

DIRECT PRODUCT AND WREATH PRODUCT OF TRANSFORMATION SEMIGROUPS

Αλγόριθμοι και πολυπλοκότητα NP-Completeness (2)

Math 6 SL Probability Distributions Practice Test Mark Scheme

LTL to Buchi. Overview. Buchi Model Checking LTL Translating LTL into Buchi. Ralf Huuck. Buchi Automata. Example

Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook

Myhill Nerode Theorem for Fuzzy Automata (Min-max Composition)

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Σχολή Εφαρμοσμένων Μαθηματικών και Φυσικών Επιστημών. Εθνικό Μετσόβιο Πολυτεχνείο. Thales Workshop, 1-3 July 2015.

Concrete Mathematics Exercises from 30 September 2016

Tree Transformations and Dependencies

Mellin transforms and asymptotics: Harmonic sums

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

Top down vs. bottom up parsing. Top down vs. bottom up parsing

Chapter 4 (c) parsing

Transcript:

Chap. 6 Pushdown Automata 6.1 Definition of Pushdown Automata Example 6.1 L = {wcw R w (0+1) * } P c 0P0 1P1 1. Start at state q 0, push input symbol onto stack, and stay in q 0. 2. If input symbol is c in state q 0, go to state q 1. 3. If input symbols is same as top of the stack, pop it and stay in q 1. 4. If no more input symbol and empty stack in state q 1, accept. 11/6/12 Kwang-Moo Choe 1

A pushdown automaton(pda) P = (Q, Σ, Γ, δ, q 0, Z 0, F) is 1. Q is a finite set of states, 2. Σ is a finite set of input symbols, 3. Γ is a finite stack alphabet, 4. δ is a transition function. δ: Q (Σ {ε}) Γ 2 Q Γ*. 5. q 0 Q is an initial state, 6. Z 0 Γ * is an initial stack content, 7. F Q is a set of final states. 11/6/12 Kwang-Moo Choe 2

Example P = ({q 0, q 1, q 2 }, {0, 1, c, $}, {Z, O, Z 0 }, δ, q 0, Z 0, {q 2 }) δ(q 0, 0, Z 0 ) = {(q 0, ZZ 0 )} δ(q 0, 0, Z) = {(q 0, ZZ)} δ(q 0, 1, Z 0 ) = {(q 0, OZ 0 )} δ(q 0, 1, Z) = {(q 0, OZ)} δ(q 0, c, Z 0 ) = {(q 1, Z 0 )} δ(q 0, c, Z) = {(q 1, Z)} δ(q 0, 0, O) = {(q 0, ZO)} If see 0, then push Z in q 0. δ(q 0, 1, O) = {(q 0, OO)} If see 1, then push O in q 0. δ(q 0, c, O) = {(q 1, O)} If see c, go to q 1. δ(q 1, 0, Z) = {(q 1, ε)} If see 0, then pop Z in q 1. δ(q 1, 1, O) = {(q 1, ε)} If see 1, then pop O in q 1. δ(q 1, $, Z 0 ) = {(q 2, ε)} If see $, go to the final state q 2. $: end of string marker 11/6/12 Kwang-Moo Choe 3

Instantaneous description of PDA (current state, remained input string, stack contents) (q, x, γ) Q Σ * Γ *. P (Q Σ * Γ * ) (Q Σ * Γ * ) (q, ax, Xβ) P (p, x, γβ), if (p, γ) δ(q, a, X) (q, x, Xβ) P (p, x, γβ), if (p, γ) δ(q, ε, X) We may use instead of P if P is understood. is a binary relation on (Q Σ * Γ * ). *, reflexive transitive closure of. Recursive definition of *. I Q Σ * Γ *, I * I. If I J and J * K, I * K. 11/6/12 Kwang-Moo Choe 4

Theorem 6.5 If P = (Q, Σ, Γ, δ, q 0, Z 0, F) is a PDA and (q, xy, α) * (p, y, β) for q,p Q, x,y Σ * and α,β Γ *. Then (q, xyw, αγ) * (p, yw, βγ) for any w Σ * and γ Γ *. Theorem 6.6 If P = (Q, Σ, Γ, δ, q 0, Z 0, F) is a PDA and (q, xyw, α) * (p, yw, β) for q,p Q, x,y,w Σ * and α,β Γ *. Then (q, xy, α) * (p, y, β). 6.2 The language of a PDA L(P) = {w Σ * (q 0, w, Z 0 ) * (f, ε, α), f F} language accepted by final state N(P) = {w Σ * (q 0, w, Z 0 ) * (f, ε, ε)} language accepted by null stack 11/6/12 Kwang-Moo Choe 5

6.2.3 From Empty Stack to Final State Theorem 6.9 If L = N(P N ) for some PDA P N. Then there is a PDA P F such that L = L(P F ). Let P N = (Q, Σ, Γ, δ N, q 0, Z N, ). P F = (Q {q 0, q F }, Σ, Γ {Z F }, δ F, q 0, Z F, {q F }) where q 0, q F Q, Z F Γ. δ F : 1. δ F (q 0, ε, Z F ) = {(q 0, Z N Z F )}. push old stack bottom Z N. 2. δ F δ N, simulate P N with δ N. 3. q Q, δ F (q, ε, Z F ) = {(q F, Z F )}. If stack is empty(z F ), go tothe final final state q F. 11/6/12 Kwang-Moo Choe 6

6.2.4 From Final State to Empty Stack Theorem 6.11 If L = L(P F ) for some PDA P F. Then there is a PDA P N such that L = N(P N ). Let P F = (Q, Σ, Γ, δ F, q 0, Z F, F). P N = (Q {q 0, q E }, Σ, Γ {Z N }, δ N, q 0, Z N, ) where q 0, q E Q, Z F Γ. δ N : 1. δ N (q 0, ε, Z N ) = {(q 0, Z F Z N )} push old stack bottom Z F. 2. δ N δ F, simulate P F with δ F. 3. f F, Z Γ {Z N }, δ N (f, ε, Z) {(q E, ε)}. If final state, pop stack symbol and go to the empty state q E. 4. Z Γ {Z N }, δ N (q E, ε, Z) = {(q E, ε)}. Empty stack in q E. 11/6/12 Kwang-Moo Choe 7

6.3.1 From Context-free Grammar to Pushdown Automata Theorem 6.13 If G = (N, Σ, P, S) is a cfg. Then PDA P.. L(G) = N(P). Construct P = ({q}, Σ, N Σ, δ, q, S, ) A N, δ(q, ε, A) = {(q, α) A α P}guess A as α(a α P). a Σ, δ(q, a, a) = {(q, ε)} verify a Σ. guess and verify parser Proof A * lm xα if and only if (q, x, A) * (q, ε, α), x Σ *, α (N Σ) *. (If) If (q, x, A) i (q, ε, α), then A lm * xα. basis i = 0, x = ε, (q, ε, A) 0 (q, ε, A). A * lm A. induction Let i 1, and consider the next-to-last step. i) (q, x, A) i-1 (q, ε, Bγ) Guess (q, ε, βγ) = (q, ε, α) A lm * xbγ by IH and B β P by construction of δ Guess. A lm * xbγ lm xβγ = xα. 11/6/12 Kwang-Moo Choe 8

ii) (q, x, A) = (q, ya, A) i-1 (q, a, aα) Verify (q, ε, α) (q, y, A) i-1 (q, ε, aα) A * lm yaα = xα by IH (Thm 6.6; (q, ε, aα)) (Only if) If A lm i xα, then (q, x, A) * (q, ε, α). basis i = 0, A lm 0 A. (q, ε, A) 0 (q, ε, A). induction Let i 1, and consider the next-to-last step. A lm i-1 ybγ lm yβγ = yy γ γ = xα where β=y γ, y Σ *, γ (N Σ) *. (q, y, A) * (q, ε, Bγ) by IH, (q, yy, A) * (q, y, Bγ) (by T.6.5) G (q, y, βγ) = (q, y, y γ γ) y V (q, ε, γ γ) = (q, ε, α) A lm * xα if and only if (q, x, A) * (q, ε, α). If A = S, α = ε, S lm * x if and only if (q, x, S) * (q, ε, ε) L(G) = N(P). 11/6/12 Kwang-Moo Choe 9

6.3.2 From Pushdown Automata to Context-free Grammar Theorem 6.14 If a PDA P = (Q, Σ, Γ, δ, q 0, Z 0, ). Then there is a CFG G such that L(G) = N(P). proof G = (Q Γ Q {S}, Σ, P, S) P = {S [q 0, Z 0, q] q Q} {[q, A, p m ] a [p, Y 1, p 1 ][p 1, Y 2, p 2 ] [p m-1, Y m, p m ] (p, Y 1 Y m ) δ(q, a, A), a Σ {ε}, p 1,, p m Q} (if m = 0, [q, A, p] a P, a Σ {ε}) [q, A, p] lm * x Σ *, if and only if (q, x, A) * (p, ε, ε). Nonterminal [q, A, p] derives terminal string x if and only if x causes PDA P to pop A from stack starting in the state q and ending in the state p. 11/6/12 Kwang-Moo Choe 10

1) If (q, x, A) i (p, ε, ε), then [q, A, p] * lm x. basis i = 1, (q, x, A) (p, ε, ε), (p, ε) δ(q, x, A), x Σ {ε}. [q, A, p] x P where x Σ {ε}. induction (q, x, A) = (q, ay, A) (p 1, y, Y 1 Y m ) i-1 (p, ε, ε). p 2,, p m, p Q and assume y = y 1 y m Σ *. (p 1,y 1 y m,y 1 Y m ) * (p 2,y 2 y m,y 2 Y m ) * (p m,y m,y m ) (p,ε,ε). 1 i m, (p i, y i, Y i ) * (p i+1, ε, ε). (Thm 6.5 and y i depends only on Y i ) [p i, Y i, p i+1 ] lm * y i by IH. [p 1, Y 1, p 2 ][p 2, Y 2, p 3 ] [p m, Y m, p] lm * y 1 y 2 y m = y Since (q, ay, A) (p 1, y, Y 1 Y m ), (p 1, Y 1 Y m ) δ(q, a, A). [q, A, p] a [p 1, Y 1, p 2 ][p 2, Y 2, p 3 ] [p m, Y m, p] P.( p i Q) [q, A, p] lm a [p 1, Y 1, p 2 ][p 2, Y 2, p 3 ] [p m, Y m, p] lm * ay = x. 11/6/12 Kwang-Moo Choe 11

2) If [q, A, p] i lm x, then (q, x, A) * (p, ε, ε). basis i = 1, [q, A, p] x P, (p, ε) δ(q, x, A) where x Σ {ε}. induction [q, A, p] lm a [p 1, Y 1, p 2 ] [p m, Y m, p] i-1 lm x Σ *. x = ay 1 y m where 1 i m, [p i, Y i, p i+1 ] lm i y i where p m+1 =p. (p i, y i, Y i ) * (p i+1, ε, ε) by IH. Since [q, A, p] a [p 1, Y 1, p 2 ] [p m, Y m, p] P, a [p 1, Y 1, p 2 ] [p m, Y m, p] δ(q, a, A). (q, ay 1 y m, A) (p 1, y 1 y m, Y 1 Y m ) * * ( p, ε, ε). [q, A, p] lm * x, p Q if and only if (q, x, A) * (p, ε, ε). [q 0, Z 0, p] lm * x, p Q if and only if (q 0, x, Z 0 ) * (p, ε, ε). S lm * x, p Q if and only if (q 0, x, Z 0 ) * (p, ε, ε). Q.E.D. 11/6/12 Kwang-Moo Choe 12