SlideShare a Scribd company logo
1 of 21
Optimization of DFA
Subject: Compiler design
CE-B
 Maulik Togadiya 130240107090
Introduction
 Minimization/optimization of a deterministic finite automaton refers to the
detection of those states of a DFA, whose presence or absence in a DFA does
not affect the language accepted by the automata.
 The states that can be eliminated from automata, without affecting the
language accepted
by automata, are:
▪Unreachable or inaccessible states.
▪Dead states.
▪Non-distinguishable or indistinguishable state or equivalent states.
Minimizing DFA’s
 Lots of methods
 All involve finding equivalent states:
 States that go to equivalent states under all inputs
Minimizing DFA’s by Partitioning
 Consider the following DFA:
 Accepting states are yellow
 Non-accepting states are blue
 S2 and S7 are really the same:
 Both Final states
 Both go to S6 under input b
 Both go to S3 under an a
 S0 and S5 really the same.
 We can merge equivalent states into 1 state.
Partitioning Algorithm
 First
Divide the set of states into
 Final and
 Non-final states
Partition I
Partition II
a b
S0 S1 S4
S1 S5 S2
S3 S3 S3
S4 S1 S4
S5 S1 S4
S6 S3 S7
*S2 S3 S6
*S7 S3 S6
Partitioning Algorithm
 Now
 See if states in each partition each go to the
same partition
 S1 & S6 are different from the rest of the states
in Partition I(but like each other)
 We will move them to their own partition
a b
S0 S1 I S4 I
S1 S5 I S2 II
S3 S3 I S3 I
S4 S1 I S4 I
S5 S1 I S4 I
S6 S3 I S7 II
*S2 S3 I S6 I
*S7 S3 I S6 I
Partitioning Algorithm
a b
S0 S1 S4
S5 S1 S4
S3 S3 S3
S4 S1 S4
S1 S5 S2
S6 S3 S7
*S2 S3 S6
*S7 S3 S6
Partitioning Algorithm
 Now again
 See if states in each partition each
go to the same partition
 In Partition I, S3 goes
to a different partition
from S0, S5 and S4
 We’ll move S3 to its own partition
a b
S0 S1 III S4 I
S5 S1 III S4 I
S3 S3 I S3 I
S4 S1 III S4 I
S1 S5 I S2 II
S6 S3 I S7 II
*S2 S3 I S6 III
*S7 S3 I S6 III
Partitioning Algorithm
Note changes in S6, S2 and S7
a b
S0 S1 III S4 I
S5 S1 III S4 I
S4 S1 III S4 I
S3 S3 IV S3 IV
S1 S5 I S2 II
S6 S3 IV S7 II
*S2 S3 IV S6 III
*S7 S3 IV S6 III
Partitioning Algorithm
 Now S6 goes to a different partition on an
a from S1
 S6 gets its own partition.
 We now have 5 partitions
 Note changes in S2 and S7
a b
S0 S1 III S4 I
S5 S1 III S4 I
S4 S1 III S4 I
S3 S3 IV S3 IV
S1 S5 I S2 II
S6 S3 IV S7 II
*S2 S3 IV S6 V
*S7 S3 IV S6 V
Partitioning Algorithm
 All states within each of the 5 partitions are
identical.
 We might as well call the states I, II III, IV
and V.
a b
S0 S1 III S4 I
S5 S1 III S4 I
S4 S1 III S4 I
S3 S3 IV S3 IV
S1 S5 I S2 II
S6 S3 IV S7 II
*S2 S3 IV S6 V
*S7 S3 IV S6 V
Partitioning Algorithm
 Here we are
a b
I III I
*II IV V
III I II
IV IV IV
V IV II
 Minimized DFA
