Inference of regular expressions/grammars for given data entities

Size: px
Start display at page:

Download "Inference of regular expressions/grammars for given data entities"

Transcription

1 Inference of regulr expressions/grmmrs for given dt entities Lis Busser University of Kiserslutern, Embedded Systems Group l busser13@cs.uni-kl.de Abstrct We consider three different lgorithmic ides to build regulr lnguge out of set of positive exmples of the lnguge nd their dvntges nd disdvntges. We contrst the tree lgorithms SL in f ere, DeLeTe2 nd n lgorithm for the regulr lnguge R1 + 1 Introduction In this pper, we discuss some lgorithms for lerning regulr expressions for given dt entities. Over the lst forty yers there hve been plenty of reserch on this topic nd mny different strtegies nd lgorithms where published. All these lgorithms join the trget to be ble, fter fixed number of given smples of the lnguge, to built regulr expression or utomton, which describes the questioned lnguge s detiled s possible. All the lgorithms, which solves tht kind of problem re more heuristic thn proper lgorithm becuse there does not exist ny specifiction, which describes the clss of lnguges in wy, tht could be lerned by lerner. Lerning regulr lnguge often mens to infer with regulr expressions becuse for humns, regulr expression re best comprehensible. But even when the output is regulr expression the lgorithms often del with utomtons to clculte the regulr expression. Only few lgorithms del directly with the regulr expression, like the one presented in chpter 3. You could lso find lgorithms in literture which uses form of nture inspires progrmming especilly something like n evolutionry lgorithm but this isn t considered in this pper. So bsiclly there re two different wys to write such n lgorithm. You could either use form of nture inspired progrmming or you cn solve the problem on the bse of utomton theory. In this pper we tke look t the second option nd which clsses of lnguge cn be lerned of the different lgorithms. We focus on three different ides to pproch n lgorithm, where everyone is using different method to solve the problem. The first solution, tht is presented, is from Efim Kinber[6] who bsed his ide on Angluin s model. The lerning process in this model is n interction between lerner nd techer. Actul the lerner is sking questions of certin type nd the techer gives correct nswers. Out of this questions nd fter finite number of them the lerner must be ble to give regulr expression, which is in certin clss. This clss must be known by the lerner nd is set by the techer. D. Angluin herself presented polynomil-time lgorithm which uses membership n equivlence query for building (miniml) deterministic finite utomt. In the lgorithm presented her, the membership query is chnged bit. If the queried string is not in the tsked lnguge the techer does not only response no, wht he does in

2 2 membership query, he returns n exmple, which is in the trget lnguge, not mentioned before nd hs the smllest edit distnce from the queried string. Out of these questions the regulr expression is built directly nd the utomton is just implicit in the bckground. The reson why regulr expressions re better for describing lnguge is, tht mostly they re better delble for humns thn describing lnguge by n utomton. This lgorithm will be explined in section 3. The next lgorithmic strtegy is from Henning Fernu[2]. It is bsed on the usge of deterministic finite utomtons to find the regulr expression for the given lnguge. Most lgorithms for infering regulr expressions re bsed on utomton so this strtegy is most common. The disdvntge of using deterministic finite utomtons is tht building regulr expressions out of them will often result in clumsy nd lengthy expression. This expression is not very comprehensible for humns. This blow up of the expression hs two resons. Even when the utomton hs no loops the regulr expression will experience blow up of qudrtic size due to repeted sub-structures. If the utomton hs loops the blow-up is ctully bout c n, to build the regulr expression out of n n-stte deterministic finite utomton. A humn who wnts to check such n expression for correctness might be esily detested of the result. But opertions on DFA s re very fst which might outblnce the blow up in size for specil pplictions. The third solution is to use non-deterministic finite utomtons. The lgorithm, presented in section 5 DeLeTe2 from Frncios Denis, Aurelien Lemy nd Alin Terlutte[4] belongs to this clss. It s bsed on Residul Finite Stte Automton(RFSA) which re specil form of non-deterministic finite utomtons. Every regulr lnguge cn be represented by n RFSA. Cnonicl RFSA s re much smller thn their relted miniml deterministic finite utomton nd cn be used for rndomly generted lnguges. If the regulr lnguge is built by rndom generted deterministic finite utomton the dvntge in size is not so big, but if the lnguge is built by rndom generted non-deterministic finite utomton or regulr expression the cnonicl RFSA is much smller thn the miniml deterministic finite utomton. The dvntge of this lgorithm is tht it cn del with ny regulr expression nd hs not such strict limittions on the lnguge tht cn be build. The disdvntge is, tht opertions on RFSA s re more expensive thn on DFA s. 2 Nottion nd Preliminries In this Section, we wnt to fix some nottions nd preliminries tht re used in every lgorithm of this pper. Some specil definitions re done in the explicit cption of the lgorithms. For more detiled informtions nd the missing proofs plese hve look into [1],[2],[3],[4]nd[6]. Let Σ be finite lphbet nd Σ set of words on Σ. A lnguge cn be ny subset of Σ. The length of word u is u. uv is the connection of the two words u nd v. The Levenshtein edit distnce d(u,v) is defined s minimum number of opertions, which re needed to convert the one string in the other. An opertion cn be n insertion, deletion or substitution opertion. 3 Lerning R1 + Vi Membership nd Correction Queries With the lgorithm presented now, you cn lern so clled indexble clsses of recursive lnguges over Σ. An indexble recursive clss of lnguges L is clss where you cn find n effective numbering L i,i =,1,2,... of ll the lnguges L L so tht for ny word w Σ nd n index i L i exists function which outputs 1 if w L i nd if not.

