SlideShare a Scribd company logo
CS5371
Theory of Computation
Lecture 5: Automata Theory
III
(Non-regular Language, Pumping
Lemma, Regular Expression)
• Prove the Pumping Lemma, and use it
to show that there are non-regular
languages
• Introduce Regular Expression
– which is one way to describe a language
(or a set of strings)
Objectives
Non-Regular Language?
• To understand the power of DFA, apart
from knowing what it can do, we need to
know what it cannot do
• Let’s look at the language B = {0n1n | n  0}
• If we try to find a DFA to recognize B, the
DFA needs to keep track of the number of
0’s we have seen so far
• However, number of 0’s is unlimited… there
are unlimited number of possibilities
• So, it is NOT POSSIBLE because the DFA
just has FINITE number of states!
Pumping Lemma
Theorem: If A is a regular language,
then there is a number p (called the
pumping length) such that:
if s is a string in A of length at least p, then
s can be divided into three pieces, s = xyz,
satisfying the following three conditions:
– For each k  0, xykz 2 A
– |y|  0, and
– |xy| · p
Pumping Lemma (Proof)
• Let us assign the pumping length p to be
the number of states in the DFA that
recognize A
• Consider the sequence of states that the
DFA goes through when reading
s = s1s2…sn
• At the beginning, it is at state r0 = qstart
• Then, it goes to r1 after reading s1, then
goes to r2, then goes to r3 …
Pumping Lemma (Proof)
• When it has finished reading sp, one of the
state has been visited at least two times (why?)
• That is, ri = rj , for some 0  i  j  p
• Now, let x = s1s2…si,
y = si+1si+2…sj, and
z = sj+1sj+2…sn
• We can check that xykz 2 A for all k  0
(why?)
• Also, |y|  0and |xy|  p (why?)
Use of Pumping Lemma
(Example 1)
• Lemma: The language B = {0n1n | n  0}
is not regular.
• How to prove?
– Use Pumping Lemma
– By contradiction
• Proof:Assume that B is regular. Then…
Use of Pumping Lemma
(Example 1)
• Then, let p be the pumping length
• We know that 0p1p is in B
• By pumping lemma, we know that 0p1p can be
divided into three parts, xyz, such that |y|
 0, |xy|  p, and xykz is in B for all k  0
• In this case, y consists of all 0’s and at
least 1 zero (why??)
• xyyz is in B, but xyyz has more 0’s than 1’s
• Contradiction occurs!
Use of Pumping Lemma
(Example 2)
• Lemma: The language C = { w | w has
an equal number of 0s and 1s } is not
regular.
• How to prove?
Use of Pumping Lemma
(Example 2)
Let s =• Proof 1: Similar to
Example 1. 0p1p and apply
pumping lemma.• Proof 2: We use the fact: the
class of regular languages is closed
under intersection (will be proved in
tutorial next Tue). That is,
If A and B are regular languages,
then A  B is also a regular language.
Use of Pumping Lemma
(Example 2:Proof 2)
• Let A = { 0m1n | m, n ¸ 0}
• Note that A is regular (why?)
• Now, assume that C is regular.Then,
it implies that C  A is
regular
• However, C  A = { 0n1n | n ¸ 0}, which is
not regular
• Thus, contradiction occurs (where?). So,
C is not regular
Use of Pumping Lemma
(Example 2)
• In Proof 1, we choose s = 0p1p, we can
apply pumping lemma successfully and
prove that C is not regular
• However, if we ‘unluckily’ choose s = (01)p,
using pumping lemma may not give
contradiction… (E.g., |x| = , y = 01, z =
(01)p-1, then every xykz is in C)
• So, if you fail on first attempt, don’t give
up, try another one!
Use of Pumping Lemma
(Example 3)
• Lemma: The language F = { ww | w 2
{0,1}* } is not regular.
• How to prove?
Use of Pumping Lemma
(Example 4)
• Lemma: The language {1n2
| n ¸ 0} is
not regular.
• Proof:
– Let p be the pumping length.
– Let s = 1p2
.
– By pumping lemma, we have |xyz| = p2.
Also, 0  |y|  |xy|  p.
– p2  |xyyz| p2 + p  (p+1)2
– Contradiction occurs (where??)
Use of Pumping Lemma
(Example 5)
• Lemma: The language E = { 0i1j | i  j }
is not regular.
• Proof: Let s = 0p+11p. By pumping
lemma, we can divide s into xyz such
that y consists of all 0’s and |y|  0.
but xz does not have more• Then, xz 2 E
0s than 1s
• Contradiction occurs
Regular Expression
• In arithmetic, we can use the operations
+ and x to build up expressions, such as
(5+3) x 4
– The value of this expression is 32
• Similarly, we can use regular operations
to build up regular expressions, such as
(0 [ 1)0*
– The value of this expression is a set of
strings (or a language)
What does (0 [ 1)0* mean?
• The symbols 0 and 1 are shorthand for the
set {0} and {1}
– So, (0 [ 1)means ( {0} [ {1} )
– 0* means {0}*, whose value is the language
consisting of all strings with any number of 0s
• Just like x in arithmetic expression, the
concatenation symbol o is often omitted
– So, ( 0 [ 1 ) 0* means ( 0 [ 1 ) o 0*
• This expression describes the set of
strings that start with a 0 or a 1, which is
followed by any number of 0s
What does the following
regular expressions mean?
• 0*10*
• *1*
• *001*
• 1*(01+)*
• ()*
• (0 [ ) 1*
• 1* ;
Note: The notation R+ means RR*
Binary strings containing exactly one 1
Any strings containing 1
Any strings containing 001
Any strings with even length
Binary strings with 1 following each 0
01* [ 1*
Empty set(no strings)
Next time
• Formally define regular expression
• We will also show that
– (1) Language recognized by DFA can be
described by Regular Expression
– (2) Language described by Regular
Expression can be recognized by DFA
Ad

More Related Content

What's hot (20)

Pumping lemma
Pumping lemmaPumping lemma
Pumping lemma
Gagan Dhawan
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
hafizhamza0322
 
context free language
context free languagecontext free language
context free language
khush_boo31
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
Akhil Kaushik
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
Huawei Technologies
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machine
Ehatsham Riaz
 
Non regular languages
Non regular languagesNon regular languages
Non regular languages
lavishka_anuj
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
SKUP1
 
Chapter 5 Syntax Directed Translation
Chapter 5   Syntax Directed TranslationChapter 5   Syntax Directed Translation
Chapter 5 Syntax Directed Translation
Radhakrishnan Chinnusamy
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
Bipul Roy Bpl
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
ElakkiyaS11
 
String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,
8neutron8
 
Push down automata
Push down automataPush down automata
Push down automata
Ratnakar Mikkili
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
Marina Santini
 
Local beam search example
Local beam search exampleLocal beam search example
Local beam search example
Megha Sharma
 
TOC 3 | Different Operations on DFA
TOC 3 | Different Operations on DFATOC 3 | Different Operations on DFA
TOC 3 | Different Operations on DFA
Mohammad Imam Hossain
 
Ch 2 lattice & boolean algebra
Ch 2 lattice & boolean algebraCh 2 lattice & boolean algebra
Ch 2 lattice & boolean algebra
Rupali Rana
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
Animesh Chaturvedi
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
Dipankar Boruah
 
Parsing LL(1), SLR, LR(1)
Parsing LL(1), SLR, LR(1)Parsing LL(1), SLR, LR(1)
Parsing LL(1), SLR, LR(1)
Nitin Mohan Sharma
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
hafizhamza0322
 
context free language
context free languagecontext free language
context free language
khush_boo31
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machine
Ehatsham Riaz
 
Non regular languages
Non regular languagesNon regular languages
Non regular languages
lavishka_anuj
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
SKUP1
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
Bipul Roy Bpl
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
ElakkiyaS11
 
String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,
8neutron8
 
Local beam search example
Local beam search exampleLocal beam search example
Local beam search example
Megha Sharma
 
Ch 2 lattice & boolean algebra
Ch 2 lattice & boolean algebraCh 2 lattice & boolean algebra
Ch 2 lattice & boolean algebra
Rupali Rana
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
Animesh Chaturvedi
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
Dipankar Boruah
 

Viewers also liked (20)

Pumping Lemma
Pumping LemmaPumping Lemma
Pumping Lemma
eburhan
 
Regular language and Regular expression
Regular language and Regular expressionRegular language and Regular expression
Regular language and Regular expression
Animesh Chaturvedi
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
Marina Santini
 
Pumping Lemma
Pumping LemmaPumping Lemma
Pumping Lemma
Juliana Félix
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Shiraz316
 
Dfa example
Dfa   exampleDfa   example
Dfa example
saerrii
 
Properties of Regular Expressions
Properties of Regular ExpressionsProperties of Regular Expressions
Properties of Regular Expressions
Shiraz316
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
Samita Mukesh
 
DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
guest5873b2d
 
Optimization of dfa
Optimization of dfaOptimization of dfa
Optimization of dfa
Kiran Acharya
 
SLIDE KE:5 NFA
SLIDE KE:5 NFASLIDE KE:5 NFA
SLIDE KE:5 NFA
Rahmatdi Black
 
Towards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression DerivativesTowards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression Derivatives
Jose Emilio Labra Gayo
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguages
issbp
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
Abhimanyu Mishra
 
Theory of Automata and formal languages unit 2
Theory of Automata and formal languages unit 2Theory of Automata and formal languages unit 2
Theory of Automata and formal languages unit 2
Abhimanyu Mishra
 
Introduction to fa and dfa
Introduction to fa  and dfaIntroduction to fa  and dfa
Introduction to fa and dfa
deepinderbedi
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Diode
DiodeDiode
Diode
Seti Saiman
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
Cisco Services
 
Dfa vs nfa
Dfa vs nfaDfa vs nfa
Dfa vs nfa
raosir123
 
Pumping Lemma
Pumping LemmaPumping Lemma
Pumping Lemma
eburhan
 
Regular language and Regular expression
Regular language and Regular expressionRegular language and Regular expression
Regular language and Regular expression
Animesh Chaturvedi
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
Marina Santini
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Shiraz316
 
Dfa example
Dfa   exampleDfa   example
Dfa example
saerrii
 
Properties of Regular Expressions
Properties of Regular ExpressionsProperties of Regular Expressions
Properties of Regular Expressions
Shiraz316
 
Towards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression DerivativesTowards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression Derivatives
Jose Emilio Labra Gayo
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguages
issbp
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
Abhimanyu Mishra
 
Theory of Automata and formal languages unit 2
Theory of Automata and formal languages unit 2Theory of Automata and formal languages unit 2
Theory of Automata and formal languages unit 2
Abhimanyu Mishra
 
Introduction to fa and dfa
Introduction to fa  and dfaIntroduction to fa  and dfa
Introduction to fa and dfa
deepinderbedi
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Ad

Similar to Pumping lemma for regular set h1 (20)

hop-chap4.ppt
hop-chap4.ppthop-chap4.ppt
hop-chap4.ppt
UniversityHacks
 
Lecture-8-Pumpdndndndndnddndning Lemma.pdf
Lecture-8-Pumpdndndndndnddndning Lemma.pdfLecture-8-Pumpdndndndndnddndning Lemma.pdf
Lecture-8-Pumpdndndndndnddndning Lemma.pdf
mounirmn33
 
09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf
ssuser47f7f2
 
AUTOMATA AUTOMATA Automata5Chapter4.pptx
AUTOMATA AUTOMATA Automata5Chapter4.pptxAUTOMATA AUTOMATA Automata5Chapter4.pptx
AUTOMATA AUTOMATA Automata5Chapter4.pptx
ArjayBalberan1
 
Chapter 4_Regular Expressions in Automata.pptx
Chapter 4_Regular Expressions in Automata.pptxChapter 4_Regular Expressions in Automata.pptx
Chapter 4_Regular Expressions in Automata.pptx
KrishnenduRarhi
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptx
Ezhumalai p
 
Module 1 TOC.pptx
Module 1 TOC.pptxModule 1 TOC.pptx
Module 1 TOC.pptx
MohitJain21BCE1523
 
hw4s05solns.ppt
hw4s05solns.ppthw4s05solns.ppt
hw4s05solns.ppt
UniversityHacks
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
MIGUELANGEL2672
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
Gaurav447273
 
Formal Languages and regular langugaes IN FLAG
Formal Languages and regular langugaes IN FLAGFormal Languages and regular langugaes IN FLAG
Formal Languages and regular langugaes IN FLAG
interestingfacts10
 
Theory of computing pdf
Theory of computing pdfTheory of computing pdf
Theory of computing pdf
Dilouar Hossain
 
non regular language updated theory of automata.ppt
non regular language updated theory of automata.pptnon regular language updated theory of automata.ppt
non regular language updated theory of automata.ppt
abdulrehmanshahzad69
 
10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx
MuhammadFaizanHameed1
 
Introduction to Theory of computations:-
Introduction to Theory of computations:-Introduction to Theory of computations:-
Introduction to Theory of computations:-
sivamathi12
 
POST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMPOST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEM
Rajendran
 
Automata
AutomataAutomata
Automata
Gaditek
 
Automata
AutomataAutomata
Automata
Gaditek
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
ArjunMehra32
 
practice-final-soln.pdf
practice-final-soln.pdfpractice-final-soln.pdf
practice-final-soln.pdf
T17Rockstar
 
Lecture-8-Pumpdndndndndnddndning Lemma.pdf
Lecture-8-Pumpdndndndndnddndning Lemma.pdfLecture-8-Pumpdndndndndnddndning Lemma.pdf
Lecture-8-Pumpdndndndndnddndning Lemma.pdf
mounirmn33
 
09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf
ssuser47f7f2
 
AUTOMATA AUTOMATA Automata5Chapter4.pptx
AUTOMATA AUTOMATA Automata5Chapter4.pptxAUTOMATA AUTOMATA Automata5Chapter4.pptx
AUTOMATA AUTOMATA Automata5Chapter4.pptx
ArjayBalberan1
 
Chapter 4_Regular Expressions in Automata.pptx
Chapter 4_Regular Expressions in Automata.pptxChapter 4_Regular Expressions in Automata.pptx
Chapter 4_Regular Expressions in Automata.pptx
KrishnenduRarhi
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptx
Ezhumalai p
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
MIGUELANGEL2672
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
Gaurav447273
 
Formal Languages and regular langugaes IN FLAG
Formal Languages and regular langugaes IN FLAGFormal Languages and regular langugaes IN FLAG
Formal Languages and regular langugaes IN FLAG
interestingfacts10
 
non regular language updated theory of automata.ppt
non regular language updated theory of automata.pptnon regular language updated theory of automata.ppt
non regular language updated theory of automata.ppt
abdulrehmanshahzad69
 
10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx
MuhammadFaizanHameed1
 
Introduction to Theory of computations:-
Introduction to Theory of computations:-Introduction to Theory of computations:-
Introduction to Theory of computations:-
sivamathi12
 
POST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMPOST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEM
Rajendran
 
Automata
AutomataAutomata
Automata
Gaditek
 
Automata
AutomataAutomata
Automata
Gaditek
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
ArjunMehra32
 
practice-final-soln.pdf
practice-final-soln.pdfpractice-final-soln.pdf
practice-final-soln.pdf
T17Rockstar
 
Ad

More from Rajendran (20)

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower bounds
Rajendran
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding Costs
Rajendran
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
Rajendran
 
Red black tree
Red black treeRed black tree
Red black tree
Rajendran
 
Hash table
Hash tableHash table
Hash table
Rajendran
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
Rajendran
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theorem
Rajendran
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
Rajendran
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theorem
Rajendran
 
Master method
Master method Master method
Master method
Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
Rajendran
 
Hash tables
Hash tablesHash tables
Hash tables
Rajendran
 
Lower bound
Lower boundLower bound
Lower bound
Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
Rajendran
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
Rajendran
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm Analysis
Rajendran
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
Rajendran
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
Rajendran
 
Np completeness
Np completenessNp completeness
Np completeness
Rajendran
 
computer languages
computer languagescomputer languages
computer languages
Rajendran
 
Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower bounds
Rajendran
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding Costs
Rajendran
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
Rajendran
 
Red black tree
Red black treeRed black tree
Red black tree
Rajendran
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
Rajendran
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theorem
Rajendran
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
Rajendran
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theorem
Rajendran
 
Master method
Master method Master method
Master method
Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
Rajendran
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
Rajendran
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm Analysis
Rajendran
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
Rajendran
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
Rajendran
 
Np completeness
Np completenessNp completeness
Np completeness
Rajendran
 
computer languages
computer languagescomputer languages
computer languages
Rajendran
 

Recently uploaded (20)

Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Open Access: Revamping Library Learning Resources.
Open Access: Revamping Library Learning Resources.Open Access: Revamping Library Learning Resources.
Open Access: Revamping Library Learning Resources.
Rishi Bankim Chandra Evening College, Naihati, North 24 Parganas, West Bengal, India
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Timber Pitch Roof Construction Measurement-2024.pptx
Timber Pitch Roof Construction Measurement-2024.pptxTimber Pitch Roof Construction Measurement-2024.pptx
Timber Pitch Roof Construction Measurement-2024.pptx
Tantish QS, UTM
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-26-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-26-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-26-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-26-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearVitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
ARUN KUMAR
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
High Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptxHigh Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptx
Ayush Srivastava
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Envenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptxEnvenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptx
rekhapositivity
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Timber Pitch Roof Construction Measurement-2024.pptx
Timber Pitch Roof Construction Measurement-2024.pptxTimber Pitch Roof Construction Measurement-2024.pptx
Timber Pitch Roof Construction Measurement-2024.pptx
Tantish QS, UTM
 
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearVitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
ARUN KUMAR
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
High Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptxHigh Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptx
Ayush Srivastava
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Envenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptxEnvenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptx
rekhapositivity
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 

Pumping lemma for regular set h1

  • 1. CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
  • 2. • Prove the Pumping Lemma, and use it to show that there are non-regular languages • Introduce Regular Expression – which is one way to describe a language (or a set of strings) Objectives
  • 3. Non-Regular Language? • To understand the power of DFA, apart from knowing what it can do, we need to know what it cannot do • Let’s look at the language B = {0n1n | n  0} • If we try to find a DFA to recognize B, the DFA needs to keep track of the number of 0’s we have seen so far • However, number of 0’s is unlimited… there are unlimited number of possibilities • So, it is NOT POSSIBLE because the DFA just has FINITE number of states!
  • 4. Pumping Lemma Theorem: If A is a regular language, then there is a number p (called the pumping length) such that: if s is a string in A of length at least p, then s can be divided into three pieces, s = xyz, satisfying the following three conditions: – For each k  0, xykz 2 A – |y|  0, and – |xy| · p
  • 5. Pumping Lemma (Proof) • Let us assign the pumping length p to be the number of states in the DFA that recognize A • Consider the sequence of states that the DFA goes through when reading s = s1s2…sn • At the beginning, it is at state r0 = qstart • Then, it goes to r1 after reading s1, then goes to r2, then goes to r3 …
  • 6. Pumping Lemma (Proof) • When it has finished reading sp, one of the state has been visited at least two times (why?) • That is, ri = rj , for some 0  i  j  p • Now, let x = s1s2…si, y = si+1si+2…sj, and z = sj+1sj+2…sn • We can check that xykz 2 A for all k  0 (why?) • Also, |y|  0and |xy|  p (why?)
  • 7. Use of Pumping Lemma (Example 1) • Lemma: The language B = {0n1n | n  0} is not regular. • How to prove? – Use Pumping Lemma – By contradiction • Proof:Assume that B is regular. Then…
  • 8. Use of Pumping Lemma (Example 1) • Then, let p be the pumping length • We know that 0p1p is in B • By pumping lemma, we know that 0p1p can be divided into three parts, xyz, such that |y|  0, |xy|  p, and xykz is in B for all k  0 • In this case, y consists of all 0’s and at least 1 zero (why??) • xyyz is in B, but xyyz has more 0’s than 1’s • Contradiction occurs!
  • 9. Use of Pumping Lemma (Example 2) • Lemma: The language C = { w | w has an equal number of 0s and 1s } is not regular. • How to prove?
  • 10. Use of Pumping Lemma (Example 2) Let s =• Proof 1: Similar to Example 1. 0p1p and apply pumping lemma.• Proof 2: We use the fact: the class of regular languages is closed under intersection (will be proved in tutorial next Tue). That is, If A and B are regular languages, then A B is also a regular language.
  • 11. Use of Pumping Lemma (Example 2:Proof 2) • Let A = { 0m1n | m, n ¸ 0} • Note that A is regular (why?) • Now, assume that C is regular.Then, it implies that C A is regular • However, C A = { 0n1n | n ¸ 0}, which is not regular • Thus, contradiction occurs (where?). So, C is not regular
  • 12. Use of Pumping Lemma (Example 2) • In Proof 1, we choose s = 0p1p, we can apply pumping lemma successfully and prove that C is not regular • However, if we ‘unluckily’ choose s = (01)p, using pumping lemma may not give contradiction… (E.g., |x| = , y = 01, z = (01)p-1, then every xykz is in C) • So, if you fail on first attempt, don’t give up, try another one!
  • 13. Use of Pumping Lemma (Example 3) • Lemma: The language F = { ww | w 2 {0,1}* } is not regular. • How to prove?
  • 14. Use of Pumping Lemma (Example 4) • Lemma: The language {1n2 | n ¸ 0} is not regular. • Proof: – Let p be the pumping length. – Let s = 1p2 . – By pumping lemma, we have |xyz| = p2. Also, 0  |y|  |xy|  p. – p2  |xyyz| p2 + p  (p+1)2 – Contradiction occurs (where??)
  • 15. Use of Pumping Lemma (Example 5) • Lemma: The language E = { 0i1j | i  j } is not regular. • Proof: Let s = 0p+11p. By pumping lemma, we can divide s into xyz such that y consists of all 0’s and |y|  0. but xz does not have more• Then, xz 2 E 0s than 1s • Contradiction occurs
  • 16. Regular Expression • In arithmetic, we can use the operations + and x to build up expressions, such as (5+3) x 4 – The value of this expression is 32 • Similarly, we can use regular operations to build up regular expressions, such as (0 [ 1)0* – The value of this expression is a set of strings (or a language)
  • 17. What does (0 [ 1)0* mean? • The symbols 0 and 1 are shorthand for the set {0} and {1} – So, (0 [ 1)means ( {0} [ {1} ) – 0* means {0}*, whose value is the language consisting of all strings with any number of 0s • Just like x in arithmetic expression, the concatenation symbol o is often omitted – So, ( 0 [ 1 ) 0* means ( 0 [ 1 ) o 0* • This expression describes the set of strings that start with a 0 or a 1, which is followed by any number of 0s
  • 18. What does the following regular expressions mean? • 0*10* • *1* • *001* • 1*(01+)* • ()* • (0 [ ) 1* • 1* ; Note: The notation R+ means RR* Binary strings containing exactly one 1 Any strings containing 1 Any strings containing 001 Any strings with even length Binary strings with 1 following each 0 01* [ 1* Empty set(no strings)
  • 19. Next time • Formally define regular expression • We will also show that – (1) Language recognized by DFA can be described by Regular Expression – (2) Language described by Regular Expression can be recognized by DFA