This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 14: Pumping Theorem for CFLs The idea behind the pumping theorem for CF languages is similar to the pumping theorem for regular languages. If the parse tree of a string is deep enough, then at least one nonterminal must be repeated along a certain branch. Some relevant substrings can then either be trimmed away or be pasted repeatedly. A A z y x v u S A A S z y v u A x v y w = uvxyz , then uxz ∈ L , and uv 2 xy 2 z ∈ L , and so on. 1 Height of tree = length of the longest path from the root to some leaf. Let b be the branching factor of a tree, i.e., the maximum number of branches from any node. A tree of height h with a branching factor of b can have at most b h leaves. Therefore, a tree with b h leaves must have height ≥ h . <= b <= b 2 h=2 Let b be the fanout of a grammar G , i.e., the maximum number of symbols on the RHS of any rule of G . A string of length b h must have its parse tree of height ≥ h . 2 Properties of CFLs The pumping theorem for CFLs Theorem 1 Let L be a context free language. Then there is an integer N ≥ 1 such that for every w ∈ L and  w  ≥ N , w can be split into five parts w = uvxyz such that 1. vy = e (i.e. v and y cannot both be e ) 2.  vxy  ≤ N 3. uv i xy i z ∈ L for i = 0 , 1 , 2 , .... 3 Properties of CFLs Proof : • Let G = ( V, Σ , R, S ) be a CFG that generates the CFL L . • Let b = max { α  : A → α in G } • Let N = b  NT  +1 = b  V − Σ  +1 • Let w ∈ L and  w  ≥ N . • Let T be a parse tree for w that has the smallest num ber of leaves....
View Full
Document
 Spring '10
 Prof.Tai

Click to edit the document details