3 3 The lerning process is bsed on n lgorithmic device which is the lerner nd techer, who hs n orcle function tht truthfully nswers the questions of the lerner. After sking the techer question the lerner cn either generte new question to the orcle, or he cn chnge the index of lnguge in L. The lerner lerned the lnguge if L L nd if the index-shift ws right. The lerner lerned the complete lnguge L if he hs lerned every lnguge L L. membership nd correction queries : If the lerner is sking membership queries he cn only become the nswers yes or no. If he is sking correction query nd the nswer is negtive, he is not just receiving no, the techer is lso correcting the queried string w nd responses v such tht: v = w d(v,w) =min{d(v,w) u L,u / A} where A is the set of words tht hve been mentioned before in the querying process. If string v doesn t exists, the techer responses the shortest string v such tht d(v, w) = min{d(v, w) u L, u / A}. He never mentions string twice nd he lwys returns the smllest string in lexicogrphic order. If even no such string exists the techer returns ε / Σ. Le ft ligned regulr expressions : A regulr expression over n lphbet Σ: u 1 (v 1 ) +...u n (v n ) +, where (v i ) + indictes loop. u i,v i,i = 1,2,..n re strings over Σ. The regulr expression is clled left ligned when ll loops re s left s possible. The regulr expression: belongs to the unique left-ligned expression: () + bccd(cd) + ddbb + b + (bb) + () + bc(cd) + cdddb + bb(bb) +. The lest preliminries we hve to mke is tht if we hve sub-expression-loop ((u) i ) + there must not be string like ((u) j) + where i, j N in the direct neighbourhood of the first string. All regulr expressions following these rules re in the clss R1 +. lerning R1 + The following lerning lgorithm is lerning ny lnguge in R1 + with one correction query nd membership queries. The work of the lgorithm will be explined by n exmple. Let s tke the R1 + expression () + b + b(b) + bb + b + s our trget lnguge L. The first step of the lgorithm is to sk the one specil correction query. The techer will nswer the shortest possible nswer: bbbbbb. Now the rel tsk strts. As first step we re serching for one-letter-loops. So the lerner is seprting the input string whenever new token is red: r 1 =,bb,,b,,bb,,b. You cn seprte the word like this, becuse of the left-lignment of

4 4 the lnguge R1 + nd becuse it is not llowed to hve loops of the sme letter in directly neighbourhood. Out of r the lerner is sking for every built string, if there could be loop. For testing if in is one-letter-loop the lerner is sking bbbbbb nd the nswer is no, becuse includes twoletter-loop nd single, so you lwys hve n odd number of. If would involve one-letter-loop you would lso be ble to build n even number of. The lerner repets his question for every string out of r. So the next question will be: bbbbbbb nd the nswer of the orcle is: yes. Now the lerner knows tht there must be one-letter-loop t the bb prt nd becuse of the left-lignment the lerner knows now tht our lnguge looks like b + bbbbb. After testing every possible one-letter-loop the lerner knows tht the expression looks like p 1 = b + bbbb + b +. In the next step, the lgorithm will serch for every two-letter-loops. The proceed is the sme like serching for the one-letter-loops. At first you seprte the word into every possible two-letter-loop string r 2 =,b,b,b,b,bb. The lgorithm will test every possibility with membership query. For testing the prt, whether there is two-letter-loop the lerner sks: bbbbbb nd the nswer is yes. Tht cn only men tht the loop is in the two leftmost s. So now the lerner knows tht the expression looks like: () + b + bbbb + b +. After testing every two-letter-loop the lerner knows, tht the expression looks like p 2 = () + b + b(b) + bb + b + nd of course this is the lnguge we re serching for but our lerner doesn t know this. So he will try to find the next loop, three-letter one. For this he proceed like before seprting the word into every possible three-letter-loop. This is only possible t r 3 = bb becuse this is the only three letters together with none of them included into loop before. The lerner will sk the techer if bbbbbbbb is correct word nd the nswer is no. But now the techer hs no more correct word tht hsn t been mentioned in the querying process before so he cn t correct the question nd will return ε which is not in Σ. This results in the determintion of our lgorithmic lerner becuse he knows, tht he hs finished nd returns the lerned expression: () + b + b(b) + bb + b + This is only the ide of the lgorithm. The pseudo-code implementtion of Efim Kimber [6] fits in the time complexity clss of O(n 5 ). The totl numbers of queries is in O(n 3 ). For every query the lerner sks, the lgorithm tkes time of O(n 2 ). It might be interesting if some modifictions of the clss R1 + re lso lernble in polynomil-time. The clss R1 might be such modifiction, where loops (v) re rther used thn the (v) + loops in R1 +. Probbly this clss is too hrd to lern in polynomil time but the modifiction R2 which only contins loops like (v) is possible under the constrint tht v doesn t contin ny repetitions e.g. v = b would not be llowed. So only one-letter-loops re llowed. A regulr expression of this type could look like b b b b. You see know tht the lgorithm doesn t only find the regulr expression for lnguges which re in R1 +. If you chnge the preliminries just little bit you cn lso use the lgorithm for modifictions of R1.

