SlideShare a Scribd company logo
1 of 26
Department of Computer and Science Engineering (CSE)
DISCOVER . LEARN .
EMPOWER
UNIVERSITY INSTITUTE OF
ENGINEERING
COMPUTER SCIENCE
ENGINEERING
Bachelor of Engineering
Theory of Computation (CST-353)
Topic: Regular Language Properties
Department of Computer and Science Engineering (CSE)
Learning Objectives & Outcomes
Objective:
• To understand the concept Regular Language and its
Properties
Outcome:
• Student will understand the
 FSM To get basic knowledge of pumping lemma
 To get knowledge of regular language
 To get knowledge of DFA
The Pumping Lemma for
Regular Sets
Proved that a given language is not
regular
3
Pumping Lemma for Regular Sets
Let L be a regular language
Then there exists some constant N such that for
every string w  L s.t. |w|≥N, there exists a way
to break w into three parts, w=xyz, such that:
1. y≠ 
2. |xy|≤N
3. For all k≥0, all strings of the form xykz  L
4
This clause should hold for all regular languages.
Definition: N is called the “Pumping Lemma Constant”
Pumping Lemma: Proof
• L is regular => it should have a DFA.
– Set N := number of states in the DFA
• Any string wL, s.t. |w|≥N, should have the
form: w=a1a2…am, where m≥N
• Let the states traversed after reading the first N
symbols be: {p0,p1,… pN}
==> There are N+1 p-states, while there are only N DFA
states
==> at least one state has to repeat
i.e, pi= pJwhere 0≤i<j≤N (by PHP)
5
Pumping Lemma: Proof…
 => We should be able to break w=xyz as follows:
 x=a1a2..ai; y=ai+1ai+2..aJ; z=aJ+1aJ+2..am
 x’s path will be p0..pi
 y’s path will be pi pi+1..pJ (but pi=pJ implying a loop)
 z’s path will be pJpJ+1..pm
 Now consider another
string wk=xykz , where k≥0
 Case k=0
 DFA will reach the accept state pm
 Case k>0
 DFA will loop for yk, and finally reach the accept state pm for z
 In either case, wk L
6
yk (for k loops)
p0 pi pm
x z
=pj
Pumping Lemma: Proof…
• For part (1):
– Since i<j, y ≠ 
• For part (2):
– By PHP, the repetition of states has to occur within the first N
symbols in w
– ==> |xy|≤N
7
p0 pi pm
x z
yk (for k loops)
=pj
The Purpose of the Pumping Lemma for RL
• To prove that some languages cannot be regular.
8
How to use the pumping lemma?
Think of playing a 2 person game
– Role 1: You claim that the language cannot be
regular
– Role 2: An adversary who claims the language is
regular
– You show that the adversary’s statement will lead to a
contradiction that implyies pumping lemma cannot
hold for the language.
– You win!!
9
Example of using the Pumping Lemma to
prove that a language is not regular
Let Leq = {w | w is a binary string with equal number of 1s
and 0s}
• Your Claim: Leq is not regular
• Proof:
 By contradiction, let Leq be regular
 P/L constant should exist
 Let N = that P/L constant
 Consider input w = 0N1N
(your choice for the template string)
 By pumping lemma, we should be able to break w=xyz, such
that:
1) y≠ 
2) |xy|≤N
3) For all k≥0, the string xykz is also in L
10
Note: This N can be anything (need not necessarily be the #states in the DFA.
It’s the adversary’s choice.)
Proof…
 Because |xy|≤N, xy should contain only 0s
 (This and because y≠ , implies y=0+)
 Therefore x can contain at most N-1 0s
 Also, all the N 1s must be inside z
 By (3), any string of the form xykz  Leq for all k≥0
 Case k=0: xz has at most N-1 0s but has N 1s
 Therefore, xy0z  Leq
 This violates the P/L (a contradiction)
11
Another way of proving this will be to show that if
the #0s is arbitrarily pumped up (e.g., k=2),
then the #0s will become exceed the #1s
 you
Template string w = 0N1N = 00 …. 011 … 1
N N
Setting k=0 is
referred to as
“pumping down”
Setting k>1 is
referred to as
“pumping up”
Exercise 2
Prove L = {0n10n | n≥ 1} is not regular
Note: This n is not to be confused with the pumping
lemma constant N. That can be different.
In other words, the above question is same as proving:
– L = {0m10m | m≥ 1} is not regular
12
Closure properties of Regular
Sets
13
Closure properties for Regular Sets (RL)
• Closure property:
– If a set of regular languages are combined using an
operator, then the resulting language is also regular
• Regular languages are closed under:
– Union, intersection, complement, difference
– Reversal
– Kleene closure
– Concatenation
– Homomorphism
– Inverse homomorphism
14
This is different
from Kleene
closure
Now, lets prove all of this!
RLs are closed under union
• IF L and M are two RLs THEN:
they both have two corresponding regular expressions, R
and S respectively
(L U M) can be represented using the regular expression
R+S
Therefore, (L U M) is also regular
15
How can this be proved using FAs?
RLs are closed under complementation
• If L is an RL over ∑, then L=∑*-L
 To show L is also regular, make the following
