SlideShare a Scribd company logo
1 of 19
Free Ebooks Download
Mba Ebooks
By Edhole
Mba ebooks
Free ebooks download
http://ebooks.edhole.com
Chapter 6 Properties of Context-free
Languages
Lemma 1 (The pumping lemma for context-free languages).
Let L be any infinite CFL.
Then there exists a constant n, depending on L, such that if z
is in L and |z| ≥ n, then we can write z = uvwxy such that
6.1 Pumping Lemma for CFL's
|vx| ≥ 1,
|vwx| ≤ n, and
for all i ≥ 0, uvi
wxi
y is in L.
http://ebooks.edhole.com
Proof (sketch of the proof)
Let G be a Chomsky normal-form grammar
generating L - {ε}.
Since the size of the variables of a context-free grammar for L
is fixed and L is infinite. There exits a long sentence z in L
such that any parse tree for z must contain a long path of
variables. And there would be at least one variable that appear
twice in the path.
For Chomsky normal-form grammar, there are only two types
of the production rules: A→BC and A→a.
Hence for a parse tree of sentence z in L having no path of
length greater than i, then the length of z is no more than 2 i-1
.
We consider the length of a path as the length of the internal
nodes of the path, not including the leaf.
http://ebooks.edhole.com
a
S S
BA
ba
|Path|=k=1,
|word|=1 2≦ k-1
|path|=k=2
|word|=2 2≦ k-1
S
T1 T2
|word of T1| 2≦ i-1
|word of T2| 2≦ i-1
|path of T1| i≦
|path of T2| i≦
|word| 2≦ i
|path| i+1≦=>
http://ebooks.edhole.com
Suppose that G has k variables, and let n = 2k
.
If z is in L and |z| ≥ n, then any parse tree of z must have a path
of length > k.
Hence there must be at least one variables that appears at least
twice in the path of the parse tree.
Let the two vertices v1 and v2 in the parse tree be the vertices
labeled with the same variable A, and the vertex v1 is closer
to the root than vertex v2 . Also they are the vertices with the
same label closest to leaves of the tree.
http://ebooks.edhole.com
S
A
A
v w xu y
≦ k+1
≦ 2k
= n
Since A→BC, we have that |vx| 1.≧
A ⇒* vAx and A⇒*w, where |vwx| n.≦
http://ebooks.edhole.com
Now, we have that A ⇒* vAx and A⇒*w, where
|vwx| n.≦
A ⇒* vi
wxi
, for i=0, 1, 2, … .
Hence S ⇒* uvi
wxi
y in L, for i=0, 1, 2, … .
End of lemma 1.
http://ebooks.edhole.com
Example 1 L={0n
1n
0n
| n=0, 1, 2,…} is not context-free.
Pf Suppose that L is context-free. Let n be the constant
in the pumping lemma for CFL.
For a sentence z in L, |z| ≥ n. Write z = uvwxy, for all
u, v, w, x, and y with |vx| ≥ 1 and |vwx| ≤ n.
If the substring vwx contains only one kind of symbol, then
for i=0, uwx is not in L. Since the number of 1’s is not equal
to the number of consecutive 0’s.
If the substring vwx contains two kinds of symbols, then for
i=2, uv2
wx2
y is not in L. Since there are 0’s between two 1’s.
Contradiction.
http://ebooks.edhole.com
Example 2 L={0n
| n is a prime numer} is not context-free.
Pf Suppose that L is context-free. Let n be the constant
in the pumping lemma for CFL.
For a sentence z in L, |z| = p ≥ n, where p is a prime.
Write z = uvwxy, for all u, v, w, x, and y satisfying that
|vx| ≥ 1, and |vwx| ≤ n.
Let |vx|=k ≥ 1. Choose i = (p+1)k.
We have that |uvi
wxi
y| = (p – k) + i*k = (p – k) + (p + 1)k =
p(k + 1), a composite number. Hence uvi
wxi
y is not in L.
Contradiction.
http://ebooks.edhole.com
Example 3 L={am
br
cs
dt
| m = 0 or r = s = t} is not context-free.
Pumping lemma for CFL fails.
For z = br
cs
dt
= uvwxy. When v and x are of the same
type of symbol, say b, for i = 0, 1, 2, …, uvi
wxi
y are all
in L.
Ogden’s lemma for CFL works.
For z = am
br
cr
dr
= uvwxy. When v and x are of the same
type of symbol, say a, for i = 0, 1, 2, …, uvi
wxi
y are all
in L.
http://ebooks.edhole.com
Lemma 2 (Ogden’s lemma).
Let L be any infinite CFL.
Then there exists a constant n, depending on L, such that if z
is in L and |z| ≥ n, and we mark any n or more positions of z
“distinguished,” then we can write
z = uvwxy, such that:
 v and x together have at least one distinguished position,
 vwx has at most n distinguished positions, and
 for all i ≥ 0, uvi