5 5 4 Lerning SL vi SL in f ere In this section we discuss how to lern the lnguge S L. The bsic concept is the sme like lerning R1 + but this time we use deterministic finite utomtons to lern the lnguge. These so clled exct lnguge S L is lso indexble like R1 +. But it lso hs some different specifictions: 1. If the lerners new hypothesis only depends on the previous hypothesis nd the lst input word, the lerner is clled itertive. 2. A conservtive lerner sserts his hypothesis s long s he hsn t seen dt dissenting his hypothesis. 3. A consistent lerner reflects ll the dt he hs immeditely in correct hypotheses. 4. A strong monotonic lerner produces lwys strem of hypothesis describing n ugmenting chin of lnguges, i.e., the new hypothesis lnguge is lwys superset of the previous one. [pper] 5. The lerner is clled rerrngement-independent or order-independent, if he concludes to the sme hypothesis if he hs seen either the sequence E()1,E(2),...E(n) or E(π n (1)),...E(π n ()) where π n could be ny permuttion of {1,...n}. 6. The lerner is set-driven, if his hypothesis h doesn t depend on if he hs either seen E(1),...,E(n) or F(1),...,F(n), where {E(1),...,E(n)} = {F(1),...,F(n)}. Ech of this rules is restriction of the lernble lnguge clss themselves. This lgorithm uses the bsic techniques of left-lignment nd blockwise grouping. Blockwisegrouping is very fmilir to wht we hve done in 3. In 3. we hve split our word whenever we hve red different chrcter. Let s tke: bc, b, b, bbcc s n exmple. Then the blockwise grouping would give us: [][b][c][],[][b],[][b][],[][bb][c][][c]. The squre brckets indictes the block letters. Any [x n ] n 1 is clled block letter whenever x Σ. x is clled the bsic letter of [x n ]. In the next step we lign the blocks: [] [b] [c] [] [] [b] [] [b] [] [] [bb] [c] [] [c] The exmple bove shows left-ligned lignment. This is wht we, s humns, would utomticlly do. If we should describe how the exmple regulr expression is build we would do this s following: the

6 6 expression strts with one or two s followed by one or two b s possibly followed by nothing or n or c... nd so one. You could lso choose other lignments for this expression. Mybe you would prefer to describe the exmple s follows: The expression mybe strts with one or two s followed mybe by one or two b s or n. Then perhps cme c or b followed mybe by on or two s. And finishes propbly by b or c. [] [b] [c] [] [] [b] [] [b] [] [] [bb] [c] [] [c] Finding the best lignment is NP-hrd. Due to this nd becuse of the psychologicl point of the left-lignment we restrict our ttention to leftmost lignments. So for our lnguge we would find the following regulr expression: ( )(b bb)(λ c( )(λ c) ) This regulr expression is still finite lnguge, but very specil one becuse we sy only one or two repetitions nd if we would hve up to five repetitions we would hve to write ( ) This is very clumsy so we generlize to one or more repetitions with +. Moreover is shorter explntion (regulr expression) of the given input better to rech the gol of Minimum Description-Length. + b + (λ c + (λ c) ) We use the x + nottion nd not the x nottion to not destroy the blockwise redings we provide t the beginning. Now we see the lerning lgorithm for SL in f er. The lgorithm cn be split up into two min prts. Algorithm-prt 1 crete tree(i) At first we hve to mke the definition how to split up the tree. For ech symbol Σ nd I Σ pplies: I() = w I w strts with. I() mens tht there exists t lest one word w witch strts with t lest one. I = v bσ b n ( n v I()) I elimintes ll leding s of ll words w in the set of given words. The I + is stnding for rooted lbelled directed tree. We first compute I(),I for ech Σ: I + =I = I + =I +(b) = {bc,b,b,bbcc} {bc,b,b,bbcc} I+ b =I+ b () = I+ b (c) = {c,,cc} I+ b = {} I bc + =I bc + () = {, c} I+ bc =I+ bc (c) = {c} I+ bcc = {}

