355hw5solf10

355hw5solf10 - Solutions for Homework Five CSE 355 1 7.1 10 points Let M be the PDA defined by Q = q,q 1,q 2 Σ = a,b Γ = A F = q 1,q 2 δ q,a, =

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Solutions for Homework Five, CSE 355 1. ( 7.1, 10 points ) Let M be the PDA defined by Q = { q ,q 1 ,q 2 } Σ = { a,b } Γ = { A } F = { q 1 ,q 2 } δ ( q ,a,λ ) = { [ q ,A ] } δ ( q ,λ,λ ) = { [ q 1 ,λ ] } δ ( q ,b,A ) = { [ q 2 ,λ ] } δ ( q 1 ,λ,A ) = { [ q 1 ,λ ] } δ ( q 2 ,b,A ) = { [ q 2 ,λ ] } δ ( q 2 ,λ,A ) = { [ q 2 ,λ ] } a) Describe the language accepted by M . b) Give the state diagram of M . c) Trace all computations of the strings aab , abb , aba in M . d) Show that aabb,aaab ∈ L ( M ). Solution: a) The PDA M accepts the language { a i b j | ≤ j ≤ i } . Processing an a pushes A onto the stack. Strings of the form a i are accepted in state q 1 . The transitions in q 1 empty the stack after the input has been read. A computation with input a i b j enters state q 2 upon processing the first b . To read the entire input string, the stack must contain at least j A ’s. The transition δ ( q 2 ,λ,A ) = [ q 2 ,λ ] will pop any A ’s remaining on the stack. b) The state diagram of M is q q 1 q 2 M : aλ/A λA/λ bA/λ,λA/λ λλ/λ bA/λ c) The computations of aab in M are as follows: State String Stack q aab λ q 1 aab λ State String Stack q aab λ q ab A q 1 ab A q 1 b λ 1 State String Stack q aab λ q ab A q b AA q 1 b AA q 1 b A q 1 b λ State String Stack q aab λ q ab A q b AA q 2 λ A q 2 λ λ The computations of abb in M are as follows: State String Stack q abb λ q 1 abb λ State String Stack q abb λ q bb A q 1 bb A q 1 bb λ State String Stack q abb λ q bb A q 2 b λ The computations of aba in M are as follows: State String Stack q aba λ q 1 aba λ State String Stack q aba λ q ba A q 1 ba A q 1 ba λ State String Stack q aba λ q ba A q 2 a λ d) To show that the string aabb and aaab are in L ( M ), we trace a computation of M that accepts these strings. State String Stack q aabb λ q abb A q bb AA q 2 b A q 2 λ λ State String Stack q aaab λ q aab A q ab AA q b AAA q 2 λ AA q 2 λ A q 2 λ λ 2. ( 7.2, 10 points ) Let M be the PDA in Example 7.1.3. q q 1 M : bλ/B,aλ/A bB/λ,aA/λ λλ/λ a) Give the transition table of M . b) Trace all computations of the strings ab , abb , abbb in M . c) Show that aaaa,baab ∈ L ( M ). d) Show that aaa,ab / ∈ L ( M ). Solution: 2 a) Q = { q ,q 1 } Σ = { a,b } Γ = { A,B } F = { q 1 } δ ( q ,b,λ ) = { [ q ,B ] } δ ( q ,a,λ ) = { [ q ,A ] } δ ( q ,λ,λ ) = { [ q 1 ,λ ] } δ ( q 1 ,b,B ) = { [ q 1 ,λ ] } δ ( q 1 ,a,A ) = { [ q 1 ,λ ] } b) The computations of ab in M are as follows: State String Stack q ab λ q 1 ab λ State String Stack q ab λ q b A q 1 b A State String Stack q ab λ q b A q λ BA q 1 λ BA The computations of abb in M are as follows: State String Stack q abb λ q 1 abb λ State String Stack q abb λ q bb A q 1 bb A State String Stack q abb λ q bb A q b BA q 1 b BA q 1 λ A State String Stack q abb λ q bb A q b BA q λ BBA q 1 λ BBA The computations of abbb in M are as follows: State String Stack q abbb λ q 1 abbb λ State String...
View Full Document

This note was uploaded on 02/27/2011 for the course CSE 355 taught by Professor Lee during the Fall '08 term at ASU.

Page1 / 13

355hw5solf10 - Solutions for Homework Five CSE 355 1 7.1 10 points Let M be the PDA defined by Q = q,q 1,q 2 Σ = a,b Γ = A F = q 1,q 2 δ q,a, =

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online