SlideShare a Scribd company logo
Top School in Ghaziabad 
By: 
school.edhole.com
Chapter 6 Properties of Context-free 
Languages 
6.1 Pumping Lemma for CFL's 
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 
|vx| ³ 1, 
|vwx| £ n, and 
for all i ³ 0, uviwxiy is in L. 
school.edhole.com
Proof (sketch of the proof) 
Let G be a Chomsky normal-form grammar 
generating L - {e}. 
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. 
school.edhole.com
S S 
a 
A B 
a b 
|Path|=k=1, 
|word|=1 ≦ 2k-1 
|path|=k=2 
|word|=2 ≦ 2k-1 
S 
T1 T2 
|path of T1| ≦ i 
|word of T1| ≦ 2i-1 
|path of T2| ≦ i 
|word of T2| ≦ 2i-1 
=> |path| ≦ i+1 
|word| ≦ 2i 
school.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. 
school.edhole.com
S 
A 
A 
u v w x y 
≦ k+1 
≦ 2k = n 
Since A®BC, we have that |vx|≧1. 
A Þ* vAx and AÞ*w, where |vwx| ≦n. 
school.edhole.com
Now, we have that A Þ* vAx and AÞ*w, where 
|vwx| ≦n. 
A Þ* viwxi, for i=0, 1, 2, … . 
Hence S Þ* uviwxiy in L, for i=0, 1, 2, … . 
End of lemma 1. 
school.edhole.com
Example 1 L={0n1n0n | 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, uv2wx2y is not in L. Since there are 0’s between two 1’s. 
Contradiction. 
school.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 |uviwxiy| = (p – k) + i*k = (p – k) + (p + 1)k = 
p(k + 1), a composite number. Hence uviwxiy is not in L. 
Contradiction. 
school.edhole.com
Example 3 L={ambrcsdt | m = 0 or r = s = t} is not context-free. 
Pumping lemma for CFL fails. 
For z = brcsdt = uvwxy. When v and x are of the same 
type of symbol, say b, for i = 0, 1, 2, …, uviwxiy are all 
in L. 
For z = ambrcrdr = uvwxy. When v and x are of the same 
type of symbol, say a, for i = 0, 1, 2, …, uviwxiy are all 
in L. 
Ogden’s lemma for CFL works. 
school.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, uviwxiy is in L. 
school.edhole.com
Proof (sketch of the proof) 
Let G be a Chomsky normal-form grammar 
generating L - {e}. 
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. 
school.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. 
school.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. 
school.edhole.com
Example 4 L = {brcsdt | 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 = bncn+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 
uv2wx2y is not in L. 
school.edhole.com
If each of v and x contains only one kind of symbol, then one 
of v and x must be a substring of b+. 
1. If x is in c* or d*, then v must be in b+. 
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+1wx2t+1y 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. 
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+1wxt+1y 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. 
school.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+1wx2t+1y 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. 
school.edhole.com
Example 5 L={ambrcsdt | m = 0 or r = s = t} is not context-free. 
Proof (by Ogden’s lemma) 
Choose z = anbncndn. 
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. 
school.edhole.com

More Related Content

What's hot

Formal Languages (in progress)
Formal Languages (in progress)Formal Languages (in progress)
Formal Languages (in progress)Jshflynn
 
Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).munawerzareef
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common SubsequenceSyeda
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common SubsequenceKrishma Parekh
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MITRawel Luciano
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...parmeet834
 
Алексей Чеусов - Расчёсываем своё ЧСВ
Алексей Чеусов - Расчёсываем своё ЧСВАлексей Чеусов - Расчёсываем своё ЧСВ
Алексей Чеусов - Расчёсываем своё ЧСВMinsk Linux User Group
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automataElakkiyaS11
 
Imc2020 day1&amp;2 problems&amp;solutions
Imc2020 day1&amp;2 problems&amp;solutionsImc2020 day1&amp;2 problems&amp;solutions
Imc2020 day1&amp;2 problems&amp;solutionsChristos Loizos
 
Class1
 Class1 Class1
Class1issbp
 
On some types of slight homogeneity
On some types of slight homogeneity On some types of slight homogeneity
On some types of slight homogeneity IJECEIAES
 
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVEChapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVEnszakir
 
Ch 2 lattice & boolean algebra
Ch 2 lattice & boolean algebraCh 2 lattice & boolean algebra
Ch 2 lattice & boolean algebraRupali Rana
 
Algoritmos Greedy
Algoritmos GreedyAlgoritmos Greedy
Algoritmos Greedyluzenith_g
 
Introduction of predicate logics
Introduction of predicate  logicsIntroduction of predicate  logics
Introduction of predicate logicschauhankapil
 

What's hot (20)

Formal Languages (in progress)
Formal Languages (in progress)Formal Languages (in progress)
Formal Languages (in progress)
 
Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
Theory of computation Lec3 dfa
Theory of computation Lec3 dfaTheory of computation Lec3 dfa
Theory of computation Lec3 dfa
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MIT
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 
Dfa
DfaDfa
Dfa
 
Алексей Чеусов - Расчёсываем своё ЧСВ
Алексей Чеусов - Расчёсываем своё ЧСВАлексей Чеусов - Расчёсываем своё ЧСВ
Алексей Чеусов - Расчёсываем своё ЧСВ
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
 
Imc2020 day1&amp;2 problems&amp;solutions
Imc2020 day1&amp;2 problems&amp;solutionsImc2020 day1&amp;2 problems&amp;solutions
Imc2020 day1&amp;2 problems&amp;solutions
 
lattice
 lattice lattice
lattice
 
Class1
 Class1 Class1
Class1
 
On some types of slight homogeneity
On some types of slight homogeneity On some types of slight homogeneity
On some types of slight homogeneity
 
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVEChapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
Chapter-3: DIRECT PROOF AND PROOF BY CONTRAPOSITIVE
 
Formal Logic - Lesson 1 - Introduction to Logic
Formal Logic - Lesson 1 - Introduction to LogicFormal Logic - Lesson 1 - Introduction to Logic
Formal Logic - Lesson 1 - Introduction to Logic
 
Ch 2 lattice & boolean algebra
Ch 2 lattice & boolean algebraCh 2 lattice & boolean algebra
Ch 2 lattice & boolean algebra
 
Calc 2.5a
Calc 2.5aCalc 2.5a
Calc 2.5a
 
Algoritmos Greedy
Algoritmos GreedyAlgoritmos Greedy
Algoritmos Greedy
 
Introduction of predicate logics
Introduction of predicate  logicsIntroduction of predicate  logics
Introduction of predicate logics
 

Viewers also liked

Viewers also liked (6)

Automata 6
Automata 6Automata 6
Automata 6
 
Subnetting
SubnettingSubnetting
Subnetting
 
Subnet Masks
Subnet MasksSubnet Masks
Subnet Masks
 
Subnetting
SubnettingSubnetting
Subnetting
 
Ip address and subnetting
Ip address and subnettingIp address and subnetting
Ip address and subnetting
 
Subnetting Made Easy
Subnetting Made EasySubnetting Made Easy
Subnetting Made Easy
 

Similar to Top school in ghaziabad

Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------MIGUELANGEL2672
 
matrix theory and linear algebra.pptx
matrix theory and linear algebra.pptxmatrix theory and linear algebra.pptx
matrix theory and linear algebra.pptxMaths Assignment Help
 
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on plSampath Kumar S
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptxEzhumalai p
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Dr. Maamoun Ahmed
 

Similar to Top school in ghaziabad (20)

Module 1 TOC.pptx
Module 1 TOC.pptxModule 1 TOC.pptx
Module 1 TOC.pptx
 
FSM.pdf
FSM.pdfFSM.pdf
FSM.pdf
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
Dfa basics
Dfa basicsDfa basics
Dfa basics
 
Linear algebra
Linear algebraLinear algebra
Linear algebra
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
 
Algorithms on Strings
Algorithms on StringsAlgorithms on Strings
Algorithms on Strings
 
matrix theory and linear algebra.pptx
matrix theory and linear algebra.pptxmatrix theory and linear algebra.pptx
matrix theory and linear algebra.pptx
 
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
 
Unit i
Unit iUnit i
Unit i
 
automata problems
automata problemsautomata problems
automata problems
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptx
 
unit 2 part b.docx
unit 2 part b.docxunit 2 part b.docx
unit 2 part b.docx
 
rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Daa notes 3
Daa notes 3Daa notes 3
Daa notes 3
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
Pumping lemma for cfl
Pumping lemma for cflPumping lemma for cfl
Pumping lemma for cfl
 

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

Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...AzmatAli747758
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...Jisc
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfThiyagu K
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfkaushalkr1407
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationDelapenabediema
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativePeter Windle
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 

Recently uploaded (20)

Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 

Top school in ghaziabad

  • 1. Top School in Ghaziabad By: school.edhole.com
  • 2. Chapter 6 Properties of Context-free Languages 6.1 Pumping Lemma for CFL's 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 |vx| ³ 1, |vwx| £ n, and for all i ³ 0, uviwxiy is in L. school.edhole.com
  • 3. Proof (sketch of the proof) Let G be a Chomsky normal-form grammar generating L - {e}. 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. school.edhole.com
  • 4. S S a A B a b |Path|=k=1, |word|=1 ≦ 2k-1 |path|=k=2 |word|=2 ≦ 2k-1 S T1 T2 |path of T1| ≦ i |word of T1| ≦ 2i-1 |path of T2| ≦ i |word of T2| ≦ 2i-1 => |path| ≦ i+1 |word| ≦ 2i school.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. school.edhole.com
  • 6. S A A u v w x y ≦ k+1 ≦ 2k = n Since A®BC, we have that |vx|≧1. A Þ* vAx and AÞ*w, where |vwx| ≦n. school.edhole.com
  • 7. Now, we have that A Þ* vAx and AÞ*w, where |vwx| ≦n. A Þ* viwxi, for i=0, 1, 2, … . Hence S Þ* uviwxiy in L, for i=0, 1, 2, … . End of lemma 1. school.edhole.com
  • 8. Example 1 L={0n1n0n | 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, uv2wx2y is not in L. Since there are 0’s between two 1’s. Contradiction. school.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 |uviwxiy| = (p – k) + i*k = (p – k) + (p + 1)k = p(k + 1), a composite number. Hence uviwxiy is not in L. Contradiction. school.edhole.com
  • 10. Example 3 L={ambrcsdt | m = 0 or r = s = t} is not context-free. Pumping lemma for CFL fails. For z = brcsdt = uvwxy. When v and x are of the same type of symbol, say b, for i = 0, 1, 2, …, uviwxiy are all in L. For z = ambrcrdr = uvwxy. When v and x are of the same type of symbol, say a, for i = 0, 1, 2, …, uviwxiy are all in L. Ogden’s lemma for CFL works. school.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, uviwxiy is in L. school.edhole.com
  • 12. Proof (sketch of the proof) Let G be a Chomsky normal-form grammar generating L - {e}. 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. school.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. school.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. school.edhole.com
  • 15. Example 4 L = {brcsdt | 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 = bncn+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 uv2wx2y is not in L. school.edhole.com
  • 16. If each of v and x contains only one kind of symbol, then one of v and x must be a substring of b+. 1. If x is in c* or d*, then v must be in b+. 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+1wx2t+1y 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. 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+1wxt+1y 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. school.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+1wx2t+1y 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. school.edhole.com
  • 18. Example 5 L={ambrcsdt | m = 0 or r = s = t} is not context-free. Proof (by Ogden’s lemma) Choose z = anbncndn. 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. school.edhole.com