7 7 q I + = {bc,b,b,bbcc} q b I + = {bc,b,b,bbcc} b q c I b + = {c,,cc} c I b q d + = {} q e I+ bc = {,c} q f I bc + = {c} c q g I bcc + = {} Figure 1: A strt tree Expressions like or bb doesn t leve ny trce in I +. Both terms of bc re eliminted in one step when I+ or I+ bc is clled. Becuse I+ b = {} we continue to lign I+ bc = {,c}. So the tree of our exmple is lbeled s follwos: I +,I+,I + b,i+ b,i+ bc,i+ bc,i+ bcc. In the tree leves re lwys lbelled with the empty set. This is shown in Fig. 1. The lterntive node lbeling convention is shown in Fig. 2. In fig. 2 the tree from fig. 1 is trnsformed into generlized NFA. The root becme n initil stte. If node is lbeld by the stte I x (), every word, which beginns t this stte of the utomton with n is written behind I x (). Between the prent node nd the child node is written, those letters which cn be red next. So we hve t first written on the edge {,} nd then the child node is written I + () nd () is eliminted when the utomton leves the node of I + (). This leds to some generlistion becuse the word bb will now be ccepted lthough it is not in our set of lerned words (bb / I + ). [...]According to the following principle, which is common chrcteristics of lignment-bsed lerning lgorithms: ligned pieces of words re considered to be interchngeble.[...] (Henning Fernu, 29). So we hve to do some generlistion nd this form we did so fr is not very ggressive, since it cretes only finite lnguges given finite number of exmples. For building infinite lnguges out of finite exmples we need to introduce loops. Now we turn the generlize NFA into generlize deterministic finite utomton(dfa). Algorithm-prt 2 generlizesimple

8 8 r {,} I + () = {bc,b,b,bbcc} {b,bb} I +(b) = {bc,b,b,bbcc} c I b + () = {} I b + (c) = {c,cc} {,} I bc + () = {,c} c I bc + (c) = {c} Figure 2: The resulting generlized NFA

9 9 b b c c Figure 3: The resulting DFA In our DFA every trnsition crries exctly one lbel. So if we tke look t fig. 2 the first trnsition is lbelled with {, }. This lbelling will not be possible nymore. Whenever trnsition α is lbelled with m>1 words, then we tke only the shortest word of the set s lbel of the trnsition α. In our exmple we would tke s lbelling for α. To mke it possible, tht the longer repetitions of, in our cse cn be reched by the utomton we use self-loop, lbelled with t the node, the trnsition α is showed in fig. 3. Also see fig. 3 for the resulting DFA. The lnguge SL includes ll lnguges tht re left-ligned nd simple looping. You hve lredy seen wht left-lignment mens. Simple looping mens, tht the expression is [...] finite union of pirwise left-lighned expressions α such tht either α = λ or the cn be written in the following norml f orm: where α = α k 1 1 αx 1 1 αk 2 2 αx αk k k αx k k. ll i re single symbols from the bsic lphbet Σ for ll 1 i < K, i i+1 ech k i is some positive integer, nd

10 1 x i equls either or * (if x i =, the prt i of the expression will not be written down, since it denotes the empty word). [...] Henning Fernu,29). So SL in f ere is getting finite set of exmples nd computes out of them n infinite lnguge. This lgorithm needs set of words before he strts his computtion becuse the lgorithm prt one is preprocessing of the prt two. Algorithms like this re clled exct lerning lgorithms. In distinction to the first lgorithm discussed in this pper, which gives us directly regulr expression s result, this one gives deterministic finite utomton. 5 Lerning rndom lnguges Vi DeLeTe2 The lgorithm DeLeTe2 is using residul finite utomtons (RFSA). To understnd the lgorithm nd this specil form of non-deterministic utomtons we need some more preliminries: Residul Lnguge: The residul lnguge of the lnguge L regrding to u u Σ is defined by u 1 L = v Σ uv L. For every stte q in DFA exists unique residul lnguge u 1 L such tht u 1 L = L q nd lso reverse.[3] Cnonicl RFSA nd prime residul lnguges: A miniml cnonicl RFSA cn represent every regulr lnguge L. The sttes of the miniml cnonicl RFSA corresponds to the prime residul lnguge. A lnguge u 1 is prime if u 1 cn not be build s union of residul lnguges it strictly contins. u 1 is prime if nd only if: {v 1 L v 1 L u 1 L} u 1 L If the lnguge is not prime, it is composed. We tke L = ε Σ + s n exmple for rndom generted regulr expression. The miniml DFA ccepting L is shown in fig.4. The residul lnguge of L A is: L q = Σ = L q1 =1 + 1 Σ = L q2 =Σ + = L q3 =Σ = ε () 1 L q1 L q 2 = prime sttes. L q3 = L q L q1 L q2 so it is not prime, it is composite. The residul lnguge is the prt behind the second eqution. For L q ε is the shortest word in lexicogrphic order, tht cn be tken to unmbiguous describe how to rech stte L q from the strt stte. It s the sme for the other sttes.

11 11 1 q 1 1 strt q,1,1 q 2 q 3 Figure 4: The miniml DFA (A) 1,1 strt ε,1 ε,,1 Figure 5: The cnonicl RFSA

