Professional Documents
Culture Documents
ITdiapositivas5 (19 1)
ITdiapositivas5 (19 1)
ITdiapositivas5 (19 1)
Andrés A. Aristizábal P.
aaaristizabal@icesi.edu.co
2019-1
1 / 55
Agenda
2 / 55
Finite State Machines Aims
3 / 55
Finite State Machines Aims
Aims
4 / 55
Finite State Machines Reading Control
5 / 55
Finite State Machines Reading Control
Reading Control
These are multiple choice questions. You just need to write the correct option(s) in
front of each number.
6 / 55
Finite State Machines Reading Control
Reading Control
7 / 55
Finite State Machines Reading Control
Reading Control
8 / 55
Finite State Machines Reading Control
Reading Control
9 / 55
Finite State Machines Reading Control
Reading Control
10 / 55
Finite State Machines Reading Control
Reading Control
11 / 55
Finite State Machines Discussion and exercises
12 / 55
Finite State Machines Discussion and exercises
13 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let ω be an input string, S = {a, b, c} and Ns (ω) = the number of
occurrences of symbol s in ω.
a) Display the state table and diagram of a Mealy machine
M = (Q, S, R, f , g, q1 ) whose last output symbol in response to an
input string ω is:
14 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let ω be an input string, S = {a, b, c} and Ns (ω) = the number of
occurrences of symbol s in ω.
b) Suppose that we ask now that the last output symbol be:
15 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let ω be an input string, S = {a, b, c} and Ns (ω) = the number of
occurrences of symbol s in ω.
b) Suppose that we ask now that the last output symbol be:
15 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Design a Mealy automaton M = (Q, R, S, f , g, q1 ) with S = R = {0, 1} and the
following output behavior:
a)
r (1) = r (2) = 0
for t > 2(r (t) = 1) ⇔ ((s(t) = 0) ∧ (s(t − 1) = 1) ∧ (s(t − 2) = 1))
16 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Design a Mealy automaton M = (Q, R, S, f , g, q1 ) with S = R = {0, 1} and the
following output behavior:
b)
r (1) = r (2) = 0
for t > 2(r (t) = 1) ⇔ (((s(t) = 0) ∧ (s(t − 1) = s(t − 2) = 1)) ∨
((s(t) = 1) ∧ (s(t − 1) = 0 ∨ s(t − 2) = 0)))
17 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let M = (Q, R, S, f , h, q1 ) be a Moore machine with S = R = {0, 1}
An input sequence ω is said to be accepted by M just if M’s response
to ω ends with 1. Present the state diagram of a machine M that
accepts:
a) All strings ω ∈ S ∗ in which the substring 101 appears.
18 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let M = (Q, R, S, f , h, q1 ) be a Moore machine with S = R = {0, 1}
An input sequence ω is said to be accepted by M just if M’s response
to ω ends with 1. Present the state diagram of a machine M that
accepts:
b) All strings ω ∈ S ∗ in which the substring 101 does not appear.
19 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let M = (Q, R, S, f , h, q1 ) be a Moore machine with S = R = {0, 1}
An input sequence ω is said to be accepted by M just if M’s response
to ω ends with 1. Present the state diagram of a machine M that
accepts:
c) All strings ω ∈ S ∗ in which
20 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Present a state table of a Moore machine that accepts just those
strings accepted by the following Mealy machine.
0 1
A A1 B1
B C1 D0
C B0 C0
D D1 A1
21 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Construct a Mealy machine similar to the following Moore machine.
0 1
A B C 0
B C B 1
C A C 0
22 / 55
Finite State Machines Discussion and exercises
Exercises
Exercise
Let M be a finite state machine with a state set Q. Suppose that Q
contains n states, including initial state q1 . For any state q ∈ Q, prove
that q is accessible in M only if q is the ω−successor of q1 , for some
string ω of length less than n. Intuitively, for q to be accessible means
that there exists a sequence from q1 until q.
23 / 55
Finite State Machines Presentation of the next topic
24 / 55
Finite State Machines Presentation of the next topic
25 / 55
Finite State Machines Presentation of the next topic
25 / 55
Finite State Machines Presentation of the next topic
25 / 55
Finite State Machines Presentation of the next topic
25 / 55
Finite State Machines Presentation of the next topic
26 / 55
Finite State Machines Presentation of the next topic
26 / 55
Finite State Machines Presentation of the next topic
26 / 55
Finite State Machines Presentation of the next topic
26 / 55
Finite State Machines Presentation of the next topic
26 / 55
Finite State Machines Presentation of the next topic
26 / 55
Finite State Machines Presentation of the next topic
27 / 55
Finite State Machines Presentation of the next topic
27 / 55
Finite State Machines Presentation of the next topic
27 / 55
Finite State Machines Presentation of the next topic
If two states are equivalent, one of them is clearly redundant, since all
transitions into one of the states may be switched to the equivalent
state without affecting the behavior of the machine.
27 / 55
Finite State Machines Presentation of the next topic
Theorem
States qa and qb of a finite state machine M are equivalent if and only if
28 / 55
Finite State Machines Presentation of the next topic
Theorem
States qa and qb of a finite state machine M are equivalent if and only if
1a. For Mealy machines: For all s ∈ S, g(qa , s) = g(qb , s).
That is, the outputs for corresponding transitions are
identical.
28 / 55
Finite State Machines Presentation of the next topic
Theorem
States qa and qb of a finite state machine M are equivalent if and only if
1a. For Mealy machines: For all s ∈ S, g(qa , s) = g(qb , s).
That is, the outputs for corresponding transitions are
identical.
1b. For Moore machines: h(qa ) = h(qb ). That is, the output
symbols for the two states are identical.
28 / 55
Finite State Machines Presentation of the next topic
Theorem
States qa and qb of a finite state machine M are equivalent if and only if
1a. For Mealy machines: For all s ∈ S, g(qa , s) = g(qb , s).
That is, the outputs for corresponding transitions are
identical.
1b. For Moore machines: h(qa ) = h(qb ). That is, the output
symbols for the two states are identical.
2. For all s ∈ S, f (qa , s) ∼ f (qb , s). That is, the
s−successors of the two states are themselves
equivalent states.
28 / 55
Finite State Machines Presentation of the next topic
Example
If we have the following Mealy machine
29 / 55
Finite State Machines Presentation of the next topic
Answer
g(A, 0) = g(B, 0) = 0
30 / 55
Finite State Machines Presentation of the next topic
Answer
g(A, 0) = g(B, 0) = 0
g(A, 1) = g(B, 1) = 0
30 / 55
Finite State Machines Presentation of the next topic
Answer
g(A, 0) = g(B, 0) = 0
g(A, 1) = g(B, 1) = 0
f (A, 0) = B f (A, 1) = C
30 / 55
Finite State Machines Presentation of the next topic
Answer
g(A, 0) = g(B, 0) = 0
g(A, 1) = g(B, 1) = 0
f (A, 0) = B f (A, 1) = C
f (B, 0) = B f (B, 1) = C
30 / 55
Finite State Machines Presentation of the next topic
Answer
g(A, 0) = g(B, 0) = 0
g(A, 1) = g(B, 1) = 0
f (A, 0) = B f (A, 1) = C
f (B, 0) = B f (B, 1) = C
And certainly B ∼ B and C ∼ C.
30 / 55
Finite State Machines Presentation of the next topic
31 / 55
Finite State Machines Presentation of the next topic
Definition
A finite state machine is reduced if it contains no pair of equivalent states.
31 / 55
Finite State Machines Presentation of the next topic
Definition
A finite state machine is reduced if it contains no pair of equivalent states.
31 / 55
Finite State Machines Presentation of the next topic
Definition
A finite state machine is reduced if it contains no pair of equivalent states.
31 / 55
Finite State Machines Presentation of the next topic
Definition
A finite state machine is reduced if it contains no pair of equivalent states.
31 / 55
Finite State Machines Presentation of the next topic
Definition
A finite state machine is reduced if it contains no pair of equivalent states.
31 / 55
Finite State Machines Presentation of the next topic
32 / 55
Finite State Machines Presentation of the next topic
33 / 55
Finite State Machines Presentation of the next topic
Two states are distinguishable if they are not equivalent, that is, if we have two copies
of a finite state machine, and each of those have one of the aforementioned states as
their initial state, they will evoke responses differing in at least one symbol.
33 / 55
Finite State Machines Presentation of the next topic
Two states are distinguishable if they are not equivalent, that is, if we have two copies
of a finite state machine, and each of those have one of the aforementioned states as
their initial state, they will evoke responses differing in at least one symbol.
33 / 55
Finite State Machines Presentation of the next topic
Two states are distinguishable if they are not equivalent, that is, if we have two copies
of a finite state machine, and each of those have one of the aforementioned states as
their initial state, they will evoke responses differing in at least one symbol.
33 / 55
Finite State Machines Presentation of the next topic
Two states are distinguishable if they are not equivalent, that is, if we have two copies
of a finite state machine, and each of those have one of the aforementioned states as
their initial state, they will evoke responses differing in at least one symbol.
Definition
States qa and qb of a transition assigned machine M = (Q, R, S, f , h, q1 ) are
k −distinguishable if there exists a string ω ∈ S ∗ with |ω| ≤ k such that the responses
of Ma = (Q, R, S, f , g, qa ) and Mb = (Q, R, S, f , g, qb ) to ω differ in at least a symbol.
33 / 55
Finite State Machines Presentation of the next topic
Two states are distinguishable if they are not equivalent, that is, if we have two copies
of a finite state machine, and each of those have one of the aforementioned states as
their initial state, they will evoke responses differing in at least one symbol.
Definition
States qa and qb of a transition assigned machine M = (Q, R, S, f , h, q1 ) are
k −distinguishable if there exists a string ω ∈ S ∗ with |ω| ≤ k such that the responses
of Ma = (Q, R, S, f , g, qa ) and Mb = (Q, R, S, f , g, qb ) to ω differ in at least a symbol.
Such a string ω is called a distinguishable sequence for states qa and qb .
33 / 55
Finite State Machines Presentation of the next topic
Two states are distinguishable if they are not equivalent, that is, if we have two copies
of a finite state machine, and each of those have one of the aforementioned states as
their initial state, they will evoke responses differing in at least one symbol.
Definition
States qa and qb of a transition assigned machine M = (Q, R, S, f , h, q1 ) are
k −distinguishable if there exists a string ω ∈ S ∗ with |ω| ≤ k such that the responses
of Ma = (Q, R, S, f , g, qa ) and Mb = (Q, R, S, f , g, qb ) to ω differ in at least a symbol.
Such a string ω is called a distinguishable sequence for states qa and qb . If states qa
and qb are not k −distinguishable, we say that they are k −equivalent.
33 / 55
Finite State Machines Presentation of the next topic
34 / 55
Finite State Machines Presentation of the next topic
34 / 55
Finite State Machines Presentation of the next topic
34 / 55
Finite State Machines Presentation of the next topic
34 / 55
Finite State Machines Presentation of the next topic
35 / 55
Finite State Machines Presentation of the next topic
35 / 55
Finite State Machines Presentation of the next topic
35 / 55
Finite State Machines Presentation of the next topic
35 / 55
Finite State Machines Presentation of the next topic
Recall that:
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
36 / 55
Finite State Machines Presentation of the next topic
37 / 55
Finite State Machines Presentation of the next topic
37 / 55
Finite State Machines Presentation of the next topic
37 / 55
Finite State Machines Presentation of the next topic
37 / 55
Finite State Machines Presentation of the next topic
37 / 55
Finite State Machines Presentation of the next topic
37 / 55
Finite State Machines Presentation of the next topic
38 / 55
Finite State Machines Presentation of the next topic
38 / 55
Finite State Machines Presentation of the next topic
38 / 55
Finite State Machines Presentation of the next topic
38 / 55
Finite State Machines Presentation of the next topic
38 / 55
Finite State Machines Presentation of the next topic
38 / 55
Finite State Machines Presentation of the next topic
Example
From the following state table of a Mealy machine, apply the partitioning procedure.
39 / 55
Finite State Machines Presentation of the next topic
Answer
40 / 55
Finite State Machines Presentation of the next topic
41 / 55
Finite State Machines Presentation of the next topic
41 / 55
Finite State Machines Presentation of the next topic
42 / 55
Finite State Machines Presentation of the next topic
42 / 55
Finite State Machines Presentation of the next topic
42 / 55
Finite State Machines Presentation of the next topic
Example
From the following state table of a Mealy machine, find its equivalent reduced
automaton.
43 / 55
Finite State Machines Presentation of the next topic
Answer
The first step is to apply the partitioning procedure on M.
44 / 55
Finite State Machines Presentation of the next topic
Answer
Each block belonging to the final partition Pf of M is a state of M 0 . That
is why we have to rename them.
45 / 55
Finite State Machines Presentation of the next topic
Answer
To find the s−successor of a state q 0 in M 0 , select any state in the block of the partition Pf
corresponding to q 0 and find the block containing its s−successor; the corresponding state of M 0
is the s−successor of q 0 . The output for an s−transition from state q 0 of M 0 is the output for an
s−transition from any state in the block corresponding to q 0 .
46 / 55
Finite State Machines Presentation of the next topic
Answer
Taking into account the new state table, we assign the new names to the blocks.
47 / 55
Finite State Machines Presentation of the next topic
48 / 55
Finite State Machines Presentation of the next topic
48 / 55
Finite State Machines Presentation of the next topic
49 / 55
Finite State Machines Presentation of the next topic
49 / 55
Finite State Machines Presentation of the next topic
50 / 55
Finite State Machines Presentation of the next topic
50 / 55
Finite State Machines Presentation of the next topic
51 / 55
Finite State Machines Presentation of the next topic
51 / 55
Finite State Machines Presentation of the next topic
51 / 55
Finite State Machines Presentation of the next topic
51 / 55
Finite State Machines Presentation of the next topic
51 / 55
Finite State Machines Presentation of the next topic
Example
Prove the equivalence of the following Mealy machines.
52 / 55
Finite State Machines Presentation of the next topic
Example
We apply the direct sum between the automata.
53 / 55
Finite State Machines Presentation of the next topic
Example
We apply the partitioning algorithm on the direct sum result.
54 / 55
Finite State Machines Presentation of the next topic
Next class
55 / 55