0% found this document useful (0 votes)
14 views44 pages

Chapter 4

Uploaded by

zy27448
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views44 pages

Chapter 4

Uploaded by

zy27448
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

4 Reduction of Finite Automata

Multiple model has been defined for finite automata so far. It is


possible to summarize the defined models as follows:

1. Recognizing model: This model, which is the basic model of finite


automata and shortly called FA, has deterministic (DFA) and non-
deterministic (NFA) types.
2. Output generating automaton model: There are also two types of
this model, called the Mealy and Moore model (or machine).
• In both the FA model and the output generating finite automata
model, the complexity of the defined finite automata (machine) is
directly proportional to the number of states.
• Therefore, given a finite automata, it may be important to reduce this
finite automata. The reduction or simplification of a finite automaton
is to find the finite automata with the smallest finite number of states
equivalent to that finite automata.
• The reduction of finite automata will be seen for DFA, Moore and
Mealy models. For this, particular definitions must be made first.
4.1 Definitions of Succesor, Predecessor, Equivalent and Distinguishable State

• The largest of the DFA, Moore and Mealy models is the Mealy model.
• Because the recognizer (FA) model can be seen as a subtype of the
Moore model with the output alphabet {accept, rejection}.
• The Moore model, on the other hand, can be seen as a subtype of the
Mealy model, whose output function is independent of the input
alphabet. For this reason, the Mealy model will be taken as a basis
while the definitions are given, and the 𝑀5 machine, whose definition
is given below, will be used as an example.
Example 4.1 The input and output alphabets of the Mealy type 𝑀11
machine are {0,1} alphabet. The transition and output functions of the
machine with initial state A are defined by the states table below.

States States, z

x=0 x=1
→A A,0 D,1

B C,0 E,1

C G,0 E,1

D G,0 F,1

E E,1 C,0

F B,0 D,1

G B,0 E,1

Figure 4.1
4.1.1 Succesor

If moving from the 𝑆1 state of the M machine to the 𝑆2 state with the
symbol x:

𝑥
𝑆1 → 𝑆2

𝑆2 is the x-successor of 𝑆1 .
• Where w is a string of input symbols, if state 𝑆1 is passed to state 𝑆2
with the input string w, the w-successor of 𝑆1 is 𝑆2 . For example, on
the 𝑀11 machine, the 1st successor of state A is D. The 011- successor
of case B of the same machine is C.
• With x an input symbol and w a string of input symbols, in
deterministic models, the x and w successor of a state is always a
single state. In nondeterministic models, the successors x and w are
subsets of states. The x-successor of a state can be easily found
because it is in the transition table. To find the successor 𝑤 =
𝑥1 𝑥2 … 𝑥𝑘 of a state, find the successor consecutive using the
transition table; then 𝑥2 -successor of 𝑥𝑖 -successor, etc. is obtained.
𝑀2 =< 𝑄, 𝛴, 𝛿, 𝑞0 , 𝐹 >

𝑄 = 𝑞0 , 𝑞1 , 𝑞2 , 𝑞3
𝛴 = {0,1}
𝐹 = {𝑞3 }
𝛿 𝑞0 , 0 = {𝑞0 , 𝑞1 } 𝛿 𝑞2 , 0 =𝜙
𝛿 𝑞0 , 1 = {𝑞0 , 𝑞2 } 𝛿 𝑞2 , 1 = {𝑞3 }
𝛿 𝑞1 , 0 = {𝑞3 } 𝛿 𝑞3 , 0 = {𝑞3 }
𝛿 𝑞1 , 1 = =𝜙 𝛿 𝑞3 , 1 = {𝑞3 }

• For example, in the 𝑀2 machine, the 0-successor of the 𝑞0 state is {𝑞0 , 𝑞1 }. {𝑞0 , 𝑞1 } can
be replaced with 𝑞0 𝑞1 . Accordingly, the 0-successor of the 𝑞0 case is 𝑞0 𝑞1 , the 1-
successor is 𝑞0 𝑞2 , and the 100-successor is 𝑞0 𝑞1 𝑞3 . The 1-successor of the 𝑞1 state of the
same machine and the 01-successor of the 𝑞2 state do not exist (it is the empty set).
4.1.2 Predecessor

• If the state 𝑆𝑗 of machine M is passed from the states 𝑆1 , 𝑆2 , ..., and 𝑆𝑖


with the input symbol x, the x-predecessor of state 𝑆𝑗 is {𝑆1 , 𝑆2 , ...,
𝑆𝑖 }.

• For example, for machine 𝑀11 , 0-predecessor of state B is FG and