12 12 Short Prefix SP(L) nd Kernl K(L) The Short Prefix nd the Kernl re defined s following: SP(L) = {u q q p} K(L) = {u q x q p,x Σ,δ(q,x) /} where q is the mximum prime stte of the utomton A nd x ny symbol in Σ. In the exmple the mximum prime stte is q 2. So SP(L) = {ε,,1} K(L) = {,1,,1,1,11} complete smple (for short) A complete smple S for inclusion reltions mens, tht this is the minimum smple which describes the inclusion reltions between the residul lnguges without loosing informtion. In this smple SP(L) must not be longer thn q becuse the prime sttes re in lexicogrphic order nd the biggest prime stte is the one, reched t lest. So if the length of the smple is possible to rech the lst prime stte, it is lso possible to rech ll other. K(L) is SP(L) x x Σndx ε. So smple S is complete for inclusion over regulr lnguge L if u SP(L) K(L),u Pre f (S + ) SP(L) L s + u SP(L), v SP(L) K(L),u 1 L v 1 L w such tht uw S + nd vw S. Pre f is ordered in length-lexicogrphic order. Where S + is the set of minimum positive smples nd S the minimum set of negtive smples. S + S = S. The size of complete smple is in O(n 5 ) which includes O(n 2 ) words whose length is t most O(n 3 ) nd n is the size of the minimum DFT. If w is for instnce word of u 1 Lv 1 L, so w n 2 nd u n thn uw thn S contins words smller thn n 3. For every regulr lnguge L there exists complete smple like tht. Let u,v S + nd vw S for smple S we define: u v if w uw S + vw S u v if u v nd v u for ny S, nd ny u,v Pre f (S + ) it obeys tht u 1 L = v 1 L u v nd u 1 L v 1 L u v. Refer to [Pper 3]. So in the exmple S + = {ε,1,,1,1} nd S = {,1,111}. The following tble is showing the reltion between SP(L) nd SP(L) K(L). If there is word w in the tble, where u is the lbel of the row nd v the lbel of the column, it mens tht uw S + nd vw S. An utomton A = Σ,Q,Q,F,δ, where Σ is the lphbet, the utomton uses, Q is the set of sttes, Q is the initil stte, F re the finl sttes nd δ is the trnsfer function. Now we present the lgorithm DeLeTe2. From smple S of the trget lnguge L, which is complete for inclusion reltions of L, DeLeTe2 builds the utomton A up. So the lgorithm is getting Pre f = {u,u 1,...u n } s set of prefixes of S + s input. Strting with n empty utomton Q = Q = F = δ = / nd u = ε the lgorithm checks the prefixes of positive exmples if they considers s new stte in A up.

13 13 Tble 1: reltion between SP(L) nd SP(L) K(L) ε ε ε ε ε We check first, if u is not rel new informtion. If there lredy exits n u Q such tht u u the informtion in u is not new one. u is equivlent to stte in Q nd cn lredy be reched by the utomton. In this cse we simply delete uσ from Pre f. If we hven t hd true t the first condition, u is new stte in Q so we dd u to Q (Q = Q {u}). Then the lgorithm checks, if u ε becuse then u is strt stte nd we would hve to dd it there: Q = Q {u}. u is F in detil u is n element of the finl sttes if u S +. If u S + u hs to be dded in F = F {u}. Also we hve to dd the corresponding trnsitions δ. There we check in to steps if there is trnsition from u to u which hs to dd or trnsition u to u, where u Q δ = δ {(u,x,u) u Q,u x Pre f,u u x} {(u,x,u ) u Q,ux Pre f,u ux} The lst two prts re working equivlent for trnsitions from u to u nd from u to u. It is checking for ech u Q including the just before dded u (becuse of self loops) if there is trnsition from one stte to the other. Exemplrily of the first prt, the next check is if there is u x Pre f where x Σ. This checks, if there exists n u tht is not finished lredy. An u where there re still shortest prefixes tht hve not been eliminted from pre f strting with u. u u x checks, tht there is no trnsition dded, tht is impossible becuse of L. If ll conditions re true, the trnsition u,x,u, in detil the trnsition from u to u vi trnsition condition x. We set u = the next element of Pre f. If u ws the lst word of Pre f or if the utomton A up is consistent with the given smple S the lgorithm ends, returning A up. In our exmple Pre f = {ε,,1,,1,1,11}. In the first step, stte ε is dded becuse t the beginning of the lgorithm before strting the loop, we set u = ε. ε / Q becuse Q is empty. So we dd ε to Q. ε ε so ε is lso Q. ε S + so dditionlly ε F. The trnsitions, tht hve to be dd cn be seen directly out of tble 1: ε ε1. Where every entry in tble 1 is used, where u = ε nd v kσ k Q. This limittion is becuse n entry ε 1 mens, tht there is trnsition from 1 to ε with the trnsition condition. We cn t dd n entry with k = 1 becuse 1 / Q, so we hve no stte Q lerned until know nd of cuse cn t dd trnsitions to stte we doesn t know so fr. Only the trnsition ε ε1 is ok, becuse we use there the implicit ε stnding before the 1. The result fter the first step is shown in fig. 6. Pre f = {ε,,1,,1,1,11} Q = {ε} Q = {ε} F = {ε} δ = {ε ε1}