wxi
y is in L.
http://ebooks.edhole.com
Proof (sketch of the proof)
Let G be a Chomsky normal-form grammar
generating L - {ε}.
Suppose that G has k variables, and let n = 1+ 2k
.
Suppose that z is in L and |z| ≥ n. We can mark any n or more
positions of z “distinguished”.
Select a path in a parse tree of z so that each vertex of the path
is a branch point, i.e., both branches of the vertex have
distinguished descendants.
http://ebooks.edhole.com
The selection is as follows:
Step 1: path = {}, empty.
Step 2: path  S; P := S; // path = <S>
Step 3: If P is leaf, done.
Step 4: If P has two children, say A and B.
If the sub-tree of B has less number of
distinguished descendant than the sub-tree of A,
then path  A; P := A; // path = <S, …, A>
else path  B; P := B; // path = <S, …, B>
goto step 3.
http://ebooks.edhole.com
Since there are at least n markers on the leaves, the selected
path must have at least k+1 branch points. Hence there are at
least one variable on the path appears twice or more.
The rest of the proof is similar to the proof of pumping lemma
for context-free languages.
End of lemma 2.
http://ebooks.edhole.com
Example 4 L = {br
cs
dt
| r≠s ≠ t ≠r} is not context-free.
Proof (by Ogden’s lemma)
Suppose that L is CF. Let n be the constant in the Ogden’s lemma.
Choose z = bn
cn+n!
dn+2n!
.
Let positions of the b’s be distinguished and z = uvwxy.
v and x together have at least one b .
vwx has at most n b’s.
If either v or x contains two different kinds of symbols, then
uv2
wx2
y is not in L.
http://ebooks.edhole.com
Assume that x is in c* and let |v| = s, i.e., v = bs
.
Then 1 s n. We have that s | n!.≦ ≦
Let t = n!/s. Choose i = 2t+1.
Then z’= uv2t+1
wx2t+1
y is in L. But v2t+1
= bs+2st
= bs+2n!
.
uwx has (n – s) b’s ⇒ z’ has (n – s) + s + 2n! = n+2n! b’s.
We have that z’ is not in L. Contradiction.
1. If x is in c* or d*, then v must be in b+
.
If each of v and x contains only one kind of symbol, then one
of v and x must be a substring of b+
.
Assume that x is in d* and let |v| = s, i.e., v = bs
.
Let t = n!/s. Choose i = t+1. Then z’= uvt+1
wxt+1
y is in L. But
vt+1
= bs+st
= bs+n!
. uwx has (n – s) b’s.
Then z’ has (n – s) + s + n! = n+n! b’s and z’ is not in L.
Contradiction.
http://ebooks.edhole.com
2. If x is in b+
, then v must be in b+
. And w is in b*.
Let |vx| = s, i.e., vx = bs
.
Then 1 s n. We have that s | n!.≦ ≦
Let t = n!/s. Choose i = 2t+1. Then z’= uv2t+1
wx2t+1
y is in L.
But v2t+1
x2t+1
= bs+2st
= bs+2n!
.
The substring uwx has (n – s) b’s.
Then z’ has n+2n! b’s and hence is not in L.
Contradiction.
End of example 4.
http://ebooks.edhole.com
Example 5 L={am
br
cs
dt
| m = 0 or r = s = t} is not context-free.
Proof (by Ogden’s lemma)
Choose z = an
bn
cn
dn
.
Mark all positions of b’s “distinguished.
Write z = uvwxy, where vx contains at least one b, and vx
contains at most n b’s.
Choose i = 0. We have that z’ = uwy is in L.
But the number of b’s in z’ ≠ the number of c’s in z’.
Contradiction.
http://ebooks.edhole.com
Free Ebooks Download
Mba Ebooks
By Edhole
Mba ebooks
Free ebooks download
http://ebooks.edhole.com

More Related Content

