SlideShare a Scribd company logo
1 of 37
Download to read offline
1
Theory Of Automata and
Formal languages (CS-536)
(Lecture 17)
______________________________________________________
GIMS- PMAS Arid Agriculture University, Gujrat Campus
2
Kleene’s Theorem
 If a language can be expressed by
1. FA or
2. TG or
3. RE or
4. NFA/ NFA-epsilon
then it can also be expressed by other three
as well.
NFA to FA
Method as per discussed in class i.e. from the
notes
3
4
NFA → DFA Construction
 The algorithm is called subset construction.
 In the transition table of an NFA, each entry is
a set of states.
 In DFA, each entry is a single state
5
NFA → DFA Construction
The general idea behind
NFA-to-DFA construction is
that each DFA state
corresponds to a set of
NFA states.
6
NFA → DFA Construction
The DFA uses its state to
keep track of all possible
states the NFA can be in
after reading each input
symbol.
7
NFA → DFA Construction
We will use the following
operations.
e-closure(T):
set of NFA states reachable
from some NFA state s in T
on e-transitions alone.
8
NFA  DFA Construction
move(T,a):
set of NFA states to which
there is a transition on input
a from some NFA state s in
set of states T.
9
NFA → DFA Construction
Before it sees the first input
symbol, NFA can be in
any of the state in the set
e-closure(s0), where s0 is the
start state of the NFA.
10
NFA → DFA Construction
Suppose that exactly the
states in set T are
reachable from s0 on a
given sequence of input
symbols.
11
NFA → DFA Construction
Let a be the next input
symbol.
On seeing a, the NFA can
move to any of the states in
the set move(T,a).
12
NFA → DFA Construction
When we allow for
e-transitions, NFA can be in
any of the states in
e-closure(move(T,a))
after seeing a.
13
Subset Construction
Algorithm:
Input:
NFA N with state set S,
alphabet S, start state
s0, final states F
14
Subset Construction
Output:
DFA D with state set
S’, alphabet S, start
states
s0’ = e-closure(s0),
final states F’,
transition
table: S’ x S → S’
15
Subset Construction Example
NFA for (a | b )*abb
0
e
e
e e
e
a
b
e
e
1
2 3
4 5
6 8 9
e
7
a b b
10
16
 The start state of equivalent DFA is e-closure(0),
which is
A = {0,1,2,4,7}
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
17
 A = {0,1,2,4,7}, these are exactly the states
reachable from state 0 via e-transition.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
18
 The input symbol alphabet here is {a,b}.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
19
 The algorithm tells us to mark A and then
compute
e-closure(move(A,a))
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
20
 move(A,a)), is the set of states of NFA that have
transition on ‘a’ from members of A.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
21
 Only 2 and 7 have such transition, to 3 and 8.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
22
 So, e-closure(move(A,a)) =
e-closure({3,8}) =
{1,2,3,4,6,7,8}
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
23
 Let B = {1,2,3,4,6,7,8}.
 Thus Dtran[A,a] = B
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
24
 For input b, among states in A, only 4 has
transition on b to 5
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
25
 C = e-closure({5})
= {1,2,4,5,6,7}
 Thus, Dtran[A,b] = C
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
26
 We continue this process with the unmarked sets B
and C
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
27
 i.e., e-closure(move(B,a)),
e-closure(move(B,b)),
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
28
 e-closure(move(C,a)) and
e-closure(move(C,b))
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
29
 Until all sets and states of DFA are marked.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
30
 This is certain since there are only 211 (!)
different subsets of a set of 11 states.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
31
 And a set, once marked, is marked forever.
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
32
Eventually, the 5 sets are:
A={0,1,2,4,7}
B={1,2,3,4,6,7,8}
C={1,2,4,5,6,7}
D={1,2,4,5,6,7,9}
E={1,2,4,5,6,7,10}
Subset Construction
33
A is start state
A={0,1,2,4,7}
D={1,2,4,5,6,7,9}
B={1,2,3,4,6,7,8} E={1,2,4,5,6,7,10}
C={1,2,4,5,6,7}
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
34
E is accepting state
A={0,1,2,4,7}
D={1,2,4,5,6,7,9}
B={1,2,3,4,6,7,8} E={1,2,4,5,6,7,10}
C={1,2,4,5,6,7}
e
0
e
e
e e
e
a
b
e
1
2 3
4 5
6 8 9
e
7
a b b
10
e
35
Resulting DFA
DFA for (a | b )*abb
A
a
b a
b b
E
B D
C
a
b
b
a
a
36
Resulting DFA
A
a
b a
b b
E
B D
C
a
b
b
a
a
a a a
a b b
37
Final Transition Table
State
Input symbol
a b
A B C
B B D
C B C
D B E
E B C

