2-Way Finite Automata Radboud University, Nijmegen. Writer: Serena Rietbergen, s Supervisor: Herman Geuvers

Size: px
Start display at page:

Download "2-Way Finite Automata Radboud University, Nijmegen. Writer: Serena Rietbergen, s Supervisor: Herman Geuvers"

Transcription

1 2-Wy Finite Automt Rdoud Univesity, Nijmegen Wite: Seen Rietegen, s Supeviso: Hemn Geuves Acdemic Ye

2 Contents 1 Intoduction 3 2 One wy utomt, deteministic nd non-deteministic 5 3 Ovehed fo conveting NFA to DFA 8 4 Two wy utomt, deteministic nd non-deteministic 9 5 Conveting 2DFA to 1DFA The lgoithm Exmples Exmple Exmple Complexity Conveting 2NFA to 1DFA Kozen vesus Shephedson NFAs Exmple Complexity Uny Lnguges nd Automt Noml fom 1NFA NFA to 1DFA DFA to 1DFA The Kozen tnsfomtion Using sweeping utomt NFA to 2DFA Conclusion A note on endmkes

3 Chpte 1 Intoduction Automt e in its most pue fom n elegnt mechnism fo deciding whethe wod elongs to specific lnguge. When pictuing lnguge though n utomton, it mkes it esie to undestnd wht the lnguge ctully is. We cn, fte ll, pick cetin input nd follow its pth. It will eithe get ccepted o ejected. Thee e howeve few polems when ctully ceting n utomton. One cn lwys simply cete lnguge tht one finds inteesting. The el chllenge lies in ceting n ctul utomton tht (optimlly) epesents the chosen lnguge. We hve seen few methods of simplifying this pocess. Among othe options, one cn use Non-Deteministic Finite Automton(NFA) o NFA-λ. All these constucts e used so tht we cn ette undestnd how some utomt wok. When viewing cetin Finite Automt tht e not Deteministic Finite Automt, one my get the impession tht when dding these options we cn ccept moe lnguges. Howeve, this is not tue. It hs een shown tht the clss of lnguges tht NFAs o NFA-λs ccept e not diffeent fom the clss of lnguges tht simple DFAs cn ccept. Thee e lgoithms fo tnsfoming NFA to n equivlent DFA, NFA-λ to n equivlent NFA, which in tun cn e tnsfomed into n equivlent DFA gin. All these vitions help us to ette undestnd the concept of Finite Automt. An impotnt issue is the nume of sttes n utomton uses. Fo exmple, when we hve NFA with few sttes we cn otin DFA with eltively mny sttes y execising the method fo tnsfoming one. When one sees the DFA, one could hve hde time imgining which lnguge it ccepts. In this thesis, we shll study nothe method which is used fo optimizing DFA. We will see the euty of Two-Wy Finite Automton, eithe Deteministic o Nondeteministic. They wee intoduced y Rin nd Scott[1] nd Shephedson[2] in Once gin, these two-wy utomt do not imply tht these utomt cn ccept moe o diffeent clsses of lnguges. You see, the clsses of lnguges tht cn e ccepted y two-wy finite utomt, cn lso e ccepted y one-wy finite utomt. Accoding to Shephedson, tnsfoming two-wy finite utomton to one-wy deteministic finite utomton cn e done in O((n + 1) n+1 ) steps whee n is the nume of sttes of the two-wy finite utomton. 3

4 DFAs nd NFAs cn only wlk in one diection, while two-wy utomt cn wlk multiple times though the wod y going ck nd foth. DFAs nd NFAs, when ccepting difficult lnguge, cn hve nume of sttes. This cn e educed this y llowing the utomton to wlk ck nd foth though the wod. By doing this, you lso hve ette oveview of the utomton, mking them esie to undestnd. Even though thee is sic definition fo two-wy deteministic finite utomton, thee hve een slight dpttions mde to this definition. These ltetions wee used fo undestnding these utomt ette. Even though these chnges mde the utomt look diffeent, they still ccept the sme clsses of lnguges. In this thesis we will see how to tun two-wy utomton, oth deteministic s non-deteministic, into one-wy deteministic utomton nd wht the costs e of tht pocess in nume of sttes. As peviously stted, two-wy utomton is moe likely to hve less sttes. We will lso see wht othe methods of conveting two-wy utomton into one-wy utomton e solely used fo uny lnguges. Tht is, lnguges ove one-symol lphet. 4

5 Chpte 2 One wy utomt, deteministic nd non-deteministic A finite utomton is simple mchine to ecognize ptten. Moe pecisely, ptten of wods ove n lphet. Definition 2.1. An lphet Σ is finite set of symols. Definition 2.2. A wod w Σ is conctention of lettes fom the lphet Σ with ny length. Definition 2.3. We will denote the empty wod s λ, it hs length 0. Definition 2.4. An lnguge L is set of wods, L Σ Definition 2.5. A deteministic finite utomton is quintuple M = (Q, Σ, δ, s, F ) whee: Q is finite set of sttes; Σ is finite set tht we cll the input lphet; δ : Q Σ Q is the so clled tnsition function; s Q is the stt stte; F Q, the set of finl sttes. The utomton tht is depicted elow ccepts the lnguge whee evey wod needs to hve n odd length. By ltenting etween the two sttes, it is effectively counting the lettes in the wod. When the length of the wod is even, it will end in q 0 nd theefoe not e ccepted. Remk 2.6. In n utomton the stt-stte is depicted with n ow coming fom stt. The finl sttes in n utomton e depicted with doule ing ound the stte., q 0 stt q 1, Figue 2.1: A DFA 5

6 When eding wod w Σ in cetin DFA, we often would like to know in which stte we end up fte n steps when eginning t the egin-stte q 0. Fo this we will use the following definition: Definition 2.7. Let M = {Q, Σ, δ, q 0, F } e DFA, w Σ, n N nd q Q. We define the eltion q 0 n w q inductively fo n > 0: q 0 1 w q if δ(q 0, k) = q with k eing the fist lette of w; nd q n 0 q if q n 1 Q : q 0 q nd q 1 q with w = w. w w Definition 2.8. Let M = {Q, Σ, δ, q 0, F } e DFA, w Σ nd n the length of w. If q 0 n w q, it is sid tht w hs un on the DFA M stting in q 0 nd ending in q. A un is ccepting if q F. Definition 2.9. Let M = {Q, Σ, δ, q 0, F } e DFA nd w = n Σ. 1. w is ccepted if it hs n ccepting un on M. 2. w is ejected if it doesn t hve n ccepting un on M. The set of wods ccepted y the DFA M is clled L(M). Definition A non-deteministic finite utomton is quintuple M = (Q, Σ, δ, s, F ) whee: Q is finite set of sttes; Σ is finite set tht we cll the input lphet; δ : Q Σ 2 Q is the so clled tnsition function; s Q is the stt stte; F Q, the set of finl sttes. The utomton s seen elow ccepts only the lnguge whee the lst lette of wod is n. It wlks though the wod nd when encounteing n the utomton cn choose whethe it stys in the loop of q 0 o goes to q 1, ut will only ccept it when the utomton is done eding the whole wod., q stt 0 q 1 Figue 2.2: Exmple of NFA Definition Let M = {Q, Σ, δ, q 0, F } e NFA, w Σ nd n the length of w. If q 0 n w q, it is sid tht w hs un on the NFA M stting in q 0 nd ending in q. A un is ccepting if the end-stte is finl stte. Tlking out NFA, wod cn hve multiple uns. 6

7 The cceptnce of wod w in NFA is the sme s the cceptnce of DFA: Definition Let M = {Q, Σ, δ, q 0, F } e DFA nd w = n Σ. 1. w is ccepted if it hs n ccepting un on M. 2. w is ejected if it doesn t hve n ccepting un on M. The set of wods ccepted y the NFA M is clled L(M). Definition When we view lettes s wods of length 1, we cn view ˆδ s n extension of δ fo wods of ity length. We will define ˆδ(q, y) inductively with y Σ s follows: ˆδ(q, λ) = q ˆδ(q, y) = δ(ˆδ(q, y), ) 7

8 Chpte 3 Ovehed fo conveting NFA to DFA We now conside the costs when tnsfoming NFA to DFA. Definition 3.1. I n = L(( + ) ( + ) n 1 ) fo n N. Fo n N, I n is the lnguge of wods whee the n th lette fom the end is n. The clss of lnguges is extemely useful when giving n exmple of tnsfoming NFA to DFA. Fo (I n ) n N we hve n elegnt NFA, one tht simply wlks until the wnted is ed, nd then eds the next n lettes. This utomton lows up exponentilly in nume of sttes when it is tnsfomed to DFA. This clss is the pime exmple s to why the complexity of tnsfoming NFA to DFA is in O(2 n ). Lemm 3.2. Let A e DFA tht ccepts I n. If v, w Σ n, q 0 n w q nd q 0 n v q, then v = w. Poof. Let A = (Q, Σ, δ, q 0, F ). Assume v w, q 0 n v q nd q 0 n w q. Assume the (n k + 1) th lette of w nd v is nd espectively. Define v = v n k nd w = w n k. We see tht thee is unique q Q such tht q n k q nd q n k q. v w Now we see tht thee e two possiilities: 1. q F. This mens tht oth w nd v e ccepted. Howeve w / L(A), ecuse w must not e ccepted y this mchine. This is ecuse the n th lette fom the end of w is nd not. 2. q Q\F. This signifies tht oth v nd w e not ccepted. Howeve v L(A), ecuse v must e ccepted y this mchine. This is ecuse the n th lette fom the end fo v is. Theefoe v = w. Theoem 3.3. Let A e DFA tht ccepts I n, then Q 2 n. Poof. Fo Σ = {, } thee e 2 n diffeent wods of length n. Afte eding wod of length n, A is in unique stte. Assume you hve less thn 2 n sttes, then thee e two wods tht will end in the sme stte ccoding to the Pigeonhole Pinciple. Accoding to the Lemm 3.2. these two wods e the sme. Hence t lest 2 n sttes e necessy. 8

9 Chpte 4 Two wy utomt, deteministic nd non-deteministic Two-Wy Finite Automt e used fo efficiently ccepting lnguge. Thee e multiple wys to denote the exct definition of two-wy deteministic finite utomton. Fist is the vint Kozen uses in his lectue notes[3]. This vint is inteesting, ecuse it uses endmkes, whees Rin nd Scott[1] did not. The eson why is ecuse it gives us ette epesenttion out wht we ctully would like to ccomplish. Fo exmple, tke the following lnguge. I 3 = {w Σ the thid lette fom the ck is } When n utomton ccepts this lnguge, we wnt to know if the thid lette fom the end is n o not. One cn simply chieve this y going to the end of the wod nd then wlk ck. To do this, we would need to know when wod is finished. Fo this Kozen intoduces endmkes. Definition 4.1 (Kozen[3]). A Kozen-2DFA is n octuple M = (Q, Σ,,, δ, s, t, ) whee: Q is finite set of sttes; Σ is finite set tht we cll the input lphet; is the left endmke, / Σ; is the ight endmke, / Σ; δ : Q (Σ {, }) (Q {L, R}) is the tnsition function (L, R stnd fo left nd ight, espectively); s Q is the initil stte; t Q is the ccept stte; Q is the eject stte, t; 9

10 such tht fo ll sttes q, nd fo ll symols Σ { }, δ(q, ) = (u, R) fo some u Q δ(q, ) = (v, L) fo some v Q, δ(t, ) = (t, R), δ(t, ) = (t, L), δ(, ) = (, R), δ(, ) = (, L). When eding wod w Σ in Kozen-2DFA, we often would like to know in which stte we end up fte n steps when eginning t the initil stte q 0. Fo this we will use the following definitions: Definition 4.2. Let M = (Q, Σ,,, δ, s, t, ) e Kozen-2DFA nd w = n. The eltion (q, i) 1 (q, i) with q, q Q nd i, j N is defined on 2DFA M s w follows: δ(p, i ) = (q, L) (p, i) 1 w (q, i 1) δ(p, i ) = (q, R) (p, i) 1 w (q, i + 1) Hee i is the i th lette of the wod w Σ, p, q Q. Definition 4.3. We define the eltion n w inductively on n 1 s follows: (p, i) 0 w (p, i); nd (p, i) n (u, k), if q Q : (p, i) n 1 (q, j) nd (q, j) 1 (u, k) fo some p Q w w w nd j N. Definition 4.4. We define w (p, i) w s follows: (q, j) def n 0 : (p, i) n w (q, j) Definition 4.5. Thee e thee possiilities: 1. A wod w Σ is sid to e ccepted if (s, 0) w (t, i) fo some i N. 2. A wod w is sid to e ejected when (s, 0) w (, i) fo some i N 3. A wod w it lso sid to e ejected when none of (1) o (2) holds. L(M) Σ is the set of wods tht e ccepted y Kozen-2DFA M. Note tht w cnnot e oth ccepted nd ejected t the sme time, ecuse of the constuction of Kozen. When wod entes o t, it cn neve leve tht stte. The exmple elow ccepts only wods whee the nume of s in w is multiple of thee nd the nume of is multiple of two. It fist checks if the nume 10

11 of s is coect when wlking though the wod y going epetedly ight. Only when the utomton ends in q 0 while eing t the end of the wod, it will ed the end-mke nd go left though the wod while checking if the nume of s is multiple of 2. Only when tht is the cse, the utomton will end in p 0 nd will ed the end-mke. Then it will go to t, the teminting stte. Let s sy the wod we wnt to check does not hve the coect mount of s, it will eithe end in q 1 o q 2. Then the utomton will ed nd go to, the ejecting stte. Exmple 4.6. The 2DFA s seen elow epesents the lnguge ove Σ = {, }, nmely L = {w Σ #(w) = 3k nd #(w) = 2i with k, i N}.,R,R,R,R,R stt q 0 q 1 q 2,L,L,R,L,L,L p 0 p 1,L t,r,r,l,l Figue 4.1: A 2DFA y Dexte Kozen,R,R,L Remk 4.7. An utomton is deteministic when evey stte hs tnsition ow fo evey lette in the lnguge Σ, nd. Note tht not evey stte hs 4 tnsition ows in this exmple. A lot of those e omitted, ecuse those situtions will neve e eched. Definition 4.8 (Shephedson[2]). A two-wy deteministic finite utomton (Shephedson- 2DFA) ove Σ is system M = (Q, δ, s, F ) whee: Q, the finl set of sttes; δ : Σ Q L Q, the tnsition function with L = { 1, 0, 1} the diection; s, the initil stte nd F, the set of finl sttes. If fo ll q Q nd Σ, we hve tht δ(q, ) 1, then M is sid to e deteministic. 11

12 Definition 4.9. A wod w Σ in Shephedson-2DFA is sid to e: ccepted if M is done eding w nd it moves off the wod t the ight-hndedge of w while M is in stte elonging to F. ejected in ny othe cse. The set of wods tht e ccepted y M is clled L(M). Exmple The utomton ccepts the lnguge L(( ) ). Note tht this utomton is deteministic, ecuse δ(q, ) 1 holds fo ll q Q nd Σ.,1, 1,1 stt q 0 q 1 q 2,1 Figue 4.2: A Shephedson-2DFA ccepting L(( ) ) We hve now only seen exmples of Two-Wy Deteministic Finite Automt. A Non-Deteministic vint is lso possile. To mke 2NFA one would need to mke few djustments: The tnsition function needs to e in the fom of δ : Σ Q 2 Q L. Insted of δ eing function tht gives evey pi (, q) single vlue in the fom of (q, d), it will now give set s nswe. This needs to hppen ecuse in 2NFA it is possile fo n utomton to move to diffeent sttes when eding lette, o to no sttes t ll. It is possile, ut not necessy, to give the 2NFA the option of hving multiple initil sttes. Fo n exct definition of n vint of two-wy non-deteministic finite utomton, see definition

13 Chpte 5 Conveting 2DFA to 1DFA 5.1 The lgoithm Fo this pt we will use the Two-Wy Deteministic Finite Automton s descied y Kozen-2DFA in Definition 4.1. To constuct 1DFA M fom 2DFA M we need to find the set of sttes, which will e found though the cetion T x fo x Σ. To evey x we ssocite function T x : (Q { }) (Q { }), which will e lte shown in the fom of tle. To constuct T x we fist need to intoduce the symols nd. Thoughout this constuction let y Σ e the conctention of x Σ nd z Σ. On this input the mchine M will stt eding the wod y on the left side nd will move though it fom left to ight. Theefoe, it my coss the ode fom x to z. Hee we sy tht M cosses the ode fom x to z if the lst lette tht is ed is the lst lette of x nd the next lette tht will e ed is the fist lette of z. Note tht thee e two possiilities, M eithe cosses the ode fom x to z o it doesn t: 1. M cosses the ode fom x to z. It does so fo the fist time while going fom q Q (the lst lette of x is ed) to q Q (the fist lette of z is ed). This will e denoted s T x ( ) = q. 2. M does not coss the ode. This will e denoted s T x ( ) =. Let s ssume tht the mchine does coss the ode fom x to z nd entes into z. Similly to the ove, M will eithe coss the ode gin fom z to x o it will not. Sy it does coss the ode etween z nd x nd entes ck into x, enteing into q i (the fist lette fom z is ed). We cn epet the distinction fom ove: 1. M cosses the ode gin fom x to z in some stte q j Q. This will e denoted s T x (q i ) = q j. 2. M neve cosses the ode etween x nd z gin. This will e denoted s T x (q i ) =. Notice tht fte cossing the ode into x fom z in stte q i, the stte q j in which it emeges only depends on x nd q i nd not on z, motivting the used nottion. 13

14 The explicit constuction of mking 1DFA fom 2DFA consists of few steps. The lgest step in the lgoithm is detemining ll function T x, which will e epesented y tles. This cn e done in vious wys. Since thee e finitely mny tles possile, nmely (n + 1) n+1 with n eing the nume of sttes in Q, one cn constuct ll tles nd see how they intect with one nothe when constucting the tnsition function. Seeing tht lot of the tles will neve e eched, this is highly inefficient method. Conside t the following lgoithm. Definition 5.1. This lgoithm lets us constuct ll T x, stting t step Let w = λ. 2. Constuct T w s stted ove. 3. If T w ( ) = o T w ledy exists, stop t this nch. Else, sve T w. Fo evey Σ let w := w nd epet fom step 2. Definition 5.2. Given the 2DFA M = (Q, Σ,,, δ, s, t, ) we define the 1DFA M = (Q, Σ, s, δ, F ) s follows: Q = {T x x Σ }, finite set of sttes; s = T λ, the stt-stte; δ (T x, ) = T x, the tnsition-function; nd F = {T x x L(M)}, the set of finite sttes. Befoe we e le to pove tht the 2DFA M nd the 1DFA M ccept the sme lnguge, we fist stte the following lemms. Lemm 5.3. Let x, y Σ : ˆδ (T x, y) = T xy. Poof. We will pove this y induction ove y. Induction se: y = λ. ˆδ (T x, λ) def = T x = T xλ. Induction hypotheses: ˆδ (T x, y) = T xy. Inductive step: y = y, which will e the conctention of wod y nd lette Σ. ˆδ (T x, y) def = δ (ˆδ (T x, y), ) IH = δ (T xy, ) = T xy. Since oth the se nd the inductive step hve een pefomed nd e coect, y mthemticl induction, ˆδ (T x, y) = T xy holds fo ll x Σ. Lemm 5.4. Let x Σ : T x F x L(M). Poof. : this follows fom the definition of F. : If T x F, then thee exists some y L(M) with T x = T y. Now we pove tht x is lso n element of L(M): let us look t the sequences of sttes M finds itself in when cossing the oundy etween x nd, nd y nd. These sequences e 14

15 identicl ecuse they e detemined y the identicl tles T x nd T y. We know tht y L(M), so the sequence of y contins t t some point. This indictes tht the sequence of x lso contins t t some point, mening tht the wod is ccepted y M. Afte ll, when the 2DFA M eches the stte t it will neve leve this stte nd thus the wod x is ccepted. Theefoe, x L(M). We cn now finlly show tht the Kozen-2DFA M nd the 1DFA M ccept the sme lnguges. This poves tht when Kozen-2DFA ccepts cetin lnguge, 1DFA cn e ceted tht ccepts the sme lnguge. It is meely nothe method of desciing n utomton tht ccepts sid lnguge. Theoem 5.5. L(M) = L(M ) Poof. x L(M ) ˆδ (s, x) F ˆδ (T λ, x) F T x F x L(M) Now we see tht w L(M) w L(M ) nd theefoe L(M) = L(M ). 5.2 Exmples This lgoithm gives n uppe ound of O((n+1) (n+1) ), ecuse thee e (n+1) (n+1) tles s mentioned in Section 5.1 Hee is n elegnt exmple nd not so elegnt exmple, in ode fo the ede to get n ide of how this lgoithm woks. The lgoithm essentilly consists of constucting the individul elements of 1DFA Exmple 1 We will now see fily elegnt exmple in which Kozen s lgoithm is used. This utomton does not hve low-up in the nume of sttes. L = {w Σ #(w) = 3k nd #(w) = 2i with i, k N} with Σ = {, }. 15

16 ,R,R,R,R,R stt q 0 q 1 q 2,L,L,R,L,L,L p 0 p 1,L t,r,r,l,l Figue 5.1: A 2DFA ccepting L,R,R,L We cn now compute ll diffeent T x. T T T T T T q 0 t p 0 p 1 q 2 t p 0 p 1 q 1 t p 0 p 1 q 0 t p 0 p 1 q 1 t p 0 p 1 q 2 t p 0 p 1 u 0 u 1 u 2 u 3 u 4 u 5 Note tht the following lwys holds fo this utomton: T x q 0 q 0 q 1 q 1 q 2 q 2 t t Sttes tht e the sme fo evey T x will e left out in the exmples tht follow. T cn e ed s follows: T ( ) = q 0 When eding stting fom the left stting in q 0, we see tht fte eding the fist the utomton goes to q 1. Afte eding the second the utomton 16

17 goes to q 2. Afte eding the thid the utomton goes to q 0 gin. So fte eding, the utomton ends in q 0. Note tht whethe n,, o follows, the utomton will leve the stte q 0. Theefoe T ( ) = q 0. T (q 0 ) = q 0 We stt eding stting fom the ight in q 0. Afte eding the, we go to q 1. So the stte we left efoe cossing the ode is q 0. Theefoe T (q 0 ) = q 0. T (q 1 ) = q 1 We stt eding stting fom the ight in q 1. Afte eding the, we go to q 2. So the stte we left efoe cossing the ode is q 1. Theefoe T (q 1 ) = q 1. T (q 2 ) = q 2 We stt eding stting fom the ight in q 2. Afte eding the, we go to q 0. So the stte we left efoe cossing the ode is q 2. Theefoe T (q 2 ) = q 2. T (p 0 ) = t Now we will stt eding fom the ight side of stting in q 0. We ed the thid nd go to p 0. We ed the second nd go to p 0. We ed the fist nd go to q 0. Then we ed the nd go to t. In stte stte we will ed the thee s, efoe we coss the est of the wod, ll while stying in t. Theefoe, T (p 0 ) = t. T (p 0 ) = Now we will stt eding fom the ight side of stting in q 1. We ed the thid nd go to p 1. We ed the second nd go to p 1. We ed the fist nd go to q 1. Then we ed the nd go to. In stte stte we will ed the thee s, efoe we coss the est of the wod, ll while stying in. Theefoe, T (p 0 ) =. T (t) = t We stt eding stting fom the ight in t. Afte eding the t, we go to t. So the stte we left efoe cossing the ode is t. Theefoe T (t) = t. T () = We stt eding stting fom the ight in. Afte eding the, we go to. So the stte we left efoe cossing the ode is. Theefoe T () =. To constuct the DFA coesponding to the 2DFA we need to tke sevel steps. We hve to give the set of sttes Q, the stting stte s, the tnsitioning function δ nd the set of sttes tht e ccepting, F. We hve ledy found ll diffeent T x, so Q is given ove. We see tht s def = T λ = T = u 0. 17

18 We see tht δ (T x, ) def = T x. This povides us with the following tnsition function: u 0 u 2 u 3 u 1 u 0 u 4 u 2 u 1 u 5 u 3 u 5 u 0 u 4 u 3 u 1 u 5 u 4 u 3 Tle 5.1: The tnsition function δ Finlly we see tht F def = {T x x L(M)} = {T } = {u 0 }, ecuse of ll the option s stted ove, only L(M). This povides us with the following DFA. stt u 0 u 1 u 2 u 3 u 4 u 5 Figue 5.2: The DFA ccepting L Exmple 2 We will now see n exmple tht isn t quite s elegnt s exmple 1. This exmple is minly used to show tht the lgoithm is indeed cple of low-up. Let us stt y consideing the lnguge I 4 = ( + ) ( + ) 3. 18

19 ,R,R,L,L,L stt q 0,L q 1,L q 2,L q 3,L q 4,L,L,L t,r,r,l,r,r,l Figue 5.3: A 2DFA ccepting the lnguge I 4. We cn now find ll T x : T T T T T T T T q 0 q 1 t q 2 t q 3 t t q 4 q 0 q 1 t q 2 t q 3 t q 4 q 0 q 1 t q 2 t q 3 t q 4 q 0 q 1 t q 2 t q 3 q 4 q 0 q 1 t q 2 q 3 t t q 4 q 0 q 1 t q 2 q 3 t q 4 q 0 q 1 t q 2 q 3 t q 4 q 0 q 1 t q 2 q 3 q 4 u 0 u 1 u 2 u 3 u 4 u 5 u 6 u 7 T T T T T T T T q 0 q 1 q 2 t q 3 t t q 4 q 0 q 1 q 2 t q 3 t q 4 q 0 q 1 q 2 t q 3 t q 4 q 0 q 1 q 2 t q 3 q 4 q 0 q 1 q 2 q 3 t t q 4 q 0 q 1 q 2 q 3 t q 4 q 0 q 1 q 2 q 3 t q 4 q 0 q 1 q 2 q 3 q 4 u 8 u 9 u 10 u 11 u 12 u 13 u 14 u 15 The set of sttes of the 1DFA Q is s stted ove. The stting stte is equl to T λ, which in this cse equls u

20 This povides us with the following tnsition function: u 0 u 0 u 1 u 1 u 2 u 3 u 2 u 4 u 5 u 3 u 6 u 7 u 4 u 8 u 9 u 5 u 10 u 11 u 6 u 12 u 13 u 7 u 14 u 15 u 8 u 0 u 1 u 9 u 2 u 3 u 10 u 4 u 5 u 11 u 6 u 7 u 12 u 8 u 9 u 13 u 10 u 11 u 14 u 12 u 13 u 15 u 14 u 15 Tle 5.2: The tnsition function δ. The finl thing tht ests us to do, is to compute the set of finl sttes: F = {T x x L(M)} = {u 0, u 1, u 2, u 3, u 4, u 5, u 6, u 7 }. This is ecuse,,,,,,, L(M). Now tht we hve computed ll the pts of the 1DFA, we cn ctully constuct it. The 1DFA M is s follows: 20

21 u 0 u 8 u 1 u 12 u 9 u 2 u 3 u stt 15 u 14 u 4 u 10 u 5 u 13 u 6 u 11 u 7 Figue 5.4: A 1DFA ccepting the lnguge I 4. 21

22 5.3 Complexity When constucting 1DFA fom Kozen-2DFA, we see tht the nume of sttes equls the nume of tles. Theefoe, the mximum nume of sttes is ound y the nume of possile tles. When we tke look t the function T x : (Q { }) (Q { }), we see tht thee is mximum of (n + 1) (n+1) tles, with n eing the nume of sttes the Kozen-2DFA hs. We cn now esily see tht the uppe ound fo the complexity of this lgoithm is O((n + 1) (n+1) ). It is not cle whethe this lgoithm hs the lowest complexity, ut t lest we cn show tht such n lgoithm cnnot e polynomil. Theoem 5.6. Thee exists no polynomil lgoithm tht cn convet genel Kozen-2DFA into 1DFA. Poof. An exmple ws given in which Kozen-2DFA hs line nume of sttes nd the coesponding 1DFA hs 2 n sttes when conveting the clss of lnguges I n. Let s ssume polynomil lgoithm is given fo conveting Kozen-2DFA into 1DFA. The ceted 1DFA will lwys hve t lest 2 n sttes ccoding to Lemm 3.2. Theefoe, the lgoithm will neve e polynomil. 22

23 Chpte 6 Conveting 2NFA to 1DFA To show we cn tun 2NFA into 1DFA we will use n vition of the lgoithm tht Shephedson descies is his ppe[2]. We will see tht the lgoithm Shephedson uses is siclly the sme s the lgoithm Kozen uses. The eson fo not using the lgoithm of Kozen when deling with 2NFA s is ecuse of his usge of end-mkes, which his method is sed on. 6.1 Kozen vesus Shephedson We will compe the method Kozen uses fo constucting DFA out of n Kozen- 2DFA (see Definition 4.1) with the method Shephedson uses to constuct DFA fom Shephedson-2DFA(see Definition 4.8). Note tht the method Shephedson uses shows get simility to the method Dexte Kozen uses. We will see tht Shephedson minly uses diffeent nottion. The only diffeence tht elly pops out is the constuction of the tles tht will e the finite set of sttes in the 1DFA. Kozen uses T x fo this, while Shephedson uses τ t. Definition 6.1. The constuction of τ t : (Q { }) (Q { }) is s follows: 1. Fo ll t Σ with t λ, τ t is defined s follows: τ t (q) = q if M, stted in the stte q while eding the ightmost lette of t, leves the wod t on the ight side in stte q. τ t (q) = when M leves t t the left o when it is stuck in loop, stting in the stte q. τ t ( ) = q if M, stted in the stte q 0 while eding the leftmost lette of t, leves the wod t on the ight side in stte q. τ t ( ) = when M leves t on the left edge o when M is stuck in loop, stting in the stte q τ λ is defined s follows: τ λ (q) = nd τ λ ( ) = s. The est of the constuction is s follows: 23

24 Shephedson Kozen Q {τ t t Σ } {T x x Σ } F {τ t τ t ( ) F } {T x x L(M)} s τ λ T λ δ : Σ Q Q : Q Σ Q One cn see tht most of these ttiutes e just simply ewitten, the only ttiute tht looks significntly diffeent is tht of F. To ctully show tht these two methods e equl, it emins to pove tht the set of end-sttes of the method of Shephedson equls those of the method of Kozen: Lemm 6.2. {τ t τ t ( ) F } = {T x x L(M)} Poof. We need to pove tht τ t ( ) F t L(M). Both of these sttements e equivlent to the following: Afte M is done eding t it is in some stte q F 6.2 2NFAs We will fist need definition of Two-Wy Non-Deteministic Finite Automton. Fo tht, we will use the following definition, which is simple djustment of the the stndd definition Shephedson uses fo 2DFA. Definition 6.3. A Shephedson-2NFA M = (Q, s, δ, F ) ove n lphet Σ is utomton tht holds the following popeties: Q, the set of sttes; s, the egin-stte; δ : Σ Q 2 Q L ; F, the set of finl sttes. To know whethe wod w Σ is ccepted y Shephedson-2FA M, we fist need to look t few useful definitions. Definition 6.4. A configution of M is pi (q, i) (Q N) consisting of stte q nd position i. Definition 6.5. A un is sequence of configutions. It is n element of (Q N). Fomlly, (q 0, i 0 ),..., (q m, i m ) is un of M on wod w = 0,..., n Σ if the following holds: 1. q 0 = s, the un stts with the egin stte; 2. i 0 = 0, the un stts on position 0; 3. i m n + 1, the finl configution does not exceed the position n + 1; 4. j : 0 j < m, we hve: 24

25 0 i j n, except fo mye the finl configution, the un neve leves the ounds of the wod; thee exists configution (t, k) δ(q j, ij ) such tht s j+1 i j+1 = i j + k. Definition 6.6. A un is ccepting if i m = n + 1 nd q m F. Definition 6.7. A wod w Σ is sid to e: ccepted y M if it hs n ccepting un on w; ejected y M if it does not hve n ccepting un on w. The set of wods tht e ccepted y M is clled L(M). = t nd The second equiement to convet Shephedson-2NFA into 1DFA, is n djustment to the constuction of ll τ t with t Σ. Definition 6.8. The function τ t : Q { } 2 Q { } is constucted s follows: 1. When tlking out stte q we see the following τ t (q) = {q M stts in q on the ightmost lette of t, thee is un whee M leves t t the ight in stte q }. is dded to τ t (q) othewise. This includes when M leves t t the left o when M is stuck in loop. 2. When tlking out we see the following τ t ( ) = {q M stts in q on the leftmost lette of t, thee is un whee M leves t t the ight in stte q }. is dded to τ t ( ) othewise. This includes when M leves t t the left o when M is stuck in loop. Definition 6.9. Given the 2NFA M = (Q, s, δ, F ) we define the 1DFA M = (Q, s, δ, F ) s follows: Q = {τ t t Σ }, finite set of sttes; s = τ λ, the stt-stte; δ (τ t, ) = τ t, the tnsition-function; nd F = {τ t q F : q τ t ( )} the set of finite sttes. Befoe we cn ctully see tht these two utomt ccept the sme lnguge, we hve to intoduce few help functions. Definition Consideing lettes s wods of length 1, we cn view ˆδ s n extension of δ fo wods of ity length. We will define ˆδ (τ x, y) inductively with y Σ s follows: ˆδ (τ x, λ) = τ x ˆδ (τ x, y) = δ (ˆδ (τ x, y), ) 25

26 Lemm Let x, y Σ : ˆδ (τ x, y) = τ xy. Poof. We will pove this y induction ove y. Induction se: y = λ. ˆδ (τ x, λ) def = τ x = τ xλ. Induction hypothesis: ˆδ (τ x, y) = τ xy. Inductive step: y = y, which will e the conctention of wod y nd lette Σ. ˆδ (τ x, y) def = δ (ˆδ (τ x, y), ) IH = δ (τ xy, ) = τ xy. Since oth the se nd the inductive step hve een pefomed nd e coect, y mthemticl induction, ˆδ (T x, y) = T xy holds fo ll x Σ. Theoem L(M) = L(M ) Poof. t L(M ) ˆδ (s, t) F ˆδ (τ λ, t) F τ t F q F : q τ t ( ) t L(M) And now we see tht L(M) = L(M ). 6.3 Exmple The exmple will mke use of the following clss of lnguges: L n = ( + ) ( + ) n 1 ( + ) Let us tke look t the following utomton epesenting the lnguge L 2 = ( + ) ( + )( + ) :,R,R,R,R,L stt q 0 q,l,r 1 q 2 q 3,L Figue 6.1: A Shephedson-2NFA ccepting L 2 26

27 τ λ q 0 q 0 q 1 q 2 u 0 τ q 0, q 0 q 0, q 1 q 2 q 3 u 1 τ q 0 q 0 q 0 q 1 q 2 u 2 τ q 0, q 0 q 0, q 1 q 3 q 2 q 3 u 3 τ q 0, q 3, q 0 q 0, q 3 q 1 q 3 q 2 q 3 u 4 τ q 0, q 0 q 0 q 1 q 3 q 2 τ q 0, q 3, q 0 q 0 q 1 q 3 q 2 τ q 0, q 3, q 0 q 0, q 3 q 1 q 2 q 3 τ q 0, q 0 q 0 q 1 q 2 u 5 u 6 u 7 u 8 τ q 0, q 3, q 0 q 0 q 1 q 2 u 9 τ q 0, q 3, q 0 q 0, q 1 q 3 q 2 q 3 u 10 τ q 0, q 0 q 0, q 1 q 2 q 3 u 11 τ q 0, q 3, q 0 q 0 q 1 q 2 u 12 The set of sttes is ll diffeent τ t, s stted ove. The stt-stte is s = τ λ = u 0. The tnsition function δ is given elow: u 0 u 1 u 2 u 1 u 3 u 5 u 2 u 1 u 2 u 3 u 4 u 5 u 4 u 4 u 6 u 5 u 7 u 8 u 6 u 7 u 9 u 7 u 10 u 6 u 8 u 11 u 8 u 9 u 12 u 9 u 10 u 4 u 6 u 11 u 3 u 5 u 12 u 10 u 6 Figue 6.2: The tnsition function δ The set of finl sttes is F = {τ t τ t ( ) F } = {u 4, u 6, u 7, u 9, u 1 0, u 1 2}. This gives us the following 1DFA. As you might notice, the sttes u 4, u 6, u 7, u 9, u 1 0 nd u 1 2 could e meged into one stte. As the wod entes though u 4 o u 7 it will neve leve tht e. Note tht the lgoithm given is not optiml! 27

28 u 2 stt u 0 u 1 u 3 u 5 u 8 u 11 u 4 u 6 u 7 u 10 u 12 u 9 Figue 6.3: A 1DFA ccepting L Complexity Becuse this lgoithm is n dpttion of the lgoithm Dexte Kozen uses, the lowe ound emins the sme. The uppe ound chnges to O(2 (n+1)(n+1) ), ecuse τ t gives mximum of 2 (n+1)(n+1) tles whee n is the nume of sttes of the 2NFA tht is eing conveted. 28

29 Chpte 7 Uny Lnguges nd Automt We now intoduce uny finite utomt, oth deteministic nd non-deteministic one-wy, nd oth one-wy nd two-wy. Since we will only e tlking out wods ove one-lette lphet in this chpte, input wods cn e identified s positive integes, s well s 0. Theefoe, we will wite x insted of x. All of the given tnsfomtions in this chpte e fom Finite Automt nd Uny Lnguges [4] witten y M. Chok in As is witten thee, we will tlk out the tnsfomtion of 1NFA to 1DFA, 2DFA to 1DFA nd 1NFA to 2DFA. All of these utomt will e uny. Definition 7.1. A uny one-wy deteministic finite utomton (U1DFA) A = (Q, q 0, E, F ) is n utomton with the following popeties. Q: the finite set of sttes; q 0 Q: the egin-stte; E Q Q: the set of diected edges etween sttes, such tht fo evey q i Q thee exists unique q j Q with (q i, q j ) E; F : the set of finl sttes, with F Q. Note tht when we e tlking out deteministic uny finite utomton, the nume of edges is equl to the nume of sttes, E = Q. Definition 7.2. The cceptnce of wod x fo uny deteministic finite utomton is the sme s the cceptnce of wod w fo deteministic finite utomton. The only diffeence is tht when we e tlking out uny 1DFA, we don t hve tnsition function, ut puely the set of edges. When we hve n edge (q i, q j ), we conside this the sme s δ(q i, ) = q j. Definition 7.3. A uny one-wy non-deteministic finite utomton (U1NFA) A = (Q, q 0, E, F ) is n utomton with the following popeties. Q: the finite set of sttes; q 0 Q: the egin-stte; E Q Q: the set of diected edges etween sttes, such tht fo evey q i Q thee exists q j Q with (q i, q j ) E; 29

30 F : the set of finl sttes. Note tht the nume of edges of non-deteministic uny finite utomton is t lest s lge s the nume of sttes, E Q. When we e tlking out the cceptnce of uny non-deteministic finite utomton, this is nely the sme s Definition 7.2. The only diffeence is of couse, tht we e tlking out uny non-deteministic finite utomt insted of uny deteministic finite utomt. Definition 7.4. An uny two-wy deteministic finite utomton (U2DFA) B = (Q, q 0, δ, F ) is n utomton with the following popeties. Q: the finite set of sttes; q 0 Q: the egin-stte; δ : Q {,, } Q {L, R}: the tnsition-function with eing the only lette tht is eing ed. L nd R epesent left nd ight: the diection tht the we ed the input wod in. nd epesent the endmkes of the wod. A wod x will e ed f x. F : the set of finl sttes. Definition 7.5. A wod x : is ccepted y B if the un of x on B ends in stte q F. is not ccepted y B othewise. We could lso define two-wy non-deteministic utomton, ut since we will not e using these utomt the definition will e omitted. Definition 7.6. A sweeping utomton is n utomton tht only tuns the diection of which it is eding the wod t the end (nd eginning) of the wod. This is the sme fo noml s well s uny utomt. 7.1 Noml fom 1NFA Definition 7.7. Let A e uny one-wy non-deteministic finite utomton (U1NFA) with the following popeties. of its vetices e in cycles s of them e not, so tht + s e equl to Q Then we define S(A) = (, s). Definition 7.8. A U1NFA A = (Q, q 0, E, F ) is in noml fom if it meets the following equiements. The sttes consist of the sttes tht e the pelude to the cycles nd the sttes tht e in the the cycles themselves. Q = {q 0, q 1,..., q n } C 1 C 2... C k, whee C i = {p i,0, p i,1,..., p i,yi 1} fo i {1,..., k}, with C i eing the i th cycle. 30

31 The vetices consist of the pth fom q 0 to q n, the pths in the cycles C 1,..., C k nd the connections etween the cycles nd q n. E ={(q i, q i+1 ) i {0,..., n 1}} {(p i,j, p i,j+1 ) i {0,..., y j 1}} {(q n, p i,0 ) i {1,..., k}} The ddition of j + 1 in the second component is mod y i. C 1 q 0 stt q n 1 q n. C k Figue 7.1: The genel shpe of n noml fom U1NFA We stte the following lemm without poof. The poof cn e found in the ppe Finite Automt nd uny lnguges [4], Lemm 4.3. Lemm 7.9. Fo evey U1NFA A with n sttes, thee exists noml fom U1NFA A tht ccepts the sme lnguge such tht S(A ) (n, O(n 2 )) NFA to 1DFA Sy we wnt to tnsfom n-stte U1NFA A into U1DFA B. Fist we wnt to tnsfom A into noml fom U1DFA A. Fo A we define y 1,..., y k nd y s follows. y 1,..., y k e the lengths of the cycles C 1,..., C k y = lcm(y 1,..., y k ) The U1DFA B = (Q, q 0, E, F ) is then constucted s follows. Q = {q 0,..., q s 1, q s,..., q y+s 1 } q 0 is the q 0 of A. E = {q i, q i+1 ) i {0, 1,..., y + s 2} {q y+s 1, q s )} F is constucted s follows: If q i with 0 i < s is n ccepting stte in A, then q i F. If p i,j is n ccepting stte in A, then q s+t F fo ech t such tht t j = cy i fo some c N. 31

32 Fo ette undestnding of this constuction ctully woks, hee is stepy-step ekdown. We will stt with the noml fom U1NFA, fo thee is wee the elevnt steps hppen. The utomton A elow ccepts the lnguge L = (() + () ). q 1,0 q 1,1 q 0 stt q 1 q 2 q 3 q 2,0 q 2,1 q 2,2 Figue 7.2: A noml fom U1NFA We see tht this utomton is in noml fom (Definition 7.8) with the following constnts. n = 9 s = 4 y 1 = 2 = 5 y = 6 y 2 = 3 Then we cn stt constucting the U1DFA B = (Q, q 0, E, F ): Q = {q 0,..., q 3, q 4,..., q 9 } E = {q i, q i+1 ) i {0, 1,..., 8}} {q 9, q 4 )} q 0 emins the sme. Fo F we hve to look t the 2 ccepting sttes of A : p 1,0 is n ccepting stte in A, so q s+t F fo ech t such tht t = 2c fo some c N. This is tue fo t = 0, 2, 4. So q 4+0, q 4+2, q 4+4 = q 4, q 6, q 8 F. p 2,0 is n ccepting stte in A, so q s+t F fo ech t such tht t = 3c fo some c N. This is tue fo t = 0, 3, so q 4+0, q 4+3 = q 4, q 7 F. This gives F = {q 4, q 6, q 7, q 8 } This gives us the following U1DFA: 32

33 q 0 stt q 1 q 2 q 3 q 4 q 5 q 6 q 9 q 8 q 7 Figue 7.3: U1DFA B tht ccepts L = (() + () ) DFA to 1DFA We hve ledy seen how to tnsfom U2DFA into U1DFA with the use of Kozen s method. Thee is lso method of tnsfoming U2DFA into U1DFA with the use of sweeping utomt, this method is puely used fo uny utomt. We will discuss oth these methods nd show the ede how the method woks with n exmple of U2DFA tht ccepts L = {n n 0 mod 6} The Kozen tnsfomtion Plese note tht n R t n edge denote,r nd L denote,l. R stt q 0 q 1 q 2 R,L,L q L 3 q 4 t R L q 5 L,L,L,L R,L Figue 7.4: U2DFA tht ccepts L = { n n 0 mod 6} To define the U1DFA coesponding to the U2DFA we need to tke sevel steps. Hee we will do the sme pocedue s in Section 5.1. We hve to decide the set of sttes Q, the stting stte s, the tnsitioning function δ nd the set of sttes tht e ccepting F. Fo ll the sttes in Q, see the tles elow. 33

34 T λ T T T T T q 1 q 3 t q 4 q 5 q 2 q 3 q 4 t q 5 q 1 q 3 q 4 t q 5 q 2 q 3 t q 4 q 5 q 1 q 3 q 4 t q 5 q 1 q 3 q 4 t q 5 u 0 u 1 u 2 u 3 u 4 u 5 We hve s = T λ = u 0 nd δ (T x, ) = T x. This povides us with the following tnsition function. u 0 u 1 u 1 u 2 u 2 u 3 u 3 u 4 u 4 u 5 u 5 u 0 Tle 7.1: The tnsition function δ Finlly we hve F = {T x x L(M)} = {T λ } = {u 0 }, ecuse of ll the options s stted ove, only λ L(M). This povides us with the following U1DFA: u 0 stt u 1 u 2 u 5 u 4 u 3 Figue 7.5: U1DFA tht ccepts L = { n n 0 mod 6} Remk When we e tlking out 1DFA tht ccepts lnguge of the fom of {x x mod n 0}, we cn note tht thee is n utomton tht hs n sttes. Indeed, the utomton needs to count n occuences of the lette. Fig shows tht uny 2DFA fo {x x mod n 0} cn e mde with Q = 3 + p pime { 0 v p (n) = 0 p vp(n) othewise whee v p (n) is the multiplicity of pime-nume p in the nume n. 34

35 7.3.2 Using sweeping utomt We now give genel method fo tnsfoming U2DFA into U1DFA, now using sweeping utomt. This method only pplies to uny lnguges, nd is due to [4]. The following is high-level desciption of the ide. We fist need to tun the U2DFA into sweeping U2DFA. This cn e done esily, ccoding to Chok[4]. Let the sweeping utomton A hve n sttes: The U1DFA B will simulte the sweeping U2DFA A = (Q, q 0, δ, F ) on the input x in the following wy. 1. If x n nd x hs n ccepting un on A, then x is ccepted y B. 2. If x > n, then A will mke cycle when eding x. Let y 1,..., y k e the lengths of the cycles C 1..., C k nd y = lcm(y 1,..., y k ). We note tht y 1 + +y k n, ecuse no stte cn e in moe thn one cycle. Fo evey two wods u nd v with v > u > n nd v u = y: u L(A) v L(A). In othe wods, knowing the lowest common multiple y suffices fo wods tht e longe thn n. If wod is longe thn n, one must only keep sutcting y fom x, until the length of x is less thn n, so it will fll in ctegoy 1. Hee e the detils of the desciption y exmple using the following sweeping U2DFA: q 3 R R stt q 0 q 1 R q 2 R q 6,L L q 4 q 5 L Figue 7.6: U2DFA tht ccepts L = { n n 0 mod 6} Let us just look t the popeties we cn decude fom this utomton: 1. The length of cycle one is 3: y 1 = The length of cycle two is 2: y 2 = y = lcm(2, 3) = 6 35

36 Fo evey x fo which x 6, only 0 nd 6 e ccepted y A. Theefoe, only 0, 6 L(B). Fom tht infomtion we see tht 0+ky nd 6+ky with k N should e ccepted y A. Howeve, we see tht those two e equivlent, ecuse they only diffe y 6 which is the lowest common multiple. We now only need to constuct U1DFA tht ccepts evey x fo which x = ky with k N holds. This povides us with the following U1DFA: u 0 stt u 1 u 2 u 5 u 4 u 3 Figue 7.7: U1DFA tht ccepts L = { n n 0 mod 6} 7.4 1NFA to 2DFA We now give genel method fo tnsfoming U1NFA into U2DFA using noml fom U1NFA. This method only pplies to uny lnguges, nd is due to [4]. The following is high-level desciption of the ide. We need to mke noml fom U1NFA A fom U1NFA A. We will not define the U2DFA B explicitly, ut will show how B simultes the noml fom 1NFA A. It will do so in the following wy: If x < s: x L(B) iff q x is n ccepting stte of A Othewise: B must mke some psses ove the input x, let s sy j. The length of the cycle in tht pss is y j. Thee B will compute if t = (x s) mod y j. B will ccept x if nd only if p j,t is n ccepting stte of A. Hee e the detils of the desciption y exmple using the following noml fom U1NFA: 36

37 q 1,0 q 1,1 q 0 stt q 1 q 2 q 3 q 2,0 q 2,1 q 2,2 Figue 7.8: A noml fom U1NFA This noml fom U1NFA hs the following popeties: So we clculte t fo C 1 nd C 2 : n = 9 s = 4 y 1 = 2 = 5 y = 6 y 2 = 3 C 1 : t (x 4) mod 2. t needs to e 0, ecuse p 1,0 is n ccepting stte in A. Then we see tht (x 4) mod 2 0 C 2 : t (x 4) mod 3. t needs to e 0, ecuse p 2,0 is n ccepting stte in A. Then we see tht (x 4) mod 3 0 So fo evey x > 4, x will e ccepted if (x 4) mod 2 0, o (x 4) mod 3 0 Remk The est wy to simulte this into U2DFA is s follows. You fist pefom the fist steps nd pefom the fist cycle y going to the ight. Afte tht you pefom you fist steps gin nd pefom cycle C 2, oth y going left. This cn e done until you e t the finl cycle, ltenting the diection fo evey cycle. 37

38 One otins the following U2DFA R stt q 0 q R 1 q R 2 q R 3 q R 4 q 1,0 q L 1,1,L q 2,1 L q 2,0 L q 8 L q 7 L q 6 L q 5 L L q 2,2 Figue 7.9: U2DFA 38

39 Chpte 8 Conclusion We hve seen tht two-wy deteministic utomt ccept the sme lnguges s one-wy deteministic finite utomt. One cn tnsfom 2DFA into 1DFA using the method Kozen povides in his lectue notes. This lgoithm hs n uppe ound of O((n + 1) (n+1) ) with n eing the nume of sttes the 2DFA hs. Futhemoe we hve seen tht two-wy non-deteministic finite utomt lso ccept the sme lnguges s one-wy deteministic finite utomt. One cn tnsfom 2NFA into 1DFA using vition on the method Shephedson povides. This lgoithm hs n uppe ound of O(2 (n+1)(n+1) ) with n eing the nume of sttes of the povided 2NFA. As finl point we viewed oth uny one-wy (non-deteministic) finite utomt nd uny two-wy deteministic finite utomt. These kind of utomt hve unique methods fo tnsfoming into one nothe, ecuse of the fct tht they only ccept uny lnguges. A common theme when tnsfoming n uny one-wy deteministic utomton into nothe utomton is the usge of the noml fom one-wy non-deteministic utomton. 8.1 A note on endmkes We notice tht Kozen pefes the use of endmkes, while othes might not. Endmkes e used fo ette undestnding nd constuction of cetin Two-Wy Automt. When one woks with 2FA s, one will quickly notice tht lot of the 2FAs e sweeping utomt. When using n endmke, the utomton quickly ecognizes it s t the end of the wod o t the eginning of wod. A plin 2FAs doesn t hve wy of ecognising it s t the end (o t the eginning) of wod. When dding something to n utomton, one cetes the imge tht thee e moe clsses of lnguges tht will e ccepted thn efoe. This is not tue in this cse. Accoding to Shephedson one cn tnsfom lnguge tht is sed on endmkes to lnguge tht isn t sed on endmkes. Addition of these endmkes does not cete moe clsses of lnguges. 39

40 Biliogphy [1] M. O. Rin nd D. S. Scott, Finite utomt nd thei decision polems, IBM Jounl of Resech nd Development, vol. 3, no. 2, pp , [2] J. C. Shephedson, The eduction of two-wy utomt to one-wy utomt, IBM Jounl of Resech nd Development, vol. 3, no. 2, pp , [3] D. Kozen, Automt nd computility. Undegdute texts in compute science, Spinge, [4] M. Chok, Finite utomt nd uny lnguges, Theo. Comput. Sci., vol. 47, no. 3, pp ,

Chapter 7. Kleene s Theorem. 7.1 Kleene s Theorem. The following theorem is the most important and fundamental result in the theory of FA s:

Chapter 7. Kleene s Theorem. 7.1 Kleene s Theorem. The following theorem is the most important and fundamental result in the theory of FA s: Chpte 7 Kleene s Theoem 7.1 Kleene s Theoem The following theoem is the most impotnt nd fundmentl esult in the theoy of FA s: Theoem 6 Any lnguge tht cn e defined y eithe egul expession, o finite utomt,

More information

Language Processors F29LP2, Lecture 5

Language Processors F29LP2, Lecture 5 Lnguge Pocessos F29LP2, Lectue 5 Jmie Gy Feuy 2, 2014 1 / 1 Nondeteministic Finite Automt (NFA) NFA genelise deteministic finite utomt (DFA). They llow sevel (0, 1, o moe thn 1) outgoing tnsitions with

More information

Discrete Mathematics and Logic II. Automata

Discrete Mathematics and Logic II. Automata Discete Mthemtics nd Logic II. Automt SFWR ENG 2FA3 Ryszd Jnicki Winte 2014 Acknowledgments: Mteil sed on Automt nd Computility y Dexte C. Kozen (Chpte 3). Ryszd Jnicki Discete Mthemtics nd Logic II. Automt

More information

10 Statistical Distributions Solutions

10 Statistical Distributions Solutions Communictions Engineeing MSc - Peliminy Reding 1 Sttisticl Distiutions Solutions 1) Pove tht the vince of unifom distiution with minimum vlue nd mximum vlue ( is ) 1. The vince is the men of the sques

More information

Week 8. Topic 2 Properties of Logarithms

Week 8. Topic 2 Properties of Logarithms Week 8 Topic 2 Popeties of Logithms 1 Week 8 Topic 2 Popeties of Logithms Intoduction Since the esult of ithm is n eponent, we hve mny popeties of ithms tht e elted to the popeties of eponents. They e

More information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

More information

Designing finite automata II

Designing finite automata II Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Let's start with an example:

Let's start with an example: Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte

More information

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

More information

Deterministic simulation of a NFA with k symbol lookahead

Deterministic simulation of a NFA with k symbol lookahead Deteministic simultion of NFA with k symbol lookhed SOFSEM 7 Bl Rvikum, Clifoni Stte Univesity (joint wok with Nic Snten, Univesity of Wteloo) Oveview Definitions: DFA, NFA nd lookhed DFA Motivtion: utomted

More information

Optimization. x = 22 corresponds to local maximum by second derivative test

Optimization. x = 22 corresponds to local maximum by second derivative test Optimiztion Lectue 17 discussed the exteme vlues of functions. This lectue will pply the lesson fom Lectue 17 to wod poblems. In this section, it is impotnt to emembe we e in Clculus I nd e deling one-vible

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton 25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q

More information

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38 Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

More information

Convert the NFA into DFA

Convert the NFA into DFA Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:

More information

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1 Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more

More information

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

( ) D x ( s) if r s (3) ( ) (6) ( r) = d dr D x

( ) D x ( s) if r s (3) ( ) (6) ( r) = d dr D x SIO 22B, Rudnick dpted fom Dvis III. Single vile sttistics The next few lectues e intended s eview of fundmentl sttistics. The gol is to hve us ll speking the sme lnguge s we move to moe dvnced topics.

More information

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

Coalgebra, Lecture 15: Equations for Deterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined

More information

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010 CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w

More information

Theory of Computation Regular Languages

Theory of Computation Regular Languages Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

More information

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9. Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.

More information

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Converting Regular Expressions to Discrete Finite Automata: A Tutorial Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert

More information

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny

More information

Math 4318 : Real Analysis II Mid-Term Exam 1 14 February 2013

Math 4318 : Real Analysis II Mid-Term Exam 1 14 February 2013 Mth 4318 : Rel Anlysis II Mid-Tem Exm 1 14 Febuy 2013 Nme: Definitions: Tue/Flse: Poofs: 1. 2. 3. 4. 5. 6. Totl: Definitions nd Sttements of Theoems 1. (2 points) Fo function f(x) defined on (, b) nd fo

More information

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

More information

Worked out examples Finite Automata

Worked out examples Finite Automata Worked out exmples Finite Automt Exmple Design Finite Stte Automton which reds inry string nd ccepts only those tht end with. Since we re in the topic of Non Deterministic Finite Automt (NFA), we will

More information

Previously. Extensions to backstepping controller designs. Tracking using backstepping Suppose we consider the general system

Previously. Extensions to backstepping controller designs. Tracking using backstepping Suppose we consider the general system 436-459 Advnced contol nd utomtion Extensions to bckstepping contolle designs Tcking Obseves (nonline dmping) Peviously Lst lectue we looked t designing nonline contolles using the bckstepping technique

More information

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

More information

Chapter 2 Finite Automata

Chapter 2 Finite Automata Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht

More information

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1 Non-Deterministic Finite Automt Fll 2018 Costs Busch - RPI 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q q2 1 q 0 q 3 Fll 2018 Costs Busch - RPI 2 Nondeterministic Finite Automton (NFA) Alphbet

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

More information

FI 2201 Electromagnetism

FI 2201 Electromagnetism FI 1 Electomgnetism Alexnde A. Isknd, Ph.D. Physics of Mgnetism nd Photonics Resech Goup Electosttics ELECTRIC PTENTIALS 1 Recll tht we e inteested to clculte the electic field of some chge distiution.

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

More information

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)

More information

Discrete Model Parametrization

Discrete Model Parametrization Poceedings of Intentionl cientific Confeence of FME ession 4: Automtion Contol nd Applied Infomtics Ppe 9 Discete Model Pmetition NOKIEVIČ, Pet Doc,Ing,Cc Deptment of Contol ystems nd Instumenttion, Fculty

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

Formal Languages and Automata

Formal Languages and Automata Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University

More information

Michael Rotkowitz 1,2

Michael Rotkowitz 1,2 Novembe 23, 2006 edited Line Contolles e Unifomly Optiml fo the Witsenhusen Counteexmple Michel Rotkowitz 1,2 IEEE Confeence on Decision nd Contol, 2006 Abstct In 1968, Witsenhusen intoduced his celebted

More information

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion

More information

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation 9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions

More information

General Physics II. number of field lines/area. for whole surface: for continuous surface is a whole surface

General Physics II. number of field lines/area. for whole surface: for continuous surface is a whole surface Genel Physics II Chpte 3: Guss w We now wnt to quickly discuss one of the moe useful tools fo clculting the electic field, nmely Guss lw. In ode to undestnd Guss s lw, it seems we need to know the concept

More information

π,π is the angle FROM a! TO b

π,π is the angle FROM a! TO b Mth 151: 1.2 The Dot Poduct We hve scled vectos (o, multiplied vectos y el nume clled scl) nd dded vectos (in ectngul component fom). Cn we multiply vectos togethe? The nswe is YES! In fct, thee e two

More information

Finite-State Automata: Recap

Finite-State Automata: Recap Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under

More information

Data Structures. Element Uniqueness Problem. Hash Tables. Example. Hash Tables. Dana Shapira. 19 x 1. ) h(x 4. ) h(x 2. ) h(x 3. h(x 1. x 4. x 2.

Data Structures. Element Uniqueness Problem. Hash Tables. Example. Hash Tables. Dana Shapira. 19 x 1. ) h(x 4. ) h(x 2. ) h(x 3. h(x 1. x 4. x 2. Element Uniqueness Poblem Dt Stuctues Let x,..., xn < m Detemine whethe thee exist i j such tht x i =x j Sot Algoithm Bucket Sot Dn Shpi Hsh Tbles fo (i=;i

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More

More information

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1 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

More information

1 From NFA to regular expression

1 From NFA to regular expression Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work

More information

Harvard University Computer Science 121 Midterm October 23, 2012

Harvard University Computer Science 121 Midterm October 23, 2012 Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is

More information

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

More information

Lecture 09: Myhill-Nerode Theorem

Lecture 09: Myhill-Nerode Theorem CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives

More information

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA) Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr

More information

2.4 Linear Inequalities and Interval Notation

2.4 Linear Inequalities and Interval Notation .4 Liner Inequlities nd Intervl Nottion We wnt to solve equtions tht hve n inequlity symol insted of n equl sign. There re four inequlity symols tht we will look t: Less thn , Less thn or

More information

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

More information

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51 Non Deterministic Automt Linz: Nondeterministic Finite Accepters, pge 51 1 Nondeterministic Finite Accepter (NFA) Alphbet ={} q 1 q2 q 0 q 3 2 Nondeterministic Finite Accepter (NFA) Alphbet ={} Two choices

More information

9.4 The response of equilibrium to temperature (continued)

9.4 The response of equilibrium to temperature (continued) 9.4 The esponse of equilibium to tempetue (continued) In the lst lectue, we studied how the chemicl equilibium esponds to the vition of pessue nd tempetue. At the end, we deived the vn t off eqution: d

More information

Lecture 3: Equivalence Relations

Lecture 3: Equivalence Relations Mthcmp Crsh Course Instructor: Pdric Brtlett Lecture 3: Equivlence Reltions Week 1 Mthcmp 2014 In our lst three tlks of this clss, we shift the focus of our tlks from proof techniques to proof concepts

More information

The Area of a Triangle

The Area of a Triangle The e of Tingle tkhlid June 1, 015 1 Intodution In this tile we will e disussing the vious methods used fo detemining the e of tingle. Let [X] denote the e of X. Using se nd Height To stt off, the simplest

More information

Parse trees, ambiguity, and Chomsky normal form

Parse trees, ambiguity, and Chomsky normal form Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs

More information

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15 Models of Comput:on Lecture #8 Chpter 7 con:nued Any lnguge tht e defined y regulr expression, finite utomton, or trnsi:on grph cn e defined y ll three methods We prove this y showing tht ny lnguge defined

More information

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-* Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion

More information

Deterministic Finite Automata

Deterministic Finite Automata Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite

More information

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018 CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA

More information

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15 Regulr Lnguge Nonregulr Lnguges The Pumping Lemm Models of Comput=on Chpter 10 Recll, tht ny lnguge tht cn e descried y regulr expression is clled regulr lnguge In this lecture we will prove tht not ll

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed

More information

Review of Mathematical Concepts

Review of Mathematical Concepts ENEE 322: Signls nd Systems view of Mthemticl Concepts This hndout contins ief eview of mthemticl concepts which e vitlly impotnt to ENEE 322: Signls nd Systems. Since this mteil is coveed in vious couses

More information

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t

More information

Electric Potential. and Equipotentials

Electric Potential. and Equipotentials Electic Potentil nd Euipotentils U Electicl Potentil Review: W wok done y foce in going fom to long pth. l d E dl F W dl F θ Δ l d E W U U U Δ Δ l d E W U U U U potentil enegy electic potentil Potentil

More information

dx was area under f ( x ) if ( ) 0

dx was area under f ( x ) if ( ) 0 13. Line Integls Line integls e simil to single integl, f ( x) dx ws e unde f ( x ) if ( ) 0 Insted of integting ove n intevl [, ] (, ) f xy ds f x., we integte ove cuve, (in the xy-plne). **Figue - get

More information

Name Ima Sample ASU ID

Name Ima Sample ASU ID Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to

More information

Class Summary. be functions and f( D) , we define the composition of f with g, denoted g f by

Class Summary. be functions and f( D) , we define the composition of f with g, denoted g f by Clss Summy.5 Eponentil Functions.6 Invese Functions nd Logithms A function f is ule tht ssigns to ech element D ectly one element, clled f( ), in. Fo emple : function not function Given functions f, g:

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Intoduction to Computing II Mcel Tucotte School of Electicl Engineeing nd Compute Science Abstct dt type: Stck Stck-bsed lgoithms Vesion of Febuy 2, 2013 Abstct These lectue notes e ment to be

More information

Improper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows:

Improper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows: Improper Integrls The First Fundmentl Theorem of Clculus, s we ve discussed in clss, goes s follows: If f is continuous on the intervl [, ] nd F is function for which F t = ft, then ftdt = F F. An integrl

More information

Fourier-Bessel Expansions with Arbitrary Radial Boundaries

Fourier-Bessel Expansions with Arbitrary Radial Boundaries Applied Mthemtics,,, - doi:./m.. Pulished Online My (http://www.scirp.og/jounl/m) Astct Fouie-Bessel Expnsions with Aity Rdil Boundies Muhmmd A. Mushef P. O. Box, Jeddh, Sudi Ai E-mil: mmushef@yhoo.co.uk

More information

More on automata. Michael George. March 24 April 7, 2014

More on automata. Michael George. March 24 April 7, 2014 More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

Probabilistic Retrieval

Probabilistic Retrieval CS 630 Lectue 4: 02/07/2006 Lectue: Lillin Lee Scibes: Pete Bbinski, Dvid Lin Pobbilistic Retievl I. Nïve Beginnings. Motivtions b. Flse Stt : A Pobbilistic Model without Vition? II. Fomultion. Tems nd

More information

Fundamentals of Computer Science

Fundamentals of Computer Science Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,

More information

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont. NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD

More information

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016 CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

Physics 604 Problem Set 1 Due Sept 16, 2010

Physics 604 Problem Set 1 Due Sept 16, 2010 Physics 64 Polem et 1 Due ept 16 1 1) ) Inside good conducto the electic field is eo (electons in the conducto ecuse they e fee to move move in wy to cncel ny electic field impessed on the conducto inside

More information

set is not closed under matrix [ multiplication, ] and does not form a group.

set is not closed under matrix [ multiplication, ] and does not form a group. Prolem 2.3: Which of the following collections of 2 2 mtrices with rel entries form groups under [ mtrix ] multipliction? i) Those of the form for which c d 2 Answer: The set of such mtrices is not closed

More information

State Minimization for DFAs

State Minimization for DFAs Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid

More information

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun: CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce

More information

On the Eötvös effect

On the Eötvös effect On the Eötvös effect Mugu B. Răuţ The im of this ppe is to popose new theoy bout the Eötvös effect. We develop mthemticl model which loud us bette undestnding of this effect. Fom the eqution of motion

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

Physics 505 Fall 2005 Midterm Solutions. This midterm is a two hour open book, open notes exam. Do all three problems.

Physics 505 Fall 2005 Midterm Solutions. This midterm is a two hour open book, open notes exam. Do all three problems. Physics 55 Fll 5 Midtem Solutions This midtem is two hou open ook, open notes exm. Do ll thee polems. [35 pts] 1. A ectngul ox hs sides of lengths, nd c z x c [1] ) Fo the Diichlet polem in the inteio

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

More information

3 Regular expressions

3 Regular expressions 3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll

More information