SlideShare a Scribd company logo
1 of 25
Download to read offline
Finite Automata
• We will now introduce the concept of regular langauges.
• Accepted by a computation device known as finite automata
• Other methods to describe regular languages include, regular ex-
pressions and a special type of grammars called regular grammars.
Some Examples
1. ON-OFF switch (push button).
Two states, on and off. Each input toggles the state.
2. Recognition of words (lexical analyzers).
3. Many home devices such as VCRs, . . .
Deterministic Finite Automata (DFA)
A deterministic Finite Automaton consists of:
• A finite set of states, often denoted by Q.
• A finite set of input symbols (letters), often denoted by Σ.
• A transition function, that takes two arguments: a state from Q
and a letter from Σ, and returns a state.
Transition function is often denoted by δ.
• A starting state, q0, which is one of the states of Q.
• A set F ⊆ Q of final/accepting states.
A = (Q, Σ, δ, q0, F).
Deterministic Finite Automata: Example
DFA accepting strings which contain odd number of 1s (here we are
taking the alphabet as {0, 1}).
A = ({q0, q1}, {0, 1}, δ, q0, {q1}).
δ(q0, 0) = q0.
δ(q0, 1) = q1.
δ(q1, 0) = q1.
δ(q1, 1) = q0.
Deterministic Finite Automata: Another Example
DFA accepting strings which contain 00 as a substring.
This is same as accepting the set: {w | w is of form x00y for some
strings x and y} (here we are taking the alphabet as {0, 1}).
A = ({q0, q1, q2}, {0, 1}, δ, q0, {q2}).
δ(q0, 0) = q1.
δ(q0, 1) = q0.
δ(q1, 0) = q2.
δ(q1, 1) = q0.
δ(q2, 0) = q2.
δ(q2, 1) = q2.
Transition Diagrams
• Using circles to denote states, arrows to denote transition.
• Starting state is denoted by using an arrow labeled start.
• Final/accepting states are denoted by using double circles.
Transition Tables
0 1
q0 q1 q0
q1 q2 q0
q2 q2 q2
Extending transition function to strings
Basis:
ˆδ(q, ) = q.
Induction:
ˆδ(q, xa) = δ(ˆδ(q, x), a).
Language Accepted by a DFA
L(A) = {w | ˆδ(q0, w) ∈ F}
Nondeterministic Finite State Automata (NFA)
• A = (Q, Σ, δ, q0, F).
• The transition function maps the input (state, symbol) to a set
of states (a subset of Q)
Example: L = {w | n-th symbol in w from the end is 1}.
Extending transition function to strings for NFA
Basis:
ˆδ(q, ) = {q}.
Induction:
ˆδ(q, xa) = p∈ˆδ(q,x)
δ(p, a).
Language Accepted by an NFA
L(A) = {w | ˆδ(q0, w) ∩ F = ∅}
Equivalence of DFA and NFA
Clearly, a DFA is also an NFA.
So, we only need to show that a language accepted by NFA is also
accepted by some DFA.
Suppose NFA A = (Q, Σ, δ, q0, F) is given.
Define DFA AD = (QD, Σ, δD, {q0}, FD) as follows.
QD = {S | S ⊆ Q}.
FD = {S | S ⊆ Q and S ∩ F = ∅}.
δD(S, a) = q∈S δ(q, a).
Equivalence of DFA and NFA
Claim: For any string w, ˆδD({q0}, w) = ˆδ(q0, w).
Proof: By induction on length of w.
Base Case: w = .
In this case clearly, ˆδD({q0}, ) = {q0} = ˆδ(q0, ).
Induction Step:
ˆδD({q0}, wa) = δD( ˆδD({q0}, w), a)
=
q∈ ˆδD({q0},w)
δ(q, a)
=
q∈ˆδ(q0,w)
δ(q, a)
= ˆδ(q0, wa)
QED Claim.
Thus, ˆδD({q0}, w) ∈ FD iff ˆδ(q0, w) ∩ F = ∅.
It follows that DFA AD accepts w iff NFA A accepts w.
Dead and Unreachable States in a DFA
Dead State is a state from which one cannot reach a final state,
whatever the sequence of inputs.
Formally, q is a dead state if, for all w ∈ Σ∗, ˆδ(q, w) ∈ F.
Unreachable states are states which cannot be reached from starting
state, whatever the sequence of inputs.
Formally, q is an unreachable state if, for all w ∈ Σ∗, ˆδ(q0, w) = q.
NFA with transitions
A = (Q, Σ, δ, q0, F).
δ maps Q × (Σ ∪ { }) to subsets of Q.
Example: An integer is (+, −, ) followed by digits.
Closures
Definition of Eclose(q)
1. q ∈ Eclose(q).
2. If state p ∈ Eclose(q), then each state in δ(p, ), is in Eclose(q).
3. We iterate step 2, until no more changes are done to Eclose(q).
Definition of extended transition function ˆδ
ˆδ(q, ) = Eclose(q).
ˆδ(q, wa) = S, where S is defined as follows:
Let R = p∈ˆδ(q,w)
δ(p, a)
Then, S = p∈R Eclose(p).
L(A) = {w | ˆδ(q0, w) ∩ F = ∅}.
Equivalence of -NFA and DFA.
Tutorial problem.
Idea:
Suppose A = (Q, Σ, δ, q0, F).
Form AD = (QD, Σ, δD, qD, FD) as follows:
Essentially let QD = {S | S ⊆ Q}.
qD = Eclose(q0).
Transition: δD(S, a) = p∈S
ˆδ(p, a)
FD = {S | S ∩ F = ∅}.
Regular Expressions
Basis: The constant and ∅ are regular expressions, and L( ) = { }
and L(∅) = ∅.
If a is any symbol in Σ, then a is a regular expression, and L(a) =
{a}.
Induction: If r1 and r2 are regular expressions, then so are:
(a) r1 + r2
L(r1 + r2) = L(r1) ∪ L(r2).
(b) r1 · r2
L(r1 · r2) = {xy | x ∈ L(r1) and y ∈ L(r2)}
(c) r∗
1
L(r∗
1) = {x1x2 . . . xk | for 1 ≤ i ≤ k, xi ∈ L(r1)}.
Note: in above k can be 0, and thus, ∈ L(r∗
1).
(d) (r1)
L((r1)) = L(r1).
Precedence
∗ has highest precedence
· has next highest precedence
+ has least precedence
Association
DFA to Regular Expressions
Let the DFA A = (Q, Σ, δ, qstart, F).
We assume Q = {1, 2, . . . , n} for some n, and qstart = 1.
Rk
i,j denote the regular expression for the set of strings which can
be formed by going from state i to state j using intermediate states
numbered ≤ k.
Base Case: Definition of R0
i,j.
If i = j: R0
i,j = a1 + a2 . . . + am, where a1, a2, . . . , am are all the
symbols such that δ(i, ar) = j (If no such symbols, then R0
i,j = ∅).
If i = j: R0
i,i = + a1 + a2 . . . + am, where a1, a2, . . . , am are all
the symbols such that δ(i, ar) = i
Induction Case:
Rk+1
i,j = Rk
i,j + Rk
i,k+1(Rk
k+1,k+1)∗Rk
k+1,j.
Regular Expression for language L(A) is given by: j∈F Rn
1,j.
Regular Expressions to -NFA
We will show how to inductively construct a -NFA for every regular
expression which additionally satisfies:
a) It has only one final state.
b) There is no transition into the starting state.
c) There is no transition out of the final state.
Base Cases:
(i) ∅:
(ii) :
(iii) a:
Induction Case:
(iv) r1 + r2
(v) r1 · r2
(vi) r∗
1
Some Properties of Regular Expressions
• M + N = N + M
• L(M + N) = LM + LN
• L + L = L
• (L∗)∗ = L∗.
• ∅∗ =
• ∗ =
• L+ = LL∗ = L∗L
• L∗ = + L+
• (L + M)∗ = (L∗M∗)∗

