Regular Languages and Finite Automata

Size: px
Start display at page:

Download "Regular Languages and Finite Automata"

Transcription

1 N Lecture Notes on Regulr Lnguges nd Finite Automt for Prt IA of the Computer Science Tripos Mrcelo Fiore Cmbridge University Computer Lbortory

2 First Edition Revised 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, c 2010 A. M. Pitts

3 Contents Lerning Guide ii 1 Regulr Expressions Alphbets, strings, nd lnguges Pttern mtching Some questions bout lnguges Exercises Finite Stte Mchines Finite utomt Determinism, non-determinism, nd ε-trnsitions A subset construction Summry Exercises Regulr Lnguges, I Finite utomt from regulr expressions Decidbility of mtching Exercises Regulr Lnguges, II Regulr expressions from finite utomt An exmple Complement nd intersection of regulr lnguges Exercises The Pumping Lemm Proving the Pumping Lemm Using the Pumping Lemm Decidbility of lnguge equivlence Exercises Grmmrs Context-free grmmrs Bckus-Nur Form Regulr grmmrs Exercises

4 ii Lerning Guide The notes re designed to ccompny six lectures on regulr lnguges nd finite utomt for Prt IA of the Cmbridge University Computer Science Tripos. The im of this short course will be to introduce the mthemticl formlisms of finite stte mchines, regulr expressions nd grmmrs, nd to explin their pplictions to computer lnguges. As such, it covers some bsic theoreticl mteril which Every Computer Scientist Should Know. Direct pplictions of the course mteril occur in the vrious CST courses on compilers. Further nd relted developments will be found in the CST Prt IB courses Computtion Theory nd Semntics of Progrmming Lnguges nd the CST Prt II course Topics in Concurrency. This course contins the kind of mteril tht is best lerned through prctice. The books mentioned below contin lrge number of problems of vrying degrees of difficulty, nd some contin solutions to selected problems. A few exercises re given t the end of ech section of these notes nd relevnt pst Tripos questions re indicted there. At the end of the course students should be ble to explin how to convert between the three wys of representing regulr sets of strings introduced in the course; nd be ble to crry out such conversions by hnd for simple cses. They should lso be ble to prove whether or not given set of strings is regulr. Recommended books Textbooks which cover the mteril in this course lso tend to cover the mteril you will meet in the CST Prt IB courses on Computtion Theory nd Complexity Theory, nd the theory underlying prsing in vrious courses on compilers. There is lrge number of such books. Three recommended ones re listed below. J. E. Hopcroft, R. Motwni nd J. D. Ullmn, Introduction to Automt Theory, Lnguges, nd Computtion, Second Edition (Addison-Wesley, 2001). D. C. Kozen, Automt nd Computbility (Springer-Verlg, New York, 1997). T. A. Sudkmp, Lnguges nd Mchines (Addison-Wesley Publishing Compny, Inc., 1988). Note The mteril in these notes hs been drwn from severl different sources, including the books mentioned bove nd previous versions of this course by the uthor nd by others. Any errors re of course ll the uthor s own work. A list of corrections will be vilble from the course web pge. Plese tke time to fill out the on-line lecture feedbck form. Mrcelo Fiore Mrcelo.Fiore@cl.cm.c.uk

5 1 1 Regulr Expressions Doubtless you hve used pttern mtching in the commnd-line shells of vrious operting systems (Slide 1) nd in the serch fcilities of text editors. Another importnt exmple of the sme kind is the lexicl nlysis phse in compiler during which the text of progrm is divided up into the llowed tokens of the progrmming lnguge. The lgorithms which implement such pttern-mtching opertions mke use of the notion of finite utomton (which is Greeklish for finite stte mchine). This course revels (some of!) the beutiful theory of finite utomt (yes, tht is the plurl of utomton ) nd their use for recognising when prticulr string mtches prticulr pttern. Pttern mtching Wht hppens if, t Unix/Linux shell prompt, you type ls nd press return? Suppose the current directory contins files clledregfl.tex, regfl.ux, regfl.log, regfl.dvi, nd (strngely).ux. Wht hppens if you type nd press return? ls.ux Slide Alphbets, strings, nd lnguges The purpose of Section 1 is to introduce prticulr lnguge for ptterns, clled regulr expressions, nd to formulte some importnt problems to do with pttern-mtching which will be solved in the subsequent sections. But first, here is some nottion nd terminology to do with chrcter strings tht we will be using throughout the course.

6 2 1 REGULAR EXPRESSIONS Alphbets An lphbet is specified by giving finite set, Σ, whose elements re clled symbols. For us, ny set qulifies s possible lphbet, so long s it is finite. Exmples: Σ 1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 10-element set of deciml digits. Σ 2 = {, b, c,..., x, y, z} 26-element set of lower-cse chrcters of the English lnguge. Σ 3 = {S S Σ 1 } element set of ll subsets of the lphbet of deciml digits. Non-exmple: N = {0, 1, 2, 3,...} set of ll non-negtive whole numbers is not n lphbet, becuse it is infinite. Slide 2 Strings over n lphbet A string of length n ( 0) over n lphbet Σ is just n ordered n-tuple of elements of Σ, written without punctution. Exmple: if Σ = {, b, c}, then, b, c, nd bbc re strings over Σ of lengths one, two, three nd four respectively. Σ def = set of ll strings over Σ of ny finite length. N.B. there is unique string of length zero over Σ, clled the null string (or empty string) nd denoted ε (no mtter which Σ we re tlking bout). Slide 3

7 1.1 Alphbets, strings, nd lnguges 3 Conctention of strings The conctention of two strings u,v Σ is the string uv obtined by joining the strings end-to-end. Exmples: If u = b, v = r nd w = cd, then vu = rb, uu = bb nd wv = cdr. This generlises to the conctention of three or more strings. E.g. uvwuv = brcdbr. Slide 4 Slides 2 nd 3 define the notions of n lphbet Σ, nd the set Σ of finite strings over n lphbet. The length of string u will be denoted by length(u). Slide 4 defines the opertion of conctention of strings. We mke no nottionl distinction between symbol Σ nd the corresponding string of length one over Σ: so Σ cn be regrded s subset of Σ. Note tht Σ is never empty it lwys contins the null string, ε, the unique string of length zero. Note lso tht for ny u, v, w Σ nd length(uv) = length(u) + length(v). uε = u = εu nd (uv)w = uvw = u(vw) Exmple Exmples of Σ for different Σ: (i) If Σ = {}, then Σ contins ε,,,,,... (ii) If Σ = {, b}, then Σ contins ε,, b,, b, b, bb,, b,b,bb,b,bb, bb,bbb,... (iii) If Σ = (the empty set the unique set with no elements), then Σ = {ε}, the set just contining the null string.

8 4 1 REGULAR EXPRESSIONS 1.2 Pttern mtching Slide 5 defines the ptterns, or regulr expressions, over n lphbet Σ tht we will use. Ech such regulr expression, r, represents whole set (possibly n infinite set) of strings in Σ tht mtch r. The precise definition of this mtching reltion is given on Slide 6. It might seem odd to include regulr expression tht is mtched by no strings t ll but it is techniclly convenient to do so. Note tht the regulr expression ε is in fct equivlent to, in the sense tht string u mtches iff it mtches ε (iff u = ε). Regulr expressions over n lphbet Σ ech symbol Σ is regulr expression ε is regulr expression is regulr expression if r nd s re regulr expressions, then so is (r s) if r nd s re regulr expressions, then so is rs if r is regulr expression, then so is (r) Every regulr expression is built up inductively, by finitely mny pplictions of the bove rules. (N.B. we ssume ε,, (, ),, nd re not symbols in Σ.) Slide 5 Remrk (Binding precedence in regulr expressions). In the definition on Slide 5 we ssume implicitly tht the lphbet Σ does not contin the six symbols ε ( ) Then, concretely speking, the regulr expressions over Σ form certin set of strings over the lphbet obtined by dding these six symbols to Σ. However it mkes things more redble if we dopt slightly more bstrct syntx, dropping s mny brckets s possible nd using the convention tht binds more tightly thn, binds more tightly thn. So, for exmple, r st mens (r s(t) ), not (r s)(t), or ((r st)), etc.

9 1.2 Pttern mtching 5 Mtching strings to regulr expressions u mtches Σ iff u = u mtches ε iff u = ε no string mtches u mtches r s iff u mtches either r or s u mtches rs iff it cn be expressed s the conctention of two strings, u = vw, with v mtching r nd w mtching s u mtches r iff either u = ε, or u mtches r, or u cn be expressed s the conctention of two or more strings, ech of which mtches r Slide 6 The definition of u mtches r on Slide 6 is equivlent to sying for some n 0, u cn be expressed s conctention of n strings, u = u 1 u 2...u n, where ech u i mtches r. The cse n = 0 just mens tht u = ε (so ε lwys mtches r ); nd the cse n = 1 just mens tht u mtches r (so ny string mtching r lso mtches r ). For exmple, if Σ = {, b, c} nd r = b, then the strings mtching r re ε, b, bb, bbb, etc. Note tht we didn t include regulr expression for the occurring in the UNIX exmples on Slide 1. However, once we know which lphbet we re referring to, Σ = { 1, 2,..., n } sy, we cn get the effect of using the regulr expression ( n ) which is indeed mtched by ny string in Σ (becuse n is mtched by ny symbol in Σ).

