Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Deep Pushdown Automata Alexander Meduna Brno University of Technology, Czech Republic  Based on Meduna, A.: Deep Pushdown Automata,"— Presentation transcript:

1 Deep Pushdown Automata Alexander Meduna Brno University of Technology, Czech Republic  meduna@fit.vutbr.cz Based on Meduna, A.: Deep Pushdown Automata, Acta Informatica, 2006

2 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

3 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

4 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

5 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

6 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

7 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

8 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#)

9 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#)

10 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#)

11 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#)

12 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

13 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

14 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]

15 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

16 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

17 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

18 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

19 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

20 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

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

22 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

23 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

24 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}.

25 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)

26 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

27 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

28 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

29 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

30 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

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

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

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


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

Similar presentations


Ads by Google