More Related Content

What's hot

Bellman ford
Bellman fordBellman ford
Bellman fordKiran K
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguagesissbp
 
Graph representation of DFA’s Da
Graph representation of DFA’s DaGraph representation of DFA’s Da
Graph representation of DFA’s Daparmeet834
 
Johnson's algorithm
Johnson's algorithmJohnson's algorithm
Johnson's algorithmKiran K
 
Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Traian Rebedea
 
Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7Traian Rebedea
 
Algorithm Design and Complexity - Course 11
Algorithm Design and Complexity - Course 11Algorithm Design and Complexity - Course 11
Algorithm Design and Complexity - Course 11Traian Rebedea
 
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurMid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Perron method for the Dirichlet problem
Perron method for the Dirichlet problemPerron method for the Dirichlet problem
Perron method for the Dirichlet problemMichael Maltese
 
Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Traian Rebedea
 
Kernel Lower Bounds
Kernel Lower BoundsKernel Lower Bounds
Kernel Lower BoundsASPAK2014
 
Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)Vlad Patryshev
 
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 LemmaRushabh2428
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...parmeet834
 
Lec2 Algorth
Lec2 AlgorthLec2 Algorth
Lec2 Algorthhumanist3
 

What's hot (20)

Bellman ford
Bellman fordBellman ford
Bellman ford
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguages
 