More from Edhole.com

Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarkaEdhole.com
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarkaEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in suratEdhole.com
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in indiaEdhole.com
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhiEdhole.com
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarkaEdhole.com
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarkaEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in suratEdhole.com
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in indiaEdhole.com
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhiEdhole.com
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbaiEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in suratEdhole.com
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in indiaEdhole.com
 

More from Edhole.com (20)

Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbai
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 

Recently uploaded

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

Mba Ebooks ! Edhole

  • 1. Free Ebooks Download Mba Ebooks By Edhole Mba ebooks Free ebooks download http://ebooks.edhole.com
  • 2. Chapter 6 Properties of Context-free Languages Lemma 1 (The pumping lemma for context-free languages). Let L be any infinite CFL. Then there exists a constant n, depending on L, such that if z is in L and |z| ≥ n, then we can write z = uvwxy such that 6.1 Pumping Lemma for CFL's |vx| ≥ 1, |vwx| ≤ n, and for all i ≥ 0, uvi wxi y is in L. http://ebooks.edhole.com
  • 3. Proof (sketch of the proof) Let G be a Chomsky normal-form grammar generating L - {ε}. Since the size of the variables of a context-free grammar for L is fixed and L is infinite. There exits a long sentence z in L such that any parse tree for z must contain a long path of variables. And there would be at least one variable that appear twice in the path. For Chomsky normal-form grammar, there are only two types of the production rules: A→BC and A→a. Hence for a parse tree of sentence z in L having no path of length greater than i, then the length of z is no more than 2 i-1 . We consider the length of a path as the length of the internal nodes of the path, not including the leaf. http://ebooks.edhole.com
  • 4. a S S BA ba |Path|=k=1, |word|=1 2≦ k-1 |path|=k=2 |word|=2 2≦ k-1 S T1 T2 |word of T1| 2≦ i-1 |word of T2| 2≦ i-1 |path of T1| i≦ |path of T2| i≦ |word| 2≦ i |path| i+1≦=> http://ebooks.edhole.com
  • 5. Suppose that G has k variables, and let n = 2k . If z is in L and |z| ≥ n, then any parse tree of z must have a path of length > k. Hence there must be at least one variables that appears at least twice in the path of the parse tree. Let the two vertices v1 and v2 in the parse tree be the vertices labeled with the same variable A, and the vertex v1 is closer to the root than vertex v2 . Also they are the vertices with the same label closest to leaves of the tree. http://ebooks.edhole.com
  • 6. S A A v w xu y ≦ k+1 ≦ 2k = n Since A→BC, we have that |vx| 1.≧ A ⇒* vAx and A⇒*w, where |vwx| n.≦ http://ebooks.edhole.com
  • 7. Now, we have that A ⇒* vAx and A⇒*w, where |vwx| n.≦ A ⇒* vi wxi , for i=0, 1, 2, … . Hence S ⇒* uvi wxi y in L, for i=0, 1, 2, … . End of lemma 1. http://ebooks.edhole.com
  • 8. Example 1 L={0n 1n 0n | n=0, 1, 2,…} is not context-free. Pf Suppose that L is context-free. Let n be the constant in the pumping lemma for CFL. For a sentence z in L, |z| ≥ n. Write z = uvwxy, for all u, v, w, x, and y with |vx| ≥ 1 and |vwx| ≤ n. If the substring vwx contains only one kind of symbol, then for i=0, uwx is not in L. Since the number of 1’s is not equal to the number of consecutive 0’s. If the substring vwx contains two kinds of symbols, then for i=2, uv2 wx2 y is not in L. Since there are 0’s between two 1’s. Contradiction. http://ebooks.edhole.com
  • 9. Example 2 L={0n | n is a prime numer} is not context-free. Pf Suppose that L is context-free. Let n be the constant in the pumping lemma for CFL. For a sentence z in L, |z| = p ≥ n, where p is a prime. Write z = uvwxy, for all u, v, w, x, and y satisfying that |vx| ≥ 1, and |vwx| ≤ n. Let |vx|=k ≥ 1. Choose i = (p+1)k. We have that |uvi wxi y| = (p – k) + i*k = (p – k) + (p + 1)k = p(k + 1), a composite number. Hence uvi wxi y is not in L. Contradiction. http://ebooks.edhole.com
  • 10. Example 3 L={am br cs dt | m = 0 or r = s = t} is not context-free. Pumping lemma for CFL fails. For z = br cs dt = uvwxy. When v and x are of the same type of symbol, say b, for i = 0, 1, 2, …, uvi wxi y are all in L. Ogden’s lemma for CFL works. For z = am br cr dr = uvwxy. When v and x are of the same type of symbol, say a, for i = 0, 1, 2, …, uvi wxi y are all in L. http://ebooks.edhole.com
  • 11. Lemma 2 (Ogden’s lemma). Let L be any infinite CFL. Then there exists a constant n, depending on L, such that if z is in L and |z| ≥ n, and we mark any n or more positions of z “distinguished,” then we can write z = uvwxy, such that:  v and x together have at least one distinguished position,  vwx has at most n distinguished positions, and  for all i ≥ 0, uvi wxi y is in L. http://ebooks.edhole.com
  • 12. Proof (sketch of the proof) Let G be a Chomsky normal-form grammar generating L - {ε}. Suppose that G has k variables, and let n = 1+ 2k . Suppose that z is in L and |z| ≥ n. We can mark any n or more positions of z “distinguished”. Select a path in a parse tree of z so that each vertex of the path is a branch point, i.e., both branches of the vertex have distinguished descendants. http://ebooks.edhole.com
  • 13. The selection is as follows: Step 1: path = {}, empty. Step 2: path  S; P := S; // path = <S> Step 3: If P is leaf, done. Step 4: If P has two children, say A and B. If the sub-tree of B has less number of distinguished descendant than the sub-tree of A, then path  A; P := A; // path = <S, …, A> else path  B; P := B; // path = <S, …, B> goto step 3. http://ebooks.edhole.com
  • 14. Since there are at least n markers on the leaves, the selected path must have at least k+1 branch points. Hence there are at least one variable on the path appears twice or more. The rest of the proof is similar to the proof of pumping lemma for context-free languages. End of lemma 2. http://ebooks.edhole.com
  • 15. Example 4 L = {br cs dt | r≠s ≠ t ≠r} is not context-free. Proof (by Ogden’s lemma) Suppose that L is CF. Let n be the constant in the Ogden’s lemma. Choose z = bn cn+n! dn+2n! . Let positions of the b’s be distinguished and z = uvwxy. v and x together have at least one b . vwx has at most n b’s. If either v or x contains two different kinds of symbols, then uv2 wx2 y is not in L. http://ebooks.edhole.com
  • 16. Assume that x is in c* and let |v| = s, i.e., v = bs . Then 1 s n. We have that s | n!.≦ ≦ Let t = n!/s. Choose i = 2t+1. Then z’= uv2t+1 wx2t+1 y is in L. But v2t+1 = bs+2st = bs+2n! . uwx has (n – s) b’s ⇒ z’ has (n – s) + s + 2n! = n+2n! b’s. We have that z’ is not in L. Contradiction. 1. If x is in c* or d*, then v must be in b+ . If each of v and x contains only one kind of symbol, then one of v and x must be a substring of b+ . Assume that x is in d* and let |v| = s, i.e., v = bs . Let t = n!/s. Choose i = t+1. Then z’= uvt+1 wxt+1 y is in L. But vt+1 = bs+st = bs+n! . uwx has (n – s) b’s. Then z’ has (n – s) + s + n! = n+n! b’s and z’ is not in L. Contradiction. http://ebooks.edhole.com
  • 17. 2. If x is in b+ , then v must be in b+ . And w is in b*. Let |vx| = s, i.e., vx = bs . Then 1 s n. We have that s | n!.≦ ≦ Let t = n!/s. Choose i = 2t+1. Then z’= uv2t+1 wx2t+1 y is in L. But v2t+1 x2t+1 = bs+2st = bs+2n! . The substring uwx has (n – s) b’s. Then z’ has n+2n! b’s and hence is not in L. Contradiction. End of example 4. http://ebooks.edhole.com
  • 18. Example 5 L={am br cs dt | m = 0 or r = s = t} is not context-free. Proof (by Ogden’s lemma) Choose z = an bn cn dn . Mark all positions of b’s “distinguished. Write z = uvwxy, where vx contains at least one b, and vx contains at most n b’s. Choose i = 0. We have that z’ = uwy is in L. But the number of b’s in z’ ≠ the number of c’s in z’. Contradiction. http://ebooks.edhole.com
  • 19. Free Ebooks Download Mba Ebooks By Edhole Mba ebooks Free ebooks download http://ebooks.edhole.com