SlideShare a Scribd company logo
1 of 24
Download to read offline
Equivalence of DFA and Regular Expressions
CSCI 3130 Formal Languages and Automata Theory
1/23
q0
0
q1
0 1
q2
q0
0
q1
1
q2
L = {x ∈ Σ∗ | x ends in 01} Σ = {0, 1}
Three ways of doing it
1 0,1
1 0 (0 + 1)∗01
regular
expressions
2/23
DFA NFA
DFA NFA
regular
expressions
They are equally powerful
regular languages
3/23
Examples: regular expression → NFA
R1 = 0
R2 = 01
4/23
q0
0 q1
q0
0 q1
1 q2
Examples: regular expression → NFA
R3 = 0+01
ε
R4 = (0+01)∗
5/23
q1 q
0
2 q2
ε
q0
NFA3
ε
q6
ε ε
q3
0 q4
1 q5
ε
q′
0
ε ε
q′
1
NFA3
In general, how do we convert a regular expression to an NFA?
Regular expressions
A regular expression over Σ is an expression formed by the following
rules
• The symbols ∅ and ε are regular expressions
• Every symbol in Σ is a regular expression
• If Σ = {0,1}, then 0 and 1 are both regular expressions
• If R asd S are regular expressions, so are R + S, RS and R∗
6/23
General method when Σ = {0, 1}
regular expression =⇒ NFA
∅
ε
0
1
7/23
q0 q1
q0
ε q1
q0
0 q1
q0
1 q1
q0
ε
NFAR
General method: induction step
regex =⇒ NFA
RS
ε
R + S
ε
R∗
8/23
ε q1
NFAS
ε
q0
ε
ε
q1
ε
NFAS
NFAR
ε
q0
ε ε q1
NFAR
2-state
GNFA
GNFA
✓
regular
expressions
NFA
Roadmap
9/23
Simplify the NFA
First we simplify the NFA so that
• It has exactly one accepting state
• No arrows come into the start state
• No arrows go out of the accepting state
q5
10/23
q3
q1
q4
q3
ε
q0
ε
q1 q5
ε
q4
Simplify the NFA
First we simplify the NFA so that
• It has exactly one accepting state
• No arrows come into the start state
• No arrows go out of the accepting state
11/23
Simplify the NFA
0 1
12/23
q1
1
0
q2
Simplify the NFA
0 1
• It has exactly one accepting state ✓
• No arrows come into the start state ✓
• No arrows go out of the accepting state ✓
13/23
q0
ε q1
1
0
q2
ε q3
Generalized NFAs
A generalized NFA is an NFA whose transitions are labeled by regular
expressions, like
0∗1
01
14/23
q0
ε + 10∗
q1
0∗11 q2
2-state
GNFA
GNFA
regular
expressions
NFA
GNFA state elimination
We will eliminate every state but the start and accepting states
15/23
q0
(ε + 10 )(0 1) 0 11
∗ ∗ ∗
q1
∗
q2
01
q0
(ε + 10 )(0 1) 0 11 + 01
∗ ∗ ∗
q1
∗
q2
State elimination
0∗1
01
⇓
⇓
16/23
q0
ε + 10∗
q1
0∗11 q2
State elimination: general method
To eliminate state q, for every pair of states (u, v) such that u → q → v
Replace
R4
by
Remember to do this even when u = v
17/23
u
R1
R2
q
R3
v
u
R1R∗
2R3 + R4
q v
✓ 2-state
GNFA
✓
GNFA
✓
regular
expressions
NFA
✓
Roadmap
A 2-state GNFA is the same as a
regular expression R
18/23
q0
R q1
Conversion example
0 1
After eliminating q1:
19/23
q0
ε q1
1
0
q2
ε q3
Conversion example
0 1
q0
ε q1
1
q2
0
ε q3
00∗1 + 1
After eliminating q1:
After eliminating q2:
20/23
q0
0
q
∗
1
1 q2
ε q3
q0
0∗1(00∗1 + 1)∗
q1 q2 q3
Conversion example
0 1
q0
ε q1
1
q2
0
ε q3
00∗1 + 1
After eliminating q1:
After eliminating q2:
0 1
Check: 0∗1(00∗1 + 1)∗ =
?
21/23
q0
0
q
∗
1
1 q2
ε q3
q0
0∗1(00∗1 + 1)∗
q1 q2 q3
q1
1
0
q2
Check your answer!
0 1
All strings ending in 1
(0 + 1)∗1
22/23
q1
1
0
q2
Check your answer!
0 1
All strings ending in 1
(0 + 1)∗1
0∗1(00∗1 + 1)∗ Always ends in 1
Does every string ending in 1
= 0∗1(0∗1)∗
have this form?
Yes
23/23
q1
1
0
q2

More Related Content

Similar to 5-DFA and equivalence with RE.pdf

6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
shruti533256
 
