2. Optimization of DFA-Based Pattern Matchers
• It refers to detecting those states of a DFA whose
presence or absence in a DFA does not affect the
language accepted by the automata.
• These states can be eliminated from the automata
without affecting the language accepted by the
automata.
• SUCH STATES ARE:-
• Unreachable States:
• Dead States:
• Nondistinguishable States:
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
2
3. Contd…….
• Unreachable States: Unreachable states of a DFA are not
reachable from the initial state of DFA on any possible input
sequence.
• Dead States: A dead state is a nonfinal state of a DFA whose
transitions on every input symbol terminates on itself. For
example, q is a dead state if q is in Q F, and δ(q, a) = q for
every a in Σ.
• Nondistinguishable States: Nondistinguishable states are those
states of a DFA for which there exist no distinguishing strings;
hence, they cannot be distinguished from one another.
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
3
4. Contd……..
• Optimization entails:
• Detection of unreachable states and eliminating
them from DFA;
• Identification of nondistinguishable states, and
merging them together; and
• Detecting dead states and eliminating them from
the DFA.
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
4
5. Consider The Transition Diagram
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
5
Fig: Partitioning down to a single state.
6. Contd……
• Initially, we have two groups, as shown below:
Group I Group II
Since
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
6
A, B, C, E, F D
7. Contd…..
• Partitioning of Group I is not possible, because the
transitions from all the members of Group I go only to
Group I. But since
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
7
state F is distinguishable from the rest of the members of Group I. Hence, we divide
Group I into two groups: one containing A, B, C, E, and the other containing F, as shown
below:
8. Contd……
Group I Group II Group III
Since
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
8
A, B, C, E F D
partitioning of Group I is not possible, because the transitions from all the
members of Group I go only to Group I. But since
9. Contd…..
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
9
states A and E are distinguishable from states B and C. Hence, we further divide Group
I into two groups: one containing A and E, and the other containing B and C, as shown
below:
10. Contd……
Group I Group II Group III Group IV
Since
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
10
A, E B, C F D
state A is distinguishable from state E. Hence, we divide Group I into two groups:
one containing A and the other containing E, as shown below:
11. Contd……
Group I Group II Group III Group IV Group V
Since
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
11
A E B, C D
partitioning of Group III is not possible, because the transitions from all the
members of Group III on a go to group III only. Similarly,
F
12. Contd…..
02/13/17
ANKUR SRIVASTAVA ASSISTANT
PROFESSOR JETGI
12
partitioning of Group III is not possible, because the transitions from all the
members of Group III on b also only go to Group III.
Hence, B and C are nondistinguishable states; therefore, we merge B and C to
form a single state, B1, as shown in next Figure…