Chapter 2. Finite Automata
Chapter 2. Finite Automata
Finite Automata
Reena Lokare
Deterministic Finite Automata (DFA)
M = { Q, Σ, δ,q0, F}
Q = Finite set of states
Σ = Finite set of Input symbols
δ = Transition functions maps from Q * Σ = Q
q0 = Initial / Start state
F = Set of final or accepting states
DFA
Language = Regular Language
Input = String = Set of input symbols
Output =Accept / Reject
DFA to accept strings ending with 0
r = (0+1) *. 0 M = { Q, Σ, δ,q0, F}
Q = { q0,q1 }
Σ = { 0,1 }
δ = Transition Table
Q0 = {q0}
F = {q1}
Q = { q0,q1,q2 }
Σ = { 0,1 }
δ = Transition Table
Q0 = {q0}
F = {q2}
q0= Initial state q1= strings end with 0 q2= strings end with 01
DFA to accept Numbers divisible by 4 (0100)
Q\Σ 0 1
M = { Q, Σ, δ,q0, F}
Q = Finite set of states
Σ = Finite set of Input symbols
δ = Transition functions maps from Q * Σ = 2Q
q0 = Initial / Start state
F = Set of final or accepting states
NFA to accept strings having at least 2 consecutive 0’s or 1’s
r= (0+1)*00 (0+1)*+ (0+1)*11 (0+1)*
NFA to accept strings with substring 101
r = (0+1)*101(0+1)*
Regular Expression to Finite Automata
r = a ( a + b )* bb
r1 = a
r2 = (a + b)*
r3 =bb
r1 = a
r2 = (a + b)*
r3 =bb
Final Automata
NFA with ε-transitions to NFA without ε-transitions
Algorithm to convert NFA with ε-transitions to NFA
without ε-transitions
Note: Number of states will remain same.
Q\∑ a b c
qo qo - -
q1 - q1 -
q2 - - q2
Transitions of new states:
New States:
Q\∑ a b c
[{q0,q1,q2}]
[{q1,q2}] [{q0,q1,q2}] [{q0,q1,q2}] [{q1,q2}] [{q2}]
[{q2}]
-
[{q1,q2}] [{q1,q2}] [{q2}]
- -
[{q2}] [{q2}]
NFA without ε-transitions
NFA to DFA
NFA
Equivalent DFA
DFA Minimization/Optimization
● Method of detecting those states of a DFA whose presence or absence in a
DFA does not affect the language accepted by the automata.
● States to remove:
○ Unreachable states
○ Dead states
○ Non-distinguishable states
Finite Automata with Output
FAs where output can be chosen from some other alphabet.
Moore Machine = Output labelled with state
M = { Q, Σ, δ,q0, λ, Δ }
Δ = Output alphabet
Δ = Output alphabet