The Pumping Lemma for ContextFree Languages Fall 2004
- Slides: 74
The Pumping Lemma for Context-Free Languages Fall 2004 COMP 335 1
Take an infinite context-free language Generates an infinite number of different strings Example: Fall 2004 COMP 335 2
In a derivation of a long string, variables are repeated A derivation: Fall 2004 COMP 335 3
Derivation tree Fall 2004 string COMP 335 4
Derivation tree string repeated Fall 2004 COMP 335 5
Fall 2004 COMP 335 6
Repeated Part Fall 2004 COMP 335 7
Another possible derivation from Fall 2004 COMP 335 8
Fall 2004 COMP 335 9
A Derivation from Fall 2004 COMP 335 10
Fall 2004 COMP 335 11
Fall 2004 COMP 335 12
A Derivation from Fall 2004 COMP 335 13
Fall 2004 COMP 335 14
Fall 2004 COMP 335 15
Fall 2004 COMP 335 16
Fall 2004 COMP 335 17
A Derivation from Fall 2004 COMP 335 18
Fall 2004 COMP 335 19
Fall 2004 COMP 335 20
Fall 2004 COMP 335 21
In General: Fall 2004 COMP 335 22
Consider now an infinite context-free language Let Take Fall 2004 be a grammar for so that it has no unit-productions no -productions COMP 335 23
Let = (Number of productions) x (Largest right side of all productions) Let Example Fall 2004 : COMP 335 24
Take a string with length We will show: in the derivation of a variable of is repeated Fall 2004 COMP 335 25
Fall 2004 COMP 335 26
maximum right hand side of the productions Fall 2004 COMP 335 27
Number of productions in grammar Fall 2004 COMP 335 28
Number of productions in grammar Some production must be repeated Repeated variable Fall 2004 COMP 335 29
Derivation of string Some variable is repeated Fall 2004 COMP 335 30
Derivation tree of string Last repeated variable repeated Strings of terminals Fall 2004 COMP 335 31
Possible derivations: Fall 2004 COMP 335 32
We know: This string is also generated: Fall 2004 COMP 335 33
We know: This string is also generated: The original Fall 2004 COMP 335 34
We know: This string is also generated: Fall 2004 COMP 335 35
We know: This string is also generated: Fall 2004 COMP 335 36
We know: This string is also generated: Fall 2004 COMP 335 37
Therefore, any string of the form is generated by the grammar Fall 2004 COMP 335 38
Therefore, knowing that we also know that Fall 2004 COMP 335 39
Observation: Since Fall 2004 is the last repeated variable COMP 335 40
Observation: Since there are no unit or Fall 2004 COMP 335 -productions 41
The Pumping Lemma: For infinite context-free language there exists an integer such that for any string we can write with lengths and it must be: Fall 2004 COMP 335 42
Applications of The Pumping Lemma Fall 2004 COMP 335 43
Non-context free languages Context-free languages Fall 2004 COMP 335 44
Theorem: The language is not context free Proof: Fall 2004 Use the Pumping Lemma for context-free languages COMP 335 45
Assume for contradiction that is context-free Since is context-free and infinite we can apply the pumping lemma Fall 2004 COMP 335 46
Pumping Lemma gives a magic number Pick any string with length We pick: Fall 2004 COMP 335 47
We can write: with lengths Fall 2004 and COMP 335 48
Pumping Lemma says: for all Fall 2004 COMP 335 49
We examine all the possible locations of string in Fall 2004 COMP 335 50
Case 1: Fall 2004 is within COMP 335 51
Case 1: Fall 2004 and consist of only COMP 335 52
Case 1: Repeating Fall 2004 and COMP 335 53
Case 1: From Pumping Lemma: Fall 2004 COMP 335 54
Case 1: From Pumping Lemma: However: Contradiction!!! Fall 2004 COMP 335 55
Case 2: Fall 2004 is within COMP 335 56
Case 2: Similar analysis with case 1 Fall 2004 COMP 335 57
Case 3: Fall 2004 is within COMP 335 58
Case 3: Similar analysis with case 1 Fall 2004 COMP 335 59
Case 4: Fall 2004 overlaps COMP 335 and 60
Case 4: Possibility 1: Fall 2004 COMP 335 contains only 61
Case 4: Possibility 1: Fall 2004 COMP 335 contains only 62
Case 4: From Pumping Lemma: Fall 2004 COMP 335 63
Case 4: From Pumping Lemma: However: Contradiction!!! Fall 2004 COMP 335 64
Case 4: Possibility 2: Fall 2004 COMP 335 contains and contains only 65
Case 4: Possibility 2: Fall 2004 COMP 335 contains and contains only 66
Case 4: From Pumping Lemma: Fall 2004 COMP 335 67
Case 4: From Pumping Lemma: However: Contradiction!!! Fall 2004 COMP 335 68
Case 4: Possibility 3: Fall 2004 COMP 335 contains only contains and 69
Case 4: Possibility 3: contains only contains and Similar analysis with Possibility 2 Fall 2004 COMP 335 70
Case 5: Fall 2004 overlaps COMP 335 and 71
Case 5: Similar analysis with case 4 Fall 2004 COMP 335 72
There are no other cases to consider (since overlap Fall 2004 , string , and COMP 335 cannot at the same time) 73
In all cases we obtained a contradiction Therefore: The original assumption that is context-free must be wrong Conclusion: Fall 2004 is not context-free COMP 335 74
- Chomsky
- Pumping lemma for regular languages
- Pumping lemma non regular languages examples
- Pumping lemma for context free languages
- Pumping lemma for cfls
- Pumping lemma for cfl examples
- Pumping lemma meme
- Pumping lemma applications
- Torzi cfg
- Regular language
- Pumping lemma pigeonhole principle
- Pumping lemma 예제
- Pumping lemma for cfls
- Pumping lemma proof
- Applications of pumping lemma
- Subgraf
- Shephard's lemma
- Grass flower diagram
- Handshaking lemma
- Schur lemma
- Itos lemma
- Burnsides lemma
- Lemma consulting
- Qn graph
- Patrizia lemma
- Lemma and palea
- Black scholes ito lemma
- Snake lemma scene
- Ceas lemma
- Pumpáló lemma
- Schwartz-zippel lemma and polynomial identity testing
- Locc
- Kondüktans nedir
- Königsberg
- Leftover hash lemma
- Pumping ada
- Shuttle pumping drill
- Pumping systems
- Turbomolecular pump advantages and disadvantages
- Pumping theorem
- Intext: "pumping"
- Hand method friction loss 2 1 2
- One stop pumping
- Armstrong pumping trap
- Intext: "pumping"
- Arctic circulation
- Ion pumps in the pumping speed range 150 to 1000 l/s
- Direct conversion pumping in laser
- Getter pumping speed
- Pumping theorem
- Ekman pumping
- Emergency bilge suction valve
- Borra hål för knoppar
- Tack för att ni har lyssnat
- Smärtskolan kunskap för livet
- Epiteltyper
- Frgar
- Teckenspråk minoritetsspråk argument
- Humanitr
- Mindre än tecken
- Delegerande ledarstil
- Toppslätskivling effekt
- Returpilarna
- Redogör för vad psykologi är
- Bris för vuxna
- Mat för unga idrottare
- Lek med geometriska former
- Ledarskapsteorier
- Offentlig förvaltning
- Datorkunskap för nybörjare
- Antika plagg
- Personlig tidbok
- Steg för steg rita
- Formuö
- Ministerstyre för och nackdelar