L3 DFA Introduction
L3 DFA Introduction
L3 DFA Introduction
DFA Introduction
Course Instructors:
Div 1: Praveen Pawar (Div 1)
Div 2: Jibi Abraham (Div 2)
1
Finite Automata
2
Example of a Finite Automaton
f
off on
f
There are states off and on, the automaton
starts in off and tries to reach the “good state”
on
What sequences of f’s lead to the final state?
Answer: {f, fff, fffff, …} = {f n: n is odd}
This is an example of a deterministic finite
automaton over alphabet {f}
Deterministic finite automata
A deterministic finite automaton (DFA) is a 5-
tuple (Q, S, d, q0, F) where
Q is a finite set of states
S is an alphabet
d: Q × S → Q is a transition function
q0 Q is the initial state
F Q is a set of accepting states (or final states).
Representation of d
Transition Function, d, can be represented in
2-ways
Transition Diagram
Transition Table
5
Example - 1
0 1 0,1
q0 1 q1 0 q2
states
q1 q2 q1
q2 q2 q2
B. No
7
Block Diagram of FA
0 1 1 0 0 .. .. Input Tape
Header
Finite
Control
9
Example -2
The language of a DFA (Q, S, d, q0, F) is the set of
all strings over S that, starting from q0 and
following the transitions as the string is read left
to right, will reach some accepting state.
f
M: off on
f
0
q0 q1 1
0
State q0 q0 q1 q0 q0 q0
Input 1 0 0 1 1
B. No
0
q0 q1 1
0
13
Construction of DFA – Example 5
Construct the FA that accept all the strings on {0,1}
where every string start with 10.
Step 1 : ∑ = {0,1}
Step 2 : L = {10, 100, 101, 1000, 1001, 1010, 1011, ….}
Step 3: Transition Diagram
0,1
q3
Step 4: Q = {q0, q1, q2, q3} 0 0,1
1
Step 5: F = {q2} q0 q1 q2
1 0
Start
14
Construction of DFA – Example 6
Construct the FA that accept all the string of {0,1}
where every string contain the substring 10.
Step 1 : ∑ = {0,1}
Step 2 : L = {10, 010, 110, 100, 101, 1010, 1011, ….}
Step 3: Transition Diagram
16
?
17