V
a
a
aa a
b
b
b
b
b
b
Myphill-Nerode Theorem
Step 1 Draw a table for all pairs of states (Qi, Qj) not
necessarily connected directly [All are
unmarked initially]
Step 2 Consider every state pair (Qi, Qj) in the DFA
where Qi ∈ F and Qj ∉ F or vice versa and
mark them. [Here F is the set of final states].
Step 3 Repeat this step until we cannot mark
anymore states −
If there is an unmarked pair (Qi, Qj), mark it
if the pair {δ(Qi, A), δ (Qi, A)} is marked for
some input alphabet.
Step 4 Combine all the unmarked pair (Qi, Qj) and
make them a single state in the reduced DFA.
Example
 Consider the following DFA
 Step 1 − We draw a table for all pair of states.
 Step 2 − We mark the state pairs −
 Step 3 − We will try to mark the state pairs, with green colored check mark,
transitively. If we input 1 to state ‘a’ and ‘f’, it will go to state ‘c’ and ‘f’
respectively. (c, f) is already marked, hence we will mark pair (a, f). Now, we
input 1 to state ‘b’ and ‘f’; it will go to state ‘d’ and ‘f’ respectively. (d, f) is
already marked, hence we will mark pair (b, f).
 After step 3, we have got state combinations {a, b} {c, d} {c, e} {d, e} that are
unmarked.
 We can recombine {c, d} {c, e} {d, e} into {c, d, e}
 Hence we got two combined states as − {a, b} and {c, d, e}
 So the final minimized DFA will contain three states {f}, {a, b} and {c, d, e}
Optimization of DFAs Using Partitioning and Myhill-Nerode Theorem

More Related Content

What's hot

Decision making in JAVA
Decision making in JAVADecision making in JAVA
Decision making in JAVAHamna_sheikh
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite AutomataRatnakar Mikkili
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusemailharmeet
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programmingKamal Acharya
 
Database system environment ppt.
Database system environment ppt.Database system environment ppt.
Database system environment ppt.yhen06
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingHemantha Kulathilake
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design MAHASREEM
 
Peephole optimization techniques
Peephole optimization techniquesPeephole optimization techniques
Peephole optimization techniquesgarishma bhatia
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation LanguageJas Singh Bhasin
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programmingsavitamhaske
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler designRiazul Islam
 
Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)Niloy Biswas
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancyVisakh V
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)Naman Joshi
 
File systems versus a dbms
File systems versus a dbmsFile systems versus a dbms
File systems versus a dbmsRituBhargava7
 

What's hot (20)

Decision making in JAVA
Decision making in JAVADecision making in JAVA
Decision making in JAVA
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
Lecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculusLecture 06 relational algebra and calculus
Lecture 06 relational algebra and calculus
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
 
Database system environment ppt.
Database system environment ppt.Database system environment ppt.
Database system environment ppt.
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological Parsing
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Peephole optimization techniques
Peephole optimization techniquesPeephole optimization techniques
Peephole optimization techniques
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler design
 
Acid properties
Acid propertiesAcid properties
Acid properties
 
Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)
 
16 virtual function
16 virtual function16 virtual function
16 virtual function
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancy
 
Finite automata
Finite automataFinite automata
Finite automata
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
 
File systems versus a dbms
File systems versus a dbmsFile systems versus a dbms
File systems versus a dbms
 

Viewers also liked

Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsingkunj desai
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresNisarg Amin
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / TranslatorsProject Student
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical AnalysisMunni28
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automatadeepinderbedi
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generationrawan_z
 
Language translator
Language translatorLanguage translator
Language translatorasmakh89
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generationRamchandraRegmi
 

Viewers also liked (20)

Dfa vs nfa
Dfa vs nfaDfa vs nfa
Dfa vs nfa
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsing
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwares
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / Translators
 
DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
 
Optimization of dfa
Optimization of dfaOptimization of dfa
Optimization of dfa
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
Nfa vs dfa
Nfa vs dfaNfa vs dfa
Nfa vs dfa
 
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
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
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
 
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
 

