Finite Automata:
Two categories of Finite Automata:
Deterministic Finite Automata (DFA)
The machine can exist in only one state
at any given time
Non-deterministic Finite Automata
(NFA)
The machine can exist in multiple states
at the same time
1
Deterministic
Finite Automata
( DFA):
A Deterministic Finite Automaton (DFA) is a
finite state machine that accepts/rejects finite
strings (sequence of symbols or alphabets) and
perform unique computation for each input
string.
Deterministic refers to the uniqueness of the
computation.
2
Deterministic
Finite Automata
( DFA):
A DFA is defined by the 5-tuples:
{Q, ∑ , q0,F, δ }
I t consists
of:
Q ==> a finite
set of states
∑ ==> a finite set of input symbols
(alphabets) q0 ==> a start state (q0 Q)
3 F ==> set of final states (subset of Q)
DFA Computation [1/3]:
Let us consider an example, where a string is
given and have to calculate that the string is
present in the language or not ?
L is a Finite language;
Given, ∑ = { a, b }
L1 = Set of all strings starts
with “a”
String, S ={ a, aa, ab, aaa,…. }
= aab
The DFA for this calculation is given in
next slide:
4
DFA Computation [2/3]:
a,b
A a
B
C
a,b
5
DFA Computation [3/3]:
Steps:
Start from the “start state/ initial state”
For every input symbol in the string we
do the following:
Compute the next state from the current state,
given the current input symbol from the string and
the transition function
After all symbols in that strings are calculated, if
the current state is one of the final states (F) then
6 we can say the string will be accepted by that
DFA Computation:
Let us consider another example, where a string is
given and have to calculate that the string is present
in the language or not ?
L is a infinite language;
Given, ∑ = { a, b }
L1 = Set of all strings starts with
“a”
String, ={ a, aa, ab, Saaa,….
= bba }
Here, S = bba is not present in the language and it is
invalid operation for computation.
7
Construct a
DFA:
Build a DFA for the following language:
L = {w | w is a binary string that contains 01 as
a substring}
Steps for building a DFA:
∑ = {0,1}
Decide on the states: Q
Designate start state and final state(s)
δ : Decide on the transitions
Final states == accepting states
8
Other states == non-accepting states
DFA for strings containing
{01
}
State Diagram • Q = {q0,q1,q2}
• ∑ = {0,1}
1 0 0,1 • start state = q0
start 0 1 • F = {q2}
q0 q1 q2
Final Transition Table
symbols
0 1
state states q0 q1 q0
q1 q1 q2
*q2 q2 q2
Construct a
DFA:
Build a DFA for the following
language:
W {a,b}; |W | ≥ 2
Solution:
∑ = {a,b} a, b
L = {aa, ab, ba, bb, aaa…, bbb….}
a,b
A a, b B C
State Diagram:
10
Example of
DFA:
11
Example of
DFA:
12
End of
13
Slides