11 Automata Theory Part1
11 Automata Theory Part1
796-813
Remark:
We can use a state table to represent the values of the
transition function f and the output function g for all pairs of
states and input.
Representation of FSM
We use state diagram to represent FSM. State diagram is a directed
graph with labeled edges. In this diagram, each sate is represented
by a circle. Arrows labeled with the input and output pair are
shown for each transition.
f(S0,0)=S1 0
s0 s1
1
f(S0,1)=S0 0
s0 s1
g(S0,0)=1 1
0 ,1
s0 s1
1,0
g(S0,1)=0 0 ,1
s0 s1
1,0
0 ,1 0,1
s0 s1 s3
1,1
1,0
0 ,1 1,0
0,1 0 ,1 0,1
s0 s1 s3 s0 s1 s3
1,1 1,0
0,0 1,1
0
0,0
0,
s2
s2
1,1
1,1
Example: Draw the state table from the state diagram obtained in
the above example
Finite-State Machines with No Output
B\A 0 11 BA={10,111,100,1011,1100,11011}
1 10 111
10 100 1011
110 1100 11011
A={0,11} B={0,11}
AB=AA=A2
Example: Let A= {0, 11} and B= {1, 10, 110}, Find AB and BA.
Solution:
AB is the set of all strings of the form xy, where x is a string in A
and y is a string in B.
x=0 and y=1, 10, or 110 then xy= 01, 010, or 0110
x=11 and y=1, 10, or 110 then xy= 111, 1110, or 11110
So, AB= {01, 010, 0110, 111, 1110, 11110} and
BA={10, 111, 100, 1011, 1100, 11011}(by similar way).
Nth concatenation
Example: 7
Given A0= { } and An+1= An A , for n = 0, 1, 2……
Then let A={1, 00}. Find An for only n= 0, 1, 2, and 3
Solution:
A\A 1 00
n=0 è A0+1= A0 A è A1= {} {1,00} è A1={1,00}
1
Input S0
state 0 1 0,1 1
s0 s0 s1 0
S2 S1
s1 s0 s2 1
s2 s0 s0 1
0
s3 s2 s1
S3
Language recognition by DFA
Definition :
# A string x is said to be recognized or accepted by the machine
M= (S, I, f, s0, F) if it takes the initial state s0 to the final state, that
is, f(s0, x) is a state in F.
# The language recognized or accepted by the machine M, denoted
by L(M), is the set of all strings that are recognized by M.
# Two finite-state automata are called equivalent if they recognize
the same language.
Example: Determine the languages recognized by the finite-state
automata M1, M2, M3 in figure 2 at page 807.
1 0,1
M1
0
start s0 s1
The only final state of M1 is s0. The strings that takes s0 to itself are
those consisting of zero or more consecutive 1s. I.e {⋋ ,1, 11, 111,
…...}
So, L(M1)={1n: n=0,1 ,2, 3,…}
0 0,1
M2
0 1 0,1
start s0 s1 s2 s3
1
The only final state of M2 is s2. The strings that takes s0 are 1and
01.
So, L(M2)={1,01}
Example: Determine the languages recognized by the finite-state
automata M1
1 0,1 S={S0,S1}
M1 I={0,1}
0 F={S0}
start s0 s1 DNF
0,1
S1
0
S1
S0 Accepted strings: 1, 11,111, ...,1n
0 l (empty string)= 10
1
S0 n>=0
1 L(M1)={1n :n>=0}
1
A.S. = Accepted string
0,1
S3
0
L(M2)={1,01}
S1 X=01 is A.S.
0 1 S2
S0 S3
1
S2 S3
X=1 is A.S.
0 0 0,1
M3
1 1
start s0 s1 s2 s3
0,1
0n is A.S., n>=0
1
S0 S1
0
10 is A.S.
S0
S3 10x is A.S., where x is a combination of 0 & 1
1 0
S1
1
S2
L(M3)={0n, 0m 10x}
Non Deterministic Finite-State Automata
In DFA for each pair of state and input value there is a unique next
state given by the transition function. But in NDFA there may be
several possible next states for each pair of input value and state.
1
Example : Find the state table for the NDFA with the state diagram
shown in figure 7. 0
0
0 s1 s3
1
1 1
start s0 0,1
0 0
s2 s4
f 1
Input
state 0 1
s0 s0 , s2 s1
s1 s3 s4
s2 s4
s3 s3 s2
s4 s3 s3
Home Work
Q1) construct a DFA that recognized each of these languages.
a) The set of bit strings that begin with two 0s.
b) The set of bit strings that contain two consecutive 0s.
c) The set of bit strings that do not contain two consecutive 0s.
d) The set of bit strings that end with two 0s.
e) The set of bit strings that contain at least two 0s.
Q2) Let A={0,11}, and B={00, 01}. Find each of these sets.
(a) AB, (b) BA, (c) A2 (d) B3