



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A detailed explanation of the pumping lemma for context-free languages (cfls), a fundamental tool in formal language theory. It covers the lemma's statement, proof, and applications in proving languages are not context-free. The document also includes illustrative examples and a game view of the lemma, making it accessible to students of computer science and related fields.
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!
Non-Context Free Languages
Question Are there languages that are not context-free? What about L = {anbncn^ | n ≥ 0 }?
Answer L is not context-free, because
The precise way to capture this intuition is through the pumping lemma
Pumping Lemma for CFLs Informal Statement
For all sufficiently long strings z in a context free language L, it is possible to find two substrings, not too far apart, that can be simultaneously pumped to obtain more words in L.
Lemma 1. If L is a CFL, then ∃p (pumping length) such that ∀z ∈ L, if |z| ≥ p then ∃u, v, w, x, y such that z = uvwxy
Proof Defered to later in the lecture.
Two Pumping Lemmas side-by-side
Context-Free Languages If L is a CFL, then ∃p (pumping length) such that ∀z ∈ L, if |z| ≥ p then ∃u, v, w, x, y such that z = uvwxy
Regular Languages If L is a regular language, then ∃p (pumping length) such that ∀z ∈ L, if |z| ≥ p then ∃u, v, w such that z = uvw
Pumping Lemma for CFLs Game View Game between Defender, who claims L satisfies the pumping condition, and Chal- lenger, who claims L does not.
Defender Challenger Pick pumping length p
p −→ ←−^ z Pick z ∈ L s.t. |z| ≥ p Divide z into u, v, w, x, y s.t. |vwx| ≤ p, and |vx| > 0
u,v,w,x,y −→ ←−^ i Pick i, s.t. uviwxiy 6 ∈ L
Pumping Lemma: If L is CFL, then there is always a winning strategy for the defender (i.e., challenger will get stuck). Pumping Lemma (in contrapositive): If there is a winning strategy for the challenger, then L is not CFL. Consequences of Pumping Lemma
Example I
Proposition 2. Lanbncn = {anbncn^ | n ≥ 0 } is not a CFL.
Proof. Suppose Lanbncn is context-free. Let p be the pumping length.
Proof. Suppose E is context-free. Let p be the pumping length.
Proof of Pumping Lemma
Lemma 6. If L is a CFL, then ∃p (pumping length) such that ∀z ∈ L, if |z| ≥ p then ∃u, v, w, x, y such that z = uvwxy
Let G be a CFG in Chomsky Normal Form such that L(G) = L. Let z be a “very long” string in L (“very long” made precise later).
z
u v w x y
Figure 1: Parse Tree for z
Pumping down and up
u
w
y
Figure 2: Pumping zero times
u v
v w x
x y
Figure 3: Pumping two times
Proof of Pumping Lemma
Proof. Let G be a grammar in Chomsky Normal Form with k variables such that L(G) = L. Take p = 2k. Consider z ∈ L such that |z| ≥ p = 2k.