SlideShare a Scribd company logo
Lecture 7 From NFA to DFA
DFA
• For every string x, there is a unique path
from initial state and associated with x.
x is accepted if and only if this path ends
at a final state.
x
NFA
• For any string x, there may exist none or
more than one path from initial state and
associated with x.
NFA  DFA
• Consider an NFA M=(Q, Σ, δ, s, F).
• For x in Σ*, define
[x] = {q in Q | there exists a path s q}
• Define DFA M’=(Q’, Σ, δ’, s’, F’}:
Q’ = { [x] | x in Σ* },
δ ([x], a) = [xa] for x in Σ* and a in Σ,
s’ = [ε],
F’ = { [x] | x in L(M) }
x
Construction of M’
Special Case: M has no ε-move.
• [ε] = {s}
• Suppose [x] is known. How to get [xa] for
a in Σ?
From [x] to [xa]
• [xa] = { p | there exists a path q p for
some q in [x] }
= { p | there exists q in [x],
q p }
= U
a
a
q in [x]
δ(q,a)
edge
path
Construction of M’
• F’ = {[x] | x in L(M)}
= {[x] | [x] ∩ F ≠ Ǿ }
Example 1
• Construct DFA to accept 00(0+1)*
p
0 0
0
1
s q s p q
0 0
1
Ǿ
1
0,1
0, 1
Example 2
• Design DFA to accept (0+1)*11
s p
1 1
0
1
q
s
1 s
p
0
1 s
q
1
0
p
0
Example 3
• Design DFA to accept 00(0+1)*11
s p q r
0 1 1
0
0
1
t
s 0 p
1
Ǿ 0,1
1
0
q
0
1 q
r
1 q
r
t
0
0
1
Example 4
• Construct DFA M for L(M)=ε.
s Is this a DFA?
s
0
Ǿ
1
0,1
Example 5
• Construct DFA M for L(M)=Ǿ.
s Is it a DFA?
s
0
Ǿ 0,1
1
0,1
Construction of M’
• For q in Q, define
ε-closure(q) = {p | there exists a path q p}
• [ε] = {q | there is a path s q}
= ε-closure(s)
• Suppose [x] is known. How to get [xa] for
a in Σ?
ε
ε
path
path
From [x] to [xa]
• [xa] = { p | there exists a path q p for
some q in [x] }
= { p | there exists q in [x],
q r p }
= { p | for some q in [x] and r in δ(q,a),
p in ε-closure(r) }
= U U ε-closure(r)
a
a ε
q in [x] r in δ(q,a)
edge path
path
Construction of M’
• F’ = {[x] | x in L(M)}
= {[x] | [x] ∩ F ≠ Ǿ }
Example 6
• Construct DFA M for L(M)=(0+1)*.
0,1
ε ε
s p q
s
p
q
0 p
q
1
0,1
0,1
Example 7
• Convert the following NFA to DFA.
s
p
0
ε
0 ε
0
1
1
ε
0
r
s
r
p
0 q
r
p
1
s
q, r, p
0
1
0
1
q
a
s
d
c
b
s
0,1
0
0 0 0 0
1 1 1 1 e
0 s,a
1
s,a,b
0 0 s,a,b,c 0 s,a,b,c,d 0 s,a,b,c,d,e
1
s,b
1
s,c
1
s,d
1
s,e
How many states? 2 =32
5
How many final states? 2 = 16
4
Can we simplify it? No, it is minimum!

More Related Content

What's hot

Shubhanshumathprojectwork10 a-120930012042-phpapp01
Shubhanshumathprojectwork10 a-120930012042-phpapp01Shubhanshumathprojectwork10 a-120930012042-phpapp01
Shubhanshumathprojectwork10 a-120930012042-phpapp01
Raghav Sachdeva
 
32 stoke's theorem
32 stoke's theorem32 stoke's theorem
32 stoke's theorem
math267
 
17 integrals of rational functions x
17 integrals of rational functions x17 integrals of rational functions x
17 integrals of rational functions x
math266
 
Calculus II - 26
Calculus II - 26Calculus II - 26
Calculus II - 26
David Mao
 
APPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONAPPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATION
Dhrupal Patel
 
Taylor series in 1 and 2 variable
Taylor series in 1 and 2 variableTaylor series in 1 and 2 variable
Taylor series in 1 and 2 variable
gidc engineering college
 
Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8
Traian Rebedea
 
POLYNOMIALS OF CLASS 10
POLYNOMIALS OF CLASS 10POLYNOMIALS OF CLASS 10
POLYNOMIALS OF CLASS 10
Sanjay Mahto
 
Newton raphson method
Newton raphson methodNewton raphson method
Newton raphson method
MOHIT AGARWAL
 
Linear approximations and_differentials
Linear approximations and_differentialsLinear approximations and_differentials
Linear approximations and_differentials
Tarun Gehlot
 
Calculus II - 21
Calculus II - 21Calculus II - 21
Calculus II - 21
David Mao
 
16 partial fraction decompositions x
16 partial fraction decompositions x16 partial fraction decompositions x
16 partial fraction decompositions x
math266
 
Data Structure and Algorithms Graphs
Data Structure and Algorithms GraphsData Structure and Algorithms Graphs
Data Structure and Algorithms Graphs
ManishPrajapati78
 
1203 ch 12 day 3
1203 ch 12 day 31203 ch 12 day 3
1203 ch 12 day 3
festivalelmo
 
Application of partial derivatives with two variables
Application of partial derivatives with two variablesApplication of partial derivatives with two variables
Application of partial derivatives with two variables
Sagar Patel
 
Class 10 Maths Ch Polynomial PPT
Class 10 Maths Ch Polynomial PPTClass 10 Maths Ch Polynomial PPT
Class 10 Maths Ch Polynomial PPT
Sanjayraj Balasara
 
4 areas in polar coordinates
4 areas in polar coordinates4 areas in polar coordinates
4 areas in polar coordinates
math267
 
Application of derivatives
Application of derivatives Application of derivatives
Application of derivatives
Seyid Kadher
 
Fundamental theorem of algebra
Fundamental theorem of algebraFundamental theorem of algebra
Fundamental theorem of algebra
Ramón Zurita
 
Calculus II - 1
Calculus II - 1Calculus II - 1
Calculus II - 1
David Mao
 

What's hot (20)

Shubhanshumathprojectwork10 a-120930012042-phpapp01
Shubhanshumathprojectwork10 a-120930012042-phpapp01Shubhanshumathprojectwork10 a-120930012042-phpapp01
Shubhanshumathprojectwork10 a-120930012042-phpapp01
 
32 stoke's theorem
32 stoke's theorem32 stoke's theorem
32 stoke's theorem
 
17 integrals of rational functions x
17 integrals of rational functions x17 integrals of rational functions x
17 integrals of rational functions x
 
Calculus II - 26
Calculus II - 26Calculus II - 26
Calculus II - 26
 
APPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONAPPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATION
 
Taylor series in 1 and 2 variable
Taylor series in 1 and 2 variableTaylor series in 1 and 2 variable
Taylor series in 1 and 2 variable
 
Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8
 
POLYNOMIALS OF CLASS 10
POLYNOMIALS OF CLASS 10POLYNOMIALS OF CLASS 10
POLYNOMIALS OF CLASS 10
 
Newton raphson method
Newton raphson methodNewton raphson method
Newton raphson method
 
Linear approximations and_differentials
Linear approximations and_differentialsLinear approximations and_differentials
Linear approximations and_differentials
 
Calculus II - 21
Calculus II - 21Calculus II - 21
Calculus II - 21
 
16 partial fraction decompositions x
16 partial fraction decompositions x16 partial fraction decompositions x
16 partial fraction decompositions x
 
Data Structure and Algorithms Graphs
Data Structure and Algorithms GraphsData Structure and Algorithms Graphs
Data Structure and Algorithms Graphs
 
1203 ch 12 day 3
1203 ch 12 day 31203 ch 12 day 3
1203 ch 12 day 3
 
Application of partial derivatives with two variables
Application of partial derivatives with two variablesApplication of partial derivatives with two variables
Application of partial derivatives with two variables
 