14 14 1 strt ε Figure 6: FSA fter the first step,1 1 strt ε,1 Figure 7: FSA fter the second step Now the lgorithm tke look t becuse it is the next element of Pre f. ε so is dd to the sttes Q. ε so is no initil stte. / S + so is lso no finl stte. The trnsitions, tht hve to be dded re: ε,, 1,ε,ε 1. The result fter step 2 is shown in fig. 7. Pre f = {ε,,1,,1,1,11} Q = {ε,} Q = {ε} F = {ε} δ = {ε ε1, ε,, 1,ε,ε 1} In the third step, the lgorithm is tking u = 1 becuse 1 is the next element in pre f. 1 ε becuse 1 ε nd ε 1. So 1Σ is deleted form Pe f. Pre f = {ε,,,1} Q = {ε,} Q = {ε} F = {ε} δ = {ε ε1, ε,, 1,ε,ε 1} In the fourth step the lgorithm tkes the next element in Pre f =. ε nd, so is new stte. ε so is not new strt stte but S + so is finl stte. The trnsitions, tht hve to be dd re: ε, ε, 1,, 1. Pre f = {ε,,,1} Q = {ε,,}

15 15 1,1 strt ε,1 ε,,1 Figure 8: FSA fter fourth step Q = {ε} F = {ε,} δ = { ε,, 1,ε,ε 1, ε, ε, 1,, 1} Now, the lgorithm termintes, becuse the utomton is consistent with S. The output is sturted subutomton A up of L. This lgorithm is very flexible over the input lnguge. There re no strict limittions except, tht L + must be complete for inclusion reltions. If the given smple S + is complete, this lgorithm cn build cnonicl FSA. The miniml cnonicl FSA is lwys shorter thn n miniml DFA, so the resulting regulr expression will be shorter. [...]The time complexity of DeLeTe2 is bounded by O(n 4 ).[...](Topics in grmmticl inference, 216)[9] 6 Conclusions, Results, Discussion In the three sections bove we hve seen three different lgorithms to solve the problem of lerning infinite regulr lnguge just by finite set of smples. The three lgorithms re joint by the property, tht there is lerner (the lgorithm) nd techer or orcle, who knows which smples re correct n which not. This techer must know how the lnguge should look like, but the formultion itself, s regulr lnguge, is done by the lgorithm. The first lgorithm, we presented, ws lerning R1 + vi membership nd correction queries. This one gives directly regulr expression s solution. By contrst to the other two lgorithms, the lerning process is continuously interction from lerner nd techer. Becuse the lgorithm is lwys sking if the next possibility, he computes, is in the lnguge or not, nd if not he directly gets correction to true positive smple of the lnguge. The dvntge of this procedure is, tht the techer hs not to think bout complete smple, describing the lnguge. This is done by the lgorithm by sking the next correction query. The disdvntge is, tht the lnguge R1 + is very strict, nd you must be sure tht your trget lnguge is in R1 + or it wouldn t work. The lgorithm is in the complexity clss of O(n 5 ). The second lgorithm SL in f ere is lerning the lnguge vi DFT. Here the interction between the lerner nd the techer is just t the beginning, where the lerner gets set of smples. Out of this set he clcultes strt tree, which is prefix tree. From this strt tree he clcultes NFA which looks like the strt tree, becuse there ws just relbelling of nodes nd trnsitions. From this NFA, the lgorithm is clculting the DFA by introducing loops, but the structure of the tree is still intct. The dvntge of

16 16 using DFA s is, tht clcultions on DFA s re very fst, but the lnguge is lso limited s the lnguge in the first lgorithm. And the second negtive point is, tht building regulr expression out of DFA, is clumsy nd not good redble or comprehensible. The third lgorithm ws DeLeTe2. This lgorithm hs no restrictions to the lernble lnguges, it just needs n input set, tht is complete for inclusion reltions, becuse it hst no structure or limittion of the lnguge, where it cn bse on his suggestions. In the exmple we showed the input on DFA nd regulr expression. We hve done some pre-clcultions, to show, wht DeLeTe2 needs in ddition to its input smple. In this lgorithm, it is only described wht the lgorithm does, if it hs this pre-clcultions, but of cuse this is n implementtion decision. After the pre-clcultions re done, DeLeTe2 checks for every symbol, if it is new stte or not. If it is new stte, he clcultes, whether it is strt or finl stte nd the new trnsitions tht hve to be fit in the utomton. The resulting NFA is smller thn the DFA from the lgorithm bove, but clcultions on NFA s re not s fst s clcultions on DFT s. There hsn t been mny reserch bout DeLeTe2 t ll so there cn be lot of chnge in the next yers. The use of one of the lgorithms depends on the lnguge-clss the lerned lnguge is in. If the lnguge is for sure in one of the first two clsses, one of these two lgorithms might be better. Not only from performnce perspective but lso for pprecition. At lest we wnt to give smll outlook wht cn be done with this kind of lgorithms in embedded systems. In embedded systems there re lwys hrd limittions on resources like computtion power nd storge plce. These lgorithms help to mke expressions more compct, so tht they doesn t wst so much power or plce. References [1] Colin de l Higuer. Grmmticl Inference: Lerning Automt nd Grmmrs. 21. [2] Henning Fernu. Algorithms for lerning regulr expressions from positive dt. 29. [3] Alin Terlutte Frncois Denis, Aurelien Lemy. Residul finite stte utomt. [4] Alin Terlutte Frncois Denis, Aurelien Lemy. Lerning regulr lguges using rfss. 24. [5] José M. Sempere Jeffrey Heinz. Topics in Grmmticl Inference [6] Efim Kimber. On lerning regulr expressions nd ptterns vi membership nd correction queries. 28. [7] R.J. vn Glbbeek. The eptcs bibliogrphy style, 21.

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

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!) CMSC 330: Orgniztion of Progrmming Lnguges DFAs, nd NFAs, nd Regexps (Oh my!) CMSC330 Spring 2018 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All

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

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

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

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

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

