SlideShare a Scribd company logo
1 of 23
DFA Minimization
Jeremy Mange
CS 6800
Summer 2009
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) )
Possible Exam Question
 Question: Inductively define when two states in a
DFA are distinct.
 Answer:
 Two states p and q are distinct if
 p F and q F or vice versa, or
 for some α Σ, δ(p, α) and δ(q, α) are distinct
 

References
 Ullman, A. V., Hopcroft, J. E. and Ullman, J. D. (1974) The Design and
Analysis of Computer Algorithms. Addison-Wesley.
 Hopcroft, J. (1971) An N Log N Algorithm for Minimizing States in a Finite
Automaton. Stanford University.
 Parthasarathy, M. and Fleck, M. (2007) DFA Minimization. University of
Illinois at Urbana-Champaign.
http://www.cs.uiuc.edu/class/fa07/cs273/Handouts/minimization/minimization.pdf

More Related Content

Similar to DFA_Minimization for engineering students.ppt

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
 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxamara jyothi
 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxranjan317165
 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsRushabh2428
 
Finite Automata
Finite AutomataFinite Automata
Finite Automataparmeet834
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdfFariyaTasneem1
 
Chapter 2 limits of DFA NDFA.ppt
Chapter 2  limits of DFA  NDFA.pptChapter 2  limits of DFA  NDFA.ppt
Chapter 2 limits of DFA NDFA.pptArwaKhallouf
 
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 DiagramAbdullah Jan
 
finiteautomata-160104102657.pptx
finiteautomata-160104102657.pptxfiniteautomata-160104102657.pptx
finiteautomata-160104102657.pptxStudyvAbhi
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).pptssuser47f7f2
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.pptRohitPaul71
 
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
 
MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptxamara jyothi
 

Similar to DFA_Minimization for engineering students.ppt (20)

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
 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
 
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptxFiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and Problems
 
Finite automata
Finite automataFinite automata
Finite automata
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
Econ501a l11
Econ501a l11Econ501a l11
Econ501a l11
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
 
Chapter 2 limits of DFA NDFA.ppt
Chapter 2  limits of DFA  NDFA.pptChapter 2  limits of DFA  NDFA.ppt
Chapter 2 limits of DFA NDFA.ppt
 
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
 
finiteautomata-160104102657.pptx
finiteautomata-160104102657.pptxfiniteautomata-160104102657.pptx
finiteautomata-160104102657.pptx
 
optimization of DFA
optimization of DFAoptimization of DFA
optimization of DFA
 
Laplace
LaplaceLaplace
Laplace
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
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
 
MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptx
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
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 RecordAsst.prof M.Gokilavani
 
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 workingrknatarajan
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

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
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
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
 
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
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

DFA_Minimization for engineering students.ppt

  • 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) )
  • 22. Possible Exam Question  Question: Inductively define when two states in a DFA are distinct.  Answer:  Two states p and q are distinct if  p F and q F or vice versa, or  for some α Σ, δ(p, α) and δ(q, α) are distinct   
  • 23. References  Ullman, A. V., Hopcroft, J. E. and Ullman, J. D. (1974) The Design and Analysis of Computer Algorithms. Addison-Wesley.  Hopcroft, J. (1971) An N Log N Algorithm for Minimizing States in a Finite Automaton. Stanford University.  Parthasarathy, M. and Fleck, M. (2007) DFA Minimization. University of Illinois at Urbana-Champaign. http://www.cs.uiuc.edu/class/fa07/cs273/Handouts/minimization/minimization.pdf