001-predecessor is AEF. State D has no 0 or 110-predecessors for the
same machine. To find the x-predecessors of a machine, a table called
predecessor chart can be created.
Statets Predecessor State
x=0 x=1
States States, z
A A -
x=0 x=1
B FG - A A,0 D,1
C B E B C,0 E,1
D - AF C G,0 E,1
E E BCG
D G,0 F,1
F - D
E E,1 C,0
G CD -
F B,0 D,1

G B,0 E,1
4.1.3 Equivalent States

• When the machine M is in any of the 𝑆1 or 𝑆2 states, if the machine


always produces the same output symbol, regardless of which input
symbol is applied, these states are called 1-equivalent states. For
example, for 𝑀11 machine A and B is 1-equivalent states. Against this,
E and G states is not 1-equivalent states.
• When machine M is in either state 𝑆1 or 𝑆2 , these states are called n-
equivalent states if the machine always produces the same output
string no matter which input string of length n or less is applied. For
example, A and D states of machine 𝑀11 are 2-equivalent. Cases B
and C are 3-equivalent. B and C states are also 4-equivalent, 5-
equivalent, ...etc. In contrast, states A and D are not 3-equivalent.
• When machine M is in either state 𝑆1 or 𝑆2 , these states are called
equivalent states if the machine always produces the same output
string, regardless of its length, no matter what input string is applied.
For example, states B and C of machine 𝑀11 are equivalent states.
States D and F are also equivalent. However, the 2-equivalent states A
and D are not.
• In practice, states that are n-equivalent for all n are called equivalent
states. Two cases that are k-equivalent for all k-values less than n (k ≤
n) are called n-equivalent. For example, the A and F states of the 𝑀11
machine are 2-equivalent. Qualifying these cases as 2-equivalent
means they are not 3-equivalent. However, 2-equivalents are
naturally 1-equivalent. However, state equivalence is always specified
over the largest n value.
4.1.4 Distinguishable State

• If an input string of at least n length is required to distinguish the 𝑆1


and 𝑆2 states of the M machine, these states are called n-
distinguishable states. If states 𝑆1 and 𝑆2 are n-distinguishable, these
two states are (n-1)-equivalent. For example, states A and E of
machine 𝑀11 are 1-distinguishable. States B and D are 2-
distinguishable. In contrast, states A and F are 3- distinguishable. It is
not possible to distinguish D and F states with any input string.
Equivalent D and F states are indistinguishable.
𝑋=0 𝑋=0
•𝐴 ⟶ 𝐴 E ⟶ 𝐸 A and E are 1- distinguishable
𝑍=0 𝑍=1

𝑋 = 10 𝑋 = 10
•B ⟶ 𝐸 D ⟶ 𝐵 B and D are 2- distinguishable
𝑍 = 11 𝑍 = 10

𝑋 = 010 𝑋 = 010
•𝐴 ⟶ 𝐺 F ⟶ 𝐸 A and F are 3- distinguishable
𝑍 = 010 𝑍 = 011
Machine Equivalance

• If for every state of machine 𝑀1 there is an equivalent state of


machine 𝑀2 ; For each state of machine 𝑀2 , if there is an equivalent
state in machine 𝑀1 , machines 𝑀1 and 𝑀2 are equivalent.
4.2 Reduction of Machine

• Given a machine M, reducing or simplifying it means finding the


machine with the smallest number of states equivalent to that
machine.
• Equivalence partitions are used to reduce finite automata. For an M
machine, the k-equivalence partition, denoted 𝑃𝑘 , is a partition in
which k-equivalent states are in the same partition. For example, 0-
equivalence partitioning for a Mealy machine 𝑀11 :
𝑃0 = (𝐴𝐵𝐶𝐷𝐸𝐹𝐺)

• contains only one section. Because it is not possible to distinguish


states of a Mealy machine without any input symbols applied. For
𝑀11 , the 1-equivalence partitioning is

𝑃1 = (𝐴𝐵𝐶𝐷𝐹𝐺)(𝐸)

• contains two sections. Because all states of the machine except E are
1-equivalent
• To find the equivalence partitioning of the machine, find 𝑃0 , 𝑃1 , 𝑃2 , ….
in order. Derivation of equivalence partitions is continued until the
below equation is obtained:
𝑃𝑘 = 𝑃𝑘+1

• When the equivalence partitioning is

𝑃 = 𝑃𝑘

is found to be true and the derivation is interrupted.

• Proposition 4.1 is used to derive 𝑃𝑚+1 equivalence partitioning from


