SlideShare a Scribd company logo
1 of 18
Download to read offline
Automata Theory and Logic:
NFA to DFA
A TUTORIAL
BY
ANIMESH CHATURVEDI
AT
INDIAN INSTITUTE OF TECHNOLOGY INDORE (IIT-I)
Non-Deterministic Finite Automata (NFA)
an NFA may have more than one transition labeled with a certain symbol
an NFA may have no transitions labeled with a certain symbol
transitions may be labeled with ε, the empty string.
NFAs are usually easier to design than equivalent DFAs
Every DFA is also a non-deterministic finite automata (NFA)
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
NFA
Q = {q1, q2, q3, q4}, Σ = {0, 1},
δ is
q1 is the start state, and F = {q4}.
0 1 ε
q1 {q1, q2} {q1} Ø
q2 {q3} Ø {q3}
q3 Ø {q4} Ø
q4 {q4} {q4} Ø
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
NFA v/s DFA
DFA: For every string x, there is a unique path from initial state and associated with x.
x is accepted if and only if this path ends at a final state.
NFA: For any string x, there may exist none or more than one path from initial state and
associated with x.
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Expressive power of DFA and NFA
Deterministic finite automata (DFA) and Non-deterministic finite automata (NFA) have same
expressive power.
Given an NFA N, then we construct a DFA M, that accepts the same language
Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
Convert NFA to DFA
Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
Convert NFA to DFA
Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
Convert NFA to DFA
Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
Convert NFA to DFA
Prof. Shunichi Toida http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-2-dfa.html
Convert NFA to DFA
Prof. Shunichi Toida http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-2-dfa.html
Convert NFA to DFA
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
Convert NFA to DFA
Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
DFA to Minimal DFA
Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
Up Next
A DFA represent a Regular Expression language
DFA or NDFA has less expressive power than Deterministic push down automata (DPDA)
References
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
NFA to DFA

More Related Content

What's hot

What's hot (20)

Finite automata
Finite automataFinite automata
Finite automata
 
COMPILER DESIGN
COMPILER DESIGNCOMPILER DESIGN
COMPILER DESIGN
 
Nfa vs dfa
Nfa vs dfaNfa vs dfa
Nfa vs dfa
 
Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
 
1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Multi Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing MachineMulti Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing Machine
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
NFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushikNFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushik
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
 

Viewers also liked

Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
rawan_z
 

Viewers also liked (19)

optimization of DFA
optimization of DFAoptimization of DFA
optimization of DFA
 
Optimization of dfa
Optimization of dfaOptimization of dfa
Optimization of dfa
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / Translators
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsing
 
DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwares
 
Dfa vs nfa
Dfa vs nfaDfa vs nfa
Dfa vs nfa
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Language translator
Language translatorLanguage translator
Language translator
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Code generation
Code generationCode generation
Code generation
 

More from Animesh Chaturvedi

More from Animesh Chaturvedi (20)

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
 
Push Down Automata (PDA)
Push Down Automata (PDA)Push Down Automata (PDA)
Push Down Automata (PDA)
 

Recently uploaded

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
 

Recently uploaded (20)

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
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
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
 
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, ...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
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...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
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
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
(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
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

NFA to DFA

  • 1. Automata Theory and Logic: NFA to DFA A TUTORIAL BY ANIMESH CHATURVEDI AT INDIAN INSTITUTE OF TECHNOLOGY INDORE (IIT-I)
  • 2. Non-Deterministic Finite Automata (NFA) an NFA may have more than one transition labeled with a certain symbol an NFA may have no transitions labeled with a certain symbol transitions may be labeled with ε, the empty string. NFAs are usually easier to design than equivalent DFAs Every DFA is also a non-deterministic finite automata (NFA) 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
  • 3. NFA Q = {q1, q2, q3, q4}, Σ = {0, 1}, δ is q1 is the start state, and F = {q4}. 0 1 ε q1 {q1, q2} {q1} Ø q2 {q3} Ø {q3} q3 Ø {q4} Ø q4 {q4} {q4} Ø 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
  • 4. NFA v/s DFA DFA: For every string x, there is a unique path from initial state and associated with x. x is accepted if and only if this path ends at a final state. NFA: For any string x, there may exist none or more than one path from initial state and associated with x. Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 5. Expressive power of DFA and NFA Deterministic finite automata (DFA) and Non-deterministic finite automata (NFA) have same expressive power. Given an NFA N, then we construct a DFA M, that accepts the same language Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
  • 6. Convert NFA to DFA Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
  • 7. Convert NFA to DFA Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
  • 8. Convert NFA to DFA Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
  • 9. Convert NFA to DFA Prof. Shunichi Toida http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-2-dfa.html
  • 10. Convert NFA to DFA Prof. Shunichi Toida http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-2-dfa.html
  • 11. Convert NFA to DFA Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 12. Convert NFA to DFA Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 13. Convert NFA to DFA Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 14. Convert NFA to DFA Dr. Ding-Zhu Du http://www.utdallas.edu/~dzdu/cs4384/lect7.ppt
  • 15. DFA to Minimal DFA Dr. Harry H. Porter http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
  • 16. Up Next A DFA represent a Regular Expression language DFA or NDFA has less expressive power than Deterministic push down automata (DPDA)
  • 17. References 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