sp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptx
sp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptxsp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptx
sp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptx
Elisée Ndjabu
 
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
Srimatre K
 

Similar to 5-DFA and equivalence with RE.pdf (20)

FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
TuringMachines.ppt
TuringMachines.pptTuringMachines.ppt
TuringMachines.ppt
 
Lecture7x.ppt
Lecture7x.pptLecture7x.ppt
Lecture7x.ppt
 
Nfa egs
Nfa egsNfa egs
Nfa egs
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
1. finite_automata_new.ppt
1. finite_automata_new.ppt1. finite_automata_new.ppt
1. finite_automata_new.ppt
 
Automata
AutomataAutomata
Automata
 
sp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptx
sp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptxsp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptx
sp12Part2 CIRCUITS AND SYSTEMS FOR COMPUTER ENGINEERING .pptx
 
Flip flops, counters & registers
Flip flops, counters & registersFlip flops, counters & registers
Flip flops, counters & registers
 
26 alternating series and conditional convergence x
26 alternating series and conditional convergence x26 alternating series and conditional convergence x
26 alternating series and conditional convergence x
 
26 alternating series and conditional convergence x
26 alternating series and conditional convergence x26 alternating series and conditional convergence x
26 alternating series and conditional convergence x
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Dcs lec02 - z-transform
Dcs   lec02 - z-transformDcs   lec02 - z-transform
Dcs lec02 - z-transform
 
lecture 10 formal methods in software enginnering.pptx
lecture 10 formal methods in software enginnering.pptxlecture 10 formal methods in software enginnering.pptx
lecture 10 formal methods in software enginnering.pptx
 
lec07_DFT.pdf
lec07_DFT.pdflec07_DFT.pdf
lec07_DFT.pdf
 
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
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)
 
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-FlopsFYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
FYBSC IT Digital Electronics Unit IV Chapter II Sequential Circuits- Flip-Flops
 
Unit 1
Unit 1Unit 1
Unit 1
 

More from shruti533256

Virtualization Introduction.ppt
Virtualization Introduction.pptVirtualization Introduction.ppt
Virtualization Introduction.ppt
shruti533256
 
Virtualization summary b.docx
Virtualization summary b.docxVirtualization summary b.docx
Virtualization summary b.docx
shruti533256
 
Virtualization summary a.docx
Virtualization summary a.docxVirtualization summary a.docx
Virtualization summary a.docx
shruti533256
 
More on Virtualization 2.pptx
More on Virtualization 2.pptxMore on Virtualization 2.pptx
More on Virtualization 2.pptx
shruti533256
 
Virtualization concepts 2.pptx
Virtualization concepts 2.pptxVirtualization concepts 2.pptx
Virtualization concepts 2.pptx
shruti533256
 
6- Threaded Interpretation.docx
6- Threaded Interpretation.docx6- Threaded Interpretation.docx
6- Threaded Interpretation.docx
shruti533256
 
2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx
shruti533256
 
4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx
shruti533256
 
Course Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docxCourse Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docx
shruti533256
 
3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx
shruti533256
 
1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx
shruti533256
 
2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt
shruti533256
 

More from shruti533256 (18)

More on Emulsion.docx
More on Emulsion.docxMore on Emulsion.docx
More on Emulsion.docx
 
More on Virtualization.ppt
More on Virtualization.pptMore on Virtualization.ppt
More on Virtualization.ppt
 
Virtualization Introduction.ppt
Virtualization Introduction.pptVirtualization Introduction.ppt
Virtualization Introduction.ppt
 
Virtualization summary b.docx
Virtualization summary b.docxVirtualization summary b.docx
Virtualization summary b.docx
 
Virtualization summary a.docx
Virtualization summary a.docxVirtualization summary a.docx
Virtualization summary a.docx
 
More on Virtualization 2.pptx
More on Virtualization 2.pptxMore on Virtualization 2.pptx
More on Virtualization 2.pptx
 
Virtualization concepts 2.pptx
Virtualization concepts 2.pptxVirtualization concepts 2.pptx
Virtualization concepts 2.pptx
 
6- Threaded Interpretation.docx
6- Threaded Interpretation.docx6- Threaded Interpretation.docx
6- Threaded Interpretation.docx
 
Overview.ppt
Overview.pptOverview.ppt
Overview.ppt
 
More on Virtualization 3.pptx
More on Virtualization 3.pptxMore on Virtualization 3.pptx
More on Virtualization 3.pptx
 
2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx
 
4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx
 
Course Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docxCourse Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docx
 
3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx
 
1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx
 
5-Emulation.docx
5-Emulation.docx5-Emulation.docx
5-Emulation.docx
 
9-Pumping Lemma.pdf
9-Pumping Lemma.pdf9-Pumping Lemma.pdf
9-Pumping Lemma.pdf
 
2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt
 

Recently uploaded

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 

5-DFA and equivalence with RE.pdf