construction
16
q0
qF1
qF2
qFk
…
qi
DFA for L
q0
qF1
qF2
qFk
…
qi
DFA for L
Convert every final state into non-final, and
every non-final state into a final state
Assumes q0 is a non-final state. If not, do the opposite.
RLs are closed under intersection
• A quick, indirect way to prove:
– By DeMorgan’s law:
– L ∩ M = (L U M)
– Since we know RLs are closed under union and complementation,
they are also closed under intersection
• A more direct way would be construct a finite
automaton for L ∩ M
17
DFA construction for L ∩ M
• AL = DFA for L = {QL, ∑ , qL,FL, δL }
• AM = DFA for M = {QM, ∑ , qM,FM, δM }
• Build AL ∩ M = {QLx QM,∑, (qL,qM), FLx FM,δ} such
that:
– δ((p,q),a) = (δL(p,a), δM(q,a)), where p in QL, and q in
QM
• This construction ensures that a string w will be
accepted if and only if w reaches an accepting
state in both input DFAs.
18
DFA construction for L ∩ M
19
q0
qF1
qF2
…
qi
DFA for L
p0
pF1
pF2
…
pi
DFA for M
qj
a
pj
a
(qF1 ,pF1)
…
DFA for LM
a
(qi ,pi) (qj ,pj)
(q0 ,p0)
RLs are closed under set difference
• We observe:
– L - M = L ∩ M
• Therefore, L - M is also regular
20
Closed under intersection
Closed under
complementation
RLs are closed under reversal
Reversal of a string w is denoted by wR
– E.g., w=00111, wR=11100
Reversal of a language:
• LR = The language generated by reversing all strings in L
Theorem: If L is regular then LR is also regular
21
 -NFA Construction for LR
22
q0
qF1
qF2
qFk
…
qi qj
a
DFA for L
New -NFA for LR
New start
state
q’0



Make the
old start state
as the only new
final state
Reverse all transitions
Convert the old set of final states
into non-final states
What to do if q0 was
one of the final states
in the input DFA?
If L is regular, LR is regular (proof using
regular expressions)
• Let E be a regular expression for L
• Given E, how to build ER?
• Basis: If E= , Ø, or a, then ER=E
• Induction: Every part of E (refer to the part as “F”) can
be in only one of the three following forms:
1. F = F1+F2
• FR = F1
R+F2
R
2. F = F1F2
• FR = F2
RF1
R
3. F = (F1)*
• (FR)* = (F1
R)*
23
Department of Computer and Science Engineering (CSE)
• Knowledge of Regular language and pumping lemma
• Knowledge of DFA
Outcomes
24
FAQ
25
1. Obtain the Greibach Normal form A1
àA2 A3, A2
àA3 A1/ b , A3
àA1A2/ a.
2. Let G = {{s , c }, {a , b }, P , s },P = S ® asb / a , A ® SbA / ss / ba .Find a derivation
tree whose yield aabbaa.
3. Find L(G),where P consists of S ® asb , s ® ab .
4. Write CFG for L(G) = {a m b n c p / m + n = p , p ³ 1}.
REFERENCES
26
•Sipser,” Theory Of Computation, Cengage Learning.
•K.L.P MISHRA, “Introduction to computer Theory” .
•Martin J.C., “Introduction to Languages and Theory of
Computation”, Tata McGraw-Hill Publising Company Limited, 3rd
Edition.
• https://youtu.be/bBSM3rs3hDw
• https://youtu.be/AG72s-aFqFs
• https://youtu.be/cFd3pz5H-TA
• https://youtu.be/qmX7DJ9j1-A
•https://en.wikipedia.org

More Related Content

Similar to PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemma ).ppt

2. context free langauages
2. context free langauages2. context free langauages
2. context free langauagesdanhumble
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Akila Krishnamoorthy
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Dr. Maamoun Ahmed
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! EdholeEdhole.com
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! EdholeEdhole.com
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaPRAVEENTALARI4
 
Turing Machine
Turing MachineTuring Machine
Turing MachineRajendran
 
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
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------MIGUELANGEL2672
 

Similar to PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemma ).ppt (20)

re1.ppt
re1.pptre1.ppt
re1.ppt
 
