SlideShare a Scribd company logo
Theory of Computation
By Rushabh Wadkar
Topics to be covered
DFA & NFA Problems Contd.
NFA to DFA
Extended transition functions(NFA)
eNFA to NFA
Day 4
DFA Problems
Draw a DFA to accept decimal strings divisible by 3.
M=(Q, ∑, δ, q0
, F)
DFA Problems
Draw a DFA to accept decimal strings divisible by 3.
● To begin, we identify the radix, input alphabet and divisor.
r=10 | d={0,1,2,3,4,5,6,7,8,9} | k=3
● 𝛿(qi
,0) = qj
Where, j =( r * i + d) mod k.
● j =( 10 * i + d) mod 3.
● Since mod3 has remainders 0,1,2 ; i = 0,1,2.
DFA Problems
Draw a DFA to accept decimal strings divisible by 3.
M=(Q, ∑, δ, q0
, F)
DFA Problems
Draw a DFA to accept na
(w) and nb
(w) are both even.
∑ = (a,b)
DFA Problems
Draw a DFA to accept na
(w)mod3=0 and
nb
(w)mod2=0.
∑ = (a,b)
DFA Problems
Draw a DFA to accept
na
(w)mod5=0 and
nb
(w)mod3=0.
∑ = (a,b)
DFA Problems
Draw a DFA to accept
na
(w)mod5 ≠ nb
(w)mod3.
∑ = (a,b)
DFA Problems
Draw a DFA to accept
na
(w)mod5 > nb
(w)mod3.
∑ = (a,b)
NFA Problems
Draw a NFA that satisfies the language:
L= {an
∪bn
: n>=0}
NFA Problems
Draw a NFA that satisfies the language:
L= {0101n
∪0100 : n>=0}
NFA Problems
Draw a NFA that contains either ‘01’ or ‘10’ on Σ = {0,1}
NFA Problems
Draw a NFA that according to the transition graph
𝛿 0 1
q0
q0
,q1
q0
,q2
q1
q3
-
q2
q2
,q3
q3
q3
q3
q3
NFA to DFA
Step 1 − Create state table from the given NFA
Step 2 − Mark the start state of the DFA by q0 (Same as the NDFA).
Step 3 − Find out the combination of States {Q0
, Q1
,... , Qn
} for each possible input
alphabet.
Step 4 − Each time we generate a new DFA state under the input alphabet
columns, we have to apply step 3 again, otherwise go to step 5.
Step 5 − The states which contain any of the final states of the NDFA are the final
states of the equivalent DFA.
Let X = (Qx, ∑, δx, q0, Fx) be a NFA which accepts the language L(X). We have to design an
equivalent DFA Y = (Qy, ∑, δy, q0, Fy) such that L(Y) = L(X).
NFA to DFA
Q.Consider a NFA with the following transitions:
𝛿(q0
,0) = {q0
q1
}
𝛿(q1
,0) = Φ
𝛿(q0
,1) = q1
𝛿(q1
,1) = {q0
q1
}
NFA to DFA
𝛿 0 1
q0
q0
q1
q1
q1
- q0
q1
Required transition graph :
NFA to DFA
We identify the required states :
We already have the
transitions for q0
,q1
on
0 & 1.
The new found state
is {q0
q1
}. Let us find
transition for this.
NFA to DFA
Required transition graph for DFA :
Notice the final
states.
NFA to DFA
Required DFA :
NFA to DFA
Q.Consider a NFA with the following transitions:
NFA to DFA
We identify the required states :
We already have the
transitions for q0
,q1
on
0 & 1.
The new found state
is {q0
q1
}. Let us find
transition for this.
NFA to DFA
Similarly for the newly generated q0
q1
q2
Required transition
graph for DFA :
NFA to DFA
*notice that q1 was not marked as final in
slide 22. Here we can either consider it as a
final state. Or remove finals that contain q1
NFA to DFA
Q.Consider the following NFA
NFA to DFA
Required transition graph :
Required transition graph for DFA :
NFA to DFA
ε-NFA
An example of ε-NFA to understand it better.
ε-NFA
States: It consists of 3 states, q0
, q1
, q2
∈ Q
Input Alphabets: There are 2 input symbols in the alphabet ∑ = {a, b}
Transitions: δ(qi
,a) = qj
δ(qi
,a) = {qi
,qj
}
δ(qi
,ε) = qj
Let us take a closer look at this ε-NFA now.
ε-NFA
It is defined using the quintuple M=(Q, Σ, 𝛿, q0
, F)
Where,
Q = Set of internal states in the ε-NFA
Σ = Finite set of symbols (input alphabet)
𝛿 = Transition function defined by 𝛿= QxΣ∪ε--->2Q
q0
= Initial state ∈ Q
F = Set of final states ∈ Q
ε-NFA
Epsilon closure(ECLOSE) is finding all the states which can be reached from the
present state on one or more epsilon transitions.
ECLOSE(A) = ABD
ECLOSE(B) = BD
ECLOSE(C) = C
ECLOSE(D) = D
ε-NFA
Epsilon closure(ECLOSE) follows the properties of extended transitions
ε-NFA
Ref: Finite
Automata and
Formal Languages
(Padma Reddy)
ε-NFA Example Problems
Draw a ε-NFA that accepts zero or more a’s or zero OR more b’s
or zero OR more c’s
ε-NFA to DFA
Step 1 : Take ∈ closure for the beginning state of NFA as beginning state of DFA.
Step 2 : Find the states that can be traversed from the present for each input
symbol(union of transition value and their closures for each states of NFA).
Step 3 : If any new state is found take it as current state and repeat step 2.
Step 4 : Do repeat Step 2 and Step 3 until no new state present in DFA transition table.
Step 5 : Mark the states of DFA which contains final state of NFA as final states of DFA.
ε-NFA to DFA
Find the DFA for the following NFA.
ε-NFA to DFA
To find the start state of the DFA we will find the eclosure of the current start
state. .
.
. the start state for DFA is ECLOSE(q0
) = {q0
q1
q2
}
ε-NFA to DFA
From the transitions of {q0
q1
q2
}, we arrive on state {q1
q2
}
ε-NFA to DFA
And then finally for state {q2
},
ε-NFA to DFA
From the following we can draw the transition table
Understanding
differences!
End of Day 4
www.linkedin.com/in/wadkar-rushabh
@RushabhWadkar
Thank you...