Graph representation of DFA’s Da
Graph representation of DFA’s DaGraph representation of DFA’s Da
Graph representation of DFA’s Da
 
Johnson's algorithm
Johnson's algorithmJohnson's algorithm
Johnson's algorithm
 
Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9
 
Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7Algorithm Design and Complexity - Course 7
Algorithm Design and Complexity - Course 7
 
Algorithm Design and Complexity - Course 11
Algorithm Design and Complexity - Course 11Algorithm Design and Complexity - Course 11
Algorithm Design and Complexity - Course 11
 
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurMid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
140210116032
140210116032140210116032
140210116032
 
Induced subgraphs
Induced subgraphsInduced subgraphs
Induced subgraphs
 
Perron method for the Dirichlet problem
Perron method for the Dirichlet problemPerron method for the Dirichlet problem
Perron method for the Dirichlet problem
 
Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8
 
Kernel Lower Bounds
Kernel Lower BoundsKernel Lower Bounds
Kernel Lower Bounds
 
Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)
 
Anomalous Transport
Anomalous TransportAnomalous Transport
Anomalous Transport
 
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
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 
Vector spaces
Vector spacesVector spaces
Vector spaces
 
Lec2 Algorth
Lec2 AlgorthLec2 Algorth
Lec2 Algorth
 

Viewers also liked

Blog's project
Blog's projectBlog's project
Blog's projectEdi27
 
Joining a PLN and Staying Active in One
Joining a PLN and Staying Active in OneJoining a PLN and Staying Active in One
Joining a PLN and Staying Active in OneSusan Elizabeth Morse
 
Moving Your ERP to the Cloud
Moving Your ERP to the CloudMoving Your ERP to the Cloud
Moving Your ERP to the CloudKenandy
 
Patching your employee's brain (by NVISO - Pieter Danhieux)
Patching your employee's brain (by NVISO - Pieter Danhieux)Patching your employee's brain (by NVISO - Pieter Danhieux)
Patching your employee's brain (by NVISO - Pieter Danhieux)NVISO
 
Getting test automation right - webinar
Getting test automation right - webinarGetting test automation right - webinar
Getting test automation right - webinarZephyr
 
Blue Clover Devices: The IoT ODM
Blue Clover Devices:  The IoT ODMBlue Clover Devices:  The IoT ODM
Blue Clover Devices: The IoT ODMKenandy
 
Oracle cloud story short
Oracle cloud story   shortOracle cloud story   short
Oracle cloud story shortYuri Grinshteyn
 

Viewers also liked (8)

Blog's project
Blog's projectBlog's project
Blog's project
 
Devans class
Devans classDevans class
Devans class
 
Joining a PLN and Staying Active in One
Joining a PLN and Staying Active in OneJoining a PLN and Staying Active in One
Joining a PLN and Staying Active in One
 
Moving Your ERP to the Cloud
Moving Your ERP to the CloudMoving Your ERP to the Cloud
Moving Your ERP to the Cloud
 
Patching your employee's brain (by NVISO - Pieter Danhieux)
Patching your employee's brain (by NVISO - Pieter Danhieux)Patching your employee's brain (by NVISO - Pieter Danhieux)
Patching your employee's brain (by NVISO - Pieter Danhieux)
 
Getting test automation right - webinar
Getting test automation right - webinarGetting test automation right - webinar
Getting test automation right - webinar
 
Blue Clover Devices: The IoT ODM
Blue Clover Devices:  The IoT ODMBlue Clover Devices:  The IoT ODM
Blue Clover Devices: The IoT ODM
 
Oracle cloud story short
Oracle cloud story   shortOracle cloud story   short
Oracle cloud story short
 

Similar to Dfa

FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).pptssuser47f7f2
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.pptRohitPaul71
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Akila Krishnamoorthy
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
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
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)Naman Joshi
 
Theory of automata
Theory of automataTheory of automata
Theory of automataArslan905905
 
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
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introductionNAMRATA BORKAR
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Abhimanyu Mishra
 

Similar to Dfa (20)