10 6 1 REGULAR EXPRESSIONS Exmples of mtching, with Σ = {0, 1} 0 1 is mtched by ech symbol in Σ 1(0 1) is mtched by ny string in Σ tht strts with 1 ((0 1)(0 1)) is mtched by ny string of even length in Σ (0 1) (0 1) is mtched by ny string in Σ (ε 0)(ε 1) 11 is mtched by just the strings ε, 0, 1, 01, nd is just mtched by 0 Slide 7 Nottion The nottion r + s is quite often used for wht we write s r s. The nottion r n, for n 0, is n bbrevition for the regulr expression obtined by conctenting n copies of r. Thus: { r 0 r n+1 def = ε def = r(r n ). Thus u mtches r iff u mtches r n for some n 0. We use r + s n bbrevition for rr. Thus u mtches r + iff it cn be expressed s the conctention of one or more strings, ech one mtching r. 1.3 Some questions bout lnguges Slide 8 defines the notion of forml lnguge over n lphbet. We tke very extensionl view of lnguge: forml lnguge is completely determined by the words in the dictionry, rther thn by ny grmmticl rules. Slide 9 gives some importnt questions bout lnguges, regulr expressions, nd the mtching reltion between strings nd regulr expressions.

11 1.3 Some questions bout lnguges 7 Lnguges A (forml) lnguge L over n lphbet Σ is just set of strings in Σ. Thus ny subset L Σ determines lnguge over Σ. The lnguge determined by regulr expression r over Σ is L(r) def = {u Σ u mtches r}. Two regulr expressions r nd s (over the sme lphbet) re equivlent iff L(r) nd L(s) re equl sets (i.e. hve exctly the sme members). Slide 8 Some questions () Is there n lgorithm which, given string u nd regulr expression r (over the sme lphbet), computes whether or not u mtches r? (b) In formulting the definition of regulr expressions, hve we missed out some prcticlly useful notions of pttern? (c) Is there n lgorithm which, given two regulr expressions r nd s (over the sme lphbet), computes whether or not they re equivlent? (Cf. Slide 8.) (d) Is every lnguge of the form L(r)? Slide 9

12 8 1 REGULAR EXPRESSIONS The nswer to question () on Slide 9 is yes. Algorithms for deciding such ptternmtching questions mke use of finite utomt. We will see this during the next few sections. If you hve used the UNIX utility grep, or text editor with good fcilities for regulr expression bsed serch, likeemcs, you will know tht the nswer to question (b) on Slide 9 is lso yes the regulr expressions defined on Slide 5 leve out some forms of pttern tht one sees in such pplictions. However, the nswer to the question is lso no, in the sense tht (for fixed lphbet) these extr forms of regulr expression re definble, up to equivlence, from the bsic forms given on Slide 5. For exmple, if the symbols of the lphbet re ordered in some stndrd wy, it is common to provide form of pttern for nming rnges of symbols for exmple [ z] might denote pttern mtching ny lowercse letter. It is not hrd to see how to define regulr expression (lbeit rther long one) which chieves the sme effect. However, some other commonly occurring kinds of pttern re much hrder to describe using the rther minimlist syntx of Slide 5. The principl exmple is complementtion, (r): u mtches (r) iff u does not mtch r. It will be corollry of the work we do on finite utomt (nd good mesure of its power) tht every pttern mking use of the complementtion opertion ( ) cn be replced by n equivlent regulr expression just mking use of the opertions on Slide 5. But why do we stick to the minimlist syntx of regulr expressions on tht slide? The nswer is tht it reduces the mount of work we will hve to do to show tht, in principle, mtching strings ginst ptterns cn be decided vi the use of finite utomt. The nswer to question (c) on Slide 9 is yes nd once gin this will be corollry of the work we do on finite utomt. (See Section 5.3.) Finlly, the nswer to question (d) is esily seen to be no, provided the lphbet Σ contins t lest one symbol. For in tht cse Σ is countbly infinite; nd hence the number of lnguges over Σ, i.e. the number of subsets of Σ is uncountble. (Recll Cntor s digonl rgument.) But since Σ is finite set, there re only countbly mny regulr expressions over Σ. (Why?) So the nswer to (d) is no for crdinlity resons. However, even mongst the countbly mny lnguges tht re finitely describble (n intuitive notion tht we will not formulte precisely) mny re not of the form L(r) for ny regulr expression r. For exmple, in Section 5.2 we will use the Pumping Lemm to see tht is not of this form. 1.4 Exercises { n b n n 0} Exercise Write down n ML dt type declrtion for type constructor regexp whose vlues correspond to the regulr expressions over n lphbet. Exercise Find regulr expressions over {0, 1} tht determine the following lnguges: () {u u contins n even number of 1 s}

13 1.4 Exercises 9 (b) {u u contins n odd number of 0 s} Exercise For which lphbets Σ is the set Σ of ll finite strings over Σ itself n lphbet? Tripos questions (d) (s) (q) (i)

14 10 1 REGULAR EXPRESSIONS

15 11 2 Finite Stte Mchines We will be mking use of mthemticl models of physicl systems clled finite utomt, or finite stte mchines to recognise whether or not string is in prticulr lnguge. This section introduces this ide nd gives the precise definition of wht constitutes finite utomton. We look t severl vritions on the definition (to do with the concept of determinism) nd see tht they re equivlent for the purpose of recognising whether or not string is in given lnguge. 2.1 Finite utomt Exmple of finite utomton b q 0 q 1 q 2 q 3 Sttes: q 0, q 1, q 2, q 3. Input symbols:, b. Trnsitions: s indicted bove. Strt stte: q 0. Accepting stte(s): q 3. b b b Slide 10 The key fetures of this bstrct notion of mchine re listed below nd re illustrted by the exmple on Slide 10. There re only finitely mny different sttes tht finite utomton cn be in. In the exmple there re four sttes, lbelled q 0, q 1, q 2, nd q 3. We do not cre t ll bout the internl structure of mchine sttes. All we cre bout is which trnsitions the mchine cn mke between the sttes. A symbol from some fixed lphbet Σ is ssocited with ech trnsition: we think of the elements of Σ s input symbols. Thus ll the possible trnsitions of the finite utomton cn be specified by giving finite grph whose vertices re the sttes nd whose edges hve

16 12 2 FINITE STATE MACHINES both direction nd lbel (drwn from Σ). In the exmple Σ = {, b} nd the only possible trnsitions from stte q 1 re q 1 b q0 nd q 1 q2. In other words, in stte q 1 the mchine cn either input the symbol b nd enter stte q 0, or it cn input the symbol nd enter stte q 2. (Note tht trnsitions from stte bck to the sme stte re llowed: e.g. q 3 q3 in the exmple.) There is distinguished strt stte. 1 In the exmple it is q 0. In the grphicl representtion of finite utomton, the strt stte is usully indicted by mens of unlbelled rrow. The sttes re prtitioned into two kinds: ccepting sttes 2 nd non-ccepting sttes. In the grphicl representtion of finite utomton, the ccepting sttes re indicted by double circles round the nme of ech such stte, nd the non-ccepting sttes re indicted using single circles. In the exmple there is only one ccepting stte, q 3 ; the other three sttes re non-ccepting. (The two extreme possibilities tht ll sttes re ccepting, or tht no sttes re ccepting, re llowed; it is lso llowed for the strt stte to be ccepting.) The reson for the prtitioning of the sttes of finite utomton into ccepting nd non-ccepting hs to do with the use to which one puts finite utomt nmely to recognise whether or not string u Σ is in prticulr lnguge (= subset of Σ ). Given u we begin in the strt stte of the utomton nd trverse its grph of trnsitions, using up the symbols in u in the correct order reding the string from left to right. If we cn use up ll the symbols in u in this wy nd rech n ccepting stte, then u is in the lnguge ccepted (or recognised ) by this prticulr utomton; otherwise u is not in tht lnguge. This is summed up on Slide The term initil stte is common synonym for strt stte. 2 The term finl stte is common synonym for ccepting stte.

17 2.1 Finite utomt 13 L(M), lnguge ccepted by finite utomton M consists of ll strings u over its lphbet of input symbols stisfying q 0 u q with q 0 the strt stte nd q some ccepting stte. Here q 0 u q mens, if u = n sy, tht for some sttes q 1,q 2,...,q n = q (not necessrily ll distinct) there re trnsitions of the form N.B. q q1 3 q2 n qn = q. cse n = 0: q ε q iff q = q cse n = 1: q q iff q q. Slide 11 Exmple Let M be the finite utomton pictured on Slide 10. Using the nottion introduced on Slide 11 we hve: In fct in this cse q 0 b q 3 (so b L(M)) q 0 b q iff q = q 2 (so b / L(M)) q 2 b q iff q = q 3 (no conclusion bout L(M)). L(M) = {u u contins three consecutive s}. (For q i (i = 0, 1, 2) corresponds to the stte in the process of reding string in which the lst i symbols red were ll s.) So L(M) coincides with the lnguge L(r) determined by the regulr expression (cf. Slide 8). r = ( b) ( b)

18 14 2 FINITE STATE MACHINES A non-deterministic finite utomton (NFA), M, is specified by finite set Sttes M (of sttes) finite set Σ M (the lphbet of input symbols) for ech q Sttes M nd ech Σ M, subset M (q,) Sttes M (the set of sttes tht cn be reched from q with single trnsition lbelled ) n element s M Sttes M (the strt stte) subset Accept M Sttes M (of ccepting sttes) Slide Determinism, non-determinism, nd ε-trnsitions Slide 12 gives the forml definition of the notion of finite utomton. Note tht the function M gives precise wy of specifying the llowed trnsitions of M, vi: q q iff q M (q, ). The reson for the qulifiction non-deterministic on Slide 12 is becuse in generl, for ech stte q Sttes M nd ech input symbol Σ M, we llow the possibilities tht there re no, one, or mny sttes tht cn be reched in single trnsition lbelled from q, corresponding to the cses tht M (q, ) hs no, one, or mny elements. For exmple, if M is the NFA pictured on Slide 13, then M (q 1, b) = i.e. in M, no stte cn be reched from q 1 with trnsition lbelled b; M (q 1, ) = {q 2 } i.e. in M, precisely one stte cn be reched from q 1 with trnsition lbelled ; M (q 0, ) = {q 0, q 1 } i.e. in M, precisely two sttes cn be reched from q 0 with trnsition lbelled.

19 2.2 Determinism, non-determinism, nd ε-trnsitions 15 Exmple of non-deterministic finite utomton Input lphbet: {, b}. Sttes, trnsitions, strt stte, nd ccepting sttes s shown: q 0 q 1 q 2 q 3 b b The lnguge ccepted by this utomton is the sme s for the utomton on Slide 10, nmely {u {,b} u contins three consecutive s}. Slide 13 When ech subset M (q, ) hs exctly one element we sy tht M is deterministic. This is prticulrly importnt cse nd is singled out for definition on Slide 14. The finite utomton pictured on Slide 10 is deterministic. But note tht if we took the sme grph of trnsitions but insisted tht the lphbet of input symbols ws {, b, c} sy, then we hve specified n NFA not DFA, since for exmple M (q 0, c) =. The morl of this is: when specifying n NFA, s well s giving the grph of stte trnsitions, it is importnt to sy wht is the lphbet of input symbols (becuse some input symbols my not pper in the grph t ll). When constructing mchines for mtching strings with regulr expressions (s we will do in Section 3) it is useful to consider finite stte mchines exhibiting n internl form of non-determinism in which the mchine is llowed to chnge stte without consuming ny input symbol. One clls such trnsitions ε-trnsitions nd writes them s q ε q. This leds to the definition on Slide 15. Note tht in n NFA ε, M, we lwys ssume tht ε is not n element of the lphbet Σ M of input symbols.

20 16 2 FINITE STATE MACHINES A deterministic finite utomton (DFA) is n NFA M with the property tht for ech q Sttes M nd Σ M, the finite set M (q,) contins exctly one element cll it δ M (q,). Thus in this cse trnsitions in M re essentilly specified by next-stte function, δ M, mpping ech (stte, input symbol)-pir (q,) to the unique stte δ M (q,) which cn be reched from q by trnsition lbelled : q q iff q = δ M (q,) Slide 14 An NFA with ε-trnsitions (NFA ε ) is specified by n NFA M together with binry reltion, clled the ε-trnsition reltion, on the set Sttes M. We write q ε q to indicte tht the pir of sttes (q,q ) is in this reltion. Exmple (with input lphbet = {, b}): ε q 1 q 2 q 3 ε q 0 q 7 b ε q 4 b q 5 b q 6 ε b Slide 15

21 2.3 A subset construction 17 L(M), lnguge ccepted by n NFA ε M consists of ll strings u over the lphbet Σ M of input symbols stisfying q 0 u q with q0 the initil stte nd q some ccepting stte. Here is defined by: q ε q iff q = q or there is sequence q ε q of one or more ε-trnsitions in M from q to q q q (for Σ M ) iff q ε q b q (for,b Σ M ) iff q ε nd similrly for longer strings ε q ε b ε q Slide 16 When using n NFA ε M to ccept string u Σ of input symbols, we re interested in sequences of trnsitions in which the symbols in u occur in the correct order, but with zero or more ε-trnsitions before or fter ech one. We write q u q to indicte tht such sequence exists from stte q to stte q in the NFA ε. Then, by definition u is ccepted by the NFA ε M iff q 0 u q holds for q0 the strt stte nd q some ccepting stte: see Slide 16. For exmple, for the NFA ε on Slide 15, it is not too hrd to see tht the lnguge ccepted consists of ll strings which either contin two consecutive s or contin two consecutive b s, i.e. the lnguge determined by the regulr expression ( b) ( bb)( b). 2.3 A subset construction Note tht every DFA is n NFA (whose trnsition reltion is deterministic) nd tht every NFA is n NFA ε (whose ε-trnsition reltion is empty). It might seem tht non-determinism nd ε-trnsitions llow greter rnge of lnguges to be chrcterised s recognisble by finite utomton, but this is not so. We cn use construction, clled the subset construction, to convert n NFA ε M into DFA PM ccepting the sme lnguge (t the expense of incresing the number of sttes, possibly exponentilly). Slide 17 gives n exmple of this construction. The nme subset construction refers to the fct tht there is one stte of PM for ech subset of the set Sttes M of sttes of M. Given two subsets S, S Sttes M, there is trnsition S S in PM just in cse S consists of ll the M-sttes q rechble from

22 18 2 FINITE STATE MACHINES sttes q in S vi the reltion defined on Slide 16, i.e. such tht we cn get from q to q in M vi finitely mny ε-trnsitions followed by n -trnsition followed by finitely mny ε-trnsitions. Exmple of the subset construction M : q 1 ε q 0 ε q 2 δ PM : b {q 0 } {q 0,q 1,q 2 } {q 2 } {q 1 } {q 1 } {q 2 } {q 2 } {q 0,q 1 } {q 0,q 1,q 2 } {q 2 } {q 0,q 2 } {q 0,q 1,q 2 } {q 2 } {q 1,q 2 } {q 1 } {q 2 } {q 0,q 1,q 2 } {q 0,q 1,q 2 } {q 2 } b Slide 17 By definition, the strt stte of PM is the subset of Sttes M whose elements re the sttes rechble by ε-trnsitions from the strt stte of M; nd subset S Sttes M is n ccepting stte of PM iff some ccepting stte of M is n element of S. Thus in the exmple on Slide 17 the strt stte is {q 0, q 1, q 2 } nd b L(M) becuse in M: q 0 q0 ε q2 b q2 b L(PM) becuse in PM: {q 0, q 1, q 2 } {q 0, q 1, q 2 } b {q 2 }. Indeed, in this cse L(M) = L( b ) = L(PM). The fct tht M nd PM ccept the sme lnguge in this cse is no ccident, s the Theorem on Slide 18 shows. Tht slide lso gives the definition of the subset construction in generl.

23 2.3 A subset construction 19 Theorem. For ech NFA ε M there is DFA PM with the sme lphbet of input symbols nd ccepting exctly the sme strings s M, i.e. with L(PM) = L(M) Definition of P M (refer to Slides 12 nd 14): Sttes PM def = {S S Sttes M } Σ PM def = Σ M S S in PM iff S = δ PM (S,), where δ PM (S,) def = {q q S (q q in M)} s PM def = {q s M ε q} Accept PM def = {S Sttes PM q S (q Accept M )} Slide 18 To prove the theorem on Slide 18, given ny NFA ε M we hve to show tht L(M) = L(P M). We split the proof into two hlves. ε Proof tht L(M) L(PM). Consider the cse of ε first: if ε L(M), then s M q for some q Accept M, hence s PM Accept PM nd thus ε L(PM). Now given ny nonnull string u = n, if u is ccepted by M then there is sequence of trnsitions in M of the form (1) s 1 M 2 q1 n qn Accept M. Since it is deterministic, feeding n to PM results in the sequence of trnsitions (2) s 1 PM 2 S1 n S n where S 1 = δ PM (s PM, 1 ), S 2 = δ PM (S 1, 2 ), etc. By definition of δ PM (Slide 18), from (1) we deduce q 1 δ PM (s PM, 1 ) = S 1 so q 2 δ PM (S 1, 2 ) = S 2... so q n δ PM (S n 1, n ) = S n

24 20 2 FINITE STATE MACHINES nd hence S n Accept PM (becuse q n Accept M ). Therefore (2) shows tht u is ccepted by PM. Proof tht L(PM) L(M). Consider the cse of ε first: if ε L(PM), then s PM ε Accept PM nd so there is some q s PM with q Accept M, i.e. s M q AcceptM nd thus ε L(M). Now given ny non-null string u = n, if u is ccepted by PM then there is sequence of trnsitions in PM of the form (2) with S n Accept PM, i.e. with S n contining some q n Accept M. Now since q n S n = δ PM (S n 1, n ), by definition of δ PM there is some q n 1 S n 1 with q n n 1 qn in M. Then since n 1 q n 1 S n 1 = δ PM (S n 2, n 1 ), there is some q n 2 S n 2 with q n 2 qn 1. Working bckwrds in this wy we cn build up sequence of trnsitions like (1) until, t the lst step, from the fct tht q 1 S 1 = δ PM (s PM, 1 ) we deduce tht s 1 M q1. So we get sequence of trnsitions (1) with q n Accept M, nd hence u is ccepted by M. 2.4 Summry The importnt concepts in Section 2 re those of deterministic finite utomton (DFA) nd the lnguge of strings tht it ccepts. Note tht if we know tht lnguge L is of the form L = L(M) for some DFA M, then we hve method for deciding whether or not ny given string u (over the lphbet of L) is in L or not: begin in the strt stte of M nd crry out the sequence of trnsitions given by reding u from left to right (t ech step the next stte is uniquely determined becuse M is deterministic); if the finl stte reched is ccepting, then u is in L, otherwise it is not. We lso introduced other kinds of finite utomt (with non-determinism nd ε-trnsitions) nd proved tht they determine exctly the sme clss of lnguges s DFAs. 2.5 Exercises Exercise For ech of the two lnguges mentioned in Exercise find DFA tht ccepts exctly tht set of strings. Exercise The exmple of the subset construction given on Slide 17 constructs DFA with eight sttes whose lnguge of ccepted strings hppens to be L( b ). Give DFA with the sme lnguge of ccepted strings, but fewer sttes. Give n NFA with even fewer sttes tht does the sme job. Exercise Given DFA M, construct new DFA M with the sme lphbet of input symbols Σ M nd with the property tht for ll u Σ M, u is ccepted by M iff u is not ccepted by M. Exercise Given two DFAs M 1, M 2 with the sme lphbet Σ of input symbols, construct third such DFA M with the property tht u Σ is ccepted by M iff it is ccepted by both M 1 nd M 2. [Hint: tke the sttes of M to be ordered pirs (q 1, q 2 ) of sttes with q 1 Sttes M1 nd q 2 Sttes M2.]

25 2.5 Exercises 21 Tripos questions (d) (d) (b) (s)

26 22 2 FINITE STATE MACHINES

27 23 3 Regulr Lnguges, I Slide 19 defines the notion of regulr lnguge, which is set of strings of the form L(M) for some DFA M (cf. Slides 11 nd 14). The slide lso gives the sttement of Kleene s Theorem, which connects regulr lnguges with the notion of mtching strings to regulr expressions introduced in Section 1: the collection of regulr lnguges coincides with the collection of lnguges determined by mtching strings with regulr expressions. The im of this section is to prove prt () of Kleene s Theorem. We will tckle prt (b) in Section 4. Definition A lnguge is regulr iff it is the set of strings ccepted by some deterministic finite utomton. Kleene s Theorem () For ny regulr expression r, L(r) is regulr lnguge (cf. Slide 8). (b) Conversely, every regulr lnguge is the form L(r) for some regulr expression r. Slide Finite utomt from regulr expressions Given regulr expression r, over n lphbet Σ sy, we wish to construct DFA M with lphbet of input symbols Σ nd with the property tht for ech u Σ, u mtches r iff u is ccepted by M so tht L(r) = L(M). Note tht by the Theorem on Slide 18 it is enough to construct n NFA ε N with the property L(N) = L(r). For then we cn pply the subset construction to N to obtin DFA M = PN with L(M) = L(PN) = L(N) = L(r). Working with finite utomt tht re non-deterministic nd hve ε-trnsitions simplifies the construction of suitble finite utomton from r. Let us fix on prticulr lphbet Σ nd from now on only consider finite utomt whose set of input symbols is Σ. The construction of n NFA ε for ech regulr expression r over Σ proceeds by recursion on the syntctic structure of the regulr expression, s follows.

28 24 3 REGULAR LANGUAGES, I (i) For ech tomic form of regulr expression, ( Σ), ε, nd, we give n NFA ε ccepting just the strings mtching tht regulr expression. (ii) Given ny NFA ε s M 1 nd M 2, we construct new NFA ε, Union(M 1, M 2 ) with the property L(Union(M 1, M 2 )) = {u u L(M 1 ) or u L(M 2 )}. Thus L(r 1 r 2 ) = L(Union(M 1, M 2 )) when L(r 1 ) = L(M 1 ) nd L(r 2 ) = L(M 2 ). (iii) Given ny NFA ε s M 1 nd M 2, we construct new NFA ε, Conct(M 1, M 2 ) with the property L(Conct(M 1, M 2 )) = {u 1 u 2 u 1 L(M 1 ) nd u 2 L(M 2 )}. Thus L(r 1 r 2 ) = L(Conct(M 1, M 2 )) when L(r 1 ) = L(M 1 ) nd L(r 2 ) = L(M 2 ). (iv) Given ny NFA ε M, we construct new NFA ε, Str(M) with the property L(Str(M)) = {u 1 u 2...u n n 0 nd ech u i L(M)}. Thus L(r ) = L(Str(M)) when L(r) = L(M). Thus strting with step (i) nd pplying the constructions in steps (ii) (iv) over nd over gin, we eventully build NFA ε s with the required property for every regulr expression r. Put more formlly, one cn prove the sttement for ll n 0, nd for ll regulr expressions of size n, there exists n NFA ε M such tht L(r) = L(M) by mthemticl induction on n, using step (i) for the bse cse nd steps (ii) (iv) for the induction steps. Here we cn tke the size of regulr expression to be the number of occurrences of union ( ), conctention ( ), or str ( ) in it. Step (i) Slide 20 gives NFAs whose lnguges of ccepted strings re respectively L() = {} (ny Σ), L(ε) = {ε}, nd L( ) =.

29 3.1 Finite utomt from regulr expressions 25 NFAs for tomic regulr expressions just ccepts the one-symbol string q 0 q 1 just ccepts the null string, ε q 0 ccepts no strings q 0 Slide 20 Step (ii) Given NFA ε s M 1 nd M 2, the construction of Union(M 1, M 2 ) is pictured on Slide 21. First, renming sttes if necessry, we ssume tht Sttes M1 nd Sttes M2 re disjoint. Then the sttes of Union(M 1, M 2 ) re ll the sttes in either M 1 or M 2, together with new stte, clled q 0 sy. The strt stte of Union(M 1, M 2 ) is this q 0 nd its ccepting sttes re ll the sttes tht re ccepting in either M 1 or M 2. Finlly, the trnsitions of Union(M 1, M 2 ) re given by ll those in either M 1 or M 2, together with two new ε- trnsitions out of q 0 to the strt sttes of M 1 nd M 2. u Thus if u L(M 1 ), i.e. if we hve s M1 q1 for some q 1 Accept M1, then we ε u get q 0 sm1 q1 showing tht u L(Union(M 1, M 2 ). Similrly for M 2. So L(Union(M 1, M 2 )) contins the union of L(M 1 ) nd L(M 2 ). Conversely if u is ccepted by u Union(M 1, M 2 ), there is trnsition sequence q 0 q with q AcceptM1 or q Accept M2. Clerly, in either cse this trnsition sequence hs to begin with one or other of the ε- trnsitions from q 0, nd therefter we get trnsition sequence entirely in one or other of M 1 or M 2 finishing in n cceptble stte for tht one. So if u L(Union(M 1, M 2 )), then either u L(M 1 ) or u L(M 2 ). So we do indeed hve L(Union(M 1, M 2 )) = {u u L(M 1 ) or u L(M 2 )}.

30 26 3 REGULAR LANGUAGES, I Union(M 1,M 2 ) ε s M1 M 1 q 0 ε s M2 M 2 Set of ccepting sttes is union of Accept M1 nd Accept M2. Slide 21 Step (iii) Given NFA ε s M 1 nd M 2, the construction of Conct(M 1, M 2 ) is pictured on Slide 22. First, renming sttes if necessry, we ssume tht Sttes M1 nd Sttes M2 re disjoint. Then the sttes of Conct(M 1, M 2 ) re ll the sttes in either M 1 or M 2. The strt stte of Conct(M 1, M 2 ) is the strt stte of M 1. The ccepting sttes of Conct(M 1, M 2 ) re the ccepting sttes of M 2. Finlly, the trnsitions of Conct(M 1, M 2 ) re given by ll those in either M 1 or M 2, together with new ε-trnsitions from ech ccepting stte of M 1 to the strt stte of M 2 (only one such new trnsition is shown in the picture). u Thus if u 1 L(M 1 ) nd u 2 L(M 2 ), there re trnsition sequences s 1 M1 q1 in M 1 u with q 1 Accept M1, nd s 2 M2 q2 in M 2 with q 2 Accept M2. These combine to yield u s 1 ε u M1 q1 2 sm2 q2 in Conct(M 1, M 2 ) witnessing the fct tht u 1 u 2 is ccepted by Conct(M 1, M 2 ). Conversely, it is not hrd to see tht every v L(Conct(M 1, M 2 )) is of this form. For ny trnsition sequence witnessing the fct tht v is ccepted strts out in the sttes of M 1 but finishes in the disjoint set of sttes of M 2. At some point in the sequence one of the new ε-trnsitions occurs to get from M 1 to M 2 nd thus we cn split v s v = u 1 u 2 with u 1 ccepted by M 1 nd u 2 ccepted by M 2. So we do indeed hve L(Conct(M 1, M 2 )) = {u 1 u 2 u 1 L(M 1 ) nd u 2 L(M 2 )}.

31 3.1 Finite utomt from regulr expressions 27 Conct(M 1,M 2 ) s M1 M 1 ε s M2 M 2 Set of ccepting sttes is Accept M2. Slide 22 Step (iv) Given n NFA ε M, the construction of Str(M) is pictured on Slide 23. The sttes of Str(M) re ll those of M together with new stte, clled q 0 sy. The strt stte of Str(M) is q 0 nd this is lso the only ccepting stte of Str(M). Finlly, the trnsitions of Str(M) re ll those of M together with new ε-trnsitions from q 0 to the strt stte of M nd from ech ccepting stte of M to q 0 (only one of this ltter kind of trnsition is shown in the picture). Clerly, Str(M) ccepts ε (since its strt stte is ccepting) nd ny conctention of one or more strings ccepted by M. Conversely, if v is ccepted by Str(M), the occurrences of q 0 in trnsition sequence witnessing this fct llow us to split v into the conctention of zero or more strings, ech of which is ccepted by M. So we do indeed hve L(Str(M)) = {u 1 u 2...u n n 0 nd ech u i L(M)}.

32 28 3 REGULAR LANGUAGES, I Str(M) q 0 ε s M M The only ccepting stte of Str(M) is q 0. ε Slide 23 This completes the proof of prt () of Kleene s Theorem (Slide 19). Figure 1 shows how the step-by-step construction pplies in the cse of the regulr expression ( b) to produce n NFA ε M stisfying L(M) = L(( b) ). Of course n utomton with fewer sttes nd ε-trnsitions doing the sme job cn be crfted by hnd. The point of the construction is tht it provides n utomtic wy of producing utomt for ny given regulr expression. 3.2 Decidbility of mtching The proof of prt () of Kleene s Theorem provides us with positive nswer to question () on Slide 9. In other words, it provides method tht, given ny string u nd regulr expression r, decides whether or not u mtches r. The method is: construct DFA M stisfying L(M) = L(r); beginning in M s strt stte, crry out the sequence of trnsitions in M corresponding to the string u, reching some stte q of M (becuse M is deterministic, there is unique such trnsition sequence); check whether q is ccepting or not: if it is, then u L(M) = L(r), so u mtches r; otherwise u / L(M) = L(r), so u does not mtch r. Note. The subset construction used to convert the NFA ε resulting from steps (i) (iv) of Section 3.1 to DFA produces n exponentil blow-up of the number of sttes. (PM hs

33 3.2 Decidbility of mtching 29 Step of type (i): Step of type (i): b b Step of type (ii): b ε Step of type (iv): ( b) ε b ε ε ε ε b ε Step of type (iii): ( b) ε ε ε ε ε b ε Figure 1: Steps in constructing n NFA ε for ( b)

34 30 3 REGULAR LANGUAGES, I 2 n sttes if M hs n.) This mkes the method described bove very inefficient. (Much more efficient lgorithms exist.) 3.3 Exercises Exercise Why cn t the utomton Str(M) required in step (iv) of Section 3.1 be constructed simply by tking M, mking its strt stte the only ccepting stte nd dding new ε-trnsitions bck from ech old ccepting stte to its strt stte? Exercise Work through the steps in Section 3.1 to construct n NFA ε M stisfying L(M) = L((ε b) b ). Do the sme for some other regulr expressions. Exercise Show tht ny finite set of strings is regulr lnguge.

35 31 4 Regulr Lnguges, II The im of this section is to prove prt (b) of Kleene s Theorem (Slide 19). 4.1 Regulr expressions from finite utomt Given ny DFA M, we hve to find regulr expression r (over the lphbet of input symbols of M) stisfying L(r) = L(M). In fct we do something more generl thn this, s described in the Lemm on Slide Note tht if we cn find such regulr expressions r Q q,q for ny choice of Q, q, nd q, then the problem is solved. For tking Q to be the whole of Sttes M nd q to be the strt stte, s sy, then by definition of r Q s,q, string u mtches this regulr expression iff there is trnsition sequence s u q in M. As q rnges over the finitely mny ccepting sttes, q 1,..., q k sy, then we mtch exctly ll the strings ccepted by M. In other words the regulr expression r Q s,q 1 r Q s,q k hs the property we wnt for prt (b) of Kleene s Theorem. (In cse k = 0, i.e. there re no ccepting sttes in M, then L(M) is empty nd so we cn use the regulr expression.) Lemm Given n NFA M, for ech subset Q Sttes M nd ech pir of sttes q,q Sttes M, there is regulr expression r Q q,q stisfying L(r Q q,q ) = {u (Σ M ) q u q in M with ll intermedite sttes of the sequence in Q}. Hence L(M) = L(r), where r = r 1 r k nd k = number of ccepting sttes, r i = r Q s,q i with Q = Sttes M, s = strt stte, q i = ith ccepting stte. (In cse k = 0, tke r to be the regulr expression.) Slide 24 cn be constructed by induc- Proof of the Lemm on Slide 24. The regulr expression r Q q,q tion on the number of elements in the subset Q. 1 The lemm works just s well whether M is deterministic or non-deterministic; it lso works for NFA ε s, provided we replce u by u (cf. Slide 16).

36 32 4 REGULAR LANGUAGES, II Bse cse, Q is empty. In this cse, for ech pir of sttes q, q, we re looking for regulr expression to describe the set of strings {u q u q with no intermedite sttes}. So ech element of this set is either single input symbol (if q q holds in M) or possibly ε, in cse q = q. If there re no input symbols tht tke us from q to q in M, we cn simply tke r q,q def = { if q q ε if q = q. On the other hnd, if there re some such input symbols, 1,..., k sy, we cn tke { rq,q def 1 k if q q = 1 k ε if q = q. Induction step. Suppose we hve defined the required regulr expressions for ll subsets of sttes with n elements. If Q is subset with n+1 elements, choose some element q 0 Q nd consider the n-element set Q \ {q 0 } = {q Q q q 0 }. Then for ny pir of sttes q, q Sttes M, by inductive hypothesis we hve lredy constructed the regulr expressions r 1 def = r Q\{q 0} q,q, r 2 def = r Q\{q 0} q,q 0, r 3 def = r Q\{q 0} q 0,q 0, nd r 4 def = r Q\{q 0} q 0,q. Consider the regulr expression Clerly every string mtching r is in the set r def = r 1 r 2 (r 3 ) r 4. {u q u q with ll intermedite sttes in this sequence in Q}. Conversely, if u is in this set, consider the number of times the sequence of trnsitions q u q psses through stte q 0. If this number is zero then u L(r 1 ) (by definition of r 1 ). Otherwise this number is k 1 nd the sequence splits into k + 1 pieces: the first piece is in L(r 2 ) (s the sequence goes from q to the first occurrence of q 0 ), the next k 1 pieces re in L(r 3 ) (s the sequence goes from one occurrence of q 0 to the next), nd the lst piece is in L(r 4 ) (s the sequence goes from the lst occurrence of q 0 to q ). So in this cse u is in L(r 2 (r 3 ) r 4 ). So in either cse u is in L(r). So to complete the induction step we cn define r Q q,q to be this regulr expression r = r 1 r 2 (r 3 ) r An exmple Perhps n exmple will help to understnd the rther clever rgument in Section 4.1. The exmple will lso demonstrte tht we do not hve to pursue the inductive construction of the regulr expression to the bitter end (the bse cse Q = ): often it is possible to find some of the regulr expressions r Q q,q one needs by d hoc rguments.

37 4.2 An exmple 33 Note lso tht t the inductive steps in the construction of regulr expression for M we re free to choose which stte q 0 to remove from the current stte set Q. A good rule of thumb is: choose stte tht disconnects the utomton s much s possible. Exmple 0 b b 1 2 Direct inspection yields: r {0} i,j ε 2 b ε r {0,2} i,j b 1 2 Slide 25 As n exmple, consider the NFA shown on Slide 25. Since the strt stte is 0 nd this is lso the only ccepting stte, the lnguge of ccepted strings is tht determined by the regulr expression r {0,1,2} 0,0. Choosing to remove stte 1 from the stte set, we hve (3) L(r {0,1,2} 0,0 ) = L(r {0,2} 0,0 r {0,2} 0,1 (r {0,2} 1,1 ) r {0,2} 1,0 ). Direct inspection shows tht L(r {0,2} 0,0 ) = L( ) nd L(r {0,2} 0,1 ) = L( b). To clculte L(r {0,2} 1,1 ), nd L(r {0,2} 1,0 ), we choose to remove stte 2: L(r {0,2} 1,1 ) = L(r {0} 1,1 r{0} 1,2 (r{0} 2,2 ) r {0} 2,1 ) L(r {0,2} 1,0 ) = L(r {0} 1,0 r{0} 1,2 (r{0} 2,2 ) r {0} 2,0 ). These regulr expressions cn ll be determined by inspection, s shown on Slide 25. Thus L(r {0,2} 1,1 ) = L(ε (ε) ( b)) nd it s not hrd to see tht this is equl to L(ε b); nd L(r {0,2} 1,0 ) = L( (ε) ( ))

38 34 4 REGULAR LANGUAGES, II which is equl to L( ). Substituting ll these vlues into (3), we get L(r {0,1,2} 0,0 ) = L( b(ε b) ). So b(ε b) is regulr expression whose mtching strings comprise the lnguge ccepted by the NFA on Slide 25. (Clerly, one could simplify this to smller, but equivlent regulr expression (in the sense of Slide 8), but we do not bother to do so.) 4.3 Complement nd intersection of regulr lnguges We sw in Section 3.2 tht prt () of Kleene s Theorem llows us to nswer question () on Slide 9. Now tht we hve proved the other hlf of the theorem, we cn sy more bout question (b) on tht slide. Complementtion Recll tht on pge 8 we mentioned tht for ech regulr expression r over n lphbet Σ, we cn find regulr expression (r) tht determines the complement of the lnguge determined by r: L( (r)) = {u Σ u / L(r)}. As we now show, this is consequence of Kleene s Theorem. Sttes Not(M) def = Sttes M Σ Not(M) def = Σ M Not(M) trnsitions of Not(M) = trnsitions of M strt stte of Not(M) = strt stte of M Accept Not(M) = {q Sttes M q / Accept M }. Provided M is deterministic finite utomton, then u is ccepted by Not(M) iff it is not ccepted by M : L(Not(M)) = {u Σ u / L(M)}. Slide 26

39 4.3 Complement nd intersection of regulr lnguges 35 Lemm If L is regulr lnguge over lphbet Σ, then its complement {u Σ u / L} is lso regulr. Proof. Since L is regulr, by definition there is DFA M such tht L = L(M). Let Not(M) be the DFA constructed from M s indicted on Slide 26. Then {u Σ u / L} is the set of strings ccepted by Not(M) nd hence is regulr. Given regulr expression r, by prt () of Kleene s Theorem there is DFA M such tht L(r) = L(M). Then by prt (b) of the theorem pplied to the DFA Not(M), we cn find regulr expression (r) so tht L( (r)) = L(Not(M)). Since L(Not(M)) = {u Σ u / L(M)} = {u Σ u / L(r)}, this (r) is the regulr expression we need for the complement of r. Note. The construction given on Slide 26 cn be pplied to finite utomton M whether or not it is deterministic. However, for L(Not(M)) to equl {u Σ u / L(M)} we need M to be deterministic. See Exercise Intersection As nother exmple of the power of Kleene s Theorem, given regulr expressions r 1 nd r 2 we cn show the existence of regulr expression (r 1 &r 2 ) with the property: u mtches (r 1 &r 2 ) iff u mtches r 1 nd u mtches r 2. This cn be deduced from the following lemm. Lemm If L 1 nd L 2 re regulr lnguges over n lphbet Σ, then their intersection is lso regulr. L 1 L 2 def = {u Σ u L 1 nd u L 2 } Proof. Since L 1 nd L 2 re regulr lnguges, there re DFA M 1 nd M 2 such tht L i = L(M i ) (i = 1, 2). Let And(M 1, M 2 ) be the DFA constructed from M 1 nd M 2 s on Slide 27. It is not hrd to see tht And(M 1, M 2 ) hs the property tht ny u Σ is ccepted by And(M 1, M 2 ) iff it is ccepted by both M 1 nd M 2. Thus L 1 L 2 = L(And(M 1, M 2 )) is regulr lnguge.

40 36 4 REGULAR LANGUAGES, II And(M 1,M 2 ) sttes of And(M 1,M 2 ) re ll ordered pirs (q 1,q 2 ) with q 1 Sttes M1 nd q 2 Sttes M2 lphbet of And(M 1,M 2 ) is the common lphbet of M 1 nd M 2 (q 1,q 2 ) (q 1,q 2 ) in And(M 1,M 2 ) iff q 1 q 1 in M 1 nd q 2 q 2 in M 2 strt stte of And(M 1,M 2 ) is (s M1,s M2 ) (q 1,q 2 ) ccepting in And(M 1,M 2 ) iff q 1 ccepting in M 1 nd q 2 ccepting in M 2. Slide 27 Thus given regulr expressions r 1 nd r 2, by prt () of Kleene s Theorem we cn find DFA M 1 nd M 2 with L(r i ) = L(M i ) (i = 1, 2). Then by prt (b) of the theorem we cn find regulr expression r 1 &r 2 so tht L(r 1 &r 2 ) = L(And(M 1, M 2 )). Thus u mtches r 1 &r 2 iff And(M 1, M 2 ) ccepts u, iff both M 1 nd M 2 ccept u, iff u mtches both r 1 nd r 2, s required. 4.4 Exercises Exercise Use the construction in Section 4.1 to find regulr expression for the DFA M whose stte set is {0, 1, 2}, whose strt stte is 0, whose only ccepting stte is 2, whose lphbet of input symbols is {, b}, nd whose next-stte function is given by the following tble. δ M : b Exercise The construction M Not(M) given on Slide 26 pplies to both DFA nd NFA; but for L(Not(M)) to be the complement of L(M) we need M to be deterministic. Give n exmple of n lphbet Σ nd NFA M with set of input symbols Σ, such tht {u Σ u / L(M)} is not the sme set s L(Not(M)).

41 4.4 Exercises 37 Exercise Let r = ( b) b( b). Find complement for r over the lphbet Σ = {, b}, i.e. regulr expressions (r) over the lphbet Σ stisfying L( (r)) = {u Σ u / L(r)}. Tripos questions

42 38 4 REGULAR LANGUAGES, II

43 39 5 The Pumping Lemm In the context of progrmming lnguges, typicl exmple of regulr lnguge (Slide 19) is the set of ll strings of chrcters which re well-formed tokens (bsic keywords, identifiers, etc) in prticulr progrmming lnguge, Jv sy. By contrst, the set of ll strings which represent well-formed Jv progrms is typicl exmple of lnguge tht is not regulr. Slide 28 gives some simpler exmples of non-regulr lnguges. For exmple, there is no wy to use serch bsed on mtching regulr expression to find ll the plindromes in piece of text (lthough of course there re other kinds of lgorithm for doing this). Exmples of non-regulr lnguges The set of strings over {(,),,b,...,z} in which the prentheses ( nd ) occur well-nested. The set of strings over {,b,...,z} which re plindromes, i.e. which red the sme bckwrds s forwrds. { n b n n 0} Slide 28 The intuitive reson why the lnguges listed on Slide 28 re not regulr is tht mchine for recognising whether or not ny given string is in the lnguge would need infinitely mny different sttes (wheres chrcteristic feture of the mchines we hve been using is tht they hve only finitely mny sttes). For exmple, to recognise tht string is of the form n b n one would need to remember how mny s hd been seen before the first b is encountered, requiring countbly mny sttes of the form just seen n s. This section mke this intuitive rgument rigorous nd describes useful wy of showing tht lnguges such s these re not regulr. The fct tht finite utomton does only hve finitely mny sttes mens tht s we look t longer nd longer strings tht it ccepts, we see certin kind of repetition the pumping lemm property given on Slide 29.

44 40 5 THE PUMPING LEMMA The Pumping Lemm For every regulr lnguge L, there is number l 1 stisfying the pumping lemm property: ll w L with length(w) l cn be expressed s conctention of three strings, w = u 1 vu 2, where u 1, v nd u 2 stisfy: length(v) 1 (i.e. v ε) length(u 1 v) l for ll n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew tht nywy], u 1 vvu 2 L, u 1 vvvu 2 L, etc). Slide Proving the Pumping Lemm Since L is regulr, it is equl to the set L(M) of strings ccepted by some DFA M. Then we cn tke the number l mentioned on Slide 29 to be the number of sttes in M. For suppose w = n with n l. If w L(M), then there is trnsition sequence s shown t the top of Slide 30. Then w cn be split into three pieces s shown on tht slide. Note tht by choice of i nd j, length(v) = j i 1 nd length(u 1 v) = j l. So it just remins to check tht u 1 v n u 2 L for ll n 0. As shown on the lower hlf of Slide 30, the string v tkes the mchine M from stte q i bck to the sme stte (since q i = q j ). So for ny n, u 1 v n u 2 tkes us from the initil stte s M = q o to q i, then n times round the loop from q i to itself, nd then from q i to q n Accept M. Therefore for ny n 0, u 1 v n u 2 is ccepted by M, i.e. u 1 v n u 2 L. Note. In the bove construction it is perfectly possible tht i = 0, in which cse u 1 is the null-string, ε.

Regular Sets and Expressions

Regular Sets and Expressions Regulr Sets nd Expressions Finite utomt re importnt in science, mthemtics, nd engineering. Engineers like them ecuse they re super models for circuits (And, since the dvent of VLSI systems sometimes finite

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

One Minute To Learn Programming: Finite Automata

One Minute To Learn Programming: Finite Automata Gret Theoreticl Ides In Computer Science Steven Rudich CS 15-251 Spring 2005 Lecture 9 Fe 8 2005 Crnegie Mellon University One Minute To Lern Progrmming: Finite Automt Let me tech you progrmming lnguge

More information

Algebra Review. How well do you remember your algebra?

Algebra Review. How well do you remember your algebra? Algebr Review How well do you remember your lgebr? 1 The Order of Opertions Wht do we men when we write + 4? If we multiply we get 6 nd dding 4 gives 10. But, if we dd + 4 = 7 first, then multiply by then

More information

Integration by Substitution

Integration by Substitution Integrtion by Substitution Dr. Philippe B. Lvl Kennesw Stte University August, 8 Abstrct This hndout contins mteril on very importnt integrtion method clled integrtion by substitution. Substitution is

More information

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES DAVID WEBB CONTENTS Liner trnsformtions 2 The representing mtrix of liner trnsformtion 3 3 An ppliction: reflections in the plne 6 4 The lgebr of

More information

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY MAT 0630 INTERNET RESOURCES, REVIEW OF CONCEPTS AND COMMON MISTAKES PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY Contents 1. ACT Compss Prctice Tests 1 2. Common Mistkes 2 3. Distributive

More information

Math 135 Circles and Completing the Square Examples

Math 135 Circles and Completing the Square Examples Mth 135 Circles nd Completing the Squre Exmples A perfect squre is number such tht = b 2 for some rel number b. Some exmples of perfect squres re 4 = 2 2, 16 = 4 2, 169 = 13 2. We wish to hve method for

More information

4.11 Inner Product Spaces

4.11 Inner Product Spaces 314 CHAPTER 4 Vector Spces 9. A mtrix of the form 0 0 b c 0 d 0 0 e 0 f g 0 h 0 cnnot be invertible. 10. A mtrix of the form bc d e f ghi such tht e bd = 0 cnnot be invertible. 4.11 Inner Product Spces

More information

Binary Representation of Numbers Autar Kaw

Binary Representation of Numbers Autar Kaw Binry Representtion of Numbers Autr Kw After reding this chpter, you should be ble to: 1. convert bse- rel number to its binry representtion,. convert binry number to n equivlent bse- number. In everydy

More information

Graphs on Logarithmic and Semilogarithmic Paper

Graphs on Logarithmic and Semilogarithmic Paper 0CH_PHClter_TMSETE_ 3//00 :3 PM Pge Grphs on Logrithmic nd Semilogrithmic Pper OBJECTIVES When ou hve completed this chpter, ou should be ble to: Mke grphs on logrithmic nd semilogrithmic pper. Grph empiricl

More information

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers. 2 Rtionl Numbers Integers such s 5 were importnt when solving the eqution x+5 = 0. In similr wy, frctions re importnt for solving equtions like 2x = 1. Wht bout equtions like 2x + 1 = 0? Equtions of this

More information

Solution to Problem Set 1

Solution to Problem Set 1 CSE 5: Introduction to the Theory o Computtion, Winter A. Hevi nd J. Mo Solution to Prolem Set Jnury, Solution to Prolem Set.4 ). L = {w w egin with nd end with }. q q q q, d). L = {w w h length t let

More information

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes The Sclr Product 9.3 Introduction There re two kinds of multipliction involving vectors. The first is known s the sclr product or dot product. This is so-clled becuse when the sclr product of two vectors

More information

Experiment 6: Friction

Experiment 6: Friction Experiment 6: Friction In previous lbs we studied Newton s lws in n idel setting, tht is, one where friction nd ir resistnce were ignored. However, from our everydy experience with motion, we know tht

More information

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom Byesin Updting with Continuous Priors Clss 3, 8.05, Spring 04 Jeremy Orloff nd Jonthn Bloom Lerning Gols. Understnd prmeterized fmily of distriutions s representing continuous rnge of hypotheses for the

More information

FORMAL LANGUAGES, AUTOMATA AND THEORY OF COMPUTATION EXERCISES ON REGULAR LANGUAGES

FORMAL LANGUAGES, AUTOMATA AND THEORY OF COMPUTATION EXERCISES ON REGULAR LANGUAGES FORMAL LANGUAGES, AUTOMATA AND THEORY OF COMPUTATION EXERCISES ON REGULAR LANGUAGES Introduction This compendium contins exercises out regulr lnguges for the course Forml Lnguges, Automt nd Theory of Computtion

More information

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( ) Polynomil Functions Polynomil functions in one vrible cn be written in expnded form s n n 1 n 2 2 f x = x + x + x + + x + x+ n n 1 n 2 2 1 0 Exmples of polynomils in expnded form re nd 3 8 7 4 = 5 4 +

More information

and thus, they are similar. If k = 3 then the Jordan form of both matrices is

and thus, they are similar. If k = 3 then the Jordan form of both matrices is Homework ssignment 11 Section 7. pp. 249-25 Exercise 1. Let N 1 nd N 2 be nilpotent mtrices over the field F. Prove tht N 1 nd N 2 re similr if nd only if they hve the sme miniml polynomil. Solution: If

More information

Reasoning to Solve Equations and Inequalities

Reasoning to Solve Equations and Inequalities Lesson4 Resoning to Solve Equtions nd Inequlities In erlier work in this unit, you modeled situtions with severl vriles nd equtions. For exmple, suppose you were given usiness plns for concert showing

More information

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity Bbylonin Method of Computing the Squre Root: Justifictions Bsed on Fuzzy Techniques nd on Computtionl Complexity Olg Koshelev Deprtment of Mthemtics Eduction University of Texs t El Pso 500 W. University

More information

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions. Lerning Objectives Loci nd Conics Lesson 3: The Ellipse Level: Preclculus Time required: 120 minutes In this lesson, students will generlize their knowledge of the circle to the ellipse. The prmetric nd

More information

9 CONTINUOUS DISTRIBUTIONS

9 CONTINUOUS DISTRIBUTIONS 9 CONTINUOUS DISTIBUTIONS A rndom vrible whose vlue my fll nywhere in rnge of vlues is continuous rndom vrible nd will be ssocited with some continuous distribution. Continuous distributions re to discrete

More information

Operations with Polynomials

Operations with Polynomials 38 Chpter P Prerequisites P.4 Opertions with Polynomils Wht you should lern: Write polynomils in stndrd form nd identify the leding coefficients nd degrees of polynomils Add nd subtrct polynomils Multiply

More information

Lecture 5. Inner Product

Lecture 5. Inner Product Lecture 5 Inner Product Let us strt with the following problem. Given point P R nd line L R, how cn we find the point on the line closest to P? Answer: Drw line segment from P meeting the line in right

More information

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding 1 Exmple A rectngulr box without lid is to be mde from squre crdbord of sides 18 cm by cutting equl squres from ech corner nd then folding up the sides. 1 Exmple A rectngulr box without lid is to be mde

More information

Section 5-4 Trigonometric Functions

Section 5-4 Trigonometric Functions 5- Trigonometric Functions Section 5- Trigonometric Functions Definition of the Trigonometric Functions Clcultor Evlution of Trigonometric Functions Definition of the Trigonometric Functions Alternte Form

More information

Unambiguous Recognizable Two-dimensional Languages

Unambiguous Recognizable Two-dimensional Languages Unmbiguous Recognizble Two-dimensionl Lnguges Mrcell Anselmo, Dor Gimmrresi, Mri Mdoni, Antonio Restivo (Univ. of Slerno, Univ. Rom Tor Vergt, Univ. of Ctni, Univ. of Plermo) W2DL, My 26 REC fmily I REC

More information

MODULE 3. 0, y = 0 for all y

MODULE 3. 0, y = 0 for all y Topics: Inner products MOULE 3 The inner product of two vectors: The inner product of two vectors x, y V, denoted by x, y is (in generl) complex vlued function which hs the following four properties: i)

More information

6.2 Volumes of Revolution: The Disk Method

6.2 Volumes of Revolution: The Disk Method mth ppliction: volumes of revolution, prt ii Volumes of Revolution: The Disk Method One of the simplest pplictions of integrtion (Theorem ) nd the ccumultion process is to determine so-clled volumes of

More information

Integration. 148 Chapter 7 Integration

Integration. 148 Chapter 7 Integration 48 Chpter 7 Integrtion 7 Integrtion t ech, by supposing tht during ech tenth of second the object is going t constnt speed Since the object initilly hs speed, we gin suppose it mintins this speed, but

More information

Factoring Polynomials

Factoring Polynomials Fctoring Polynomils Some definitions (not necessrily ll for secondry school mthemtics): A polynomil is the sum of one or more terms, in which ech term consists of product of constnt nd one or more vribles

More information

Warm-up for Differential Calculus

Warm-up for Differential Calculus Summer Assignment Wrm-up for Differentil Clculus Who should complete this pcket? Students who hve completed Functions or Honors Functions nd will be tking Differentil Clculus in the fll of 015. Due Dte:

More information

All pay auctions with certain and uncertain prizes a comment

All pay auctions with certain and uncertain prizes a comment CENTER FOR RESEARC IN ECONOMICS AND MANAGEMENT CREAM Publiction No. 1-2015 All py uctions with certin nd uncertin prizes comment Christin Riis All py uctions with certin nd uncertin prizes comment Christin

More information

Basic Analysis of Autarky and Free Trade Models

Basic Analysis of Autarky and Free Trade Models Bsic Anlysis of Autrky nd Free Trde Models AUTARKY Autrky condition in prticulr commodity mrket refers to sitution in which country does not engge in ny trde in tht commodity with other countries. Consequently

More information

Solutions for Selected Exercises from Introduction to Compiler Design

Solutions for Selected Exercises from Introduction to Compiler Design Solutions for Selected Exercises from Introduction to Compiler Design Torben Æ. Mogensen Lst updte: My 30, 2011 1 Introduction This document provides solutions for selected exercises from Introduction

More information

2005-06 Second Term MAT2060B 1. Supplementary Notes 3 Interchange of Differentiation and Integration

2005-06 Second Term MAT2060B 1. Supplementary Notes 3 Interchange of Differentiation and Integration Source: http://www.mth.cuhk.edu.hk/~mt26/mt26b/notes/notes3.pdf 25-6 Second Term MAT26B 1 Supplementry Notes 3 Interchnge of Differentition nd Integrtion The theme of this course is bout vrious limiting

More information

flex Regular Expressions and Lexical Scanning Regular Expressions and flex Examples on Alphabet A = {a,b} (Standard) Regular Expressions on Alphabet A

flex Regular Expressions and Lexical Scanning Regular Expressions and flex Examples on Alphabet A = {a,b} (Standard) Regular Expressions on Alphabet A flex Regulr Expressions nd Lexicl Scnning Using flex to Build Scnner flex genertes lexicl scnners: progrms tht discover tokens. Tokens re the smllest meningful units of progrm (or other string). flex is

More information

EQUATIONS OF LINES AND PLANES

EQUATIONS OF LINES AND PLANES EQUATIONS OF LINES AND PLANES MATH 195, SECTION 59 (VIPUL NAIK) Corresponding mteril in the ook: Section 12.5. Wht students should definitely get: Prmetric eqution of line given in point-direction nd twopoint

More information

A.7.1 Trigonometric interpretation of dot product... 324. A.7.2 Geometric interpretation of dot product... 324

A.7.1 Trigonometric interpretation of dot product... 324. A.7.2 Geometric interpretation of dot product... 324 A P P E N D I X A Vectors CONTENTS A.1 Scling vector................................................ 321 A.2 Unit or Direction vectors...................................... 321 A.3 Vector ddition.................................................

More information

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one. 5.2. LINE INTEGRALS 265 5.2 Line Integrls 5.2.1 Introduction Let us quickly review the kind of integrls we hve studied so fr before we introduce new one. 1. Definite integrl. Given continuous rel-vlued

More information

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2011 - Final Exam

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2011 - Final Exam 1./1.1 Introduction to Computers nd Engineering Problem Solving Fll 211 - Finl Exm Nme: MIT Emil: TA: Section: You hve 3 hours to complete this exm. In ll questions, you should ssume tht ll necessry pckges

More information

Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials

Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials MEI Mthemtics in Ection nd Instry Topic : Proof MEI Structured Mthemtics Mole Summry Sheets C, Methods for Anced Mthemtics (Version B reference to new book) Topic : Nturl Logrithms nd Eponentils Topic

More information

Treatment Spring Late Summer Fall 0.10 5.56 3.85 0.61 6.97 3.01 1.91 3.01 2.13 2.99 5.33 2.50 1.06 3.53 6.10 Mean = 1.33 Mean = 4.88 Mean = 3.

Treatment Spring Late Summer Fall 0.10 5.56 3.85 0.61 6.97 3.01 1.91 3.01 2.13 2.99 5.33 2.50 1.06 3.53 6.10 Mean = 1.33 Mean = 4.88 Mean = 3. The nlysis of vrince (ANOVA) Although the t-test is one of the most commonly used sttisticl hypothesis tests, it hs limittions. The mjor limittion is tht the t-test cn be used to compre the mens of only

More information

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation FUNCTIONS AND EQUATIONS. SETS AND SUBSETS.. Definition of set. A set is ny collection of objects which re clled its elements. If x is n element of the set S, we sy tht x belongs to S nd write If y does

More information

0.1 Basic Set Theory and Interval Notation

0.1 Basic Set Theory and Interval Notation 0.1 Bsic Set Theory nd Intervl Nottion 3 0.1 Bsic Set Theory nd Intervl Nottion 0.1.1 Some Bsic Set Theory Notions Like ll good Mth ooks, we egin with definition. Definition 0.1. A set is well-defined

More information

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100 hsn.uk.net Higher Mthemtics UNIT 3 OUTCOME 1 Vectors Contents Vectors 18 1 Vectors nd Sclrs 18 Components 18 3 Mgnitude 130 4 Equl Vectors 131 5 Addition nd Subtrction of Vectors 13 6 Multipliction by

More information

Vectors 2. 1. Recap of vectors

Vectors 2. 1. Recap of vectors Vectors 2. Recp of vectors Vectors re directed line segments - they cn be represented in component form or by direction nd mgnitude. We cn use trigonometry nd Pythgors theorem to switch between the forms

More information

Lecture 3 Gaussian Probability Distribution

Lecture 3 Gaussian Probability Distribution Lecture 3 Gussin Probbility Distribution Introduction l Gussin probbility distribution is perhps the most used distribution in ll of science. u lso clled bell shped curve or norml distribution l Unlike

More information

Section 7-4 Translation of Axes

Section 7-4 Translation of Axes 62 7 ADDITIONAL TOPICS IN ANALYTIC GEOMETRY Section 7-4 Trnsltion of Aes Trnsltion of Aes Stndrd Equtions of Trnslted Conics Grphing Equtions of the Form A 2 C 2 D E F 0 Finding Equtions of Conics In the

More information

Econ 4721 Money and Banking Problem Set 2 Answer Key

Econ 4721 Money and Banking Problem Set 2 Answer Key Econ 472 Money nd Bnking Problem Set 2 Answer Key Problem (35 points) Consider n overlpping genertions model in which consumers live for two periods. The number of people born in ech genertion grows in

More information

3 The Utility Maximization Problem

3 The Utility Maximization Problem 3 The Utility Mxiiztion Proble We hve now discussed how to describe preferences in ters of utility functions nd how to forulte siple budget sets. The rtionl choice ssuption, tht consuers pick the best

More information

A Visual and Interactive Input abb Automata. Theory Course with JFLAP 4.0

A Visual and Interactive Input abb Automata. Theory Course with JFLAP 4.0 Strt Puse Step Noninverted Tree A Visul nd Interctive Input Automt String ccepted! 5 nodes generted. Theory Course with JFLAP 4.0 q0 even 's, even 's q2 even 's, odd 's q1 odd 's, even 's q3 odd 's, odd

More information

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS 3343 -- Spring 2009

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS 3343 -- Spring 2009 CS 4 -- Spring 2009 Sorting Crol Wenk Slides courtesy of Chrles Leiserson with smll chnges by Crol Wenk CS 4 Anlysis of Algorithms 1 How fst cn we sort? All the sorting lgorithms we hve seen so fr re comprison

More information

CHAPTER 11 Numerical Differentiation and Integration

CHAPTER 11 Numerical Differentiation and Integration CHAPTER 11 Numericl Differentition nd Integrtion Differentition nd integrtion re bsic mthemticl opertions with wide rnge of pplictions in mny res of science. It is therefore importnt to hve good methods

More information

MATH 150 HOMEWORK 4 SOLUTIONS

MATH 150 HOMEWORK 4 SOLUTIONS MATH 150 HOMEWORK 4 SOLUTIONS Section 1.8 Show tht the product of two of the numbers 65 1000 8 2001 + 3 177, 79 1212 9 2399 + 2 2001, nd 24 4493 5 8192 + 7 1777 is nonnegtive. Is your proof constructive

More information

19. The Fermat-Euler Prime Number Theorem

19. The Fermat-Euler Prime Number Theorem 19. The Fermt-Euler Prime Number Theorem Every prime number of the form 4n 1 cn be written s sum of two squres in only one wy (side from the order of the summnds). This fmous theorem ws discovered bout

More information

2 DIODE CLIPPING and CLAMPING CIRCUITS

2 DIODE CLIPPING and CLAMPING CIRCUITS 2 DIODE CLIPPING nd CLAMPING CIRCUITS 2.1 Ojectives Understnding the operting principle of diode clipping circuit Understnding the operting principle of clmping circuit Understnding the wveform chnge of

More information

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

More information

Review guide for the final exam in Math 233

Review guide for the final exam in Math 233 Review guide for the finl exm in Mth 33 1 Bsic mteril. This review includes the reminder of the mteril for mth 33. The finl exm will be cumultive exm with mny of the problems coming from the mteril covered

More information

Helicopter Theme and Variations

Helicopter Theme and Variations Helicopter Theme nd Vritions Or, Some Experimentl Designs Employing Pper Helicopters Some possible explntory vribles re: Who drops the helicopter The length of the rotor bldes The height from which the

More information

1.2 The Integers and Rational Numbers

1.2 The Integers and Rational Numbers .2. THE INTEGERS AND RATIONAL NUMBERS.2 The Integers n Rtionl Numers The elements of the set of integers: consist of three types of numers: Z {..., 5, 4, 3, 2,, 0,, 2, 3, 4, 5,...} I. The (positive) nturl

More information

AA1H Calculus Notes Math1115, Honours 1 1998. John Hutchinson

AA1H Calculus Notes Math1115, Honours 1 1998. John Hutchinson AA1H Clculus Notes Mth1115, Honours 1 1998 John Hutchinson Author ddress: Deprtment of Mthemtics, School of Mthemticl Sciences, Austrlin Ntionl University E-mil ddress: John.Hutchinson@nu.edu.u Contents

More information

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered: Appendi D: Completing the Squre nd the Qudrtic Formul Fctoring qudrtic epressions such s: + 6 + 8 ws one of the topics introduced in Appendi C. Fctoring qudrtic epressions is useful skill tht cn help you

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Decision Rule Extraction from Trained Neural Networks Using Rough Sets

Decision Rule Extraction from Trained Neural Networks Using Rough Sets Decision Rule Extrction from Trined Neurl Networks Using Rough Sets Alin Lzr nd Ishwr K. Sethi Vision nd Neurl Networks Lbortory Deprtment of Computer Science Wyne Stte University Detroit, MI 48 ABSTRACT

More information

Physics 43 Homework Set 9 Chapter 40 Key

Physics 43 Homework Set 9 Chapter 40 Key Physics 43 Homework Set 9 Chpter 4 Key. The wve function for n electron tht is confined to x nm is. Find the normliztion constnt. b. Wht is the probbility of finding the electron in. nm-wide region t x

More information

SPECIAL PRODUCTS AND FACTORIZATION

SPECIAL PRODUCTS AND FACTORIZATION MODULE - Specil Products nd Fctoriztion 4 SPECIAL PRODUCTS AND FACTORIZATION In n erlier lesson you hve lernt multipliction of lgebric epressions, prticulrly polynomils. In the study of lgebr, we come

More information

Object Semantics. 6.170 Lecture 2

Object Semantics. 6.170 Lecture 2 Object Semntics 6.170 Lecture 2 The objectives of this lecture re to: to help you become fmilir with the bsic runtime mechnism common to ll object-oriented lnguges (but with prticulr focus on Jv): vribles,

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information

On decidability of LTL model checking for process rewrite systems

On decidability of LTL model checking for process rewrite systems Act Informtic (2009) 46:1 28 DOI 10.1007/s00236-008-0082-3 ORIGINAL ARTICLE On decidbility of LTL model checking for process rewrite systems Lur Bozzelli Mojmír Křetínský Vojtěch Řehák Jn Strejček Received:

More information

5 a LAN 6 a gateway 7 a modem

5 a LAN 6 a gateway 7 a modem STARTER With the help of this digrm, try to descrie the function of these components of typicl network system: 1 file server 2 ridge 3 router 4 ckone 5 LAN 6 gtewy 7 modem Another Novell LAN Router Internet

More information

Understanding Basic Analog Ideal Op Amps

Understanding Basic Analog Ideal Op Amps Appliction Report SLAA068A - April 2000 Understnding Bsic Anlog Idel Op Amps Ron Mncini Mixed Signl Products ABSTRACT This ppliction report develops the equtions for the idel opertionl mplifier (op mp).

More information

Learning Workflow Petri Nets

Learning Workflow Petri Nets Lerning Workflow Petri Nets Jvier Esprz, Mrtin Leucker, nd Mximilin Schlund Technische Universität München, Boltzmnnstr. 3, 85748 Grching, Germny {esprz,leucker,schlund}@in.tum.de Abstrct. Workflow mining

More information

4 Approximations. 4.1 Background. D. Levy

4 Approximations. 4.1 Background. D. Levy D. Levy 4 Approximtions 4.1 Bckground In this chpter we re interested in pproximtion problems. Generlly speking, strting from function f(x) we would like to find different function g(x) tht belongs to

More information

NQF Level: 2 US No: 7480

NQF Level: 2 US No: 7480 NQF Level: 2 US No: 7480 Assessment Guide Primry Agriculture Rtionl nd irrtionl numers nd numer systems Assessor:.......................................... Workplce / Compny:.................................

More information

Lectures 8 and 9 1 Rectangular waveguides

Lectures 8 and 9 1 Rectangular waveguides 1 Lectures 8 nd 9 1 Rectngulr wveguides y b x z Consider rectngulr wveguide with 0 < x b. There re two types of wves in hollow wveguide with only one conductor; Trnsverse electric wves

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information

The Velocity Factor of an Insulated Two-Wire Transmission Line

The Velocity Factor of an Insulated Two-Wire Transmission Line The Velocity Fctor of n Insulted Two-Wire Trnsmission Line Problem Kirk T. McDonld Joseph Henry Lbortories, Princeton University, Princeton, NJ 08544 Mrch 7, 008 Estimte the velocity fctor F = v/c nd the

More information

Rotating DC Motors Part II

Rotating DC Motors Part II Rotting Motors rt II II.1 Motor Equivlent Circuit The next step in our consiertion of motors is to evelop n equivlent circuit which cn be use to better unerstn motor opertion. The rmtures in rel motors

More information

Chapter 2 The Number System (Integers and Rational Numbers)

Chapter 2 The Number System (Integers and Rational Numbers) Chpter 2 The Number System (Integers nd Rtionl Numbers) In this second chpter, students extend nd formlize their understnding of the number system, including negtive rtionl numbers. Students first develop

More information

Exponential and Logarithmic Functions

Exponential and Logarithmic Functions Nme Chpter Eponentil nd Logrithmic Functions Section. Eponentil Functions nd Their Grphs Objective: In this lesson ou lerned how to recognize, evlute, nd grph eponentil functions. Importnt Vocbulr Define

More information

Or more simply put, when adding or subtracting quantities, their uncertainties add.

Or more simply put, when adding or subtracting quantities, their uncertainties add. Propgtion of Uncertint through Mthemticl Opertions Since the untit of interest in n eperiment is rrel otined mesuring tht untit directl, we must understnd how error propgtes when mthemticl opertions re

More information

Drawing Diagrams From Labelled Graphs

Drawing Diagrams From Labelled Graphs Drwing Digrms From Lbelled Grphs Jérôme Thièvre 1 INA, 4, venue de l Europe, 94366 BRY SUR MARNE FRANCE Anne Verroust-Blondet 2 INRIA Rocquencourt, B.P. 105, 78153 LE CHESNAY Cedex FRANCE Mrie-Luce Viud

More information

How To Network A Smll Business

How To Network A Smll Business Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information

When Simulation Meets Antichains (on Checking Language Inclusion of NFAs)

When Simulation Meets Antichains (on Checking Language Inclusion of NFAs) When Simultion Meets Antichins (on Checking Lnguge Inclusion of NFAs) Prosh Aziz Abdull 1, Yu-Fng Chen 1, Lukáš Holík 2, Richrd Myr 3, nd Tomáš Vojnr 2 1 Uppsl University 2 Brno University of Technology

More information

Pointed Regular Expressions

Pointed Regular Expressions Pointed Regulr Expressions Andre Asperti 1, Cludio Scerdoti Coen 1, nd Enrico Tssi 2 1 Deprtment of Computer Science, University of Bologn sperti@cs.unio.it scerdot@cs.unio.it 2 INRIA-Micorsoft tssi@cs.unio.it

More information

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report DlNBVRGH + + THE CITY OF EDINBURGH COUNCIL Sickness Absence Monitoring Report Executive of the Council 8fh My 4 I.I...3 Purpose of report This report quntifies the mount of working time lost s result of

More information

Distributions. (corresponding to the cumulative distribution function for the discrete case).

Distributions. (corresponding to the cumulative distribution function for the discrete case). Distributions Recll tht n integrble function f : R [,] such tht R f()d = is clled probbility density function (pdf). The distribution function for the pdf is given by F() = (corresponding to the cumultive

More information

COMPONENTS: COMBINED LOADING

COMPONENTS: COMBINED LOADING LECTURE COMPONENTS: COMBINED LOADING Third Edition A. J. Clrk School of Engineering Deprtment of Civil nd Environmentl Engineering 24 Chpter 8.4 by Dr. Ibrhim A. Asskkf SPRING 2003 ENES 220 Mechnics of

More information

The Definite Integral

The Definite Integral Chpter 4 The Definite Integrl 4. Determining distnce trveled from velocity Motivting Questions In this section, we strive to understnd the ides generted by the following importnt questions: If we know

More information

Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful

Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful Pentominoes Bruce Bguley Cscde Mth Systems, LLC Astrct. Pentominoes nd their reltives the polyominoes, polycues, nd polyhypercues will e used to explore nd pply vrious importnt mthemticl concepts. In this

More information

Modular Generic Verification of LTL Properties for Aspects

Modular Generic Verification of LTL Properties for Aspects Modulr Generic Verifiction of LTL Properties for Aspects Mx Goldmn Shmuel Ktz Computer Science Deprtment Technion Isrel Institute of Technology {mgoldmn, ktz}@cs.technion.c.il ABSTRACT Aspects re seprte

More information

Solving BAMO Problems

Solving BAMO Problems Solving BAMO Problems Tom Dvis tomrdvis@erthlink.net http://www.geometer.org/mthcircles Februry 20, 2000 Abstrct Strtegies for solving problems in the BAMO contest (the By Are Mthemticl Olympid). Only

More information

15.6. The mean value and the root-mean-square value of a function. Introduction. Prerequisites. Learning Outcomes. Learning Style

15.6. The mean value and the root-mean-square value of a function. Introduction. Prerequisites. Learning Outcomes. Learning Style The men vlue nd the root-men-squre vlue of function 5.6 Introduction Currents nd voltges often vry with time nd engineers my wish to know the verge vlue of such current or voltge over some prticulr time

More information

Numeracy across the Curriculum in Key Stages 3 and 4. Helpful advice and suggested resources from the Leicestershire Secondary Mathematics Team

Numeracy across the Curriculum in Key Stages 3 and 4. Helpful advice and suggested resources from the Leicestershire Secondary Mathematics Team Numercy cross the Curriculum in Key Stges 3 nd 4 Helpful dvice nd suggested resources from the Leicestershire Secondry Mthemtics Tem 1 Contents pge The development of whole school policy 3 A definition

More information

Chapter 6. Logic and Action. 6.1 Actions in General

Chapter 6. Logic and Action. 6.1 Actions in General Chpter 6 Logic nd Action Overview An ction is something tht tkes plce in the world, nd tht mkes difference to wht the world looks like. Thus, ctions re mps from sttes of the world to new sttes of the world.

More information

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn 33337_0P03.qp 2/27/06 24 9:3 AM Chpter P Pge 24 Prerequisites P.3 Polynomils nd Fctoring Wht you should lern Polynomils An lgeric epression is collection of vriles nd rel numers. The most common type of

More information

LECTURE #05. Learning Objective. To describe the geometry in and around a unit cell in terms of directions and planes.

LECTURE #05. Learning Objective. To describe the geometry in and around a unit cell in terms of directions and planes. LECTURE #05 Chpter 3: Lttice Positions, Directions nd Plnes Lerning Objective To describe the geometr in nd round unit cell in terms of directions nd plnes. 1 Relevnt Reding for this Lecture... Pges 64-83.

More information