? γ ? 2pdas accept non cfls in addition to all cfls

This preview shows page 12 - 20 out of 23 pages.

{ λ }) × ( Γ { λ }) 2PDAs accept non-CFLs, in addition to all CFLs Accepting criteria: Consume an input string Enter a final state Empty both stacks
Image of page 12

Subscribe to view the full document.

13 Two-Stack PDAs Example . Given L = { a i b i c i | i 0 }, q 0 > λ λ / λ λ / λ q 2 q 1 a λ / A λ / λ c λ / λ A / λ c λ / λ A / λ b A/ λ λ / A b A/ λ λ / A [ q 0 , aabbcc , λ , λ ] |- [ q 0 , abbcc , A , λ ] |- [ q 0 , bbcc , AA , λ ] |- [ q 1 , bcc , A , A ] |- [ q 1 , cc , λ , AA ] |- [ q 2 , c , λ , A ] |- [ q 2 , λ , λ , λ ] A 2PDA M that accepts L is L is not a CFL.
Image of page 13
14 Two-Stack PDAs Example . A 2PDA M accepts L = { a i b i c i d i | i 0 } [ q 0 , aabbccdd , λ , λ ] |- [ q 0 , abbccdd , A , λ ] |- [ q 0 , bbccdd , AA , λ ] |- [ q 1 , bccdd , A , B ] |- [ q 1 , ccdd , λ , BB ] |- [ q 2 , cdd , C , B ] |- [ q 2 , dd , CC , λ ] |- [ q 3 , d , C , λ ] |- [ q 3 , λ , λ , λ ] q 0 > λ λ / λ λ / λ q 3 q 2 a λ / A λ / λ d C / λ λ / λ b A/ λ λ / B q 1 b A/ λ λ / B c λ /C B / λ c λ /C B / λ d C / λ λ / λ
Image of page 14

Subscribe to view the full document.

15 7.3 PDA and CFLs Defn. 5.6.1. A CFG G = ( V , , P , S ) is in Greibach normal form ( GNF ) if each rule has one of the following forms: i) A aA 1 A 2 ... A n ii) A a iii) S λ where a and A i V - { S }, i = 1, 2, ..., n Example : Given the language L = { a i b j c k | i , j , k 0 and ( i = j or i = k ) }, the following PDA accepts L : b A/ λ q 1 q 2 q 3 q 4 q 5 q 6 q 7 a λ /A λ λ /$ c A/ λ λ λ / λ λ λ / λ b λ / λ λ λ / λ λ $/ λ c λ / λ λ $/ λ i = j i = k
Image of page 15
16 7.3 PDA and CFLs The CFG G that generates the set of string in the language L = { a i b j c k | i , j , k 0 and ( i = j or i = k ) }, i.e., L( G ), is S aAc | aDbC | λ A aAc | bB | λ B bB | λ D aDb | λ C cC | λ i = j i = k
Image of page 16

Subscribe to view the full document.

17 7.3 PDA and CFLs Theorem 7.3.1. Let L be a CFL. Then 5 a PDA that accepts L . Proof . Let G = ( V , , P , S ) be a grammar in GNF that generates L . An extended PDA M with start state q 0 is defined by Q m = { q 0 , q 1 }, m = , Γ m = V - { S }, and F m = { q 1 } with transitions (a) δ ( q 0 , a , λ ) = { [ q 1 , w ] | S aw P } (b) δ ( q 1 , a , A ) = { [ q 1 , w ] | A aw P and A V - { S }} (c) δ ( q 0 , λ , λ ) = { [ q 1 , λ ] | S λ P }
Image of page 17
18 7.3 PDA and CFLs Proof . We must show that i) L L ( M ) For each derivation S uw with u + and w V*, we show that 5 a computation [ q 0 , u , λ ] [ q 1 , λ , w ] in M by induction on the length of the derivation, i.e., n . Basis : n = 1, i.e., S aw , where a and w V* The transition (a), i.e., δ ( q 0 , a , λ ) = { [ q 1 , w ] | S aw P }, yields the desired computation. Induction Hypothesis : Assume for every derivation S uw , 5 a computation [ q 0 , u , λ ] [ q 1 , λ , w ] in M . * * n *
Image of page 18

Subscribe to view the full document.

19 PDA and CFLs Induction : Now consider S uw . Let u = va + & w V*, S uw can be written as S vAw 2 uw , where w = w 1 w 2 & A aw 1 P .
Image of page 19
Image of page 20
You've reached the end of this preview.
  • Winter '12
  • DennisNg
  • Trigraph, Personal digital assistant, The Stack, Automata theory, Transition function

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern