SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
Automata Theory and Logic
Regular Language & Regular Expression
A TUTORIAL
BY
ANIMESH CHATURVEDI
AT
INDIAN INSTITUTE OF TECHNOLOGY INDORE (IIT-I)
DFA, NFA, Regular Expression (RegEx)
and Regular Language (RegLang)
A DFA represent a Regular Expression language
Regular Expression Regular Language
(0 + 10∗)
(0∗ 10∗)
(0 + ε)(1 + ε)
(a + b)*
(a + b)* abb
(11)*
(aa)*(bb)*b
(aa + ab + ba +bb)*
Language of given Regular Expression?
https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
Regular Expression Regular Language
(0 + 10∗) L = { 0, 1, 10, 100, 1000, 10000, … }
(0∗ 10∗) L = {1, 01, 10, 010, 0010, …}
(0 + ε)(1 + ε) L = {ε, 0, 1, 01}
(a + b)*
(a + b)* abb
(11)*
(aa)*(bb)*b
(aa + ab + ba +bb)*
Language of given Regular Expression?
https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
Regular Expression Regular Language
(0 + 10∗) L = { 0, 1, 10, 100, 1000, 10000, … }
(0∗ 10∗) L = {1, 01, 10, 010, 0010, …}
(0 + ε)(1 + ε) L = {ε, 0, 1, 01}
(a + b)* Set of strings of a’s and b’s of any length including the null string. So L = { ε, a, b,
aa , ab , bb , ba, aaa…….}
(a + b)* abb Set of strings of a’s and b’s ending with the string abb. So L = {abb, aabb, babb,
aaabb, ababb, …………..}
(11)*
(aa)*(bb)*b
(aa + ab + ba +bb)*
Language of given Regular Expression?
https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
Regular Expression Regular Language
(0 + 10∗) L = { 0, 1, 10, 100, 1000, 10000, … }
(0∗ 10∗) L = {1, 01, 10, 010, 0010, …}
(0 + ε)(1 + ε) L = {ε, 0, 1, 01}
(a + b)* Set of strings of a’s and b’s of any length including the null string. So L = { ε, a, b,
aa , ab , bb , ba, aaa…….}
(a + b)* abb Set of strings of a’s and b’s ending with the string abb. So L = {abb, aabb, babb,
aaabb, ababb, …………..}
(11)* Set consisting of even number of 1’s including empty string, So L= {ε, 11, 1111,
111111, ……….}
(aa)*(bb)*b Set of strings consisting of even number of a’s followed by odd number of b’s , so L = {b, aab, aabbb, aabbbbb, aaaab,
aaaabbb, …………..}
(aa + ab + ba +bb)* String of a’s and b’s of even length can be obtained by concatenating any
combination of the strings aa, ab, ba and bb including null, so L = {aa, ab, ba, bb, aaab, aaba, ………..}
Language of given Regular Expression?
https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
Number of states for a given language
Definition of a language L with alphabet {a} is given as following
L = {ank | k > 0, and n is a positive integer constant}
What is the minimum number of states needed in a DFA to recognize L?
Computer Science GATE 2011
Number of states for a given language
Definition of a language L with alphabet {a} is given as following
L = {ank | k > 0, and n is a positive integer constant}
What is the minimum number of states needed in a DFA to recognize L?
n+1 states are needed in a DFA to recognize L
Let n = 3 and k=1
3+1 = 4 states
Computer Science GATE 2011
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3}
Konrad Slind Notes on Computation Theory, September 21, 2010
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3}
Konrad Slind Notes on Computation Theory, September 21, 2010
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3}
Konrad Slind Notes on Computation Theory, September 21, 2010
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3}
Konrad Slind Notes on Computation Theory, September 21, 2010
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0n | ∃k. n = 3k + 1}
Konrad Slind Notes on Computation Theory, September 21, 2010
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0n | ∃k. n = 3k + 1}
Konrad Slind Notes on Computation Theory, September 21, 2010
Minimal DFA for a given language
Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given
below {0n | ∃k. n = 3k + 1}
Konrad Slind Notes on Computation Theory, September 21, 2010
Convert NFA to DFA for a given RegEx
Construct DFA to accept 00(0+1)*
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegEx
Construct DFA to accept 00(0+1)*
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegEx
Construct DFA to accept (0+1)*11
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegEx
Construct DFA to accept (0+1)*11
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegEx
Construct DFA to accept 00(0+1)*11
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegEx
Construct DFA to accept 00(0+1)*11
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegLang
Construct DFA to accept L(M)=ε
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegLang
Construct DFA to accept L(M)=ε
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegLang
Construct DFA to accept L(M)=Ǿ
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegLang
Construct DFA to accept L(M)=Ǿ
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegLang
Construct DFA to accept L(M)=(0+1)*
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA for a given RegLang
Construct DFA to accept L(M)=(0+1)*
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Regular Expression
What is the language accepted by the NFA for one literal {a} show below?
Assume ε is the empty string
Computer Science GATE 2012
Regular Expression
What is the language accepted by the NFA for one literal {a} show below?
Assume ε is the empty string
Language accepted by NFA is a+, so complement of this language is {є}
Computer Science GATE 2012
What is the DFA & Regular expression?
30Lexical Analysis by Prof. O. Nierstrasz
Example: the set of strings containing an even number of zeros and an even number of ones
What is the DFA & Regular expression?
31Lexical Analysis by Prof. O. Nierstrasz
Example: the set of strings containing an even number of zeros and an even number of ones
What is the DFA & Regular expression?
32Lexical Analysis by Prof. O. Nierstrasz
Example: the set of strings containing an even number of zeros and an even number of ones
The RE is (0011)*((0110)(0011)*(0110)(0011)*)*
Draw NFA for given regular expressions
33Lexical Analysis by Prof. O. Nierstrasz
For the RE (a|b)*abb ?
Draw NFA for given regular expressions
34Lexical Analysis by Prof. O. Nierstrasz
For the RE (a|b)*abb ?
Draw NFA for given regular expressions
35
For the RE (a|b)*abb ?
State s0 has multiple transitions on a! It is a non-deterministic finite automaton
Lexical Analysis by Prof. O. Nierstrasz
36
A language is regular if it is recognized by
a deterministic finite automaton
Whether L = { w | w contains 001} is regular or not?
Check it by building an automaton accepts all and only those strings that contain 001
Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
37
q q00
1 0
1
q0 q001
0 0 1
0,1
A language is regular if it is recognized by
a deterministic finite automaton
Whether L = { w | w contains 001} is regular or not?
Check it by building an automaton accepts all and only those strings that contain 001
Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
A language is regular if it is recognized by
a deterministic finite automaton
Whether L = { w | w has an even number of 1s} is regular or not?
Check it by building an automaton accepts all and only those strings that has an even number
of 1s
Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
A language is regular if it is recognized by
a deterministic finite automaton
q0
q1
0 0
1
1
Whether L = { w | w has an even number of 1s} is regular or not?
Check it by building an automaton accepts all and only those strings that has an even number
of 1s
Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
References
https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University
http://www.cs.tau.ac.il/~orilahav/CompModelFall10/Compute2-print.pdf
Slide by: Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
Slide by Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Prof. Shunichi Toida http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-2-dfa.html
Konrad Slind Notes on Computation Theory, September 21, 2010
Lexical Analysis by Prof. O. Nierstrasz
GATE (Graduate Aptitude Test of Engineering) jointly conducted by IIT’s
Regular language and Regular expression

Contenu connexe

Tendances

Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
Srimatre K
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
NYversity
 

Tendances (20)

Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Regular Grammar
Regular GrammarRegular Grammar
Regular Grammar
 
Automata
AutomataAutomata
Automata
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Theory of Computation "Chapter 1, introduction"
Theory of Computation "Chapter 1, introduction"Theory of Computation "Chapter 1, introduction"
Theory of Computation "Chapter 1, introduction"
 
Theory of computation Lec3 dfa
Theory of computation Lec3 dfaTheory of computation Lec3 dfa
Theory of computation Lec3 dfa
 
0.0 Introduction to theory of computation
0.0 Introduction to theory of computation0.0 Introduction to theory of computation
0.0 Introduction to theory of computation
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata Theory
 
Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
 
Pumping lemma for regular language
Pumping lemma for regular languagePumping lemma for regular language
Pumping lemma for regular language
 
Finite automata
Finite automataFinite automata
Finite automata
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
 

En vedette

Regular Expressions 101
Regular Expressions 101Regular Expressions 101
Regular Expressions 101
Raj Rajandran
 

En vedette (20)

Finite State Automata
Finite State AutomataFinite State Automata
Finite State Automata
 
Regular Expressions 101
Regular Expressions 101Regular Expressions 101
Regular Expressions 101
 
Pumping lemma for regular set h1
Pumping lemma for regular set h1Pumping lemma for regular set h1
Pumping lemma for regular set h1
 
Regular expression (compiler)
Regular expression (compiler)Regular expression (compiler)
Regular expression (compiler)
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
 
Pattern detection in mealy machine
Pattern detection in mealy machinePattern detection in mealy machine
Pattern detection in mealy machine
 
Fundamental question and answer in cloud computing quiz by animesh chaturvedi
Fundamental question and answer in cloud computing quiz by animesh chaturvediFundamental question and answer in cloud computing quiz by animesh chaturvedi
Fundamental question and answer in cloud computing quiz by animesh chaturvedi
 
Pumping Lemma and Regular language or not?
Pumping Lemma and Regular language or not?Pumping Lemma and Regular language or not?
Pumping Lemma and Regular language or not?
 
Introduction to Regular Expressions
Introduction to Regular ExpressionsIntroduction to Regular Expressions
Introduction to Regular Expressions
 
Push Down Automata (PDA)
Push Down Automata (PDA)Push Down Automata (PDA)
Push Down Automata (PDA)
 
Minimizing DFA
Minimizing DFAMinimizing DFA
Minimizing DFA
 
Cloud Computing Architecture
Cloud Computing ArchitectureCloud Computing Architecture
Cloud Computing Architecture
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
 
Introduction to Cloud Computing
Introduction to Cloud ComputingIntroduction to Cloud Computing
Introduction to Cloud Computing
 
Class5
Class5Class5
Class5
 
Compiler Engineering Lab#3
Compiler Engineering Lab#3Compiler Engineering Lab#3
Compiler Engineering Lab#3
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Compiler Engineering Lab#1
Compiler Engineering Lab#1Compiler Engineering Lab#1
Compiler Engineering Lab#1
 
Advanced Regular Expressions in .NET
Advanced Regular Expressions in .NETAdvanced Regular Expressions in .NET
Advanced Regular Expressions in .NET
 

Similaire à Regular language and Regular expression

Theory of computing
Theory of computingTheory of computing
Theory of computing
Ranjan Kumar
 

Similaire à Regular language and Regular expression (20)

Theory of computing
Theory of computingTheory of computing
Theory of computing
 
PART A.doc
PART A.docPART A.doc
PART A.doc
 
RegularExpressions.pdf
RegularExpressions.pdfRegularExpressions.pdf
RegularExpressions.pdf
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 02
 
regular expression
regular expressionregular expression
regular expression
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
UNIT_-_II.docx
UNIT_-_II.docxUNIT_-_II.docx
UNIT_-_II.docx
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
Theory of computation Lec2
Theory of computation Lec2Theory of computation Lec2
Theory of computation Lec2
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02
 
Regular expressions h1
Regular expressions h1Regular expressions h1
Regular expressions h1
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
draft
draftdraft
draft
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdf
 
Lex analysis
Lex analysisLex analysis
Lex analysis
 

Plus de Animesh Chaturvedi

Plus de Animesh Chaturvedi (19)

Cloud Platforms & Frameworks
Cloud Platforms & FrameworksCloud Platforms & Frameworks
Cloud Platforms & Frameworks
 
Cloud platforms and frameworks
Cloud platforms and frameworksCloud platforms and frameworks
Cloud platforms and frameworks
 
Cloud service lifecycle management
Cloud service lifecycle managementCloud service lifecycle management
Cloud service lifecycle management
 
Graph Analytics and Complexity Questions and answers
Graph Analytics and Complexity Questions and answersGraph Analytics and Complexity Questions and answers
Graph Analytics and Complexity Questions and answers
 
Advance Systems Engineering Topics
Advance Systems Engineering TopicsAdvance Systems Engineering Topics
Advance Systems Engineering Topics
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
System Development Life Cycle (SDLC)
System Development Life Cycle (SDLC)System Development Life Cycle (SDLC)
System Development Life Cycle (SDLC)
 
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
 
Minimum Spanning Tree (MST), Kruskal's algorithm and Prim's Algorithm, and th...
Minimum Spanning Tree (MST), Kruskal's algorithm and Prim's Algorithm, and th...Minimum Spanning Tree (MST), Kruskal's algorithm and Prim's Algorithm, and th...
Minimum Spanning Tree (MST), Kruskal's algorithm and Prim's Algorithm, and th...
 
C- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutionsC- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutions
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
C - Programming Assignment 1 and 2
C - Programming Assignment 1 and 2C - Programming Assignment 1 and 2
C - Programming Assignment 1 and 2
 
System requirements engineering
System requirements engineeringSystem requirements engineering
System requirements engineering
 
Informatics systems
Informatics systemsInformatics systems
Informatics systems
 
Introduction to Systems Engineering
Introduction to Systems EngineeringIntroduction to Systems Engineering
Introduction to Systems Engineering
 
Big Data Analytics and Ubiquitous computing
Big Data Analytics and Ubiquitous computingBig Data Analytics and Ubiquitous computing
Big Data Analytics and Ubiquitous computing
 
Cloud Platforms and Frameworks
Cloud Platforms and FrameworksCloud Platforms and Frameworks
Cloud Platforms and Frameworks
 
Cloud Service Life-cycle Management
Cloud Service Life-cycle ManagementCloud Service Life-cycle Management
Cloud Service Life-cycle Management
 

Dernier

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Dernier (20)

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 

Regular language and Regular expression

  • 1. Automata Theory and Logic Regular Language & Regular Expression A TUTORIAL BY ANIMESH CHATURVEDI AT INDIAN INSTITUTE OF TECHNOLOGY INDORE (IIT-I)
  • 2. DFA, NFA, Regular Expression (RegEx) and Regular Language (RegLang) A DFA represent a Regular Expression language
  • 3. Regular Expression Regular Language (0 + 10∗) (0∗ 10∗) (0 + ε)(1 + ε) (a + b)* (a + b)* abb (11)* (aa)*(bb)*b (aa + ab + ba +bb)* Language of given Regular Expression? https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
  • 4. Regular Expression Regular Language (0 + 10∗) L = { 0, 1, 10, 100, 1000, 10000, … } (0∗ 10∗) L = {1, 01, 10, 010, 0010, …} (0 + ε)(1 + ε) L = {ε, 0, 1, 01} (a + b)* (a + b)* abb (11)* (aa)*(bb)*b (aa + ab + ba +bb)* Language of given Regular Expression? https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
  • 5. Regular Expression Regular Language (0 + 10∗) L = { 0, 1, 10, 100, 1000, 10000, … } (0∗ 10∗) L = {1, 01, 10, 010, 0010, …} (0 + ε)(1 + ε) L = {ε, 0, 1, 01} (a + b)* Set of strings of a’s and b’s of any length including the null string. So L = { ε, a, b, aa , ab , bb , ba, aaa…….} (a + b)* abb Set of strings of a’s and b’s ending with the string abb. So L = {abb, aabb, babb, aaabb, ababb, …………..} (11)* (aa)*(bb)*b (aa + ab + ba +bb)* Language of given Regular Expression? https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
  • 6. Regular Expression Regular Language (0 + 10∗) L = { 0, 1, 10, 100, 1000, 10000, … } (0∗ 10∗) L = {1, 01, 10, 010, 0010, …} (0 + ε)(1 + ε) L = {ε, 0, 1, 01} (a + b)* Set of strings of a’s and b’s of any length including the null string. So L = { ε, a, b, aa , ab , bb , ba, aaa…….} (a + b)* abb Set of strings of a’s and b’s ending with the string abb. So L = {abb, aabb, babb, aaabb, ababb, …………..} (11)* Set consisting of even number of 1’s including empty string, So L= {ε, 11, 1111, 111111, ……….} (aa)*(bb)*b Set of strings consisting of even number of a’s followed by odd number of b’s , so L = {b, aab, aabbb, aabbbbb, aaaab, aaaabbb, …………..} (aa + ab + ba +bb)* String of a’s and b’s of even length can be obtained by concatenating any combination of the strings aa, ab, ba and bb including null, so L = {aa, ab, ba, bb, aaab, aaba, ………..} Language of given Regular Expression? https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
  • 7. Number of states for a given language Definition of a language L with alphabet {a} is given as following L = {ank | k > 0, and n is a positive integer constant} What is the minimum number of states needed in a DFA to recognize L? Computer Science GATE 2011
  • 8. Number of states for a given language Definition of a language L with alphabet {a} is given as following L = {ank | k > 0, and n is a positive integer constant} What is the minimum number of states needed in a DFA to recognize L? n+1 states are needed in a DFA to recognize L Let n = 3 and k=1 3+1 = 4 states Computer Science GATE 2011
  • 9. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 10. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 11. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 12. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0, 1} ∪ {x ∈ {0, 1}∗ | len(x) ≥ 3} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 13. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0n | ∃k. n = 3k + 1} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 14. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0n | ∃k. n = 3k + 1} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 15. Minimal DFA for a given language Draw a minimal DFA which accepts the same language as a DFA with alphabet ∑ = {0, 1} is given below {0n | ∃k. n = 3k + 1} Konrad Slind Notes on Computation Theory, September 21, 2010
  • 16. Convert NFA to DFA for a given RegEx Construct DFA to accept 00(0+1)* Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 17. Convert NFA to DFA for a given RegEx Construct DFA to accept 00(0+1)* Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 18. Convert NFA to DFA for a given RegEx Construct DFA to accept (0+1)*11 Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 19. Convert NFA to DFA for a given RegEx Construct DFA to accept (0+1)*11 Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 20. Convert NFA to DFA for a given RegEx Construct DFA to accept 00(0+1)*11 Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 21. Convert NFA to DFA for a given RegEx Construct DFA to accept 00(0+1)*11 Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 22. Convert NFA to DFA for a given RegLang Construct DFA to accept L(M)=ε Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 23. Convert NFA to DFA for a given RegLang Construct DFA to accept L(M)=ε Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 24. Convert NFA to DFA for a given RegLang Construct DFA to accept L(M)=Ǿ Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 25. Convert NFA to DFA for a given RegLang Construct DFA to accept L(M)=Ǿ Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 26. Convert NFA to DFA for a given RegLang Construct DFA to accept L(M)=(0+1)* Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 27. Convert NFA to DFA for a given RegLang Construct DFA to accept L(M)=(0+1)* Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 28. Regular Expression What is the language accepted by the NFA for one literal {a} show below? Assume ε is the empty string Computer Science GATE 2012
  • 29. Regular Expression What is the language accepted by the NFA for one literal {a} show below? Assume ε is the empty string Language accepted by NFA is a+, so complement of this language is {є} Computer Science GATE 2012
  • 30. What is the DFA & Regular expression? 30Lexical Analysis by Prof. O. Nierstrasz Example: the set of strings containing an even number of zeros and an even number of ones
  • 31. What is the DFA & Regular expression? 31Lexical Analysis by Prof. O. Nierstrasz Example: the set of strings containing an even number of zeros and an even number of ones
  • 32. What is the DFA & Regular expression? 32Lexical Analysis by Prof. O. Nierstrasz Example: the set of strings containing an even number of zeros and an even number of ones The RE is (0011)*((0110)(0011)*(0110)(0011)*)*
  • 33. Draw NFA for given regular expressions 33Lexical Analysis by Prof. O. Nierstrasz For the RE (a|b)*abb ?
  • 34. Draw NFA for given regular expressions 34Lexical Analysis by Prof. O. Nierstrasz For the RE (a|b)*abb ?
  • 35. Draw NFA for given regular expressions 35 For the RE (a|b)*abb ? State s0 has multiple transitions on a! It is a non-deterministic finite automaton Lexical Analysis by Prof. O. Nierstrasz
  • 36. 36 A language is regular if it is recognized by a deterministic finite automaton Whether L = { w | w contains 001} is regular or not? Check it by building an automaton accepts all and only those strings that contain 001 Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
  • 37. 37 q q00 1 0 1 q0 q001 0 0 1 0,1 A language is regular if it is recognized by a deterministic finite automaton Whether L = { w | w contains 001} is regular or not? Check it by building an automaton accepts all and only those strings that contain 001 Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
  • 38. A language is regular if it is recognized by a deterministic finite automaton Whether L = { w | w has an even number of 1s} is regular or not? Check it by building an automaton accepts all and only those strings that has an even number of 1s Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
  • 39. A language is regular if it is recognized by a deterministic finite automaton q0 q1 0 0 1 1 Whether L = { w | w has an even number of 1s} is regular or not? Check it by building an automaton accepts all and only those strings that has an even number of 1s Steven Rudich: www.cs.cmu.edu/~rudich rudich0123456789
  • 40. References https://www.tutorialspoint.com/automata_theory/regular_expressions.htm Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University http://www.cs.tau.ac.il/~orilahav/CompModelFall10/Compute2-print.pdf Slide by: Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf Slide by Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt Prof. Shunichi Toida http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-2-dfa.html Konrad Slind Notes on Computation Theory, September 21, 2010 Lexical Analysis by Prof. O. Nierstrasz GATE (Graduate Aptitude Test of Engineering) jointly conducted by IIT’s