DFA minimisation using the Myhill-Nerode theorem

Size: px
Start display at page:

Download "DFA minimisation using the Myhill-Nerode theorem"

Transcription

1 DFA minimistion using the Myhill-Nerode theorem Johnn Högerg Lrs Lrsson Astrct The Myhill-Nerode theorem is n importnt chrcteristion of regulr lnguges, nd it lso hs mny prcticl implictions. In this chpter, we introduce the theorem n present its proof. One consequence of the theorem is n lgorithm for minimising DFAs tht is outlined in the ltter prt of this pper. To clrify how the lgorithm works, we conclude with n exmple of its ppliction. 1 Introduction This chpter gives n introduction to DFA minimistion using the Myhill- Nerode theorem. DFA minimistion is n importnt topic ecuse it cn e pplied oth theoreticlly nd prcticlly, in for instnce compilers. Minimising DFA increses its efficiency y reducing its mount of sttes nd it lso enles us to determine if two DFAs re equivlent. The chpter is structured s follows. Following this introduction in Section 2, some relevnt ckground informtion nd definitions re stted, which will e used in the susequent sections. In Section 3, the Myhill-Nerode theorem is stted nd its proof presented. Section 4 contins the lgorithm for DFA minimistion tht uses the Myhill-Nerode theorem. An exmple showing how such minimistion might e conducted in specific cse is found in Exmple Bckground informtion nd definitions The reder is dvised to skim through this section to recll, t lest t n intuitive level, the terms tht will e used in this chpter. Following these intuitive descriptions, more forml definitions re provided. A deterministic finite utomton, or DFA for short, my e considered kind of very sic computtionl device. It processes strings of symols of certin lphet nd yields result tht is sid to e either ccepting or rejecting. Normlly, n ccepting result mens tht the string is prt of recognised lnguge. The lnguge is then defined s ll strings tht ring the DFA into n ccepting stte. 1

2 q 1 q 2 q 3 q 4 Figure 1: DFA ccepting the lnguge n,n > 2 Definition 2.1 (DFA) A deterministic finite utomton (DFA) A is quintuple A = (S,Σ,δ,s,F) consisting of: finite set of sttes S, finite set of symols Σ, clled the lphet, trnsition function δ : S Σ S, strting stte s S, nd set of ccepting sttes F S. We extend the definition of δ to the domin of Σ y letting 1. δ(q,λ) = q, where λ denotes the empty string, nd 2. δ(q,w) = δ(δ(q,),w), where Σ nd w Σ. Finlly, A is sid to ccept the string w Σ if δ(q 0,w) F. DFA re commonly represented y stte digrms, such s in Figure 1 nd Figure 2. The sttes tht re ccepting hve doule order, the initil stte is the stte with the ngle on the left nd the rrows or trnsitions signify wht stte should e entered fter reding the symol on the rrow. There re some limittions s to wht kind of lnguge the DFA cn recognise. The numer of symols in the lphet s well s the numer of sttes in the DFA hs to e finite. This mens tht while it is entirely possile to construct DFA tht ccepts strings tht for instnce look like n,n > 2 (let the strting stte of the DFA e followed y two rejecting sttes nd finlly y stte tht ccepts ny numer of s, see Figure 1) it is not possile to recognise lnguge such s n n,n N (the symol repeted n times, followed y the exct sme numer of s) ecuse tht would require infinitely mny sttes to keep trck of the numer of s to ensure tht the sme numer of s re red. See Figure 2 for n exmple of how DFA ccepting the lnguge n n,n 2 might e constructed. Note the ovious difficulty tht rises if n my e ritrrily lrge s well s the difference etween this lnguge nd n. The clss of lnguges tht cn e recognised y DFA re clled regulr lnguges or Type-3 lnguges in the Chomsky hierrchy. Every regulr lnguge cn e recognised y red-only Turing mchine, descried y regulr expression, generted y regulr grmmr, nd defined in so-clled mondic second-order logic. As fr s this chpter is concerned, the forml definition including syntx for regulr lnguges hs no useful mening. Insted, it is sufficient to define regulr lnguges s follows. 2

3 q 00 q 10 q 20 q 11 q 21, q in, q 22, Figure 2: DFA ccepting the lnguge n n,n 2 Definition 2.2 (regulr lnguge) The clss of lnguges tht cn e recognised y deterministic finite utomton. The Myhill-Nerode theorem tht will provide the theoreticl ckground tht llows us to minimise DFA requires the following definitions tht re relted to equivlence reltions. Definition 2.3 (equivlence reltion) An equivlence reltion,, is inry reltion on set if it is Reflexive ( ) Symmetric (if then ) Trnsitive (if nd c then c) Definition 2.4 (equivlence clsses, index) An equivlence reltion on set S imposes prtition S/ on S, such tht elements e,e S re in the sme prt of S/ if e e. The prts of S/ re clled equivlence clsses, nd we write [e] to denote the unique equivlence clss of S/ to which e elongs. The index of equivlence reltion is S/. Definition 2.5 (right invrint) An equivlence reltion on strings of symols from some lphet Σ is sid to e right invrint if x,y Σ with x y nd ll w Σ we hve tht xw yw. This lst definition sttes tht n equivlence reltion hs the right invrint property if two equivlent strings (x nd y) tht re in the lnguge still re equivlent if third string (w) is ppended to the right of oth of them. 3

4 In the rest of the chpter, the following two equivlence reltions will e of prticulr importnce. Definition 2.6 (equivlence reltion for DFA:s) Let A e DFA. For strings x,y Σ, let x A y iff the sme stte in the DFA is reched from the initil stte y reding the strings x nd y. Definition 2.7 (equivlence reltion for lnguges) Let L e ny lnguge over Σ. For strings x,y Σ, let x L y iff w Σ we hve tht xw L yw L. Definition 2.8 (distinguishing string) Let A = (Q,Σ,δ,q 0,F) e DFA. The string w Σ is distinguishing string for sttes p,q Q if exctly one of δ(p,w) nd δ(q,w) is in F. Intuitively, distinguishing string s for sttes p nd q in n utomton A is string which is mpped to n ccepting stte from exctly one of p nd q. In other words, the existence of distinguishing string for pir of sttes p,q Q proves tht p nd q re not equivlent. 3 Myhill-Nerode theorem In this section, the Myhill-Nerode theorem [Ner58] nd its proof re presented. Theorem 3.1 Let L Σ. Then the following sttements re equivlent: 1. There is DFA tht ccepts L (L is regulr). 2. There is right-invrint equivlence reltion of finite index such tht L is the union of some of the equivlence clsses of. 3. L is of finite index. Proof The proof tht we give here is n dption of tht in [Vis05], which uses the impliction order (1) (2) (3) (1). (1) (2). Since L is regulr lnguge, there exits DFA A = (Q,Σ,δ,q 0,F) tht recognises L. Recll tht A is right-invrint reltion of finite index. It remins to oserve tht L = [x], where x Σ. x:δ(q 0,x) F (2) (3). Assume tht L is the union of some equivlence clsses of rightinvrint reltion of finite index. Now, if (the prtition imposed y) is refinement of (the prtition imposed y) L, then L must e of finite index since it hs fewer equivlence clsses thn, which y ssumption is of finite index. As we shll see, is indeed refinement of L. Since is right-invrint, we hve tht for every pir x,y Σ such tht x y, it must hold tht (z) xz yz. Moreover, we hve tht L is the union of some 4

5 equivlence clsses of, so if x y, then x L y L. Comining these implictions gives us x y (z)xz yz (z)xz L yz L x L y. We now know tht x y implies x L y, nd drw the conclusion tht is refinement of L. (3) (1). To prove tht if L is of finite index, then L is regulr, it suffices to construct, for n ritrry L, DFA A which recognises L. The ide tht underlies the construction is to use the equivlence clsses of L s sttes in A. First, we choose x 1,...,x k s representtives for the k equivlence clsses of L, nd then ssemle the DFA A = (Q,Σ,δ,q 0,F), where Q = {[x 1 ],...,[x k ]}, δ([x],) = [x], q 0 = [λ], where λ denotes the empty string, nd F = {[x] x L}. It should e ovious tht δ is well defined nd tht δ(q 0,x) F iff x L. Plese note tht the Myhill-Nerode theorem lets us decide whether lnguge L is regulr, y determining if either of Condition 2 or Condition 3 is met. 4 DFA minimistion Not only does the Myhill-Nerode Theorem provide n informtive chrcteristion of the recognisle lnguges, ut it lso suggests n lgorithm for minimising DFAs. Before we ttempt to descrie this lgorithm, we wish to mke few definitions tht will shorten nd simplify the lter discussion. Definition 4.1 (prtition, lock) Let S e set. A (finite) prtition of S is set P of mutully disjoint non-empty sets {S 1,...,S k }, such tht S i S, where 1 i k, nd the union of the sets in the prtition equls the whole of S. Formlly, k S i = S. i=1 The components S 1,...,S k re clled the locks or prts of P. If s S, then we denote y [s] P the unique lock of P to which s elongs. When P is not importnt, or follows from the context, we omit the suscript of [s] P. In the proof of Theorem 3.1, it is estlished tht if L is regulr lnguge, nd the index of L is i L N, then it is oth necessry nd sufficient for DFA to hve i L sttes in order to recognise L correctly. Now, let A = (Q,Σ,δ,q 0,F) e DFA recognising the regulr lnguge L(A). Furthermore, let [q], where q Q, e the set of strings {x x Σ δ(q 0,x) = q}. We note tht {[q] q Q} 5

6 prtitions Σ. We oserve tht for every q Q, nd x,y [q], the equivlence x L(A) y holds nd drw the conclusion tht the prtition imposed y Q is refinement of the prtition imposed y L(A). This leds us to elieve tht if the the numer of sttes of n utomton A exceeds the numer of equivlence clsses of L(A), then the utomton cn e reduced in size without ltering the lnguge tht it recognises. A first ttempt to minimise A could e to find, for ech equivlence clss C in the prtition of Σ tht follows from L(A), the suset Q of Q such tht q Q [q ] = C nd merge the sttes of Q into single stte. The prolem with this pproch is tht to e solutely sure tht two sttes p nd q cn e merged, we must exmine δ(p,w) nd δ(q,w) for every string in {w w Q } Σ. A more efficient method is to strt y ssuming tht ll ccepting sttes cn e merged into one, nd ll rejecting into nother, nd then refine this initil prtition until it is stle. By stle, we men tht if sttes p nd q oth elong to lock B, then for ll σ Σ, the stte p goes to lock B on σ, if nd only if q goes to B on σ. If the refinement process is llowed to continue long enough, then the prtition will eventully ecome set of singletons, in which cse it is stle nd termintion gurnteed. The minimistion lgorithm tht stems from the ltter method is listed in Algorithm 1 on pge 10. Although it is ovious tht miniml utomton my not contin unrechle sttes, the prtitioning procedure lone will not purge such sttes from the input utomton A. Insted, the removl of unrechle sttes is done in RemoveUnrechleSttes, while Collpse merges the sttes of A in ccordnce with the prtitioning produced y RefinePrtition. q 1 q 2 q 5 q 6 q 3 q 4 Figure 3: The DFA tht is given s input to Algorithm 1 in Exmple 4.2. Exmple 4.2 We shll now illustrte how RefinePrtition of Algorithm 1 finds the corsest stle prtition with running exmple. The input DFA with lphet Σ = {,} is given in Figure 3, nd the reder should note tht ll of its sttes re rechle from the initil stte q 1. The lgorithm egins with the trivil prtition, P 0 = {I, II}, where I = {q 1,q 3,q 4,q 5 }, nd II = {q 2,q 6 }, nd determines, for ech q Q nd σ Σ, the lock [δ(q,σ)] P0. 6

7 I: [δ(q 1,)] = [q 2 ] = II [δ(q 1,)] = [q 5 ] = I [δ(q 3,)] = [q 4 ] = I [δ(q 3,)] = [q 3 ] = I [δ(q 4,)] = [q 4 ] = I [δ(q 4,)] = [q 3 ] = I [δ(q 5,)] = [q 6 ] = II [δ(q 5,)] = [q 1 ] = I II: [δ(q 2,)] = [q 3 ] = I [δ(q 2,)] = [q 6 ] = II [δ(q 6,)] = [q 5 ] = I [δ(q 6,)] = [q 2 ] = II The prtition P 0 is not stle, s q 1 nd q 5 goes to rejecting stte on, while q 3 nd q 4 goes to n ccepting stte on the sme input symol. As the sttes in II ehve identiclly on oth input symols, only I hs to e refined, yielding the next prtition in sequence P 1 = {I, II, III}, where I = {q 1,q 5 }, II = {q 2,q 6 }, nd III = {q 3,q 4 }. P 1 is lso unstle, which the lgorithm determines y exmining the ehviour of ll q Q for ll input symols. I: [δ(q 1,)] = [q 2 ] = II [δ(q 1,)] = [q 5 ] = I [δ(q 5,)] = [q 6 ] = II [δ(q 5,)] = [q 1 ] = I II: [δ(q 2,)] = [q 3 ] = III [δ(q 2,)] = [q 6 ] = II [δ(q 6,)] = [q 5 ] = I [δ(q 6,)] = [q 2 ] = II III: [δ(q 3,)] = [q 4 ] = III [δ(q 3,)] = [q 3 ] = III [δ(q 4,)] = [q 4 ] = III [δ(q 4,)] = [q 3 ] = III In this itertion, the only sttes tht elong to the sme lock nd disgrees re q 2 nd q 6 of lock II. After II is divided into {q 2 } nd {q 6 }, prtition P 2 = {I, II, III, IV}, where I = {q 1,q 5 }, II = {q 2 }, III = {q 3,q 4 } nd IV = {q 6 } remins. When deciding whether P 2 is stle, the lgorithm could in theory tke shortcut nd only exmine lock I, s it contins ll sttes tht were mpped to lock III P1 in the previous itertion, nd is hence the only lock tht could hve een ffected y the refinement of III P1. Indeed, it turns out tht I hs indeed ecome inconsistent. I: [δ(q 1,)] = [q 2 ] = II [δ(q 1,)] = [q 5 ] = I [δ(q 5,)] = [q 6 ] = IV [δ(q 5,)] = [q 1 ] = I Block I is consequently split, yielding P 3 = {I, II, III, IV, V }, where I = {q 1 }, II = {q 2 }, III = {q 3, q 4 }, IV = {q 6 } nd V = {q 5 }. The lgorithm would need nother itertion to notice tht the prtition does not chnge nd tht it is done, ut we cn estlish this y simple oservtion. 7

8 The only locks tht could hve een ffected y the lst refinement re I, II nd IV, ut these re ll singletons nd cnnot e refined further in ny cse. It ppers tht the originl DFA ws close to miniml, s the minimised version contins only one stte less. If we nlyse the utomton, we see tht it recognises the lnguge L, given y L = L 1 L 2, where L 1 = {w Σ w is even}, nd L 2 = {w Σ w = uv, where u is even, nd u is odd.}, where w denotes the numer of occurences of in w. In the light of this, sttes q 1,q 2,q 5 nd q 6 ll rememer unique spect of the the input string w red so fr. Stte q 1 rememers tht w hs n even numer of s nd s, q 2 tht it hs nd odd numer of s nd s, while q 5 nd q 6 covers the remining two comintions. As these four sttes re ll oth useful nd distinct, no two of the cn e merged. Sttes q 3 nd q 4 re oth ccepting nd rememer tht w cn e divided in the mnner required y the definition of L 2. Since q 3 nd q 4 re equivlent in ll spects tht mtter, they cn e merged. 4.1 Distinguishing strings One could esily modify Algorithm 1 to generte, for ech (rechle) stte q of the input utomton A, string which distinguishes it from every stte q [q] L(A) : With every stte q, we ssocite string s q Σ. When the lgorithm first enters RefinePrtition, ll ssocited strings re empty. Every time lock B is found to e unstle with respect to some input symol nd is consequently prtitioned into smller locks, the symol which forced the split is ppended to s q for ll q tht elonged to B. Eventully, the lgorithm termintes y outputting the DFA A = (Q,Σ,δ,q 0,F ), the sttes of which re the equivlence clsses of L(A). It then holds for every pir of sttes [q 1 ],[q 2 ] Q, tht s q, where q [q 1 ] [q 2 ], is distinguishing string for [q 1 ],[q 2 ]. As finl oservtion, we note tht the set {q s q Q} is prefixed-closed nd thus forms tree over Σ. 5 Further reding In 1971, Hopcroft presented minimistion lgorithm for DFAs tht runs in time O(n log n), where n is the numer of sttes of the input lgorithm. Hopcrofts lgorithm is similr to the one presented in this chpter, ut uses the so-clled process the smller hlf -strtegy to void unnecessry comprisons [Hop71]. During the fll semester of 2005, course covering this topic nd the ckground topics were given t the deprtment of Computer Science t the University of Illinois y Prof. Viswnthn. The lecture notes from tht course re quite extensive nd my e suitle s further reding [Vis05]. 8

9 References [Hop71] J. E. Hopcroft. An n log n lgorithm for minimizing sttes in finite utomton. Theory of Mchines nd Computtions, [Ner58] A. Nerode. Liner utomton trnsformtions. In In Proc. of the Americn Mthemticl Society 9, pges , [Vis05] Professor Mhesh Viswnthn. Lecture notes. CS475: Automt, Forml Lnguges, nd Computtionl Complexity

10 Input: deterministic finite utomton A Output: the miniml DFA recognising L(A) 01: procedure Minimise (DFA A) 02: A := RemoveUnrechleSttes (A); 03: (Q, Σ, δ, q 0, F) := A ; 04: P := RefinePrtition (A, {Q \ F, F }); 05: return Collpse (A, P); 01: procedure RemoveUnrechleSttes (DFA (Q, Σ, δ, q 0, F)) 02: Q := q 0 ; 03: while q Q such tht q is not mrked 04: choose q Q such tht q is not mrked; 05: mrk q; 06: for ech Σ 07: if δ(q, ) Q 08: dd δ(q, ) to Q ; 09: δ (q, ) := δ(q, ); 10: 11: return (Q, Σ, δ, q 0, F Q ); 01: procedure RefinePrtition (DFA A = (Q, Σ, δ, q 0, F), Prtition P) 02: P := ; 03: for ech q in Q 04: os q := ; 05: for ech symol in Σ 06: dd (, [δ(q, )] P ) to os q ; 07: dd q to [os q ] P ; 08: 09: if P is equl to P 10: return P ; 11: else 12: return RefinePrtition (A, P ); 01: procedure Collpse (DFA A = (Q, Σ, δ, q 0, F), Prtition P) 02: for ech q Q 03: dd [q] P to Q ; 04: for ech Σ 05: δ ([q] P, ) := [δ(q, )] P ; 06: 07: for ech q F 08: dd [q] P to F ; 09: 10: return (Q, Σ, δ, [q 0 ] P, F ); Algorithm 1: A minimistion lgorithm for DFAs. 10

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

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

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

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

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

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

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

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

Myhill-Nerode Theorem

Myhill-Nerode Theorem Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute

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

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

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

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

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

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014 CS125 Lecture 12 Fll 2014 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

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

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

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

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

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

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

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

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

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

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

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model? CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction

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

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

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

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

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

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

Tutorial Automata and formal Languages

Tutorial Automata and formal Languages Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

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

GNFA GNFA GNFA GNFA GNFA

GNFA GNFA GNFA GNFA GNFA DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with

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

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

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

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

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted

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

Some Theory of Computation Exercises Week 1

Some Theory of Computation Exercises Week 1 Some Theory of Computtion Exercises Week 1 Section 1 Deterministic Finite Automt Question 1.3 d d d d u q 1 q 2 q 3 q 4 q 5 d u u u u Question 1.4 Prt c - {w w hs even s nd one or two s} First we sk whether

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

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook

More information

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30 Tlen en Automten Test 1, Mon 7 th Dec, 2015 15h45 17h30 This test consists of four exercises over 5 pges. Explin your pproch, nd write your nswer to ech exercise on seprte pge. You cn score mximum of 100

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

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

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

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

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

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

1.4 Nonregular Languages

1.4 Nonregular Languages 74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll

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

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite

More information

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6 CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized

More information

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q

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

Model Reduction of Finite State Machines by Contraction

Model Reduction of Finite State Machines by Contraction Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, 09123 Cgliri, Itly Phone: +39-070-675-5892 Fx: +39-070-675-5900

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

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:

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

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

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

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

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

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

Java II Finite Automata I

Java II Finite Automata I Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression

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

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

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

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)

More information

1.3 Regular Expressions

1.3 Regular Expressions 56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,

More information

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge

More information

FABER Formal Languages, Automata and Models of Computation

FABER Formal Languages, Automata and Models of Computation DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte

More information

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1 CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother

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

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

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

Homework Solution - Set 5 Due: Friday 10/03/08

Homework Solution - Set 5 Due: Friday 10/03/08 CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl.

More information

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,

More information

Lecture 9: LTL and Büchi Automata

Lecture 9: LTL and Büchi Automata Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled

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

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

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks

More information

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck. Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent

More information

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Supervisory control for nondeterministic systems

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Supervisory control for nondeterministic systems Centrum voor Wiskunde en Informtic REPORTRAPPORT Supervisory control for nondeterministic systems A. Overkmp Deprtment of Opertions Reserch, Sttistics, nd System Theory BS-R9411 1994 Supervisory Control

More information

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v. 1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,

More information

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.

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

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

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers 80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES 2.6 Finite Stte Automt With Output: Trnsducers So fr, we hve only considered utomt tht recognize lnguges, i.e., utomt tht do not produce ny output on ny input

More information

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A. 378 Reltions 16.7 Solutions for Chpter 16 Section 16.1 Exercises 1. Let A = {0,1,2,3,4,5}. Write out the reltion R tht expresses > on A. Then illustrte it with digrm. 2 1 R = { (5,4),(5,3),(5,2),(5,1),(5,0),(4,3),(4,2),(4,1),

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

SWEN 224 Formal Foundations of Programming WITH ANSWERS

SWEN 224 Formal Foundations of Programming WITH ANSWERS T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 END-OF-YEAR SWEN 224 Forml Foundtions of Progrmming

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

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

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks

More information

Bases for Vector Spaces

Bases for Vector Spaces Bses for Vector Spces 2-26-25 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything

More information

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p

More information

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn

More information