SlideShare uma empresa Scribd logo
1 de 21
Minimization of DFA
• Name: Kunj Desai
• Enrollment No.:140950107022
• Branch: CSE-A
• Year : 2017
DFA
• Deterministic Finite Automata (DFSA)
• (Q, Σ, δ, q0, F)
• Q – (finite) set of states
• Σ – alphabet – (finite) set of input symbols
• δ – transition function
• q0 – start state
• F – set of final / accepting states
DFA
• Often representing as a diagram:
DFA Minimization
• Some states can be redundant:
• The following DFA accepts (a|b)+
• State s1 is not necessary
DFA Minimization
• So these two DFAs are equivalent:
DFA Minimization
• This is a state-minimized (or just minimized) DFA
• Every remaining state is necessary
DFA Minimization
• The task of DFA minimization, then, is to automatically transform a
given DFA into a state-minimized DFA
• Several algorithms and variants are known
• Note that this also in effect can minimize an NFA (since we know algorithm
to convert NFA to DFA)
DFA Minimization Algorithm
• Recall that a DFA M=(Q, Σ, δ, q0, F)
• Two states p and q are distinct if
• p in F and q not in F or vice versa, or
• for some α in Σ, δ(p, α) and δ(q, α) are distinct
• Using this inductive definition, we can calculate which states are
distinct
DFA Minimization Algorithm
• Create lower-triangular table DISTINCT, initially blank
• For every pair of states (p,q):
• If p is final and q is not, or vice versa
• DISTINCT(p,q) = ε
• Loop until no change for an iteration:
• For every pair of states (p,q) and each symbol α
• If DISTINCT(p,q) is blank and
DISTINCT( δ(p,α), δ(q,α) ) is not blank
• DISTINCT(p,q) = α
• Combine all states that are not distinct
Very Simple Example
s0
s1
s2
s0 s1 s2
Very Simple Example
s0
s1 ε
s2 ε
s0 s1 s2
Label pairs with ε where one is a final state and the other is not
Very Simple Example
s0
s1 ε
s2 ε
s0 s1 s2
Main loop (no changes occur)
Very Simple Example
s0
s1 ε
s2 ε
s0 s1 s2
DISTINCT(s1, s2) is empty, so s1 and s2 are equivalent states
Very Simple Example
Merge s1 and s2
More Complex Example
More Complex Example
•Check for pairs with one state final and one not:
More Complex Example
• First iteration of main loop:
More Complex Example
• Second iteration of main loop:
More Complex Example
• Third iteration makes no changes
• Blank cells are equivalent pairs of states
More Complex Example
•Combine equivalent states for minimized DFA:
Conclusion
• DFA Minimization is a fairly understandable process, and is useful in
several areas
• Regular expression matching implementation
• Very similar algorithm is used for compiler optimization to eliminate
duplicate computations
• The algorithm described is O(kn2
)
• John Hopcraft describes another more complex algorithm that is O(k (n log n)
)

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Pda
PdaPda
Pda
 
Pushdown Automata Theory
Pushdown Automata TheoryPushdown Automata Theory
Pushdown Automata Theory
 
Finite automata
Finite automataFinite automata
Finite automata
 
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
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Minimization of DFA.pptx
Minimization of DFA.pptxMinimization of DFA.pptx
Minimization of DFA.pptx
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Push down automata
Push down automataPush down automata
Push down automata
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
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
 
Simplification of cfg ppt
Simplification of cfg pptSimplification of cfg ppt
Simplification of cfg ppt
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 

Destaque

Destaque (19)

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

Semelhante a Minimization of DFA

DFA_Minimization_Presentation_uploaded.pdf
DFA_Minimization_Presentation_uploaded.pdfDFA_Minimization_Presentation_uploaded.pdf
DFA_Minimization_Presentation_uploaded.pdfAnandaSaikia1
 
DFA_Minimization for engineering students.ppt
DFA_Minimization for engineering students.pptDFA_Minimization for engineering students.ppt
DFA_Minimization for engineering students.pptAnandaSaikia1
 
minimization the number of states of DFA
minimization the number of states of DFAminimization the number of states of DFA
minimization the number of states of DFAArchana Gopinath
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).pptssuser47f7f2
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.pptRohitPaul71
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaRushabh2428
 
CS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptxCS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptxALIZAIB KHAN
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Akila Krishnamoorthy
 
Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsRushabh2428
 
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 1Srimatre K
 
Materi 3 Finite State Automata
Materi 3   Finite State AutomataMateri 3   Finite State Automata
Materi 3 Finite State Automataahmad haidaroh
 
Finite Automata
Finite AutomataFinite Automata
Finite Automataparmeet834
 
1. finite_automata_new.ppt
1. finite_automata_new.ppt1. finite_automata_new.ppt
1. finite_automata_new.pptSanthoshS508159
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauagesdanhumble
 

Semelhante a Minimization of DFA (20)

DFA_Minimization_Presentation_uploaded.pdf
DFA_Minimization_Presentation_uploaded.pdfDFA_Minimization_Presentation_uploaded.pdf
DFA_Minimization_Presentation_uploaded.pdf
 
DFA_Minimization for engineering students.ppt
DFA_Minimization for engineering students.pptDFA_Minimization for engineering students.ppt
DFA_Minimization for engineering students.ppt
 
