Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is epted only y strting t stte q,nd x = is epted only y strting stte q 2. Tw o strt-sttes q nd q 2 : q, q 3 q 2 L(M) ={,,,,,, } (2) Non-unique trnsitions; δ(q i, j )isset of sttes Q. The lnguge L(M) ={x:xtkes M for some hoie of suessive trnsitions from the strt-stte to some finl-stte nd ll of x is proessed}. δ(q, ) ={q,q 2 } q q q 2 x= n e fully proessed in only 2 wys, nd one of them epts x. For eh NFS M, there is n equivlent deterministi FS M suh tht L(M) =L(M ).
opyright@995 6.2 REVERSING N FS MY CRETE NFS, C B M; L(M) = (+)* + ( + )*, C B M r ; L(M r) = ( + )* +(+)* Reversing n FS: Reverse diretion of eh trnsition (my rete non-determinism). Mke the strt-stte the finl-stte. Mke eh finl-stte strt-stte (my rete non-determinism). Reverse of Lnguge L: L r ={x r :x L}, where x r = k k 2 if x = 2 k k. If L is regulr, then L r is lso regulr. In M: q q 2 q 2 3 k q k k q k In M r : q q 2 q 2 3 k q k k q k Question: If M hs n error-stte, then wht will hppen to it in M r? Cn the reversl proess rete unrehle sttes?
opyright@995 6.3 λ-trnsition: MULTIPLE STRT-STTES ELIMINTION USING λ-trnsitions n FS n hnge stte y using λ-trnsition nd without reding n input symol. Elimintion of Multiple Strt-sttes: dd new stte s nd mke itthe only strt-stte. dd λ-trnsition from s to eh of the originl strt-stte. Nohnge in finl-sttes or other trnsitions. q q 2 q 3 s λ λ q q 2 q 3 q s,, q 2 q 3, (i) Strt-sttes = {q, q 2 }. Question:, (ii) n equivlent FS with strt-stte nd λ-moves., (iii) nother equivlent FS with strt-stte.? Give n exmple FS to show tht it is not enough to dd new stte s, mke itthe only strt-stte, nd for eh j dd the following trnsitions t s: δ(s, j )= δ(q i, j ), union over ll strt-sttes in M. qi (We hve to mke the new strt-stte s lso finl-stte if one or more the originl strt-sttes is finl-stte.)? Show the resulting FS when we pply the ove onstrution to the FS shown t the top left. Does it hnge the lnguge?
opyright@995 6.4 SUBSET-CONSTRUCTION METHOD FOR CONVERTING NFS TO FS The new FS M nnot simulte ll lterntive pths π (x) in the originl FS M for n input string x, euse the numer of π (x) n e exponentilly lrge (in x ) nd M hs finitely mny sttes. Insted, M keeps trk of the end points E(x) ofthe pths π (x); x is epted E(x) ontins one or more finl-sttes of M. The end-points of the pths π (x) form suset of Q in M, nd there re only 2 Q mny different susets. If x = 2 j nd x = x j+,then E(x ) = δ(q i, j+ ). q i E(x) 2 4 3 2 2 2 3 2 4 3 4 #(pths π (x) for proessing x = n )=n+2. {} {2} {2,3} {2,4} {2,3,4} {2,3,4} Use the susets of Q s the sttes of the new FS.
opyright@995 6.5 THE SUBSET-CONSTRUCTION v oid onstrution of unrehle sttes: () Choose the set of ll strt-sttes in M s the strt-stte S of the new FS M. (2) While there is stte S j for whih the trnsitions hve not een determined, do the following: For eh input symol Σin M, (i) Let S = δ (q i, ). (It my hppen tht S =.) (ii) q i S j If S is not lredy stte in M, then dd it s new stte. (iii) dd the trnsition δ(s j, ) =Sin M. (3) Mke eh stte S j in M finl-stte if it ontins one or more finl-sttes of M 2 4 n NFS 3 {} {2} {4} {2,3} {2,3,4} {2,4} The FS otined y the suset-onstrution Note: If we did not hve the ded-stte 4 in the ove exmple, then 4 would e removed from ll sttes in the new FS; the stte {4} would now eome.
opyright@995 6.6 EXERCISE. Complete the prtil desription of the stte in the finite-stte utomton M hs- elow for the lnguge L hs- (= the inry strings ontining ""), sed on the desriptions of sttes B nd C, to justify the trnsitions to nd from. Note tht eh stte-desription is in terms of the "pst", i.e., the prt of the input whih is proessed to rrive t the stte. M hs- :, B = hve not seen "" nd C B = hve not seen "" nd just seen C = seen "" Let M r hs- e the non-deterministi utomton otined y pplying the reversl-opertion to M hs- ; L(M r hs-) =L r hs- = L hs-. () Give suitle desription in English for the sttes of Mhs- r tht would justify its trnsitions. Wht is the onnetion etween these desriptions nd the previous desriptions? () Show the FS otined from M r hs- y the suset-onstrution. lso desrie the sttes of the new FS in simple English in terms of the desriptions in (). 2. Remove the redundnt stte 4 in the NFS in pge 6.4 nd then pply the suset-onstrution. How does the result differ from the FS shown ove; dothey ept the sme lnguge? 3. pply the suset-onstrution for the NFSs in pge 6.. 4. Consider deterministi FS for verifying multiplition of inry numers y 3, with the usul lest signifint it on the right. lso, onsider similr FS for verifying multiplition y 2. The input lphet for these mhines should e {,, 2, 3 }. Now, otin non-deterministi FS for verifying multiplition y either of 2 nd 3; onvert it to deterministi form.
opyright@995 6.7 Projetion: PROJECTION OF LNGUGEND λ-trnsition IN N FSM If x = x x 2 x 3 x k,where some of x i s n e λ, none of x i ontins, nd k, then the projetion Π (x) =x x 2 x k,whih is simply x minus ll ourrenes of. Π (L) ={Π (x): x L}. Theorem: For ny lnguge L nd the symols, Π (Π (L))) = Π (Π (L))). If L is regulr lnguge, then there is NFSM for Π (L) ontining λ-trnsitions. Exmple. M: d 2 d 3 Π d (M): λ 2 λ 3
opyright@995 6.8 λ-trnsition: ELIMINTION OF λ-trnsitions The FS n hnge its stte without reding n input symol. M: λ 2 λ 3 L(M): λ 2 3 L(M): λ 2 3 λ 2 3 Elimintion of λ-moves inmgives possily n NFS M : M nd M hve the sme sttes, nd the sme finl-sttes. M my hve multiple strt-sttes (due to λ-trnsitions from strtstte of M) nd non-deterministi trnsitions. Define: λ(q i )={q j :q j is rehle from q i y zero or more λ-trnsitions}; q i λ(q i ). lgorithm: () Mke eh stte in λ(q )strt-stte in M. (2) For eh δ(q i, j )=q k in M for j λ, let δ(q i, j )=λ(q k )inm. Exmple. For ove M, λ() = {, 2}, λ(2) = {2}, nd λ(3) = {2, 3}., M : 2 3
opyright@995 6.9 THE EFFECT OF INTRODUCING ERRORS IN REGULR LNGUGE Lnguge L modified y one replement error: RE (L) ={x:xdiffers from some y L in one position}. L nd RE (L) hve the sme lphet. If L is regulr, then RE (L) islso regulr. Exmple. If L = L -div-2 = L -even,then RE (L) =L -odd. L -even ={λ,,,,,,,, } L -odd = {,,,,,,, } Building n M(RE (L)) from M(L): The onstrution elow pplies to ny FS. M even B NFS for RE (L -div-2 ) B B trnsitions efore error error-trnsitions trnsitions fter error M(RE (L -even )): {, B } {, B} redued M(RE (L -even )): ( merged with B )
opyright@995 6. EXERCISE. pply the ove method to otin n FS for RE (L hs- ). Show ll detils of oversion of NFS to FS nd the detils of stteminimiztion. 2. How will you generlize the ove onstrution for extly k ( 2) replement errors? Illustrte the onstrution using k = 2 nd M -div-2.(the generliztion to errors is lso esy.) 3. Show tht RE L (L) ={uv w: v L, v = v, nd uvw L} is regulr if oth L nd L re regulr. Note tht v my equl v. (Hint: n NFS for RE L (L) will hve three phses: for the prt u (efore the error), v, nd w (fter the error).) 4. Let DE (L) ={xy: xy L for some x,, nd y} =the set of strings otined y deletion of symol from strings in L. One n show tht DE (L) isregulr y giving method for the onstrution of NFS for DE (L) from n FS for L where the deletion opertion is modeled y λ-trnsitions. Illustrte your method y using M hs- s n exmple; show the NFS fter the introdution of λ-trnsitions (keep the sttes "efore deletion" distint from those "fter deletion" similr to tht for the se of RE (L)). 5. similr result holds for the insertion error. Stte the result lerly.