CS 275 Automata and Formal Language Theory

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

More information

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

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

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

More information

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

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

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

More information

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

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

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

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

Learning Moore Machines from Input-Output Traces

Learning Moore Machines from Input-Output Traces Lerning Moore Mchines from Input-Output Trces Georgios Gintmidis 1 nd Stvros Tripkis 1,2 1 Alto University, Finlnd 2 UC Berkeley, USA Motivtion: lerning models from blck boxes Inputs? Lerner Forml Model

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

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

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

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)

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

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

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

Theory of Computation Regular Languages

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

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

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

More information

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa CS:4330 Theory of Computtion Spring 208 Regulr Lnguges Equivlences between Finite utomt nd REs Hniel Brbos Redings for this lecture Chpter of [Sipser 996], 3rd edition. Section.3. Finite utomt nd regulr

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

Automata and Languages

Automata and Languages Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive

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

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

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

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

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

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

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

Where did dynamic programming come from?

Where did dynamic programming come from? Where did dynmic progrmming come from? String lgorithms Dvid Kuchk cs302 Spring 2012 Richrd ellmn On the irth of Dynmic Progrmming Sturt Dreyfus http://www.eng.tu.c.il/~mi/cd/ or50/1526-5463-2002-50-01-0048.pdf

More information

Chapter 0. What is the Lebesgue integral about?

Chapter 0. What is the Lebesgue integral about? Chpter 0. Wht is the Lebesgue integrl bout? The pln is to hve tutoril sheet ech week, most often on Fridy, (to be done during the clss) where you will try to get used to the ides introduced in the previous

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

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

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

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

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

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

Learning Regular Languages over Large Alphabets

Learning Regular Languages over Large Alphabets Irini-Eleftheri Mens VERIMAG, University of Grenoble-Alpes Lerning Regulr Lnguges over Lrge Alphbets 10 October 2017 Jury Members Oded Mler Directeur de thèse Lurent Fribourg Exminteur Dn Angluin Rpporteur

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

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

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

Coalgebra, Lecture 15: Equations for Deterministic Automata

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

More information

Math Lecture 23

Math Lecture 23 Mth 8 - Lecture 3 Dyln Zwick Fll 3 In our lst lecture we delt with solutions to the system: x = Ax where A is n n n mtrix with n distinct eigenvlues. As promised, tody we will del with the question of

More information

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies Stte spce systems nlysis (continued) Stbility A. Definitions A system is sid to be Asymptoticlly Stble (AS) when it stisfies ut () = 0, t > 0 lim xt () 0. t A system is AS if nd only if the impulse response

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

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

SUMMER KNOWHOW STUDY AND LEARNING CENTRE SUMMER KNOWHOW STUDY AND LEARNING CENTRE Indices & Logrithms 2 Contents Indices.2 Frctionl Indices.4 Logrithms 6 Exponentil equtions. Simplifying Surds 13 Opertions on Surds..16 Scientific Nottion..18

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

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

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

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages Automt & lnguges A primer on the Theory of Computtion Lurent Vnbever www.vnbever.eu Prt 5 out of 5 ETH Zürich (D-ITET) October, 19 2017 Lst week ws ll bout Context-Free Lnguges Context-Free Lnguges superset

More information

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives Block #6: Properties of Integrls, Indefinite Integrls Gols: Definition of the Definite Integrl Integrl Clcultions using Antiderivtives Properties of Integrls The Indefinite Integrl 1 Riemnn Sums - 1 Riemnn

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

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

Lecture 6 Regular Grammars

Lecture 6 Regular Grammars Lecture 6 Regulr Grmmrs COT 4420 Theory of Computtion Section 3.3 Grmmr A grmmr G is defined s qudruple G = (V, T, S, P) V is finite set of vribles T is finite set of terminl symbols S V is specil vrible

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

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