automata problems
automata problemsautomata problems
automata problems
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauages
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
FLAT.pdf
FLAT.pdfFLAT.pdf
FLAT.pdf
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! Edhole
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 
hop-chap4.ppt
hop-chap4.ppthop-chap4.ppt
hop-chap4.ppt
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
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...
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
 

Recently uploaded

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 

Recently uploaded (20)

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 

PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemma ).ppt

  • 1. Department of Computer and Science Engineering (CSE) DISCOVER . LEARN . EMPOWER UNIVERSITY INSTITUTE OF ENGINEERING COMPUTER SCIENCE ENGINEERING Bachelor of Engineering Theory of Computation (CST-353) Topic: Regular Language Properties
  • 2. Department of Computer and Science Engineering (CSE) Learning Objectives & Outcomes Objective: • To understand the concept Regular Language and its Properties Outcome: • Student will understand the  FSM To get basic knowledge of pumping lemma  To get knowledge of regular language  To get knowledge of DFA
  • 3. The Pumping Lemma for Regular Sets Proved that a given language is not regular 3
  • 4. Pumping Lemma for Regular Sets Let L be a regular language Then there exists some constant N such that for every string w  L s.t. |w|≥N, there exists a way to break w into three parts, w=xyz, such that: 1. y≠  2. |xy|≤N 3. For all k≥0, all strings of the form xykz  L 4 This clause should hold for all regular languages. Definition: N is called the “Pumping Lemma Constant”
  • 5. Pumping Lemma: Proof • L is regular => it should have a DFA. – Set N := number of states in the DFA • Any string wL, s.t. |w|≥N, should have the form: w=a1a2…am, where m≥N • Let the states traversed after reading the first N symbols be: {p0,p1,… pN} ==> There are N+1 p-states, while there are only N DFA states ==> at least one state has to repeat i.e, pi= pJwhere 0≤i<j≤N (by PHP) 5
  • 6. Pumping Lemma: Proof…  => We should be able to break w=xyz as follows:  x=a1a2..ai; y=ai+1ai+2..aJ; z=aJ+1aJ+2..am  x’s path will be p0..pi  y’s path will be pi pi+1..pJ (but pi=pJ implying a loop)  z’s path will be pJpJ+1..pm  Now consider another string wk=xykz , where k≥0  Case k=0  DFA will reach the accept state pm  Case k>0  DFA will loop for yk, and finally reach the accept state pm for z  In either case, wk L 6 yk (for k loops) p0 pi pm x z =pj
  • 7. Pumping Lemma: Proof… • For part (1): – Since i<j, y ≠  • For part (2): – By PHP, the repetition of states has to occur within the first N symbols in w – ==> |xy|≤N 7 p0 pi pm x z yk (for k loops) =pj
  • 8. The Purpose of the Pumping Lemma for RL • To prove that some languages cannot be regular. 8
  • 9. How to use the pumping lemma? Think of playing a 2 person game – Role 1: You claim that the language cannot be regular – Role 2: An adversary who claims the language is regular – You show that the adversary’s statement will lead to a contradiction that implyies pumping lemma cannot hold for the language. – You win!! 9
  • 10. Example of using the Pumping Lemma to prove that a language is not regular Let Leq = {w | w is a binary string with equal number of 1s and 0s} • Your Claim: Leq is not regular • Proof:  By contradiction, let Leq be regular  P/L constant should exist  Let N = that P/L constant  Consider input w = 0N1N (your choice for the template string)  By pumping lemma, we should be able to break w=xyz, such that: 1) y≠  2) |xy|≤N 3) For all k≥0, the string xykz is also in L 10 Note: This N can be anything (need not necessarily be the #states in the DFA. It’s the adversary’s choice.)
  • 11. Proof…  Because |xy|≤N, xy should contain only 0s  (This and because y≠ , implies y=0+)  Therefore x can contain at most N-1 0s  Also, all the N 1s must be inside z  By (3), any string of the form xykz  Leq for all k≥0  Case k=0: xz has at most N-1 0s but has N 1s  Therefore, xy0z  Leq  This violates the P/L (a contradiction) 11 Another way of proving this will be to show that if the #0s is arbitrarily pumped up (e.g., k=2), then the #0s will become exceed the #1s  you Template string w = 0N1N = 00 …. 011 … 1 N N Setting k=0 is referred to as “pumping down” Setting k>1 is referred to as “pumping up”
  • 12. Exercise 2 Prove L = {0n10n | n≥ 1} is not regular Note: This n is not to be confused with the pumping lemma constant N. That can be different. In other words, the above question is same as proving: – L = {0m10m | m≥ 1} is not regular 12
  • 13. Closure properties of Regular Sets 13
  • 14. Closure properties for Regular Sets (RL) • Closure property: – If a set of regular languages are combined using an operator, then the resulting language is also regular • Regular languages are closed under: – Union, intersection, complement, difference – Reversal – Kleene closure – Concatenation – Homomorphism – Inverse homomorphism 14 This is different from Kleene closure Now, lets prove all of this!
  • 15. RLs are closed under union • IF L and M are two RLs THEN: they both have two corresponding regular expressions, R and S respectively (L U M) can be represented using the regular expression R+S Therefore, (L U M) is also regular 15 How can this be proved using FAs?
  • 16. RLs are closed under complementation • If L is an RL over ∑, then L=∑*-L  To show L is also regular, make the following construction 16 q0 qF1 qF2 qFk … qi DFA for L q0 qF1 qF2 qFk … qi DFA for L Convert every final state into non-final, and every non-final state into a final state Assumes q0 is a non-final state. If not, do the opposite.
  • 17. RLs are closed under intersection • A quick, indirect way to prove: – By DeMorgan’s law: – L ∩ M = (L U M) – Since we know RLs are closed under union and complementation, they are also closed under intersection • A more direct way would be construct a finite automaton for L ∩ M 17
  • 18. DFA construction for L ∩ M • AL = DFA for L = {QL, ∑ , qL,FL, δL } • AM = DFA for M = {QM, ∑ , qM,FM, δM } • Build AL ∩ M = {QLx QM,∑, (qL,qM), FLx FM,δ} such that: – δ((p,q),a) = (δL(p,a), δM(q,a)), where p in QL, and q in QM • This construction ensures that a string w will be accepted if and only if w reaches an accepting state in both input DFAs. 18
  • 19. DFA construction for L ∩ M 19 q0 qF1 qF2 … qi DFA for L p0 pF1 pF2 … pi DFA for M qj a pj a (qF1 ,pF1) … DFA for LM a (qi ,pi) (qj ,pj) (q0 ,p0)
  • 20. RLs are closed under set difference • We observe: – L - M = L ∩ M • Therefore, L - M is also regular 20 Closed under intersection Closed under complementation
  • 21. RLs are closed under reversal Reversal of a string w is denoted by wR – E.g., w=00111, wR=11100 Reversal of a language: • LR = The language generated by reversing all strings in L Theorem: If L is regular then LR is also regular 21
  • 22.  -NFA Construction for LR 22 q0 qF1 qF2 qFk … qi qj a DFA for L New -NFA for LR New start state q’0    Make the old start state as the only new final state Reverse all transitions Convert the old set of final states into non-final states What to do if q0 was one of the final states in the input DFA?
  • 23. If L is regular, LR is regular (proof using regular expressions) • Let E be a regular expression for L • Given E, how to build ER? • Basis: If E= , Ø, or a, then ER=E • Induction: Every part of E (refer to the part as “F”) can be in only one of the three following forms: 1. F = F1+F2 • FR = F1 R+F2 R 2. F = F1F2 • FR = F2 RF1 R 3. F = (F1)* • (FR)* = (F1 R)* 23
  • 24. Department of Computer and Science Engineering (CSE) • Knowledge of Regular language and pumping lemma • Knowledge of DFA Outcomes 24
  • 25. FAQ 25 1. Obtain the Greibach Normal form A1 àA2 A3, A2 àA3 A1/ b , A3 àA1A2/ a. 2. Let G = {{s , c }, {a , b }, P , s },P = S ® asb / a , A ® SbA / ss / ba .Find a derivation tree whose yield aabbaa. 3. Find L(G),where P consists of S ® asb , s ® ab . 4. Write CFG for L(G) = {a m b n c p / m + n = p , p ³ 1}.
  • 26. REFERENCES 26 •Sipser,” Theory Of Computation, Cengage Learning. •K.L.P MISHRA, “Introduction to computer Theory” . •Martin J.C., “Introduction to Languages and Theory of Computation”, Tata McGraw-Hill Publising Company Limited, 3rd Edition. • https://youtu.be/bBSM3rs3hDw • https://youtu.be/AG72s-aFqFs • https://youtu.be/cFd3pz5H-TA • https://youtu.be/qmX7DJ9j1-A •https://en.wikipedia.org

Editor's Notes

  1. School of EECS, WSU
  2. School of EECS, WSU
  3. School of EECS, WSU
  4. School of EECS, WSU
  5. School of EECS, WSU
  6. School of EECS, WSU
  7. School of EECS, WSU
  8. School of EECS, WSU
  9. School of EECS, WSU
  10. School of EECS, WSU
  11. School of EECS, WSU
  12. School of EECS, WSU
  13. School of EECS, WSU
  14. School of EECS, WSU
  15. School of EECS, WSU
  16. School of EECS, WSU
  17. School of EECS, WSU
  18. School of EECS, WSU
  19. School of EECS, WSU