Finite automata
Finite automataFinite automata
Finite automata
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.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
Automata theoryAutomata theory
Automata theory
 
Fsa
FsaFsa
Fsa
 
Teori automata lengkap
Teori automata lengkapTeori automata lengkap
Teori automata lengkap
 
Pda
PdaPda
Pda
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
 
Dfa h11
Dfa h11Dfa h11
Dfa h11
 
Theory of automata
Theory of automataTheory of automata
Theory of automata
 
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
 
PDA (1) (1).pptx
PDA (1) (1).pptxPDA (1) (1).pptx
PDA (1) (1).pptx
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introduction
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
 
NFAvsDFA.ppt
NFAvsDFA.pptNFAvsDFA.ppt
NFAvsDFA.ppt
 
Nfa egs
Nfa egsNfa egs
Nfa egs
 

Recently uploaded

Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...amitlee9823
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
ELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxolyaivanovalion
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...amitlee9823
 

Recently uploaded (20)

Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
ELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptx
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 

Dfa

  • 1. Finite Automata • We will now introduce the concept of regular langauges. • Accepted by a computation device known as finite automata • Other methods to describe regular languages include, regular ex- pressions and a special type of grammars called regular grammars.
  • 2. Some Examples 1. ON-OFF switch (push button). Two states, on and off. Each input toggles the state. 2. Recognition of words (lexical analyzers). 3. Many home devices such as VCRs, . . .
  • 3. Deterministic Finite Automata (DFA) A deterministic Finite Automaton consists of: • A finite set of states, often denoted by Q. • A finite set of input symbols (letters), often denoted by Σ. • A transition function, that takes two arguments: a state from Q and a letter from Σ, and returns a state. Transition function is often denoted by δ. • A starting state, q0, which is one of the states of Q. • A set F ⊆ Q of final/accepting states. A = (Q, Σ, δ, q0, F).
  • 4. Deterministic Finite Automata: Example DFA accepting strings which contain odd number of 1s (here we are taking the alphabet as {0, 1}). A = ({q0, q1}, {0, 1}, δ, q0, {q1}). δ(q0, 0) = q0. δ(q0, 1) = q1. δ(q1, 0) = q1. δ(q1, 1) = q0.
  • 5. Deterministic Finite Automata: Another Example DFA accepting strings which contain 00 as a substring. This is same as accepting the set: {w | w is of form x00y for some strings x and y} (here we are taking the alphabet as {0, 1}). A = ({q0, q1, q2}, {0, 1}, δ, q0, {q2}). δ(q0, 0) = q1. δ(q0, 1) = q0. δ(q1, 0) = q2. δ(q1, 1) = q0. δ(q2, 0) = q2. δ(q2, 1) = q2.
  • 6. Transition Diagrams • Using circles to denote states, arrows to denote transition. • Starting state is denoted by using an arrow labeled start. • Final/accepting states are denoted by using double circles.
  • 7. Transition Tables 0 1 q0 q1 q0 q1 q2 q0 q2 q2 q2
  • 8. Extending transition function to strings Basis: ˆδ(q, ) = q. Induction: ˆδ(q, xa) = δ(ˆδ(q, x), a).
  • 9. Language Accepted by a DFA L(A) = {w | ˆδ(q0, w) ∈ F}
  • 10. Nondeterministic Finite State Automata (NFA) • A = (Q, Σ, δ, q0, F). • The transition function maps the input (state, symbol) to a set of states (a subset of Q) Example: L = {w | n-th symbol in w from the end is 1}.
  • 11. Extending transition function to strings for NFA Basis: ˆδ(q, ) = {q}. Induction: ˆδ(q, xa) = p∈ˆδ(q,x) δ(p, a).
  • 12. Language Accepted by an NFA L(A) = {w | ˆδ(q0, w) ∩ F = ∅}
  • 13. Equivalence of DFA and NFA Clearly, a DFA is also an NFA. So, we only need to show that a language accepted by NFA is also accepted by some DFA. Suppose NFA A = (Q, Σ, δ, q0, F) is given. Define DFA AD = (QD, Σ, δD, {q0}, FD) as follows. QD = {S | S ⊆ Q}. FD = {S | S ⊆ Q and S ∩ F = ∅}. δD(S, a) = q∈S δ(q, a).
  • 14. Equivalence of DFA and NFA Claim: For any string w, ˆδD({q0}, w) = ˆδ(q0, w). Proof: By induction on length of w. Base Case: w = . In this case clearly, ˆδD({q0}, ) = {q0} = ˆδ(q0, ). Induction Step: ˆδD({q0}, wa) = δD( ˆδD({q0}, w), a) = q∈ ˆδD({q0},w) δ(q, a) = q∈ˆδ(q0,w) δ(q, a) = ˆδ(q0, wa) QED Claim.
  • 15. Thus, ˆδD({q0}, w) ∈ FD iff ˆδ(q0, w) ∩ F = ∅. It follows that DFA AD accepts w iff NFA A accepts w.
  • 16. Dead and Unreachable States in a DFA Dead State is a state from which one cannot reach a final state, whatever the sequence of inputs. Formally, q is a dead state if, for all w ∈ Σ∗, ˆδ(q, w) ∈ F. Unreachable states are states which cannot be reached from starting state, whatever the sequence of inputs. Formally, q is an unreachable state if, for all w ∈ Σ∗, ˆδ(q0, w) = q.
  • 17. NFA with transitions A = (Q, Σ, δ, q0, F). δ maps Q × (Σ ∪ { }) to subsets of Q. Example: An integer is (+, −, ) followed by digits.
  • 18. Closures Definition of Eclose(q) 1. q ∈ Eclose(q). 2. If state p ∈ Eclose(q), then each state in δ(p, ), is in Eclose(q). 3. We iterate step 2, until no more changes are done to Eclose(q).
  • 19. Definition of extended transition function ˆδ ˆδ(q, ) = Eclose(q). ˆδ(q, wa) = S, where S is defined as follows: Let R = p∈ˆδ(q,w) δ(p, a) Then, S = p∈R Eclose(p). L(A) = {w | ˆδ(q0, w) ∩ F = ∅}.
  • 20. Equivalence of -NFA and DFA. Tutorial problem. Idea: Suppose A = (Q, Σ, δ, q0, F). Form AD = (QD, Σ, δD, qD, FD) as follows: Essentially let QD = {S | S ⊆ Q}. qD = Eclose(q0). Transition: δD(S, a) = p∈S ˆδ(p, a) FD = {S | S ∩ F = ∅}.
  • 21. Regular Expressions Basis: The constant and ∅ are regular expressions, and L( ) = { } and L(∅) = ∅. If a is any symbol in Σ, then a is a regular expression, and L(a) = {a}. Induction: If r1 and r2 are regular expressions, then so are: (a) r1 + r2 L(r1 + r2) = L(r1) ∪ L(r2). (b) r1 · r2 L(r1 · r2) = {xy | x ∈ L(r1) and y ∈ L(r2)} (c) r∗ 1 L(r∗ 1) = {x1x2 . . . xk | for 1 ≤ i ≤ k, xi ∈ L(r1)}. Note: in above k can be 0, and thus, ∈ L(r∗ 1). (d) (r1) L((r1)) = L(r1).
  • 22. Precedence ∗ has highest precedence · has next highest precedence + has least precedence Association
  • 23. DFA to Regular Expressions Let the DFA A = (Q, Σ, δ, qstart, F). We assume Q = {1, 2, . . . , n} for some n, and qstart = 1. Rk i,j denote the regular expression for the set of strings which can be formed by going from state i to state j using intermediate states numbered ≤ k. Base Case: Definition of R0 i,j. If i = j: R0 i,j = a1 + a2 . . . + am, where a1, a2, . . . , am are all the symbols such that δ(i, ar) = j (If no such symbols, then R0 i,j = ∅). If i = j: R0 i,i = + a1 + a2 . . . + am, where a1, a2, . . . , am are all the symbols such that δ(i, ar) = i Induction Case: Rk+1 i,j = Rk i,j + Rk i,k+1(Rk k+1,k+1)∗Rk k+1,j. Regular Expression for language L(A) is given by: j∈F Rn 1,j.
  • 24. Regular Expressions to -NFA We will show how to inductively construct a -NFA for every regular expression which additionally satisfies: a) It has only one final state. b) There is no transition into the starting state. c) There is no transition out of the final state. Base Cases: (i) ∅: (ii) : (iii) a: Induction Case: (iv) r1 + r2 (v) r1 · r2 (vi) r∗ 1
  • 25. Some Properties of Regular Expressions • M + N = N + M • L(M + N) = LM + LN • L + L = L • (L∗)∗ = L∗. • ∅∗ = • ∗ = • L+ = LL∗ = L∗L • L∗ = + L+ • (L + M)∗ = (L∗M∗)∗