Professional Documents
Culture Documents
0 1 1 0 0
Finite
Control
n(Q) = 2 , n(Σ) = 2
:QΣ→Q
Examples
M = ( {q0 , q1 , q2 , D } , {a, b} , q0 , , {q2} ) a b
q1 D
where (q0 , a) = q1 (q0 , b) = D q0
q1 q2
(q1 , a) = q1 (q1 , b) = q2 q1 D q2
(q2 , a) = D (q2 , b) = q2 q2 D D
(D , a) = Da (D , b) = D D
Transition Table or State Table
q0 a b b
q1 q2
Transition diagram or State diagram
b a
D
a,b
Extended Transition Function
^
*
Extend to : Q Q
a q1 b c
^ q0 q2 q3
1) ( q, ) q, q Q ^ ^
(q0 , abc) ( ( q0 , ab), c)
* ^
2) x , a , q Q ( ( (q0 , a ), b), c)
^
^ ^
( ( ( (q0 , ), a ), b), c)
(q, xa) ( (q, x), a)
( ( ( q0 , a ), b), c)
( ( q1 , b), c)
(q2 , c) q3
Grammar and Automata
L(M) is the of strings accepted by M
^
L ( M ) { x / x , ( q0 , x ) F }
*
a,b
2) q1 {a, b}
*
L( M )
3) a
q0 q1
L( M ) {(ab) n / n 0}
b
b a
a,b
4) a,b {a, b}
a,b
q0 q1 L(M )
5)
a,b
q0 q1
a,b a,b
{a, b} q2
*
L( M ) {x / x , | x | 3k , k 0,1,2,...}
DFA
Language accepted by a FSA is called regular set or regular language
(qi , a) = { qi , q j }
Q = {q0 , q1 } , Σ = { a, b}
n(Q) = 2 , n(Σ) = 2
n(2Q) = 2n(Q) = 22 = 4
: Q Σ → 2Q
QΣ 2Q
(q0, b)
(q1, b ) = { q0}
(q1, a)
(q1, b)
qi
a qk
Example - 1
a a
(q0 , a) {q1 , q4 }
q1 q2 q3
a (q1 , a) {q2 }
q0 a
(q2 , a) {q3}
a q4 q5
(q4 , a ) {q5 }
a (q5 , a ) {q4 }
3 2n
L( M ) {a } {a / n 1}
Example - 2
a b a b
a b q0 {q0 , q1}
q0 q1 q2
q1 {q1 , q2 }
q2
n m
L( M ) {a b / m, n 1}
NFA to DFA (Procedure)
1. Create a graph GD with vertex {q0 }. Identify this vertex as the initial
vertex.
2. Repeat the following steps until no more edges are missing:
Take any vertex {qi , q j ,...., qk } of GD that as no outgoing edge
for some . Compute {qi , a ), {q j , a ),..., {qk , a ).
q0 a
A
a q4 q5
q0
a q1,q4 a a a
q0 q2,q5 q3,q4 q5
δ(q5 , a) = {q4}
a a a a a
q0 q1,q4 q2,q5 q3,q4 q5 q4
δ(q4 , a) = {q5}
q0 a q1,q4 a a a a
q2,q5 q3,q4 q5 q4
a
NFA with moves (-NFA)
A non-deterministic finite automaton with moves is a 5-tuple
M = (Q, Σ, , q0, F), where
• Q - is a finite set of states
• Σ - is a finite set of input symbols
• q0 Q - is the start state (initial state)
• F Q - is the set of accept states (final states)
• : Q Σ U { } → 2Q - is the transition function
-closure
-closure of a state q is the set of all states reachable from q through
-moves only and including q itself.
L( M ) {a n b m c k d p / m, n, k , p 0}
Q = {q0 , q1 } , Σ = { a, b} , Σ U { } = { a, b, }
n(Q) = 2 , n(Σ U { } ) = 3
Q x (Σ U { } ) = {(q0, ), (q0, a), (q0, b), (q1, ), (q1, a), (q1, b) }
n(2Q) = 2n(Q) = 22 = 4
: Q ( Σ U { })→ 2Q
Q (ΣU { }) 2Q
(q0, b)
(q1, b ) = { q0}
(q1, a)
(q1, b)
(q1 , ))
qi
qk