More Related Content

PDF
NFA DFA Equivalence theorem
PPTX
NFA Converted to DFA , Minimization of DFA , Transition Diagram
PDF
Nfa to-dfa
PPTX
Toc(df avs nfa)avishek130650107020
PPT
Nfa egs
PPTX
Automata theory - Push Down Automata (PDA)
PPT
Minimization of DFA
PDF
Theory of Computation Basics of Finite Acceptors
NFA DFA Equivalence theorem
NFA Converted to DFA , Minimization of DFA , Transition Diagram
Nfa to-dfa
Toc(df avs nfa)avishek130650107020
Nfa egs
Automata theory - Push Down Automata (PDA)
Minimization of DFA
Theory of Computation Basics of Finite Acceptors

What's hot (20)

PPT
Dfa h11
PPT
Finite automata(For college Seminars)
PPT
Nfa vs dfa
PPT
Finite Automata
PPT
NFA or Non deterministic finite automata
PPTX
formal definitions in theory of computation
PDF
Formal Languages and Automata Theory Unit 1
PPT
DFA Minimization
PPT
Finite automata
PPTX
push down automata
PPTX
Push down automata
PPT
Nondeterministic Finite Automata
PDF
Finite automata
PPTX
Automata Theory - Turing machine
PPTX
1.3.1 deterministic finite automaton
PDF
Ch2 finite automaton
PPTX
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
PPTX
NFA Non Deterministic Finite Automata by Mudasir khushik
Dfa h11
Finite automata(For college Seminars)
Nfa vs dfa
Finite Automata
NFA or Non deterministic finite automata
formal definitions in theory of computation
Formal Languages and Automata Theory Unit 1
DFA Minimization
Finite automata
push down automata
Push down automata
Nondeterministic Finite Automata
Finite automata
Automata Theory - Turing machine
1.3.1 deterministic finite automaton
Ch2 finite automaton
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
NFA Non Deterministic Finite Automata by Mudasir khushik
Ad

Similar to Theory of Computation FSM Conversions and Problems (20)

