SlideShare uma empresa Scribd logo
1 de 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 DFA

Mais conteúdo relacionado

Mais procurados

Push down automata
Push down automataPush down automata
Push down automata
Somya Bagai
 

Mais procurados (20)

Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
 
Clipping
ClippingClipping
Clipping
 
Visible surface identification
Visible surface identificationVisible surface identification
Visible surface identification
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Transport layer
Transport layerTransport layer
Transport layer
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptx
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
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
 
Chapter 2 Time boxing & agile models
Chapter 2   Time boxing & agile modelsChapter 2   Time boxing & agile models
Chapter 2 Time boxing & agile models
 
push down automata
push down automatapush down automata
push down automata
 
10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Finite automata
Finite automataFinite automata
Finite automata
 
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
 
Finite automata
Finite automataFinite automata
Finite automata
 
Push down automata
Push down automataPush down automata
Push down automata
 
11. Hashing - Data Structures using C++ by Varsha Patil
11. Hashing - Data Structures using C++ by Varsha Patil11. Hashing - Data Structures using C++ by Varsha Patil
11. Hashing - Data Structures using C++ by Varsha Patil
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 

Destaque

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

Destaque (17)

Dfa vs nfa
Dfa vs nfaDfa vs nfa
Dfa vs nfa
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsing
 
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
 
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
 

Semelhante a optimization of DFA

Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2
bolovv
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)
bolovv
 
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
 

Semelhante a optimization of DFA (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(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
 
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
 

Mais de 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
 

Último

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

optimization of DFA

  • 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}