Deep Pushdown Automata Alexander Meduna Brno University of Technology, Czech Republic  Based on Meduna, A.: Deep Pushdown Automata,

Slides:



Advertisements
Similar presentations
Chapter 5 Pushdown Automata
Advertisements

1 Pushdown Automata (PDA) Informally: –A PDA is an NFA-ε with a stack. –Transitions are modified to accommodate stack operations. Questions: –What is a.
C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
CFGs and PDAs Sipser 2 (pages ). Long long ago…
LR-Grammars LR(0), LR(1), and LR(K).
Top-down Parsing By Georgi Boychev, Rafal Kala, Ildus Mukhametov.
CFGs and PDAs Sipser 2 (pages ). Last time…
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.
CS5371 Theory of Computation
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
Transparency No. P2C3-1 Formal Language and Automata Theory Chapter 3 Pushdown Automata and Context-Free Languages.
CS 310 – Fall 2006 Pacific University CS310 Pushdown Automata Sections: 2.2 page 109 October 9, 2006.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
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)
Context-Free Grammars Chapter 3. 2 Context-Free Grammars and Languages n Defn A context-free grammar is a quadruple (V, , P, S), where  V is.
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.
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.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
Chapter 7 PDA and CFLs.
CS 461 – Sept. 26 CFG correctness Section 2.2 – Pushdown Automata.
Pushdown Automata (PDA) Intro
Context-Free Grammars Normal Forms Chapter 11. Normal Forms A normal form F for a set C of data objects is a form, i.e., a set of syntactically valid.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Context-free Languages
Regulated Pushdown Automata Alexander Meduna 1/22 Faculty of Information Technology Brno University of Technology Brno, Czech Republic, Europe.
Introduction to Language Theory
Lecture Pushdown Automata. stack stack head finite control tape head tape.
Part VII. Models for Context-Free Languages 1/50.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
1 Simplification of Context-Free Grammars Some useful substitution rules. Removing useless productions. Removing -productions. Removing unit-productions.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Grammars CS 130: Theory of Computation HMU textbook, Chap 5.
1 Chapter 6 Simplification of CFGs and Normal Forms.
Introduction Finite Automata accept all regular languages and only regular languages Even very simple languages are non regular (  = {a,b}): - {a n b.
Context-Free Languages
1 Pushdown Automata There are context-free languages that are not regular. Finite automata cannot recognize all context-free languages.
Formal Languages, Automata and Models of Computation
1/44 #-Rewriting Systems Based upon Brno University of Technology, Czech Republic  Křivka, Z., Meduna, A., Schönecker, R.: Generation.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
1 Section 12.2 Pushdown Automata A pushdown automaton (PDA) is a finite automaton with a stack that has stack operations pop, push, and nop. PDAs always.
Theory of Languages and Automata By: Mojtaba Khezrian.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
1 Key to Homework #3 (Models of Computation, Spring, 2001) Finite state control with a 4-way read/write head Figure (a)Figure (b) (over)
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.
6. Pushdown Automata CIS Automata and Formal Languages – Pei Wang.
Formal Languages, Automata and Models of Computation
PDAs Accept Context-Free Languages
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Chapter 7 PUSHDOWN AUTOMATA.
PARSE TREES.
Pushdown Automata Reading: Chapter 6.
A HIERARCHY OF FORMAL LANGUAGES AND AUTOMATA
Context-free Languages
Chapter 5 Pushdown Automata
Pushdown automata a_introduction.htm.
Chapter 2 Context-Free Language - 01
… NPDAs continued.
Pushdown automata The Chinese University of Hong Kong Fall 2011
Normal Forms for Context-free Grammars
Presentation transcript:

Deep Pushdown Automata Alexander Meduna Brno University of Technology, Czech Republic  Based on Meduna, A.: Deep Pushdown Automata, Acta Informatica, 2006

Pushdown Automaton (PDA) 2/22 AmAm A1A1 A2A2 … aiai anan …a1a1 a2a2 … Read-write head Read head Pushdown: Input tape: top move of head Finite State Control p = current state

Inspiration conversion of CFG to PDA that acts as a general top-down parser if pd top = input symbol, pop if pd top = non-input symbol, expand 3/22

PDA as a general Top-Down Parser 4/22 Configuration: (state, input, pd) Pop: (q, ax, a  ) p  (q, x,  ) Expansion: (q, x, A  ) e  (p, x,  ) by rule qA  p  A cceptance: (s, x, S)  * (f, ,  ) Final state

Deep Pushdown Automata: Fundamental Modification 5/22 expansion may be performed deeper in pd Standard Expansion top # A B b C Deep Expansion qA  pxqA  px3qC  px3qC  px pq 3 rd # A B b C x x

Deep Pushdown Automata Same as Top-Down Parser except deep expansions Expansion of depth m: the mth topmost non-input pd symbol is replaced with a string by rule 6/22 depth of expansion mqA  px states pushdown stringpushdown symbol

Expansion of Depth m 7/22 Expansion of depth m: (q, w, uAz) e  (p, w, uvz) by rule of depth m [mqA  pv], where u contains m – 1 non-input symbols

Pop: Illustration 8/22 Pushdown: top qp # a A b B c Read head Input tape: move of head cbbaa a  a   Move: (p, aabbcc, aAbB#) p  (p, abbcc, AbB#)

Pop: Illustration 8/22 Pushdown: top qp # a A b B c Read head Input tape: move of head cbbaa a  a   = Move: (p, aabbcc, aAbB#) p  (p, abbcc, AbB#)

Pop: Illustration pop 8/22 Pushdown: top qp # a A b B c Read head Input tape: move of head cbbaa a  a   = Move: (p, aabbcc, aAbB#) p  (p, abbcc, AbB#)

Pop: Illustration pop 8/22 Pushdown: top qp # a A b B c Read head Input tape: move of head cbbaa move head Move: (p, aabbcc, aAbB#) p  (p, abbcc, AbB#)

Pop: Illustration pop 8/22 Pushdown: top qp # a A b B remove Move: (p, aabbcc, aAbB#) p  (p, abbcc, AbB#) ac Read head Input tape: cbbaa

Pop: Illustration pop 8/22 Pushdown: top qp # A b B Move: (p, aabbcc, aAbB#) p  (p, abbcc, AbB#) ac Read head Input tape: cbbaa

Deep Expansion: Illustration 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa A  -  Rules Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc]