𝑃𝑚 equivalence partitioning.
Proposition 4.1 In order for the 𝑆1 and 𝑆2 states of the machine M to
be (m+1)-equivalent, the following two conditions are necessary and
sufficient.

a) 𝑆1 and 𝑆2 must be m-equivalent (𝑃𝑚 must be in the same partition


in the equivalence partitioning).

b) For all the input symbols x, the x-successors of the states 𝑆1 and
𝑆2 must also be m-equivalent (they must be in the same section in the
𝑃𝑚 equivalence partitioning).
4.2.1 Reduction of Mealy Machines

The reduction of Mealy machines will be studied by taking the 𝑀11


machine as an example. As stated earlier, the states of the Mealy
machine cannot be distinguished without applying any input. In other
words, all states of the Mealy machine are 0-equivalent.

𝑃0 = (𝐴𝐵𝐶𝐷𝐸𝐹𝐺)
It is sufficient to examine the state table to find the equivalence
partitioning of 𝑃1 . In the state table of 𝑀11 , it is seen that the output
value produced during the x pass is 0 in the first column and 1 in the
second column for all cases except E. Accordingly, cases other than E
are 1-equivalent.

𝑃1 = (𝐴𝐵𝐶𝐷𝐹𝐺)(𝐸)
Proposition 4.1 is used to find the 𝑃2 equivalence partition. In order for
the two states of the 𝑀11 machine to be 2-equivalent, both these two
states and the 0 and 1-succesors of these two states must be 1-
equivalent; for this, it must be in the same section in the 𝑃1
equivalence partitioning.
In the 𝑃1 -partition, the 0-successors of the states ABCDFG, which are
located in the same section, are 1-equivalent due to their presence in
the same 𝑃1 partition. However, not all 1-successors of these states are
1-equivalent. From this, it is understood that the ADF states are 2-
equivalent among themselves and the BCG states are 2-equivalent
among themselves, and the following 𝑃2 equivalence partitioning is
obtained:

𝑃2 = (𝐴𝐷𝐹)(𝐵𝐶𝐺)(𝐸)
To find the 𝑃3 equivalence partitioning, 0 and 1- successors of ADF and
BCG states are examined:
Upon examination, it is seen that 1-successors of ADF states are in the
same section in 𝑃2 , but 0-successors are not in the same section in 𝑃2 .
Therefore, it is understood that the DF states are 3-equivalent, but the
A state is not 3-equivalent to the D and F states, and in 𝑃3 , the A state
differs from the DF states. As for the BCG states, both 0 and 1-
successors of these cases are in the same partition in 𝑃2 . Accordingly,
the BCG cases are 3-equivalents and will be in the same partition in the
𝑃3 equivalence partition. As a result, the 𝑃3 equivalence partitioning
occurs as follows:

𝑃3 = (𝐴)(𝐷𝐹)(𝐵𝐶𝐺)(𝐸)
To find the 𝑃4 equivalence partitioning, it is necessary to examine the 0
and 1 successors of the DF and BCG states. The 0 and 1-successors of
the BCG states, previously reviewed and included above, are also
included in 𝑃3 in the same section. Therefore, BCG states will be
included in 𝑃4 in the same section.
When the successors of the DF cases are examined, it is seen that the 0
and 1-successors of these two cases are in the same section in 𝑃3 .
Therefore, the DF states will be in the same section in 𝑃4 . As a result,
the equivalence partition 𝑃4 is equal to 𝑃3 .

𝑃4 = 𝑃3 = (𝐴)(𝐷𝐹)(𝐵𝐶𝐺)(𝐸)
Thus, the equivalence partitioning of the 𝑀5 machine is obtained as :

𝑃 = (𝐴)(𝐷𝐹)(𝐵𝐶𝐺)(𝐸)

Since there are 4 partitions in equivalence partitioning, the smallest machine


equivalent to 𝑀11 will have 4 states. If the states of the smallest machine are
called as below :

for A : 𝑆0
for DF : 𝑆1
for BCG : 𝑆2
for E : 𝑆3
The state table of the smallest machine equivalent to machine 𝑀11 is
found as follows:

SD, z
States
x=0 x=1

𝑆0 𝑆0 ,0 𝑆1 ,1

𝑆1 𝑆2 ,0 𝑆1 ,1

𝑆2 𝑆2 ,0 𝑆3 ,1

𝑆3 𝑆3 ,1 𝑆2 ,0
4.2.2 Reduction of Moore Machines

• As known, the output function in Moore machines is a mapping from