Similar to Optimization of DFAs Using Partitioning and Myhill-Nerode Theorem

Lecture 17- F19.pdf
Lecture 17- F19.pdfLecture 17- F19.pdf
Lecture 17- F19.pdfAbrar11535
 
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...parmeet834
 
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
 
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
 
Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2bolovv
 
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
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)bolovv
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfSergioUlisesRojasAla
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler DesignBabu Pushkaran
 
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...venkatapranaykumarGa
 

Similar to Optimization of DFAs Using Partitioning and Myhill-Nerode Theorem (20)

Ch4b
Ch4bCh4b
Ch4b
 
Lecture 17- F19.pdf
Lecture 17- F19.pdfLecture 17- F19.pdf
Lecture 17- F19.pdf
 
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
 
Hwsoln03 toc
Hwsoln03 tocHwsoln03 toc
Hwsoln03 toc
 
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
 
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
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2
 
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
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)
 
Lecture4 lexical analysis2
Lecture4 lexical analysis2Lecture4 lexical analysis2
Lecture4 lexical analysis2
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdf
 
Compiler Design Material 2
Compiler Design Material 2Compiler Design Material 2
Compiler Design Material 2
 
Pcd(Mca)
Pcd(Mca)Pcd(Mca)
Pcd(Mca)
 
PCD ?s(MCA)
PCD ?s(MCA)PCD ?s(MCA)
PCD ?s(MCA)
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler Design
 
Pcd(Mca)
Pcd(Mca)Pcd(Mca)
Pcd(Mca)
 
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 

More from Maulik Togadiya

Information and Network Security
Information and Network SecurityInformation and Network Security
Information and Network SecurityMaulik Togadiya
 
Multiple Access in wireless communication
Multiple Access in wireless communicationMultiple Access in wireless communication
Multiple Access in wireless communicationMaulik Togadiya
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architectureMaulik Togadiya
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFAMaulik Togadiya
 

More from Maulik Togadiya (8)

Information and Network Security
Information and Network SecurityInformation and Network Security
Information and Network Security
 
Data mining
Data miningData mining
Data mining
 
Multiple Access in wireless communication
Multiple Access in wireless communicationMultiple Access in wireless communication
Multiple Access in wireless communication
 
Turing machine-TOC
Turing machine-TOCTuring machine-TOC
Turing machine-TOC
 
Select query in JDBC
Select query in JDBCSelect query in JDBC
Select query in JDBC
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architecture
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFA
 
Computer networking
Computer networkingComputer networking
Computer networking
 

Recently uploaded

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 

