Chpter 1, Prt 1 Regulr Lnguges CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 1
Finite Automt A finite utomton is system for processing ny finite sequence of symols, where the symols re chosen from finite set of symols. The gol is to determine whether the sequence hs certin property y simply reding the symols of the sequence from the eginning to the end. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 2
An Illustrting Exmple of Finite Automt A coin exchnger tkes nickels or dimes nd delivers qurters. It tkes coins one t time. When the deposited mount reches or goes eyond 25 cents it delivers qurter. There is no chnge utton nd ny chnge is crried over s deposit. For exmple, if the deposit is currently 20 cents, upon receiving dime, the mchine delivers qurter nd the deposit ecomes 5 cents. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 3
Question If you hve g full of nickels nd dimes nd use this mchine to chnge for qurters, do you rek even? CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 4
Reltionship Between Deposit nd Coin Inserted The deposit mount in cents is one of 0, 5, 10, 15, nd 20. Upon receiving coin, the deposit chnges s follows: Current Coin Inserted Deposit Nickel Dime 0 5 10 5 10 15 10 15 20 15 20 0 20 0 5 CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 5
Visul Representtion of the Reltionship Let N stnd for nickel nd D for dime. For {0,5,10,15,20}, let q represent the sttus in which the deposit is cents. D D N q0 N q5 N q10 N q15 N q20 D D D CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 6
Finite Automt A finite utomton is 5-tuple (Q,Σ,δ,q 0,F), where 1. Q is finite set clled the sttes, 2. Σ is finite set clled the lphet, 3. δ : Q Σ Q is the trnsition function, 4. q 0 Q is the initil stte, nd 5. F Q is the set of ccepting sttes or the set of finl sttes. Let M = (Q,Σ,δ,q 0,F) e n FA. A string w = w 1 w n is ccepted y M if there exists sequence (p 0,..., p n ) of sttes in Q such tht p 0 = q 0, p n F, nd for every i, 1 i n, δ(p i 1,w i ) = p i. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 7
The Lnguge Decided y Finite Automton The lnguge decided y M, denoted L(M), is the lnguge over Σ such tht (*) for every string w over Σ, w L(M) M ccepts w. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 8
Let Σ = {N,D}. Let Q = {q 0,q 5,q 10,q 15,q 20 }. The trnsition function is: F = {q 0 }. An FA for the Coin Chnger stte N D q 0 q 5 q 10 q 5 q 10 q 15 q 10 q 15 q 20 q 15 q 20 q 0 q 20 q 0 q 5 Our FA ccepts NNND nd DDDDD ut not NNN. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 9
The Coin Chnger As Finite Automton D D N N q0 N q5 N q10 N q15 N q20 D D D CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 10
Regulr Lnguges The regulr lnguges is the clss of lnguges ccepted y finite utomt. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 11
Exmple 1 An FA tht ccepts the strings over 0 nd 1 with either (n even numer of 0s nd n even numer of 1s) or (n odd numer of 0s nd n odd numer of 1s) 0 0 1 1 1 1 0 0 Drwing rules: Theinitilsttehsnincoming edge from outside. Accept sttes re represented with doule circles. Every node hs one outgoing edge for ech symol. CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 12
Exmple 2 An FA tht ccepts the set of ll words over {,} hving odd length,, CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 13
Exmple 3 An FA tht ccepts the set of ll words over {,} contining s suword, CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 14
Exmple 4 An FA tht ccepts the set of ll words over {,} contining t lest three s nd t lest two s CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 15
Exmple 4 An FA tht ccepts the set of ll words over {,} contining t lest three s nd t lest two s At lest two s nd t lest three s,, CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 16
Exmple 4 An FA tht ccepts the set of ll words over {,} contining t lest three s nd t lest two s, CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 17
Exmple 5 An FA tht ccepts the set of ll words over {,} contining either s lest three s or t lest two s CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 18
Exmple 5 An FA tht ccepts the set of ll words over {,} contining either s lest three s or t lest two s,, CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 19