The Overall Procedure I Given P = ( Q , , , , q 0 , { q accept } ) - - PowerPoint PPT Presentation

the overall procedure i
SMART_READER_LITE
LIVE PREVIEW

The Overall Procedure I Given P = ( Q , , , , q 0 , { q accept } ) - - PowerPoint PPT Presentation

The Overall Procedure I Given P = ( Q , , , , q 0 , { q accept } ) Construct a CFG G var( G ) = { A pq | p , q Q } Start variable: A q 0 , q accept Rules: see earlier slides October 15, 2020 1 / 7 Needed modifications of PDA I


slide-1
SLIDE 1

The Overall Procedure I

Given P = (Q, Σ, Γ, δ, q0, {qaccept}) Construct a CFG G var(G) = {Apq | p, q ∈ Q} Start variable: Aq0,qaccept Rules: see earlier slides

October 15, 2020 1 / 7

slide-2
SLIDE 2

Needed modifications of PDA I

Recall we need PDA to satisfy

1

Single accept state

2

Stack empty before accepting

3

Each transition push or pop, but not both Let’s handle the first two together: single accept and stack empty before accepting: A new start qs → qs′ with ǫ, ǫ → $ For any q ∈ F, we have ǫ, a → ǫ back to q, ∀a. This pops things out before accepting a string Then from any q ∈ F, we do ǫ, $ → ǫ to qa.

October 15, 2020 2 / 7

slide-3
SLIDE 3

Needed modifications of PDA II

q ∈ F are no longer accept states See the illustration in the following figures Original PDA: qs′ · · · q1 q2

October 15, 2020 3 / 7

slide-4
SLIDE 4

Needed modifications of PDA III

New: qs′ qs · · · q1 q2 qa ǫ, ǫ → $ ǫ, a → ǫ ǫ, b → ǫ ǫ, a → ǫ ǫ, b → ǫ ǫ, $ → ǫ ǫ, $ → ǫ

October 15, 2020 4 / 7

slide-5
SLIDE 5

Needed modifications of PDA IV

To have each transition push or pop, but not both, change q1 → q2 with a, a → b to q1 → q3, a, a → ǫ q3 → q2, ǫ, ǫ → b and change q1 → q2, a, ǫ → ǫ to q1 → q3, a, ǫ →? q3 → q2, ǫ, ? → ǫ

October 15, 2020 5 / 7

slide-6
SLIDE 6

Regular language is context Free I

We roughly know this but didn’t give a formal

  • proof. Here are the steps

Regular language ⇒ recognized by DFA (in Chapter 1) DFA is a PDA Thus regular language recognized by PDA Then any regular language is context free (by the proof in this chapter)

October 15, 2020 6 / 7

slide-7
SLIDE 7

Non-context free languages I

There are such languages We omit the discussion

October 15, 2020 7 / 7