Deep Expansion: Illustration 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa A  -  Rules Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc] 2pB  qBc2pB  qBc

Deep Expansion: Illustration expand 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa A  -  Rules Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc] 2pB  qBc2pB  qBc

Deep Expansion: Illustration expand 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa Rules expand Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc] 2pB  qBc2pB  qBc

Deep Expansion: Illustration expand 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa Rules change state Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc] 2pB  qBc2pB  qBc c

Deep Expansion: Illustration expand 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa Rules change state Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc] 2pB  qBc2pB  qBc c

Deep Expansion: Illustration expand 9/22 a Pushdown: top qp # A b B c Read head Input tape: move of head cbbaa Rules Move: (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [2pB  qBc] 2pB  qBc2pB  qBc c

Example: Deep PDA (s, aabbcc, S#) e  (q, aabbcc, AB#) [1] e  (p, aabbcc, aAbB#) [2] p  (p, abbcc, AbB#) e  (q, abbcc, AbBc#) [4] e  (f, abbcc, abbBc#) [3] p  (f, bbcc, bbBc#) p  2 (f, cc, Bc#) e  (f, cc, cc#) [5] p  (f, c, c#) p  (f, , #) L(M) = {a n b n c n : n  1}  PD 2 Deep PDA M: [1]. 1sS  qAB [2]. 1qA  paAb [3]. 1qA  fab [4]. 2pB  qBc [5]. 1fB  fc 10/22 M accepts aabbcc:

Definition 1/3 A deep pushdown automaton is a 7-tuple M = (Q, , , R, s, S, F), where Q – states,    – input alphabet,  – pushdown alphabet, bottom symbol #   –  R – finite set of rules of the form mqA  pw or mq#  pv# s  Q – start state S   – start pushdown symbol F  Q – final states 11/22

Definition 2/3 if a non-input symbol is on pd top, M expands the pd as (q, w, uAz) e  (p, w, uvz) [mqA  pv], where u contains m – 1 non-input symbols 12/22 if an input symbol is on pd top, M pops the pd as (q, au, az) p  (q, u, z), a   no explicit rule needed in R

Definition 3/3 M is of depth n, denotated by n M, if n is the minimal positive integer such that each of M’s rules is of depth n or less. 13/22 Language accepted by n M, L( n M), is defined as L( n M) = {w   * : (s, w, S#)  * (f, , #) in n M with f  F}.

Main Result and its Proof Theorem: PD n  PD n+1, for all n  1. PD n – the language family defined by DeepPDAs of depth n. 14/22 Proof (Sketch): State grammars (Kasai, 1970) are needed in the proof State grammar is a modification of CFG based on rules of the form (q, A)  (p, v)

Proof 1/6: State Grammar 15/22 V – total alphabet, W – states, T  V – terminals, P – set of rules of the form (q, A)  (p, v) S  (V – T) – start symbol, State grammar G = (V, W, T, P, S) Configuration – (q, x) Derivation step: (q, uAz)  (p, uvz) [(q, A)  (p, v)] and for every nonterminal B in u, P contains no rule with (q, B) on the left-hand side

Proof 2/6: n-limited Step 16/22 n-limited derivation step: each derivation step within the first n non-terminals (q, uAz) n  (p, uvz) and uA has n or fewer non-terminals n-limited state language: L(G, n) = {w  T * :(q, S) n  * (p, w ) } ST n – the family of n-limited state languages

Proof 3/6: Example [1]. (1, S)  (2, AC ) [2]. (2, A)  (3, aAb ) [3]. (2, A)  (4, ab ) [4]. (3, C)  (2, Cc ) [5]. (4, C)  (4, c ) W = {1, 2, 3, 4} G generates aabbcc: (S, 1)  (AC, 2) [1]  (aAbC, 3) [2]  (aAbCc, 2) [4]  (aabbCc, 4) [3]  (aabbcc, 4) [5] L(G) = {a n b n c n : n  1}  ST 2 State Grammar G: 17/22

Proof 4/6: PD n  ST n, n  1 18/22 G simulates the application of ipA  qy  R: make a left-to-right scan of the pd until the ith occurence of a non-terminal if X i = A, then replace A with y and return to the beginning of the sentential form rightmost symbol is always a special a', and G completes the simulation by changing a' to a

Proof 5/6: ST n  PD n, n  1 19/22 n M simulates G’s n-limited derivations in pd: always records the first n non-terminals from current G’s sentential form in its state fewer than n non-terminals are extended by #s reads the string, empties pd, enters $  F

Proof 6/6: PD n  PD n+1, n  1 20/22 For all n  1, PD n = ST n  ST n+1 = PD n+1 2) Kasai (1970): ST n  ST n+1, for all n  1. 1)As PD n  ST n and ST n  PD n for all n  1, ST n = PD n. Q. E. D.

Note: PD n  CS, n  1 21/22 For every n  1, there exists a context- sensitive language L not included in PD n.

Open Problem Areas Determinism Rules of form mqA  p  22/22 Discussion