PDF
PPTX
INTRODUTION Formal Language and Automatic Theory.pptx
PDF
Hwsoln03 toc
PDF
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
PDF
Nondeterministic Finite Automata
PPTX
FiniteAutomata_anim.pptx
PPTX
FiniteAutomata_anim.pptx
PDF
Automata theory
PPTX
chapter 1 automata and complexity theory lecture note.pptx
PPTX
Week 3 - to FiniteAutomata DrJunaid.pptx
PPT
Lecture03 (1).ppt
PPTX
1.3.2 non deterministic finite automaton
PDF
TOC 4 | Non-deterministic Finite Automata
PPTX
AUTOMATA THEORY AUTOMATA THEORYAutomata3Chapter2.pptx
PPTX
Theory of computation Unit 1 Lecute 2.pptx
PPTX
Automata theory -- NFA and DFA construction
PDF
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
PPTX
Theory of Automata and formal languages unit 1
PDF
Ch03 lexical analysis nfa_2_dfa_2019
PPTX
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
INTRODUTION Formal Language and Automatic Theory.pptx
Hwsoln03 toc
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
Nondeterministic Finite Automata
FiniteAutomata_anim.pptx
FiniteAutomata_anim.pptx
Automata theory
chapter 1 automata and complexity theory lecture note.pptx
Week 3 - to FiniteAutomata DrJunaid.pptx
Lecture03 (1).ppt
1.3.2 non deterministic finite automaton
TOC 4 | Non-deterministic Finite Automata
AUTOMATA THEORY AUTOMATA THEORYAutomata3Chapter2.pptx
Theory of computation Unit 1 Lecute 2.pptx
Automata theory -- NFA and DFA construction
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
Theory of Automata and formal languages unit 1
Ch03 lexical analysis nfa_2_dfa_2019
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
Ad

Recently uploaded (20)

PPTX
Institutional Correction lecture only . . .
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Insiders guide to clinical Medicine.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Lesson notes of climatology university.
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
GDM (1) (1).pptx small presentation for students
Institutional Correction lecture only . . .
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Insiders guide to clinical Medicine.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
STATICS OF THE RIGID BODIES Hibbelers.pdf
Basic Mud Logging Guide for educational purpose
O7-L3 Supply Chain Operations - ICLT Program
Supply Chain Operations Speaking Notes -ICLT Program
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Microbial disease of the cardiovascular and lymphatic systems
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Lesson notes of climatology university.
Computing-Curriculum for Schools in Ghana
Final Presentation General Medicine 03-08-2024.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
2.FourierTransform-ShortQuestionswithAnswers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
GDM (1) (1).pptx small presentation for students