More Related Content

Similar to Lecture 17- F19.pdf

Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2bolovv
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automatonSampath Kumar S
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automatonSampath Kumar S
 
Automata theory - RE to DFA Conversion
Automata theory - RE to DFA ConversionAutomata theory - RE to DFA Conversion
Automata theory - RE to DFA ConversionAkila Krishnamoorthy
 
10 modtab
10 modtab10 modtab
10 modtabHanibei
 
Scalable Online Betweenness Centrality in Evolving Graphs
Scalable Online Betweenness Centrality in Evolving GraphsScalable Online Betweenness Centrality in Evolving Graphs
Scalable Online Betweenness Centrality in Evolving GraphsNicolas Kourtellis
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysisraosir123
 
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
 
Ch03 lexical analysis nfa_2_dfa_2019
Ch03 lexical analysis nfa_2_dfa_2019Ch03 lexical analysis nfa_2_dfa_2019
Ch03 lexical analysis nfa_2_dfa_2019Bushra Al-Anesi
 
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptxa7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptxpivap22198
 
The Power of Graphs in Immersive Communications
The Power of Graphs in Immersive CommunicationsThe Power of Graphs in Immersive Communications
The Power of Graphs in Immersive Communicationstonizza82
 
@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
 
Theory of automata and formal language lab manual
Theory of automata and formal language lab manualTheory of automata and formal language lab manual
Theory of automata and formal language lab manualNitesh Dubey
 
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
 
Robotics_Final_Paper_Folza
Robotics_Final_Paper_FolzaRobotics_Final_Paper_Folza
Robotics_Final_Paper_FolzaAlex Folz
 

Similar to Lecture 17- F19.pdf (20)

Lecture4 lexical analysis2
Lecture4 lexical analysis2Lecture4 lexical analysis2
Lecture4 lexical analysis2
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton
 
Data structure
Data structureData structure
Data structure
 
Automata theory - RE to DFA Conversion
Automata theory - RE to DFA ConversionAutomata theory - RE to DFA Conversion
Automata theory - RE to DFA Conversion
 
10 modtab
10 modtab10 modtab
10 modtab
 
Scalable Online Betweenness Centrality in Evolving Graphs
Scalable Online Betweenness Centrality in Evolving GraphsScalable Online Betweenness Centrality in Evolving Graphs
Scalable Online Betweenness Centrality in Evolving Graphs
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysis
 
optimization of DFA
optimization of DFAoptimization of DFA
optimization of DFA
 
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
 
Ch03 lexical analysis nfa_2_dfa_2019
Ch03 lexical analysis nfa_2_dfa_2019Ch03 lexical analysis nfa_2_dfa_2019
Ch03 lexical analysis nfa_2_dfa_2019
 
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptxa7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
 
The Power of Graphs in Immersive Communications
The Power of Graphs in Immersive CommunicationsThe Power of Graphs in Immersive Communications
The Power of Graphs in Immersive Communications
 
@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
 
Theory of automata and formal language lab manual
Theory of automata and formal language lab manualTheory of automata and formal language lab manual
Theory of automata and formal language lab manual
 
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
 
Robotics_Final_Paper_Folza
Robotics_Final_Paper_FolzaRobotics_Final_Paper_Folza
Robotics_Final_Paper_Folza
 

Recently uploaded

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

