CSE322
Definition and description of finite
Automata
Lecture #1
Definition
An automaton is defined as a system where energy,
materials and information are transformed, transmitted
and used for performing some functions without direct
participation of man.
Formal Definition
•
Finite Automaton (FA)
M Q, , , q0 , F
Q
q0
: set of states
: input alphabet
: transition function
: initial state
F : set of accepting states
Input alphabet
a, b
a, b
q5
b
q0 a
a
a
b
q1 b q2 b q3 a
a, b
q4
Set of States
Q q0 , q1, q2 , q3 , q4 , q5
a, b
q5
b
q0 a
a
a
b
q1 b q2 b q3 a
a, b
q4
Initial State
a, b
q5
b
q0 a
a
a
b
q1 b q2 b q3 a
a, b
q4
Accepting State
F
Set of Accepting States
F q4
a, b
q5
b
q0 a
a
a
b
q1 b q2 b q3 a
a, b
q4
Non-Deterministic
Finite Automata
Nondeterministic Finite Automaton
Alphabet = {a}
a
q0
q1
a
q3
a
q2
Alphabet = {a}
Two choices
a
q0
q1
a
q3
a
q2
Alphabet = {a}
Two choices
a
q0
q1
a
q2 No transition
a
q3 No transition
First Choice
a a
a
q0
q1
a
q3
a
q2
First Choice
a a
a
q0
q1
a
q3
a
q2
First Choice
a a
a
q0
q1
a
q3
a
q2
First Choice
a a
All input is consumed
a
q0
q1
a
q3
a
q2
“accept”
Second Choice
a a
a
q0
q1
a
q3
a
q2
Second Choice
a a
a
q0
q1
a
q3
a
q2
Second Choice
a a
a
q0
q1
a
q3
a
q2
No transition:
the automaton hangs
Second Choice
a a
Input cannot be consumed
a
q0
q1
a
q2
a
q3
“reject”
An NFA accepts a string:
when there is a computation of the
NFA that accepts the string
There is a computation:
all the input is consumed and the automaton
is in an accepting state
Example
aa
is accepted by the NFA:
“accept”
a
q0
q1
a
q2
a
q0
a
q3
because this
computation
accepts aa
q1
a
q3
a
q2
“reject”
Rejection example
a
a
q0
q1
a
q3
a
q2
First Choice
a
a
q0
q1
a
q3
a
q2
First Choice
a
“reject”
a
q0
q1
a
q3
a
q2
Second Choice
a
a
q0
q1
a
q3
a
q2
Second Choice
a
a
q0
q1
a
q3
a
q2
Second Choice
a
a
q0
q1
a
q2
a
q3 “reject”
An NFA rejects a string:
when there is no computation of the
NFA that accepts the string.
For each computation:
• All the input is consumed and the
automaton is in a non final state
OR
• The input cannot be consumed
Example
a
is rejected by the NFA:
“reject”
a
q0
q1
a
q2
a
q0
a
q3
“reject”
q1
a
q2
a
q3
All possible computations lead to rejection
Rejection example
a a a
a
q0
q1
a
q3
a
q2
First Choice
a a a
a
q0
q1
a
q3
a
q2
First Choice
a a a
a
q0
q1
a
q3
a
q2
No transition:
the automaton hangs
First Choice
a a a
Input cannot be consumed
a
q0
q1
a
q3
a
q2
“reject”
Second Choice
a a a
a
q0
q1
a
q3
a
q2
Second Choice
a a a
a
q0
q1
a
q3
a
q2
Second Choice
a a a
a
q0
q1
a
q3
a
q2
No transition:
the automaton hangs
Second Choice
a a a
Input cannot be consumed
a
q0
q1
a
q2
a
q3
“reject”
aaa
is rejected by the NFA:
“reject”
a
q0
q1
a
q2
a
q0
a
q3
q1
a
q3
a
q2
“reject”
All possible computations lead to rejection
Language accepted:
a
q0
q1
a
q3
a
L {aa}
q2
Lambda Transitions
q0
a
q1
q2
a
q3
a a
q0
a
q1
q2
a
q3
a a
q0
a
q1
q2
a
q3
(read head does not move)
a a
q0
a
q1
q2
a
q3
a a
q0
a
q1
q2
a
q3
all input is consumed
a a
“accept”
q0
String
a
q1
aa is accepted
q2
a
q3
Rejection Example
a a a
q0
a
q1
q2
a
q3
a a a
q0
a
q1
q2
a
q3
(read head doesn’t move)
a a a
q0
a
q1
q2
a
q3
a a a
q0
a
q1
q2
a
q3
No transition:
the automaton hangs
Input cannot be consumed
a a a
“reject”
q0
String
a
aaa
q1
q2
is rejected
a
q3
Language accepted:
q0
a
q1
L {aa}
q2
a
q3
Another NFA Example
q0
a
b
q1
q2
q3
a b
q0
a
b
q1
q2
q3
a b
q0
a
b
q1
q2
q3
a b
q0
a
b
q1
q2
q3
a b
“accept”
q0
a
b
q1
q2
q3
Another String
a b a b
q0
a
b
q1
q2
q3
a b a b
q0
a
b
q1
q2
q3
a b a b
q0
a
b
q1
q2
q3
a b a b
q0
a
b
q1
q2
q3
a b a b
q0
a
b
q1
q2
q3
a b a b
q0
a
b
q1
q2
q3
a b a b
q0
a
b
q1
q2
q3
a b a b
“accept”
q0
a
b
q1
q2
q3
Language accepted
L ab, abab, ababab, ...
ab
q0
a
b
q1
q2
q3
Another NFA Example
0
q0
1
q1
0, 1 q2
Language accepted
L(M ) = {λ, 10, 1010, 101010, ...}
= {10} *
0
q0
1
q1
0, 1 q2
(redundant
state)
Remarks:
•The symbol never appears on the
input tape
•Simple automata:
M1
q0
M2
L(M1 ) = {}
L(M 2 ) = {λ}
q0
•NFAs are interesting because we can
express languages easier than FAs
NFA
q0
a
M1
FA
q2
q1
a
q0
L( M1 ) = {a}
a
M2
a
q1
L( M 2 ) = {a}
Formal Definition of NFAs
M Q, , , q0 , F
Q:
Set of states, i.e.
q0 , q1, q2
:
Input aplhabet, i.e.
a, b
:
Transition function
q0 : Initial state
F:
Accepting states
Transition Function
q0 , 1 q1
0
q0
1
q1
0, 1 q
2
(q1,0) {q0 , q2 }
0
q0
1
q1
0, 1 q
2
(q0 , ) {q0 , q2}
0
q0
1
q1
0, 1 q
2
(q2 ,1)
0
q0
1
q1
0, 1 q
2
Extended Transition Function *
* q0 , a q1
q5
q4
a
q0
a
a
b
q1
q2
q3
* q0 , aa q4 , q5
q5
q4
a
q0
a
a
b
q1
q2
q3
* q0 , ab q2 , q3 , q0
q5
q4
a
q0
a
a
b
q1
q2
q3
Formally
q j * qi , w : there is a walk from qi to q j
with label
w
w
qi
qj
w 1 2 k
qi
1
2
k
qj
The Language of an NFA
F q0 ,q5
q5
q4
a
q0
a
a
b
q1
q2
q3
* q0 , aa q4 , q5
F
aa L(M )
F q0 ,q5
q5
q4
a
q0
a
a
b
q1
q2
* q0 , ab q2 , q3 , q0
F
ab LM
q3
F q0 ,q5
q5
q4
a
q0
a
a
b
q1
q2
q3
* q0 , abaa q4 , q5
aaba L(M )
F
F q0 ,q5
q5
q4
a
q0
a
a
b
q1
q2
q3
* q0 , aba q1
F
aba LM
q5
q4
a
q0
a
a
b
q1
q2
LM ab* {aa}
q3
© Copyright 2026 Paperzz