SlideShare a Scribd company logo
TK Prasad Pumping Lemma 1
Nonregularity Proofs
TK Prasad Pumping Lemma 2
Regular Languages: Grand Unification
)
(
)
(
)
(
DFAs
L
NFAs
L
s
NFA
L


 
)
(
)
( RE
L
FA
L 
(Parallel Simulation)
(Rabin and Scott’s work)
(Collapsing graphs;
Structural Induction)
(S. Kleene’s work)
)
(
)
( RG
L
FA
L  (Construction)
(Solving linear equations)
)
(
)
( RE
L
RG
L 
TK Prasad Pumping Lemma 3
Role of various representations
for Regular Languages
• Closure under complemention. (DFAs)
• Closure under union, concatenation, and Kleene
star. (NFA-s, Regular expression.)
• Consequence:
Closure under intersection by De Morgan’s Laws.
• Relationship to context-free languages. (Regular
Grammars.)
• Ease of specification. (Regular expression.)
• Building tokenizers/lexical analyzers. (DFAs)
TK Prasad Pumping Lemma 4
regular.
not
is
}
0
|
{
Show 
 i
b
a
L i
i
Consider pairs of strings:
...
...
:
'
...
...
:
'
n
s
i
n
s
i
b
bb
b
v
a
aa
a
u
j
i
F
b
a
q
F
b
a
q
j
i
M
i
i
M



if
)
,
(
)
,
(
0
*
0
*


If L were regular, then there exists a DFA M
accepting L with the following property:
j
i
b
a
q
b
a
q j
i
M
i
i
M 
 if
)
,
(
)
,
( 0
*
0
*


TK Prasad Pumping Lemma 5
j
i
a
q
a
q j
M
i
M 
 if
)
,
(
)
,
( 0
*
0
*


j
i
b
a
q
b
a
q i
j
M
i
i
M 
 for
)
,
(
)
,
( 0
*
0
*


JUSTIFICATION: Otherwise, from the definition of DFA,
CLAIM:
which contradicts the earlier conclusion.
In order to satisfy
j
i
a
q
a
q j
M
i
M 
 if
)
,
(
)
,
( 0
*
0
*


the machine M must have a unique state for every i.
Thus, M must have infinite number of states, if L
is regular. This violates the definition of DFA.
So, L must be non-regular.
TK Prasad Pumping Lemma 6
Using Closure Properties
• Regular languages are closed under set-intersection.
• Note that regularity is a property
of a collection, and not a property
of an individual string in the
collection.
2
1
2
1
2
1
L
L
L
L
L
L
L






L1=bit strings with even parity
L2=bit strings with number of 1’s divisible by 3
L=bit strings with number of 1’s a multiple of 6
TK Prasad Pumping Lemma 7
• Show that
is not regular.
• Proof: If L were regular, ought to be
regular. However, is known to be
non-regular. Hence, L cannot be regular.
• If R is a regular language and C is context-free,
then may not be regular.
• Proof:
C
R
C
C
R
i
b
a
C
b
a
R
i
i





}
0
|
{
*
*
}
in
s
'
#
in
'
#
|
*
}
,
{
{ 

 b
s
a
b
a
L 


R
L 
C
R
L 

TK Prasad Pumping Lemma 8
Prelude to Pumping Lemma
• Is 46551 divisible by 46?
• Is 46554 divisible by 46?
• Is 46552 divisible by 46?
Necessary vs sufficient condition
TK Prasad Pumping Lemma 9
Pumping Lemma for Regular Languages
• It is a necessary condition.
– Every regular language satisfies it.
– If a language violates it, it is not regular.
• RL => PL not PL => not RL
• It is not a sufficient condition.
– Not every non-regular language violates it.
• not RL =>? PL or not PL (no conclusion)
TK Prasad Pumping Lemma 10
Basic Idea:
q0
b
a
a
a,b
b
b
a
q2 q3
q1
)
(M
L
ababbaaab
3
1
0
2
3
1
2
3
1
0 q
q
q
q
q
q
q
q
q
q
b
a
a
a
b
b
a
b
a









TK Prasad Pumping Lemma 11
3
1
0
2
3
1
2
3
1
0 q
q
q
q
q
q
q
q
q
q
b
a
a
a
b
b
a
b
a









Note,
)
(M
L
ababb
So,
)
(M
L
abaaab
3
1
0
2
3
1
2
3
1
0 q
q
q
q
q
q
q
q
q
q
b
a
a
a
b
b
a
b
a









)
(
)
(
)
(
:
, M
L
aaab
abb
ab
j
i j
i




TK Prasad Pumping Lemma 12
Fundamental Observation
• Given a “sufficiently” long string, the states
of a DFA must repeat in an accepting
computation. These cycles can then be used
to predict (generate) infinitely many other
strings in (of) the language.
Pigeon-Hole Principle
TK Prasad Pumping Lemma 13
Pumping Lemma
• Let L be a regular language that is accepted
by a DFA M with k states. Let z be any
string in L with . Then z can
be decomposed as uvw with
L
w
uv
i
v
length
k
uv
length
i





:
0
and
,
0
)
(
,
)
(
k
z
length 
)
(
TK Prasad Pumping Lemma 14
)
0
:
(
0)
|
|
(
)
|
|
(
)
(
:
|
|
:
L
w
uv
i
i
v
k
uv
s
uvw
u,v,w
k
s
L
s
i















For all sufficiently long strings (z)
There exists non-null prefix (uv)
and substring (v)
For all repetitions of the substring (v),
we get strings in the language.
TK Prasad Pumping Lemma 15
Proving non-regularity
• If there exists an arbitrarily long string s L, and
for each decomposition s = uvw, there exists an i
such that , then L is non-regular.
)
0
:
(
0)
|
|
(
)
|
|
(
)
(
:
|
|
:
L
w
uv
i
i
v
k
uv
s
uvw
u,v,w
k
s
L
s
i















Negation of the necessary condition:

L
w
uvi

TK Prasad Pumping Lemma 16
Examples
Applying Pumping Lemma
TK Prasad Pumping Lemma 17
Proof by contradiction:
• Let be accepted by a k-state DFA.
• Choose
• For all prefixes of length
• show there exists such that
• i.e.,
regular.
not
is
}
number
prime
a
is
|
{ p
a
L p
p 
p
L
k
n
a
s n

 prime
a
is
where
,
,
k
j 
,
j
i p
j
n
i
j
L
a
a j


)
(
number.
composite
a
is
)
( j
n
i
j j 


TK Prasad Pumping Lemma 18
• Choose
(For this specific problem happens to be
independent of j, but that need not always be the
case.)
• is non-regular because it violates the
necessary condition.
1

 n
ij
j
i
number!
composite
)
1
(
*
)
1
(







j
n
n
n*j
j
n
n
j*
p
L
,...
)
(
, 2
1
2
1
1
p
n
n
p
n
n
L
a
a
L
a
a 
 



TK Prasad Pumping Lemma 19
Proof : (For this example, choice of initial string is crucial.)
• For this choice of s, the pumping lemma cannot
generate a contradiction!
• However, let instead.
}
|
{ m
n
b
a
L m
n
p 

DFA
of
states
of
number
where 
 n
a
s n
1 n
n
b
a
s 

:
String
Pumped
:
String
Original
1
*
1
n
j
n
j
i
n
j
n
j
b
a
a
b
a
a
s





TK Prasad Pumping Lemma 20
• For
• Thus, by pumping the substring containing
a’s 0 times (effectively deleting it), the
number of a’s can be made smaller than the
number of b’s.
• So, by pumping lemma, L is non-regular.
n
j
n
j
n
i








1
1
0
TK Prasad Pumping Lemma 21
• Proof by contradiction:
– If is regular, then so is , the complement of
– But which is known to be non-regular.
– So, cannot be regular.
regular.
not
is
}
number
composite
a
is
|
{ c
a
L c
c 
p
c L
L
a 


c
L
a 

c
L .
c
L
c
L
TK Prasad Pumping Lemma 22
Summary: Proof Techniques
• Counter Examples
• Constructions/Simulations
• Induction Proofs
• Impossibility Proofs
• Proofs by Contradiction
• Reduction Proofs : Closure Properties

More Related Content

PPT
Mba admission in india
PPT
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPTX
Chapter 4_Regular Expressions in Automata.pptx
PPT
Regular Languages
PPTX
RegularLanguageProperties.pptx
PPTX
AUTOMATA AUTOMATA Automata5Chapter4.pptx
PPT
Ch3.ppt
PPTX
parsing.pptx
Mba admission in india
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
Chapter 4_Regular Expressions in Automata.pptx
Regular Languages
RegularLanguageProperties.pptx
AUTOMATA AUTOMATA Automata5Chapter4.pptx
Ch3.ppt
parsing.pptx

Similar to 06_PumpingLemma compiler design of chapter 4.ppt (20)

PPT
PDF
Formal Languages and Automata Theory unit 2
PPTX
Unit-2. Regular Expressions and Languages.pptx
PDF
Presentation (5).pdf
PPTX
Regular expressions
PDF
Unit ii
PPTX
Unit2 Toc.pptx
PPT
Turing Machine
PDF
N20190729
PPT
TuringMachines and its introduction for computer science studetns
PDF
Lexicalanalyzer
PDF
Lexicalanalyzer
PDF
Formal Languages and Automata Theory unit 5
PPT
POST’s CORRESPONDENCE PROBLEM
PPT
TuringMachineS FOUNDATION OF DATA SCIENCE
PPT
THEORY OF COMPUTATION PROCESS AND MECHANISUMS
PPT
Formal Languages and regular langugaes IN FLAG
PPT
RegularExpressions-theory of computation and formal language
PPT
PPT
re1.ppt
Formal Languages and Automata Theory unit 2
Unit-2. Regular Expressions and Languages.pptx
Presentation (5).pdf
Regular expressions
Unit ii
Unit2 Toc.pptx
Turing Machine
N20190729
TuringMachines and its introduction for computer science studetns
Lexicalanalyzer
Lexicalanalyzer
Formal Languages and Automata Theory unit 5
POST’s CORRESPONDENCE PROBLEM
TuringMachineS FOUNDATION OF DATA SCIENCE
THEORY OF COMPUTATION PROCESS AND MECHANISUMS
Formal Languages and regular langugaes IN FLAG
RegularExpressions-theory of computation and formal language
re1.ppt
Ad

More from ranjan317165 (18)

PPT
universal human values L 14 Trust v4.ppt
PPT
Universal human values self and body chapter
PPT
L 13 universal human values Harmony in the Family v4.ppt
PPT
L 20 Mutual Fulfilment in Nature uhv lectures v5.ppt
PPTX
Module 4 Project management by ranjan v.pptx
PPTX
Software Requiremnet analysis module 2.pptx
PPTX
Introduction-to-Programming-Languages.pptx
PPT
Information system securit lecture 1y .ppt
PPTX
C functions with exercise to solve easily.pptx
PPTX
C functions by ranjan call by value and reference.pptx
PPT
L 27 Holistic Technologies v5 universal human values.ppt
PPT
CS540-2-lecture2 Lexical analyser of .ppt
PPT
atc 3rd module compiler and automata.ppt
PDF
role of lexical parser compiler design1-181124035217.pdf
PPT
15CS46 - Data communication or computer networks 1_Module-3.ppt
PPTX
compiler introduction vtu syllabus 1st chapter.pptx
PPT
Ppt on Design engineering which is chapter 9
PPTX
FiniteAutomata_anim.pptx
universal human values L 14 Trust v4.ppt
Universal human values self and body chapter
L 13 universal human values Harmony in the Family v4.ppt
L 20 Mutual Fulfilment in Nature uhv lectures v5.ppt
Module 4 Project management by ranjan v.pptx
Software Requiremnet analysis module 2.pptx
Introduction-to-Programming-Languages.pptx
Information system securit lecture 1y .ppt
C functions with exercise to solve easily.pptx
C functions by ranjan call by value and reference.pptx
L 27 Holistic Technologies v5 universal human values.ppt
CS540-2-lecture2 Lexical analyser of .ppt
atc 3rd module compiler and automata.ppt
role of lexical parser compiler design1-181124035217.pdf
15CS46 - Data communication or computer networks 1_Module-3.ppt
compiler introduction vtu syllabus 1st chapter.pptx
Ppt on Design engineering which is chapter 9
FiniteAutomata_anim.pptx
Ad

Recently uploaded (20)

PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Geodesy 1.pptx...............................................
PDF
Well-logging-methods_new................
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPT
Mechanical Engineering MATERIALS Selection
PDF
PPT on Performance Review to get promotions
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Sustainable Sites - Green Building Construction
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Welding lecture in detail for understanding
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
additive manufacturing of ss316l using mig welding
OOP with Java - Java Introduction (Basics)
Internet of Things (IOT) - A guide to understanding
Geodesy 1.pptx...............................................
Well-logging-methods_new................
Model Code of Practice - Construction Work - 21102022 .pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Mechanical Engineering MATERIALS Selection
PPT on Performance Review to get promotions
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Lecture Notes Electrical Wiring System Components
Embodied AI: Ushering in the Next Era of Intelligent Systems
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Sustainable Sites - Green Building Construction
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Welding lecture in detail for understanding
UNIT 4 Total Quality Management .pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
additive manufacturing of ss316l using mig welding

06_PumpingLemma compiler design of chapter 4.ppt

  • 1. TK Prasad Pumping Lemma 1 Nonregularity Proofs
  • 2. TK Prasad Pumping Lemma 2 Regular Languages: Grand Unification ) ( ) ( ) ( DFAs L NFAs L s NFA L     ) ( ) ( RE L FA L  (Parallel Simulation) (Rabin and Scott’s work) (Collapsing graphs; Structural Induction) (S. Kleene’s work) ) ( ) ( RG L FA L  (Construction) (Solving linear equations) ) ( ) ( RE L RG L 
  • 3. TK Prasad Pumping Lemma 3 Role of various representations for Regular Languages • Closure under complemention. (DFAs) • Closure under union, concatenation, and Kleene star. (NFA-s, Regular expression.) • Consequence: Closure under intersection by De Morgan’s Laws. • Relationship to context-free languages. (Regular Grammars.) • Ease of specification. (Regular expression.) • Building tokenizers/lexical analyzers. (DFAs)
  • 4. TK Prasad Pumping Lemma 4 regular. not is } 0 | { Show   i b a L i i Consider pairs of strings: ... ... : ' ... ... : ' n s i n s i b bb b v a aa a u j i F b a q F b a q j i M i i M    if ) , ( ) , ( 0 * 0 *   If L were regular, then there exists a DFA M accepting L with the following property: j i b a q b a q j i M i i M   if ) , ( ) , ( 0 * 0 *  
  • 5. TK Prasad Pumping Lemma 5 j i a q a q j M i M   if ) , ( ) , ( 0 * 0 *   j i b a q b a q i j M i i M   for ) , ( ) , ( 0 * 0 *   JUSTIFICATION: Otherwise, from the definition of DFA, CLAIM: which contradicts the earlier conclusion. In order to satisfy j i a q a q j M i M   if ) , ( ) , ( 0 * 0 *   the machine M must have a unique state for every i. Thus, M must have infinite number of states, if L is regular. This violates the definition of DFA. So, L must be non-regular.
  • 6. TK Prasad Pumping Lemma 6 Using Closure Properties • Regular languages are closed under set-intersection. • Note that regularity is a property of a collection, and not a property of an individual string in the collection. 2 1 2 1 2 1 L L L L L L L       L1=bit strings with even parity L2=bit strings with number of 1’s divisible by 3 L=bit strings with number of 1’s a multiple of 6
  • 7. TK Prasad Pumping Lemma 7 • Show that is not regular. • Proof: If L were regular, ought to be regular. However, is known to be non-regular. Hence, L cannot be regular. • If R is a regular language and C is context-free, then may not be regular. • Proof: C R C C R i b a C b a R i i      } 0 | { * * } in s ' # in ' # | * } , { {    b s a b a L    R L  C R L  
  • 8. TK Prasad Pumping Lemma 8 Prelude to Pumping Lemma • Is 46551 divisible by 46? • Is 46554 divisible by 46? • Is 46552 divisible by 46? Necessary vs sufficient condition
  • 9. TK Prasad Pumping Lemma 9 Pumping Lemma for Regular Languages • It is a necessary condition. – Every regular language satisfies it. – If a language violates it, it is not regular. • RL => PL not PL => not RL • It is not a sufficient condition. – Not every non-regular language violates it. • not RL =>? PL or not PL (no conclusion)
  • 10. TK Prasad Pumping Lemma 10 Basic Idea: q0 b a a a,b b b a q2 q3 q1 ) (M L ababbaaab 3 1 0 2 3 1 2 3 1 0 q q q q q q q q q q b a a a b b a b a         
  • 11. TK Prasad Pumping Lemma 11 3 1 0 2 3 1 2 3 1 0 q q q q q q q q q q b a a a b b a b a          Note, ) (M L ababb So, ) (M L abaaab 3 1 0 2 3 1 2 3 1 0 q q q q q q q q q q b a a a b b a b a          ) ( ) ( ) ( : , M L aaab abb ab j i j i    
  • 12. TK Prasad Pumping Lemma 12 Fundamental Observation • Given a “sufficiently” long string, the states of a DFA must repeat in an accepting computation. These cycles can then be used to predict (generate) infinitely many other strings in (of) the language. Pigeon-Hole Principle
  • 13. TK Prasad Pumping Lemma 13 Pumping Lemma • Let L be a regular language that is accepted by a DFA M with k states. Let z be any string in L with . Then z can be decomposed as uvw with L w uv i v length k uv length i      : 0 and , 0 ) ( , ) ( k z length  ) (
  • 14. TK Prasad Pumping Lemma 14 ) 0 : ( 0) | | ( ) | | ( ) ( : | | : L w uv i i v k uv s uvw u,v,w k s L s i                For all sufficiently long strings (z) There exists non-null prefix (uv) and substring (v) For all repetitions of the substring (v), we get strings in the language.
  • 15. TK Prasad Pumping Lemma 15 Proving non-regularity • If there exists an arbitrarily long string s L, and for each decomposition s = uvw, there exists an i such that , then L is non-regular. ) 0 : ( 0) | | ( ) | | ( ) ( : | | : L w uv i i v k uv s uvw u,v,w k s L s i                Negation of the necessary condition:  L w uvi 
  • 16. TK Prasad Pumping Lemma 16 Examples Applying Pumping Lemma
  • 17. TK Prasad Pumping Lemma 17 Proof by contradiction: • Let be accepted by a k-state DFA. • Choose • For all prefixes of length • show there exists such that • i.e., regular. not is } number prime a is | { p a L p p  p L k n a s n   prime a is where , , k j  , j i p j n i j L a a j   ) ( number. composite a is ) ( j n i j j   
  • 18. TK Prasad Pumping Lemma 18 • Choose (For this specific problem happens to be independent of j, but that need not always be the case.) • is non-regular because it violates the necessary condition. 1   n ij j i number! composite ) 1 ( * ) 1 (        j n n n*j j n n j* p L ,... ) ( , 2 1 2 1 1 p n n p n n L a a L a a      
  • 19. TK Prasad Pumping Lemma 19 Proof : (For this example, choice of initial string is crucial.) • For this choice of s, the pumping lemma cannot generate a contradiction! • However, let instead. } | { m n b a L m n p   DFA of states of number where   n a s n 1 n n b a s   : String Pumped : String Original 1 * 1 n j n j i n j n j b a a b a a s     
  • 20. TK Prasad Pumping Lemma 20 • For • Thus, by pumping the substring containing a’s 0 times (effectively deleting it), the number of a’s can be made smaller than the number of b’s. • So, by pumping lemma, L is non-regular. n j n j n i         1 1 0
  • 21. TK Prasad Pumping Lemma 21 • Proof by contradiction: – If is regular, then so is , the complement of – But which is known to be non-regular. – So, cannot be regular. regular. not is } number composite a is | { c a L c c  p c L L a    c L a   c L . c L c L
  • 22. TK Prasad Pumping Lemma 22 Summary: Proof Techniques • Counter Examples • Constructions/Simulations • Induction Proofs • Impossibility Proofs • Proofs by Contradiction • Reduction Proofs : Closure Properties