Recently uploaded (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 

Optimization of DFAs Using Partitioning and Myhill-Nerode Theorem

  • 1. Optimization of DFA Subject: Compiler design CE-B  Maulik Togadiya 130240107090
  • 2. Introduction  Minimization/optimization of a deterministic finite automaton refers to the detection of those states of a DFA, whose presence or absence in a DFA does not affect the language accepted by the automata.  The states that can be eliminated from automata, without affecting the language accepted by automata, are: ▪Unreachable or inaccessible states. ▪Dead states. ▪Non-distinguishable or indistinguishable state or equivalent states.
  • 3. Minimizing DFA’s  Lots of methods  All involve finding equivalent states:  States that go to equivalent states under all inputs
  • 4. Minimizing DFA’s by Partitioning  Consider the following DFA:  Accepting states are yellow  Non-accepting states are blue
  • 5.  S2 and S7 are really the same:  Both Final states  Both go to S6 under input b  Both go to S3 under an a  S0 and S5 really the same.  We can merge equivalent states into 1 state.
  • 6. Partitioning Algorithm  First Divide the set of states into  Final and  Non-final states Partition I Partition II a b S0 S1 S4 S1 S5 S2 S3 S3 S3 S4 S1 S4 S5 S1 S4 S6 S3 S7 *S2 S3 S6 *S7 S3 S6
  • 7. Partitioning Algorithm  Now  See if states in each partition each go to the same partition  S1 & S6 are different from the rest of the states in Partition I(but like each other)  We will move them to their own partition a b S0 S1 I S4 I S1 S5 I S2 II S3 S3 I S3 I S4 S1 I S4 I S5 S1 I S4 I S6 S3 I S7 II *S2 S3 I S6 I *S7 S3 I S6 I
  • 8. Partitioning Algorithm a b S0 S1 S4 S5 S1 S4 S3 S3 S3 S4 S1 S4 S1 S5 S2 S6 S3 S7 *S2 S3 S6 *S7 S3 S6
  • 9. Partitioning Algorithm  Now again  See if states in each partition each go to the same partition  In Partition I, S3 goes to a different partition from S0, S5 and S4  We’ll move S3 to its own partition a b S0 S1 III S4 I S5 S1 III S4 I S3 S3 I S3 I S4 S1 III S4 I S1 S5 I S2 II S6 S3 I S7 II *S2 S3 I S6 III *S7 S3 I S6 III
  • 10. Partitioning Algorithm Note changes in S6, S2 and S7 a b S0 S1 III S4 I S5 S1 III S4 I S4 S1 III S4 I S3 S3 IV S3 IV S1 S5 I S2 II S6 S3 IV S7 II *S2 S3 IV S6 III *S7 S3 IV S6 III
  • 11. Partitioning Algorithm  Now S6 goes to a different partition on an a from S1  S6 gets its own partition.  We now have 5 partitions  Note changes in S2 and S7 a b S0 S1 III S4 I S5 S1 III S4 I S4 S1 III S4 I S3 S3 IV S3 IV S1 S5 I S2 II S6 S3 IV S7 II *S2 S3 IV S6 V *S7 S3 IV S6 V
  • 12. Partitioning Algorithm  All states within each of the 5 partitions are identical.  We might as well call the states I, II III, IV and V. a b S0 S1 III S4 I S5 S1 III S4 I S4 S1 III S4 I S3 S3 IV S3 IV S1 S5 I S2 II S6 S3 IV S7 II *S2 S3 IV S6 V *S7 S3 IV S6 V
  • 13. Partitioning Algorithm  Here we are a b I III I *II IV V III I II IV IV IV V IV II
  • 14.  Minimized DFA V a a aa a b b b b b b
  • 15. Myphill-Nerode Theorem Step 1 Draw a table for all pairs of states (Qi, Qj) not necessarily connected directly [All are unmarked initially] Step 2 Consider every state pair (Qi, Qj) in the DFA where Qi ∈ F and Qj ∉ F or vice versa and mark them. [Here F is the set of final states]. Step 3 Repeat this step until we cannot mark anymore states − If there is an unmarked pair (Qi, Qj), mark it if the pair {δ(Qi, A), δ (Qi, A)} is marked for some input alphabet. Step 4 Combine all the unmarked pair (Qi, Qj) and make them a single state in the reduced DFA.
  • 16. Example  Consider the following DFA
  • 17.  Step 1 − We draw a table for all pair of states.
  • 18.  Step 2 − We mark the state pairs −
  • 19.  Step 3 − We will try to mark the state pairs, with green colored check mark, transitively. If we input 1 to state ‘a’ and ‘f’, it will go to state ‘c’ and ‘f’ respectively. (c, f) is already marked, hence we will mark pair (a, f). Now, we input 1 to state ‘b’ and ‘f’; it will go to state ‘d’ and ‘f’ respectively. (d, f) is already marked, hence we will mark pair (b, f).
  • 20.  After step 3, we have got state combinations {a, b} {c, d} {c, e} {d, e} that are unmarked.  We can recombine {c, d} {c, e} {d, e} into {c, d, e}  Hence we got two combined states as − {a, b} and {c, d, e}  So the final minimized DFA will contain three states {f}, {a, b} and {c, d, e}