Deterministic Finite-State Automata

Deterministic Finite-State Automata Deterministic Finite-Stte Automt Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 12 August 2013 Outline 1 Introduction 2 Exmple DFA 1 DFA for Odd number of

More information

Vyacheslav Telnin. Search for New Numbers.

Vyacheslav Telnin. Search for New Numbers. Vycheslv Telnin Serch for New Numbers. 1 CHAPTER I 2 I.1 Introduction. In 1984, in the first issue for tht yer of the Science nd Life mgzine, I red the rticle "Non-Stndrd Anlysis" by V. Uspensky, in which

More information

Equations and Inequalities

Equations and Inequalities Equtions nd Inequlities Equtions nd Inequlities Curriculum Redy ACMNA: 4, 5, 6, 7, 40 www.mthletics.com Equtions EQUATIONS & Inequlities & INEQUALITIES Sometimes just writing vribles or pronumerls in

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

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

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

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

The First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a).

The First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a). The Fundmentl Theorems of Clculus Mth 4, Section 0, Spring 009 We now know enough bout definite integrls to give precise formultions of the Fundmentl Theorems of Clculus. We will lso look t some bsic emples

More information

Lexical Analysis Finite Automate

Lexical Analysis Finite Automate Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition

More information

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7 CS103 Hndout 32 Fll 2016 Novemer 11, 2016 Prolem Set 7 Wht cn you do with regulr expressions? Wht re the limits of regulr lnguges? On this prolem set, you'll find out! As lwys, plese feel free to drop

More information

Riemann Sums and Riemann Integrals

Riemann Sums and Riemann Integrals Riemnn Sums nd Riemnn Integrls Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University August 26, 2013 Outline 1 Riemnn Sums 2 Riemnn Integrls 3 Properties

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

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

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

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

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

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

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

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

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite Unit #8 : The Integrl Gols: Determine how to clculte the re described by function. Define the definite integrl. Eplore the reltionship between the definite integrl nd re. Eplore wys to estimte the definite

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

Riemann Sums and Riemann Integrals

Riemann Sums and Riemann Integrals Riemnn Sums nd Riemnn Integrls Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University August 26, 203 Outline Riemnn Sums Riemnn Integrls Properties Abstrct

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

Matrix Solution to Linear Equations and Markov Chains

Matrix Solution to Linear Equations and Markov Chains Trding Systems nd Methods, Fifth Edition By Perry J. Kufmn Copyright 2005, 2013 by Perry J. Kufmn APPENDIX 2 Mtrix Solution to Liner Equtions nd Mrkov Chins DIRECT SOLUTION AND CONVERGENCE METHOD Before

More information

7.2 The Definite Integral

7.2 The Definite Integral 7.2 The Definite Integrl the definite integrl In the previous section, it ws found tht if function f is continuous nd nonnegtive, then the re under the grph of f on [, b] is given by F (b) F (), where

More information

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1 Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges

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

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

Turing Machines Part One

Turing Machines Part One Turing Mchines Prt One Wht problems cn we solve with computer? Regulr Lnguges CFLs Lnguges recognizble by ny fesible computing mchine All Lnguges Tht sme drwing, to scle. All Lnguges The Problem Finite

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

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

Module 9: Tries and String Matching

Module 9: Tries and String Matching Module 9: Tries nd String Mtching CS 240 - Dt Structures nd Dt Mngement Sjed Hque Veronik Irvine Tylor Smith Bsed on lecture notes by mny previous cs240 instructors Dvid R. Cheriton School of Computer

More information

Module 9: Tries and String Matching

Module 9: Tries and String Matching Module 9: Tries nd String Mtching CS 240 - Dt Structures nd Dt Mngement Sjed Hque Veronik Irvine Tylor Smith Bsed on lecture notes by mny previous cs240 instructors Dvid R. Cheriton School of Computer

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

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

This lecture covers Chapter 8 of HMU: Properties of CFLs

This lecture covers Chapter 8 of HMU: Properties of CFLs This lecture covers Chpter 8 of HMU: Properties of CFLs Turing Mchine Extensions of Turing Mchines Restrictions of Turing Mchines Additionl Reding: Chpter 8 of HMU. Turing Mchine: Informl Definition B

More information

SOLUTIONS FOR ADMISSIONS TEST IN MATHEMATICS, COMPUTER SCIENCE AND JOINT SCHOOLS WEDNESDAY 5 NOVEMBER 2014

SOLUTIONS FOR ADMISSIONS TEST IN MATHEMATICS, COMPUTER SCIENCE AND JOINT SCHOOLS WEDNESDAY 5 NOVEMBER 2014 SOLUTIONS FOR ADMISSIONS TEST IN MATHEMATICS, COMPUTER SCIENCE AND JOINT SCHOOLS WEDNESDAY 5 NOVEMBER 014 Mrk Scheme: Ech prt of Question 1 is worth four mrks which re wrded solely for the correct nswer.

More information