Lecture 17- F19.pdf

  • 1. 1 Theory Of Automata and Formal languages (CS-536) (Lecture 17) ______________________________________________________ GIMS- PMAS Arid Agriculture University, Gujrat Campus
  • 2. 2 Kleene’s Theorem  If a language can be expressed by 1. FA or 2. TG or 3. RE or 4. NFA/ NFA-epsilon then it can also be expressed by other three as well.
  • 3. NFA to FA Method as per discussed in class i.e. from the notes 3
  • 4. 4 NFA → DFA Construction  The algorithm is called subset construction.  In the transition table of an NFA, each entry is a set of states.  In DFA, each entry is a single state
  • 5. 5 NFA → DFA Construction The general idea behind NFA-to-DFA construction is that each DFA state corresponds to a set of NFA states.
  • 6. 6 NFA → DFA Construction The DFA uses its state to keep track of all possible states the NFA can be in after reading each input symbol.
  • 7. 7 NFA → DFA Construction We will use the following operations. e-closure(T): set of NFA states reachable from some NFA state s in T on e-transitions alone.
  • 8. 8 NFA  DFA Construction move(T,a): set of NFA states to which there is a transition on input a from some NFA state s in set of states T.
  • 9. 9 NFA → DFA Construction Before it sees the first input symbol, NFA can be in any of the state in the set e-closure(s0), where s0 is the start state of the NFA.
  • 10. 10 NFA → DFA Construction Suppose that exactly the states in set T are reachable from s0 on a given sequence of input symbols.
  • 11. 11 NFA → DFA Construction Let a be the next input symbol. On seeing a, the NFA can move to any of the states in the set move(T,a).
  • 12. 12 NFA → DFA Construction When we allow for e-transitions, NFA can be in any of the states in e-closure(move(T,a)) after seeing a.
  • 13. 13 Subset Construction Algorithm: Input: NFA N with state set S, alphabet S, start state s0, final states F
  • 14. 14 Subset Construction Output: DFA D with state set S’, alphabet S, start states s0’ = e-closure(s0), final states F’, transition table: S’ x S → S’
  • 15. 15 Subset Construction Example NFA for (a | b )*abb 0 e e e e e a b e e 1 2 3 4 5 6 8 9 e 7 a b b 10
  • 16. 16  The start state of equivalent DFA is e-closure(0), which is A = {0,1,2,4,7} e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 17. 17  A = {0,1,2,4,7}, these are exactly the states reachable from state 0 via e-transition. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 18. 18  The input symbol alphabet here is {a,b}. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 19. 19  The algorithm tells us to mark A and then compute e-closure(move(A,a)) e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 20. 20  move(A,a)), is the set of states of NFA that have transition on ‘a’ from members of A. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 21. 21  Only 2 and 7 have such transition, to 3 and 8. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 22. 22  So, e-closure(move(A,a)) = e-closure({3,8}) = {1,2,3,4,6,7,8} e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 23. 23  Let B = {1,2,3,4,6,7,8}.  Thus Dtran[A,a] = B e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 24. 24  For input b, among states in A, only 4 has transition on b to 5 e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 25. 25  C = e-closure({5}) = {1,2,4,5,6,7}  Thus, Dtran[A,b] = C e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 26. 26  We continue this process with the unmarked sets B and C e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 27. 27  i.e., e-closure(move(B,a)), e-closure(move(B,b)), e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 28. 28  e-closure(move(C,a)) and e-closure(move(C,b)) e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 29. 29  Until all sets and states of DFA are marked. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 30. 30  This is certain since there are only 211 (!) different subsets of a set of 11 states. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 31. 31  And a set, once marked, is marked forever. e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 32. 32 Eventually, the 5 sets are: A={0,1,2,4,7} B={1,2,3,4,6,7,8} C={1,2,4,5,6,7} D={1,2,4,5,6,7,9} E={1,2,4,5,6,7,10} Subset Construction
  • 33. 33 A is start state A={0,1,2,4,7} D={1,2,4,5,6,7,9} B={1,2,3,4,6,7,8} E={1,2,4,5,6,7,10} C={1,2,4,5,6,7} e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 34. 34 E is accepting state A={0,1,2,4,7} D={1,2,4,5,6,7,9} B={1,2,3,4,6,7,8} E={1,2,4,5,6,7,10} C={1,2,4,5,6,7} e 0 e e e e e a b e 1 2 3 4 5 6 8 9 e 7 a b b 10 e
  • 35. 35 Resulting DFA DFA for (a | b )*abb A a b a b b E B D C a b b a a
  • 36. 36 Resulting DFA A a b a b b E B D C a b b a a a a a a b b
  • 37. 37 Final Transition Table State Input symbol a b A B C B B D C B C D B E E B C