Theory of Computation FSM Conversions and Problems

  • 1. Theory of Computation By Rushabh Wadkar
  • 2. Topics to be covered DFA & NFA Problems Contd. NFA to DFA Extended transition functions(NFA) eNFA to NFA Day 4
  • 3. DFA Problems Draw a DFA to accept decimal strings divisible by 3. M=(Q, ∑, δ, q0 , F)
  • 4. DFA Problems Draw a DFA to accept decimal strings divisible by 3. ● To begin, we identify the radix, input alphabet and divisor. r=10 | d={0,1,2,3,4,5,6,7,8,9} | k=3 ● 𝛿(qi ,0) = qj Where, j =( r * i + d) mod k. ● j =( 10 * i + d) mod 3. ● Since mod3 has remainders 0,1,2 ; i = 0,1,2.
  • 5. DFA Problems Draw a DFA to accept decimal strings divisible by 3. M=(Q, ∑, δ, q0 , F)
  • 6. DFA Problems Draw a DFA to accept na (w) and nb (w) are both even. ∑ = (a,b)
  • 7. DFA Problems Draw a DFA to accept na (w)mod3=0 and nb (w)mod2=0. ∑ = (a,b)
  • 8. DFA Problems Draw a DFA to accept na (w)mod5=0 and nb (w)mod3=0. ∑ = (a,b)
  • 9. DFA Problems Draw a DFA to accept na (w)mod5 ≠ nb (w)mod3. ∑ = (a,b)
  • 10. DFA Problems Draw a DFA to accept na (w)mod5 > nb (w)mod3. ∑ = (a,b)
  • 11. NFA Problems Draw a NFA that satisfies the language: L= {an ∪bn : n>=0}
  • 12. NFA Problems Draw a NFA that satisfies the language: L= {0101n ∪0100 : n>=0}
  • 13. NFA Problems Draw a NFA that contains either ‘01’ or ‘10’ on Σ = {0,1}
  • 14. NFA Problems Draw a NFA that according to the transition graph 𝛿 0 1 q0 q0 ,q1 q0 ,q2 q1 q3 - q2 q2 ,q3 q3 q3 q3 q3
  • 15. NFA to DFA Step 1 − Create state table from the given NFA Step 2 − Mark the start state of the DFA by q0 (Same as the NDFA). Step 3 − Find out the combination of States {Q0 , Q1 ,... , Qn } for each possible input alphabet. Step 4 − Each time we generate a new DFA state under the input alphabet columns, we have to apply step 3 again, otherwise go to step 5. Step 5 − The states which contain any of the final states of the NDFA are the final states of the equivalent DFA. Let X = (Qx, ∑, δx, q0, Fx) be a NFA which accepts the language L(X). We have to design an equivalent DFA Y = (Qy, ∑, δy, q0, Fy) such that L(Y) = L(X).
  • 16. NFA to DFA Q.Consider a NFA with the following transitions: 𝛿(q0 ,0) = {q0 q1 } 𝛿(q1 ,0) = Φ 𝛿(q0 ,1) = q1 𝛿(q1 ,1) = {q0 q1 }
  • 17. NFA to DFA 𝛿 0 1 q0 q0 q1 q1 q1 - q0 q1 Required transition graph :
  • 18. NFA to DFA We identify the required states : We already have the transitions for q0 ,q1 on 0 & 1. The new found state is {q0 q1 }. Let us find transition for this.
  • 19. NFA to DFA Required transition graph for DFA : Notice the final states.
  • 21. NFA to DFA Q.Consider a NFA with the following transitions:
  • 22. NFA to DFA We identify the required states : We already have the transitions for q0 ,q1 on 0 & 1. The new found state is {q0 q1 }. Let us find transition for this.
  • 23. NFA to DFA Similarly for the newly generated q0 q1 q2
  • 24. Required transition graph for DFA : NFA to DFA *notice that q1 was not marked as final in slide 22. Here we can either consider it as a final state. Or remove finals that contain q1
  • 25. NFA to DFA Q.Consider the following NFA
  • 26. NFA to DFA Required transition graph :
  • 27. Required transition graph for DFA : NFA to DFA
  • 28. ε-NFA An example of ε-NFA to understand it better.
  • 29. ε-NFA States: It consists of 3 states, q0 , q1 , q2 ∈ Q Input Alphabets: There are 2 input symbols in the alphabet ∑ = {a, b} Transitions: δ(qi ,a) = qj δ(qi ,a) = {qi ,qj } δ(qi ,ε) = qj Let us take a closer look at this ε-NFA now.
  • 30. ε-NFA It is defined using the quintuple M=(Q, Σ, 𝛿, q0 , F) Where, Q = Set of internal states in the ε-NFA Σ = Finite set of symbols (input alphabet) 𝛿 = Transition function defined by 𝛿= QxΣ∪ε--->2Q q0 = Initial state ∈ Q F = Set of final states ∈ Q
  • 31. ε-NFA Epsilon closure(ECLOSE) is finding all the states which can be reached from the present state on one or more epsilon transitions. ECLOSE(A) = ABD ECLOSE(B) = BD ECLOSE(C) = C ECLOSE(D) = D
  • 32. ε-NFA Epsilon closure(ECLOSE) follows the properties of extended transitions
  • 33. ε-NFA Ref: Finite Automata and Formal Languages (Padma Reddy)
  • 34. ε-NFA Example Problems Draw a ε-NFA that accepts zero or more a’s or zero OR more b’s or zero OR more c’s
  • 35. ε-NFA to DFA Step 1 : Take ∈ closure for the beginning state of NFA as beginning state of DFA. Step 2 : Find the states that can be traversed from the present for each input symbol(union of transition value and their closures for each states of NFA). Step 3 : If any new state is found take it as current state and repeat step 2. Step 4 : Do repeat Step 2 and Step 3 until no new state present in DFA transition table. Step 5 : Mark the states of DFA which contains final state of NFA as final states of DFA.
  • 36. ε-NFA to DFA Find the DFA for the following NFA.
  • 37. ε-NFA to DFA To find the start state of the DFA we will find the eclosure of the current start state. . . . the start state for DFA is ECLOSE(q0 ) = {q0 q1 q2 }
  • 38. ε-NFA to DFA From the transitions of {q0 q1 q2 }, we arrive on state {q1 q2 }
  • 39. ε-NFA to DFA And then finally for state {q2 },
  • 40. ε-NFA to DFA From the following we can draw the transition table
  • 42. End of Day 4 www.linkedin.com/in/wadkar-rushabh @RushabhWadkar Thank you...