Properties of ContextFree Languages - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Properties of ContextFree Languages

Description:

Is the family of CFLs closed under a certain operation? 2. Pumping Lemma. Let L be an infinite CFL. ... Pumping Lemma for Linear CFLs. Let L be an infinite linear CFL. ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 24
Provided by: TruHoa3
Category:

less

Transcript and Presenter's Notes

Title: Properties of ContextFree Languages


1
Properties of Context-Free Languages
  • Is a certain language context-free?
  • Is the family of CFLs closed under a certain
    operation?

2
Pumping Lemma
  • Let L be an infinite CFL. Then there exists m ? 0
    such that any w ? L with w ? m can be
    decomposed as w uvxyz where
  • vy ? 1
  • vxy ? m
  • uvixyiz ? L for all i ? 0

3
Pumping Lemma
  • Proof
  • The RL case S ? xA ? xyA ? xyz
  • The CFL case S ? uAz ? uvAyz ? uvxyz

4
Moves in the Game
  • The opponent picks m ? 0.
  • We choose w ? L with w ? m.
  • The opponent chooses the decomposition w uvxyz
    such that vy ? 1 and vxy ? m.
  • We pick i such that uvixyiz ? L.

5
Example
  • Prove L ww w ? a, b is not a CFL.

6
Moves in the Game
  • The opponent picks m ? 0.

7
Moves in the Game
  • The opponent picks m ? 0.
  • We choose w ambmambm.

8
Moves in the Game
  • The opponent picks m ? 0.
  • We choose w ambmambm.
  • The opponent chooses the decomposition w uvxyz
    such that vy ? 1 and vxy ? m.
  • m m m m
  • a . . . a b . . . b a . . . a b . . . b
  • u v x y z

9
Moves in the Game
  • The opponent picks m ? 0.
  • We choose w ambmambm.
  • The opponent chooses the decomposition w uvxyz
    such that vy ? 1 and vxy ? m.
  • m m m m
  • a . . . a b . . . b a . . . a b . . . b
  • u v x y z
  • We pick i such that uvixyiz ? L.

10
Example
  • Prove L anbncn n ? 0 is not a CFL.

11
Linear Context-Free Languages
  • A CFL L is said to be linear iff there exists a
    linear CFG G such that L L(G).
  • (A grammar is linear iff at most 1 variable can
    occur on the right side of any production)

12
Pumping Lemma for Linear CFLs
  • Let L be an infinite linear CFL. Then there
    exists m ? 0 such that any w ? L with w ? m can
    be decomposed as w uvxyz where
  • vy ? 1
  • uvyz ? m
  • uvixyiz ? L for all i ? 0

13
Moves in the Game
  • The opponent picks m ? 0.
  • We choose w ? L with w ? m.
  • The opponent chooses the decomposition w uvxyz
    such that vy ? 1 and uvyz ? m.
  • We pick i such that uvixyiz ? L.

14
Example
  • Prove L w na(w) nb(w) is not linear.

15
Closure Properties of Context-Free Languages
  • L1 and L2 are context-free.
  • How about L1?L2, L1?L2 , L1L2 , L1, L1 ?

16
Theorem
  • If L1 and L2 are context-free, then so are L1?L2
    , L1L2 , L1.
  • (The family of context-free languages is closed
    under union, concatenation, and star-closure.)

17
Proof
  • G1 (V1, T1, S1, P1) G2 (V2, T2, S2, P2)
  • G3 (V1?V2?S3, T1?T2, S3, P1?P2?S3 ? S1
    S2)
  • L(G3) L(G1)?L(G2)

18
Proof
  • G1 (V1, T1, S1, P1) G2 (V2, T2, S2, P2)
  • G4 (V1?V2?S4, T1?T2, S4, P1?P2?S4 ? S1S2)
  • L(G4) L(G1).L(G2)

19
Proof
  • G1 (V1, T1, S1, P1)
  • G5 (V1?S5, T1, S5, P1?S5 ? S1S5 ?)
  • L(G5) L(G1)

20
Theorem
  • The family of context-free languages is not
    closed under intersection and complement.

21
Proof
  • L1 anbncm n ? 0, m ? 0
  • L2 anbmcm n ? 0, m ? 0
  • L anbncn n ? 0 L1?L2

22
Proof
  • L1?L2 L1?L2

23
Homework
  • Exercises 2, 7, 8, 9, 14, 15, 16 of Section 8.1.
  • Exercises 2, 4, 10, 15 of Section 8.2.
  • Presentations
  • Section 12.1 Computability and Decidability
    Halting Problem
  • Section 13.1 Recursive Functions
  • Post Systems Church's Thesis
  • Section 13.2 Measures of Complexity
    Complexity Classes
Write a Comment
User Comments (0)
About PowerShow.com