Class 10 Maths Ch Polynomial PPT
Class 10 Maths Ch Polynomial PPTClass 10 Maths Ch Polynomial PPT
Class 10 Maths Ch Polynomial PPT
 
4 areas in polar coordinates
4 areas in polar coordinates4 areas in polar coordinates
4 areas in polar coordinates
 
Application of derivatives
Application of derivatives Application of derivatives
Application of derivatives
 
Fundamental theorem of algebra
Fundamental theorem of algebraFundamental theorem of algebra
Fundamental theorem of algebra
 
Calculus II - 1
Calculus II - 1Calculus II - 1
Calculus II - 1
 

Recently uploaded

MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 

Recently uploaded (20)

MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 

Lect7

  • 1. Lecture 7 From NFA to DFA
  • 2. DFA • For every string x, there is a unique path from initial state and associated with x. x is accepted if and only if this path ends at a final state. x
  • 3. NFA • For any string x, there may exist none or more than one path from initial state and associated with x.
  • 4. NFA  DFA • Consider an NFA M=(Q, Σ, δ, s, F). • For x in Σ*, define [x] = {q in Q | there exists a path s q} • Define DFA M’=(Q’, Σ, δ’, s’, F’}: Q’ = { [x] | x in Σ* }, δ ([x], a) = [xa] for x in Σ* and a in Σ, s’ = [ε], F’ = { [x] | x in L(M) } x
  • 5. Construction of M’ Special Case: M has no ε-move. • [ε] = {s} • Suppose [x] is known. How to get [xa] for a in Σ?
  • 6. From [x] to [xa] • [xa] = { p | there exists a path q p for some q in [x] } = { p | there exists q in [x], q p } = U a a q in [x] δ(q,a) edge path
  • 7. Construction of M’ • F’ = {[x] | x in L(M)} = {[x] | [x] ∩ F ≠ Ǿ }
  • 8. Example 1 • Construct DFA to accept 00(0+1)* p 0 0 0 1 s q s p q 0 0 1 Ǿ 1 0,1 0, 1
  • 9. Example 2 • Design DFA to accept (0+1)*11 s p 1 1 0 1 q s 1 s p 0 1 s q 1 0 p 0
  • 10. Example 3 • Design DFA to accept 00(0+1)*11 s p q r 0 1 1 0 0 1 t s 0 p 1 Ǿ 0,1 1 0 q 0 1 q r 1 q r t 0 0 1
  • 11. Example 4 • Construct DFA M for L(M)=ε. s Is this a DFA? s 0 Ǿ 1 0,1
  • 12. Example 5 • Construct DFA M for L(M)=Ǿ. s Is it a DFA? s 0 Ǿ 0,1 1 0,1
  • 13. Construction of M’ • For q in Q, define ε-closure(q) = {p | there exists a path q p} • [ε] = {q | there is a path s q} = ε-closure(s) • Suppose [x] is known. How to get [xa] for a in Σ? ε ε path path
  • 14. From [x] to [xa] • [xa] = { p | there exists a path q p for some q in [x] } = { p | there exists q in [x], q r p } = { p | for some q in [x] and r in δ(q,a), p in ε-closure(r) } = U U ε-closure(r) a a ε q in [x] r in δ(q,a) edge path path
  • 15. Construction of M’ • F’ = {[x] | x in L(M)} = {[x] | [x] ∩ F ≠ Ǿ }
  • 16. Example 6 • Construct DFA M for L(M)=(0+1)*. 0,1 ε ε s p q s p q 0 p q 1 0,1 0,1
  • 17. Example 7 • Convert the following NFA to DFA. s p 0 ε 0 ε 0 1 1 ε 0 r s r p 0 q r p 1 s q, r, p 0 1 0 1 q
  • 18. a s d c b s 0,1 0 0 0 0 0 1 1 1 1 e 0 s,a 1 s,a,b 0 0 s,a,b,c 0 s,a,b,c,d 0 s,a,b,c,d,e 1 s,b 1 s,c 1 s,d 1 s,e How many states? 2 =32 5 How many final states? 2 = 16 4 Can we simplify it? No, it is minimum!