fin-auto
Post on 06-Apr-2018
213 Views
Preview:
TRANSCRIPT
-
8/2/2019 fin-auto
1/7
Finit e Autom at a
Let u s b egin by rem oving alm ost a l l of th e Turing m achine 's po wer! Maybe thenwe shal l have solvable decis ion problems and s t i l l be able to accomplish somecom pu tat ional tasks . Also, we might be able to gain ins ight into th e natu re of comp uta t ion by examining what com pu ta t iona l losses we incur with th i s loss o f power.
If we do n ot a l low writ ing or two-way operat ion of th e tap e head , we have whathas been t rad it ional ly called a f ini te autom aton. This m achine is on ly allowed toread i t s input t ape and then , on the bas i s o f what i t has read and processed ,accept or re ject the inp ut . This res t r ic ted m achine operat es by:
a) Reading a sym bol,b) Tran sferring to a new instruction, an d c) Ad van cing th e tape head one square to the r ight .
When it a r r ives a t the en d of it s inpu t i t then accep ts o r re ject s depen ding up onwhat instru ct ion is being executed.
This sou nd s very sim ple. It is m erely a one-way, sem i-litera te Turing ma chineth at just decides m em bersh ip prob lems for a living! Let us exam ine on e. Inorder to depict one, a l l we need to do is jot down Turing machine instruct ionsin on e large table , leave out th e write p ar t (tha t was n ot a p un !), and add a no tewhich ind icates wheth er the mach ine sho uld accept . Here is an exam ple:
Inst r uct ion Read Got o Accept ?
1 01
samenext
no
2 01
samenext
yes
3 01
samesame
no
Look closely at this m achine. It s tays on instru ct ion on e un t i l it reads a on e.Then i t goes to ins t ruc t ion t wo and accep ts an y inp ut un less an o ther on e a r r ives(the sym bol 1 - not an oth er inp ut) . If two or mo re ones app ear in th e inp ut ,then i t ends u p execut ing ins t ru c t ion th ree and d oes no t accep t when the inputis over. And if no ones app ear in th e inpu t the m achine rem ains on ins t ru c t ionone and does no t accep t . So , th i s machine accep ts on ly inputs tha t con ta inexactly on e 1.
-
8/2/2019 fin-auto
2/7
Finit e Aut omat a 2
(N.B. Endmarkers a re no t needed s ince the machine jus t moves to the r igh t .Accept ing happens when the machine f inishes the input while execut ing anins t ru c t ion th a t ca lls fo r accep tance . Try th i s machine ou t on the inputs 000 ,010 0, 100010 0, e tc .)
Trad it iona l ly these m achines h ave n o t h ad ins t ru c t ions bu t states. (Recall A. M.Turing's states of m ind .) Anoth er way to represen t th is sam e m achine is to pu tt h e next instruction or next state or goto por t ion un der th e input in a t ab le liketha t in f igure 1.
There is another t radi t ional method to descr ibe f ini te automata which isextrem ely intu itive. It is a picture called a state graph. The s ta tes of the f ini teau tomaton appear as ver t i ces o f the graph whi le the t rans i t ions f rom s ta te tos ta te under inputs a re the graph edges . The s ta te g raph for the same machinealso app ears in f igure 1.
0,100
1 2 31 1
Input State 0 1
Accept?
1
23
1
23
2
33
no
yesno
Figu re 1 - Fin it e Aut om aton Represent ation s
(Note th a t th e two c i rc les th a t su r round s ta te two m ean accep tance .)
Before cont inuing le t ' s exam ine the com pu tat ion of a f ini te auto m aton . Our f irs texample beg ins in s ta te one and reads the input symbols in tu rn changings ta tes as necessary. Thus a comp uta t ion can be charac te r ized by a sequen ce of s ta tes . (Recal l that Turing machine configurat ions needed the s ta te plus the
tap e content . Since a f ini te autom aton n ever writes , we always know what is onthe tape and need only look at a s ta te as a configurat ion.) Here is the sequencefor the input 00010 01 .
Input Read: 0 0 0 1 0 0 1States: 1 1 1 1 2 2 2 3
-
8/2/2019 fin-auto
3/7
Finit e Aut omat a 3
Our next exam ple is an elevator control ler. Let ' s im agine an elevator th at servestwo f loors . Inp uts a re calls to a floor e ither f rom ins ide the elevator or f rom th ef loor itself . This m akes th ree dis t inct inpu ts po ssible , nam ely:
0 - no calls
1 - call to floor on e2 - call to floor t wo
The elevator i tself can be going up, going down, or halted at a floor. If i t is on af loor i t could be wai t ing for a call or abou t to go to th e other f loor. Thisprovides us with the s ix s ta tes shown in f igure 2 a long with the s ta te graph forth e elevator control ler.
Figure 2 - Elevator Control
A state tab le for the elevator is p rovided below as table 1 .
Input State none cal l t o 1 cal l t o 2
W1 (wait on 1)U1 (start up)UPDN
W2 (wait on 2)D2 (start d own)
W1UPW2W1
W2DN
W1U1D2W1
DNDN
UPUPW2U1
W2D2
Table 1 - Elevator Control
Accept ing and reject ing s ta tes are not included in the elevator design becauseacceptan ce is not an issu e. If we were to des ign a m ore sop his t icated elevator,it m ight h ave s ta tes tha t ind ica ted :
10,1
0 ,2
0,2 2
0,11 1
0,2 0,1
2 2
UP
W2 D2
DN
W1 D1
W1 Wai t i ng o n f i r st f l o o rU1 About t o g o upUP Going upDN Go in g d ow nW2 Wait ing - s econd f loo rD2 Ab out t o g o d ow n
-
8/2/2019 fin-auto
4/7
Finit e Aut omat a 4
a) po wer failur e,b) overload ing, orc) breakd own
In t h i s case accep tance an d re jec t ion m ight m ake sense .
Let us m ake a few sm all not es abou t the d esign. If the elevator is abou t to m ove(i.e. in state U1 or D2) and it is called to the floor i t is presently on it will stay.(This m ay be good - try it ne xt t im e you are in an elevator.) And if it is m oving(up or d own) and gets cal led b ack the o ther way, it rem em bers t he cal l by goingto th e U1 or D2 s ta t e upo n arr ival on th e next f loor. Of cours e the elevator d oesnot do th ings l ike open and c lose doors ( these could be s ta tes too) s ince tha twould have add ed com plexity to the design. Speak ing of comp lexity, im aginehaving 100 f loors .
That is our levity for this sect ion. Now that we kn ow what a f ini te autom aton is ,we m us t (as us ual) def ine i t precisely.
D e f i n i t i o n . A f in i t e au tom aton M is a q u int u p le M = (S,I, ,s 0 ,F) where:S is a finite set (of states)
I is a finite alph ab et (of inp ut sy m bols) : S I S (next state f un ction)s0 S (th e starting sta te)
F S (th e accepting states).
We also need so m e addi t ional not at ion. The next s ta t e fun ct ion is called th etransition function and the accept ing s ta tes are of ten cal led final states. Th eent i re mach ine is usu al ly def ined by presen t ing a s ta t e table or a s ta te graph . Inthis way, the s ta tes , a lphabet , t ransi t ion funct ion, and f inal s ta tes areconst ruct ively def ined. The s tar t ing s ta t e is usu al ly th e lowest nu m bered s t a te .Our f irs t exam ple of a fini te auto m aton is :
M = ({s 1 , s 2 , s 3}, {0,1}, , s 1, {s2})
where the t ransi t ion funct ion , is defined explicit ly by either a state table or as ta te g raph .
At th i s po in t we mus t make a s l igh t de tour and examine a very impor tan t ye tseemingly insignif icant input s t r ing cal led the emp t y st ring. It is a st ringwithou t any symbols in i t and is d enoted as . It is n ot a st ring of blank s. Anexam ple might m ake this c lear. Look between th e brackets in th e pictu re below.
-
8/2/2019 fin-auto
5/7
Finit e Aut omat a 5
A Blank
[ ]
Em pty Str ing
[]
Let 's look again at a com pu tat ion by our f irs t f ini te autom aton . For the inp ut010 , our m achine beg ins in s 1 , reads a 0 an d goes to (s 1 ,0) = s 1 , then read s a 1a n d goes t o (s 1 ,1) = s 2 , and en ds u p in (s 2 ,0) = s 2 after read ing th e final 0. Allof tha t can be pu t toge ther as :
( ( (s 1 ,0),1),0) = s 2
We cal l this t rans it ion on s t r ings * and def ine i t as fol lows.
D e f i n i t i o n . Let M = (S,I, ,s 0 ,F). For an y inp u t strin g x, in pu t sym bol a, an d
state s i , th e t r an s it ion fu nc t ion on s t r ings * takes the va lues:
*(s i ,(*e) = s i *(s i ,a) = (s i ,a)
*(s i ,xa) = ( *(s i ,x),a).
That certa inly was ters e. But , * is real ly just wha t one expects i t to be. Itm erely app lies th e t rans it ion funct ion to th e symb ols in t he s t r ing. Let ' s look atth is for th e examp le in f igure 3.
s
0 1
2
s
s
s
3
b
a
a,b a,b
ba
This ma chine has a set of s ta tes = {s 0 , s 1 , s 2 , s 3 } and operat es over the inpu talph abet {a, b}. Its s tar ting st ate is s 0 and its s et of f inal or accept ing s t a tes , F ={s 2 }. The tran sition fun ction is fully de scribed t wice in figur e 3; on ce in figur e3a as a s ta te t ab le and on ce in f igure 3b as a s ta te g raph .
-
8/2/2019 fin-auto
6/7
Finit e Aut omat a 6
Input State a b
Accept?
0123
3323
1223
nonoyesno
Figu re 3 - Fin it e Aut om aton
If the m achine rece ives th e input bbaa i t goes th rou gh th e sequ ence of s ta tes :
s 0, s 1, s 2, s 2, s 2
while when i t get s an inp ut s uch as abab i t goes th rough th e s ta te t rans it ion :
s 0, s 3, s 3, s 3, s 3
Now we shal l becom e a bit m ore abstract . When a f inite auto m aton receives aninpu t s t r ing such as :
x = x 1 x2 ... x n
where the x i a re symbols f rom i t s input a lphabe t , i t p rogresses th rough thesequence :
s s ... , sk k k1 2 n+1, ,
where the s ta tes in the sequ ence a re def ined as :
)x...xx,s()x,(ss
)xx,s()x,(ss
)x,s()x,(ss
s=s
n210nkk
2102kk
101kk
0k
n1+n
23
12
1
==
==
==
!
Getting back to a more intuitive reality, the following table provides anass ignment o f va lues to the symbols used above for an input o f bbaba to thef ini te autom aton o f figure 3.
i 1 2 3 4 5 6xi b b a b as k i s 0 s 1 s 2 s 2 s 2 s 2
-
8/2/2019 fin-auto
7/7
Finit e Aut omat a 7
We have ment ioned accep tance and re jec t ion bu t have no t t a lked too muchabou t it . This can be m ad e precise a lso.
D e f i n i t i o n . Th e se t (of strings) accep ted by the f ini te automaton M =
(S,I, ,s 0 ,F) is: T (M) = { x | *(s0 ,x) F }
This set of accepted s t r ings (named T(M) to mean T apes of M ) is merely all of the s t r ings for which M ended up in a f inal or accept ing s ta te af ter processingthe s t r ing. For ou r f irs t exam ple (f igure 1) th is was al l s t r ings of 0 's an d 1 's tha tcontain exactly one 1 . Our las t exam ple (f igure 3.1.3) accepted t he s et of s t r ingsover th e alph abe t {a, b} which b egan with exactly two b 's .
top related