minimization the number of states of DFA
minimization the number of states of DFAminimization the number of states of DFA
minimization the number of states of DFA
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
 
CS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptxCS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptx
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)
 
Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite Acceptors
 
Automata
AutomataAutomata
Automata
 
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
 
Dfa
DfaDfa
Dfa
 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
Materi 3 Finite State Automata
Materi 3   Finite State AutomataMateri 3   Finite State Automata
Materi 3 Finite State Automata
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Model checking
Model checkingModel checking
Model checking
 
1. finite_automata_new.ppt
1. finite_automata_new.ppt1. finite_automata_new.ppt
1. finite_automata_new.ppt
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauages
 

Mais de kunj desai

OLAP operations
OLAP operationsOLAP operations
OLAP operationskunj desai
 
Loaders and Linkers
Loaders and LinkersLoaders and Linkers
Loaders and Linkerskunj desai
 
Introduction to 8085 microprocessor
Introduction to 8085 microprocessorIntroduction to 8085 microprocessor
Introduction to 8085 microprocessorkunj desai
 
Custom Controls in ASP.net
Custom Controls in ASP.netCustom Controls in ASP.net
Custom Controls in ASP.netkunj desai
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Modelkunj desai
 
Requirement specification (SRS)
Requirement specification (SRS)Requirement specification (SRS)
Requirement specification (SRS)kunj desai
 
php databse handling
php databse handlingphp databse handling
php databse handlingkunj desai
 
Concept of constructors
Concept of constructorsConcept of constructors
Concept of constructorskunj desai
 

Mais de kunj desai (9)

OLAP operations
OLAP operationsOLAP operations
OLAP operations
 
Loaders and Linkers
Loaders and LinkersLoaders and Linkers
Loaders and Linkers
 
Binary Search
Binary SearchBinary Search
Binary Search
 
Introduction to 8085 microprocessor
Introduction to 8085 microprocessorIntroduction to 8085 microprocessor
Introduction to 8085 microprocessor
 
Custom Controls in ASP.net
Custom Controls in ASP.netCustom Controls in ASP.net
Custom Controls in ASP.net
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 
Requirement specification (SRS)
Requirement specification (SRS)Requirement specification (SRS)
Requirement specification (SRS)
 
php databse handling
php databse handlingphp databse handling
php databse handling
 
Concept of constructors
Concept of constructorsConcept of constructors
Concept of constructors
 

Último

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 

Último (20)

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 

Minimization of DFA

  • 1. Minimization of DFA • Name: Kunj Desai • Enrollment No.:140950107022 • Branch: CSE-A • Year : 2017
  • 2. DFA • Deterministic Finite Automata (DFSA) • (Q, Σ, δ, q0, F) • Q – (finite) set of states • Σ – alphabet – (finite) set of input symbols • δ – transition function • q0 – start state • F – set of final / accepting states
  • 4. DFA Minimization • Some states can be redundant: • The following DFA accepts (a|b)+ • State s1 is not necessary
  • 5. DFA Minimization • So these two DFAs are equivalent:
  • 6. DFA Minimization • This is a state-minimized (or just minimized) DFA • Every remaining state is necessary
  • 7. DFA Minimization • The task of DFA minimization, then, is to automatically transform a given DFA into a state-minimized DFA • Several algorithms and variants are known • Note that this also in effect can minimize an NFA (since we know algorithm to convert NFA to DFA)
  • 8. DFA Minimization Algorithm • Recall that a DFA M=(Q, Σ, δ, q0, F) • Two states p and q are distinct if • p in F and q not in F or vice versa, or • for some α in Σ, δ(p, α) and δ(q, α) are distinct • Using this inductive definition, we can calculate which states are distinct
  • 9. DFA Minimization Algorithm • Create lower-triangular table DISTINCT, initially blank • For every pair of states (p,q): • If p is final and q is not, or vice versa • DISTINCT(p,q) = ε • Loop until no change for an iteration: • For every pair of states (p,q) and each symbol α • If DISTINCT(p,q) is blank and DISTINCT( δ(p,α), δ(q,α) ) is not blank • DISTINCT(p,q) = α • Combine all states that are not distinct
  • 11. Very Simple Example s0 s1 ε s2 ε s0 s1 s2 Label pairs with ε where one is a final state and the other is not
  • 12. Very Simple Example s0 s1 ε s2 ε s0 s1 s2 Main loop (no changes occur)
  • 13. Very Simple Example s0 s1 ε s2 ε s0 s1 s2 DISTINCT(s1, s2) is empty, so s1 and s2 are equivalent states
  • 16. More Complex Example •Check for pairs with one state final and one not:
  • 17. More Complex Example • First iteration of main loop:
  • 18. More Complex Example • Second iteration of main loop:
  • 19. More Complex Example • Third iteration makes no changes • Blank cells are equivalent pairs of states
  • 20. More Complex Example •Combine equivalent states for minimized DFA:
  • 21. Conclusion • DFA Minimization is a fairly understandable process, and is useful in several areas • Regular expression matching implementation • Very similar algorithm is used for compiler optimization to eliminate duplicate computations • The algorithm described is O(kn2 ) • John Hopcraft describes another more complex algorithm that is O(k (n log n) )