the set of states to the output alphabet. With this mapping, an exit
symbol is mapped to each state. When a Moore machine is in a
certain state, it produces a specific exit symbol. Therefore, certain
states or subsets of states can be distinguished without applying any
input symbols. In other words, not all states of the Moore machine
are 0-equivalent. The 0-equivalence partitioning of the Moore
machine (𝑃0 ) has as many partitions as the output symbol.
• The only difference in the reduction of Mealy and Moore machines is
the establishment of the equivalence partitioning 𝑃0 . The next steps
of the reduction are carried out similarly. The reduction of Moore
machines will be seen on an example.
Example 4.2 The input alphabet of the Moore 𝑀12 machine is {0,1}
and the output alphabet is {0,1,2}. The transition and output functions
of the machine with initial status A are described by the status table
below:
States SD z
x=0 x=1
→A C B 0
B B D 1
C A H 2
D E G 1
E C D 2
F C H 2
G G H 1
H F B 1
The machine 𝑀12 is reduced as below:

𝑃0 = (𝐴)(𝐵𝐷𝐺𝐻)(𝐶𝐸𝐹)

𝑃1 = (𝐴)(𝐵𝐺)(𝐷𝐻)(𝐶)(𝐸𝐹)
𝑃1 = (𝐴)(𝐵𝐺)(𝐷𝐻)(𝐶)(𝐸𝐹)

𝑃2 = 𝑃1 = (𝐴)(𝐵𝐺)(𝐷𝐻)(𝐶)(𝐸𝐹)
𝑃 = (𝐴)(𝐵𝐺)(𝐷𝐻)(𝐶)(𝐸𝐹)
𝑃 = (𝐴)(𝐵𝐺)(𝐷𝐻)(𝐶)(𝐸𝐹)

Since there are 5 sections in equivalence partitioning, the smallest machine


equivalent to 𝑀12 will have 5 states. If the states renamed as below:

for A, 𝑆0
for BG, 𝑆1
for DH, 𝑆2
for C, 𝑆3
for EF, 𝑆4
State table of the smallest machine equivalent to 𝑀12 is as below:

SD, z
States x=0 x=1 z

𝑆0 𝑆3 𝑆1 0

𝑆1 𝑆1 𝑆2 1

𝑆2 𝑆4 𝑆1 1

𝑆3 𝑆0 𝑆2 2

𝑆4 𝑆3 𝑆2 2
4.2.3 Reduction of DFA Model

As is known, the DFA model is a constrained variant of the Moore


machine. If the output alphabet in the Moore model is limited to a
binary alphabet such as {accept, reject}, the states are divided into two
as "acceptable" and "not accepting" states with the output function
and the DFA model is obtained. Accordingly, the reduction of DFAs will
be the same as the reduction of Moore's machines.
Example 4.3 𝑀13 , which is a deterministic automata (DFA), is described
by the state table below:
States Next States
x=0 x=1
→ 𝑞0 𝑞0 𝑞1
𝑞1 𝑞2 𝑞4
𝑞2 𝑞4 𝑞7
𝑞3 𝑞6 𝑞5
𝑞4 𝑞5 𝑞3
𝑞5 𝑞5 𝑞7
𝑞6 𝑞7 𝑞2
𝑞7 𝑞7 𝑞5
The machine 𝑀13 is reduced as below:

𝑃0 = (𝑞0 𝑞1 𝑞2 𝑞3 𝑞4 𝑞6 )(𝑞5 𝑞7 )
𝑃1 = (𝑞0 𝑞1 )(𝑞2 𝑞3 )(𝑞4 𝑞6 )(𝑞5 𝑞7 )

𝑃2 = (𝑞0 )(𝑞1 )(𝑞2 𝑞3 )(𝑞4 𝑞6 )(𝑞5 𝑞7 )


𝑃3 = 𝑃2
𝑃 = (𝑞0 )(𝑞1 )(𝑞2 𝑞3 )(𝑞4 𝑞6 )(𝑞5 𝑞7 )
Since there are 5 sections in equivalence partitioning, the smallest
machine equivalent to 𝑀7 will have 5 states. If the states renamed as
below:

for 𝑞0 , 𝑆0
for 𝑞1 , 𝑆1
for 𝑞2 𝑞3 , 𝑆2
for 𝑞4 𝑞6 , 𝑆3
for 𝑞5 𝑞7 , 𝑆4
State table of the smallest machine equivalent to 𝑀13 is as below:

SD, z
States x=0 x=1

𝑆0 𝑆0 𝑆1
𝑆1 𝑆2 𝑆3
𝑆2 𝑆3 𝑆4
𝑆3 𝑆4 𝑆2
𝑆4 𝑆4 𝑆4

You might also like