The pumping lemma for context-free languages (CFLs) states that for any CFL L, there exists a constant n such that any string z in L of length at least n can be divided into five parts uvwxy where |vwx| ≤ n, vx ≠ ε, and uvixwixy is in L for all i ≥ 0. This allows any CFL to "pump" the middle substring vwx any number of times while keeping the string in the language.
The pumping lemma for context-free languages (CFLs) states that for any CFL L, there exists a constant n such that any string z in L of length at least n can be divided into five parts uvwxy where |vwx| ≤ n, vx ≠ ε, and uvixwixy is in L for all i ≥ 0. This allows any CFL to "pump" the middle substring vwx any number of times while keeping the string in the language.
The pumping lemma for context-free languages (CFLs) states that for any CFL L, there exists a constant n such that any string z in L of length at least n can be divided into five parts uvwxy where |vwx| ≤ n, vx ≠ ε, and uvixwixy is in L for all i ≥ 0. This allows any CFL to "pump" the middle substring vwx any number of times while keeping the string in the language.
The pumping lemma for context-free languages (CFLs) states that for any CFL L, there exists a constant n such that any string z in L of length at least n can be divided into five parts uvwxy where |vwx| ≤ n, vx ≠ ε, and uvixwixy is in L for all i ≥ 0. This allows any CFL to "pump" the middle substring vwx any number of times while keeping the string in the language.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online from Scribd
Download as pdf or txt
You are on page 1of 4
Pumping Lemma for CFLs
In any sufficiently long string in a CFL, it is
possible to find at most two short, nearby sub- strings that we can “pump” i times in tandem, for any integer i, and the resulting string will still be in that language.
Pumping lemma for CFLs: Let L be a CFL.
Then there exists a constant n such that if z ∈ L with |z| ≥ n, then we can write z = uvwxy, subject to the following conditions:
1. |vwx| ≤ n.
2. vx 6= .
3. For all i ≥ 0, we have uv iwxiy ∈ L.
1 Informal Proof
If the string z is sufficiently long, then the parse
tree produced by z has a variable symbol that is repeated on a path from the root to a leaf. Suppose Ai = Aj , such that the overall parse tree has yield z = uvwxy, the subtree for root Aj has yield w, and the subtree for root Ai has yield vwx.
We can replace the subtree for root Ai with the
subtree for root Aj , giving a tree with yield uwy (corresponding to the case i = 0), which also belongs to L.
We can replace the subtree for root Aj with
the subtree for root Ai, giving a tree with yield uv 2wx2y (corresponding to the case i = 2), which also belongs to L.
Etc. 2 Examples
While CFLs can match two sub-strings for (in)
equality of length, they cannot match three such sub-strings.
Example 1: Consider L = {0m1m2m | m ≥ 1}.
Pick n of the pumping lemma. Pick z = 0n1n2n.
Break z into uvwxy, with |vwx| ≤ n and vx 6= . Hence vwx cannot involve both 0s and 2s, since the last 0 and the first 2 are at least n + 1 po- sitions apart. There are two cases:
• vwx has no 2s. Then vx has only 0s and
1s. Then uwy, which would have to be in L, has n 2s, but fewer than n 0s or 1s.
• vwx has no 0s. Analogous.
Hence L is not a CFL.
3 Examples (continued)
CFLs cannot match two pairs of sub-strings of
equal lengths if the pairs interleave.
Example 2: Consider L = {0i1j 2i3j | i, j ≥ 1}.
Pick n of the pumping lemma. Pick z = 0n1n2n3n.
Break z into uvwxy, with |vwx| ≤ n and vx 6= . Then vwx contains one or two different sym- bols. In both cases, the string uwy cannot be in L.
CFLs cannot match two sub-strings of arbi-
trary length over an alphabet of at least two symbols.