You are on page 1of 23

| 



Jeremy Mange
CS 6800
Summer 2009
| 
˜ |eterministic Finite Automata (|FSA)
˜ (ax Ȉx įx x )
˜ a ± (finite) set of states
˜ Ȉ ± alphabet ± (finite) set of input symbols
˜ į ± transition function
˜ q0 ± start state
˜ F ± set of final / accepting states
| 
˜ uften representing as a diagram:
|  

˜ Some states can be redundant:
˜ The following |FA accepts (a|b)+
˜ State s1 is not necessary
|  

˜ So these two |FAs are u u :
|  

˜ This is a îu u (or just  u)
|FA
˜ r ery remaining state is necessary
|  

˜ The task of |
  x thenx is to
automatically transform a gi en |FA into a
state-minimized |FA
˜ Se eral algorithms and ariants are known
˜ Note that this also in effect can minimize an NFA
(since we know algorithm to con ert NFA to |FA)
|  

 
˜ ·ecall that a |FA V=(ax Ȉx įx x )

˜ Two states  and are distinct if


˜  in F and not in F or ice ersax or
˜ for some Į in Ȉx į(x Į) and į( x Į) are distinct

˜ üsing this inducti e definitionx we can


calculate which states are distinct
|  

 
˜ Create lower-triangular table |STNCTx initially
blank
˜ For e ery pair of states (x ):
˜ f p is final and q is notx or ice ersa
˜ |STNCT(x ) = İ

˜ Aoop until no change for an iteration:


˜ For e ery pair of states (x ) and each symbol Į
˜ f |STNCT(x ) is blank and
|STNCT( į(x )x į( x ) ) is not blank
X |STNCT(x ) = Į
˜ Combine all states that are not distinct
o  

s0
s1
s2
s0 s1 s2
o  

s0
s1 İ
s2 İ
s0 s1 s2

Aabel pairs with İ where one is a final state and the other is not
o  

s0
s1 İ
s2 İ
s0 s1 s2

Main loop (no changes occur)


o  

s0
s1 İ
s2 İ
s0 s1 s2

|STNCT(s1x s2) is emptyx so s1 and s2 are equi alent states


o  

 


 


 
˜ Check for pairs with one state final and one not:


 
˜ First iteration of main loop:


 
˜ Second iteration of main loop:


 
˜ Third iteration makes no changes
˜ Blank cells are equi alent pairs of states


 
˜ Combine equi alent states for minimized |FA:

 

˜ |FA Minimization is a fairly understandable
processx and is useful in se eral areas
˜ ·egular expression matching implementation
˜ Very similar algorithm is used for compiler
optimization to eliminate duplicate computations
˜ The algorithm described is u( 2)

˜ John Hopcraft describes another more complex


algorithm that is u(
( log ) )
6
   

˜ auî : nducti ely define when two states in a
|FA are distinct.
˜ îu:
˜ Two states  and are distinct if
˜  w F and F or ice ersax or
˜ for some Į w Ȉx į(x Į) and į( x Į) are distinct
·   
˜ üllmanx A. V.x Hopcroftx J. r. and üllmanx J. |. (1974) º u
|uî
 

 îî

 u
  î. Addison-Wesley.

˜ Hopcroftx J. (1971)



  
 
V 
uî


 u

  . Stanford üni ersity.

˜ 6arthasarathyx M. and Fleckx M. (2007) |


V  

üni ersity of
llinois at ürbana-Champaign.
http://www.cs.uiuc.edu/class/fa07/cs273/Handouts/minimization/minimization.pdf

You might also like