example 2 16 i
play

Example 2.16 I { a i b j c k | i = j or i = k } Idea: push a i into - PowerPoint PPT Presentation

Example 2.16 I { a i b j c k | i = j or i = k } Idea: push a i into stack But should we check b or c ? Need nondeterminism Pushdown automata may be nondeterministic October 8, 2020 1 / 7 Example 2.16 II Recall was defined as Q


  1. Example 2.16 I { a i b j c k | i = j or i = k } Idea: push a i into stack But should we check b or c ? Need nondeterminism Pushdown automata may be nondeterministic October 8, 2020 1 / 7

  2. Example 2.16 II Recall δ was defined as Q × Σ ǫ × Γ ǫ → P ( Q × Γ ǫ ) We see the power set P ( Q × Γ ǫ ) Fig 2.17 The upper part checks if i = j The lower part checks if i = k October 8, 2020 2 / 7

  3. Example 2.16 III c , ǫ → ǫ b , a → ǫ ǫ, $ → ǫ q 3 q 4 a , ǫ → a ǫ, ǫ → ǫ ǫ, ǫ → $ q 1 q 2 ǫ, ǫ → ǫ q 5 q 6 q 7 ǫ, ǫ → ǫ ǫ, $ → ǫ c , a → ǫ b , ǫ → ǫ October 8, 2020 3 / 7 nondeterminism: q → q or q → q

  4. Running a PDA I Input a 2 bc 2 The way is similar to how we run an NFA October 8, 2020 4 / 7

  5. Running a PDA II q 1 ∅ q 2 { $ } q 3 { $ } q 4 ∅ q 5 { $ } q 6 { $ } q 7 ∅ a q 2 { a , $ } q 3 { a , $ } q 5 { a , $ } q 6 { a , $ } a q 2 { a , a , $ } q 3 { a , a , $ } q 5 { a , a , $ } q 6 { a , a , $ } b q 3 { a , $ } q 5 { a , a , $ } q 6 { a , a , $ } c q 6 { a , $ } c q 6 { $ } q 7 ∅ October 8, 2020 5 / 7

  6. Example 2.18 I { ww R | w ∈ { 0 , 1 } ∗ } w R : reverse Approach: symbols pushed to stack nondeterministically guess middle is reached fig 2.19 October 8, 2020 6 / 7

  7. Example 2.18 II ǫ, ǫ → $ 0 , ǫ → 0 q 1 q 2 1 , ǫ → 1 ǫ, ǫ → ǫ 0 , 0 → ǫ q 4 q 3 1 , 1 → ǫ ǫ, $ → ǫ October 8, 2020 7 / 7

Recommend


More recommend