Deterministic: Finite Automata
Deterministic: Finite Automata
Deterministic: Finite Automata
Finite Automata
Input
String
Output
“Accept”
Finite
or
Automaton
“Reject”
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
initial accepting
state state
transition
state
Fall 2005 Costas Busch - RPI 3
Initial Configuration
Input String
a b b a
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a b b a
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a b b a
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
accept
Fall 2005 Costas Busch - RPI 9
Rejection
a b a
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a b a
a, b
reject
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
reject
Fall 2005 Costas Busch - RPI 16
Another Example
a a b
a a,b
q0 b q1 a, b q2
a a,b
q0 b q1 a, b q2
a a,b
q0 b q1 a, b q2
a a,b
q0 b q1 a, b q2
a a b
a a,b
accept
q0 b q1 a, b q2
b a b
a a,b
q0 b q1 a, b q2
a a,b
q0 b q1 a, b q2
a a,b
q0 b q1 a, b q2
a a,b
q0 b q1 a, b q2
b a b
a a,b
q0 b q1 a, b q2
reject
Definition:
The language L M contains
all input strings accepted by M
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
accept
a, b
q5
b a a a, b
b
q0 a q1 b q2 b q3 a q4
accept accept accept
L M {a b : n 0}
n
a a,b
q0 b q1 a, b q2
M Q, , , q0 , F
Q : set of states
: input alphabet
: transition function
q0 : initial state
F : set of accepting states
Fall 2005 Costas Busch - RPI 31
Input Alphabet
a, b
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
F q4
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
:Q Q
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
* : Q * Q
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
* q , w q
q w q
w 1 2 k
1 2 k
q q
* q0 , abbbaa q5
a, b
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
q w q1 q
* q , w q
* q, w (q1, )
(q1, ) q
* q, w ( * (q, w), )
* q, w q1
q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
Fall 2005 Costas Busch - RPI 48
Language Accepted by DFA
For a DFA M Q, , , q0 , F
Language accepted by M :
L M w * : * q0 , w F
q0 w q q F
L M w * : * q0 , w F
q0 w q q F
q0 a q1 b q2
b a accept
q3 a, b
1 0 0,1
1
0 1
0 00 001
0
Fall 2005 Costas Busch - RPI 52
Example
L( M ) awa : w a, b *
a
b
b
q0 a q2 q3
b a
q4
a, b
Fall 2005 Costas Busch - RPI 53
Regular Languages
Definition:
A language L is regular if there is
DFA M such that L L M
Observation:
All languages accepted by all DFAs
form the family of regular languages
n n
Example: L {a b : n 0}