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


 Madeline Cleopatra Ward
 4 years ago
 Views:
Transcription
1 Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge. We sy tht the vlue of regulr expression is lnguge. Regulr lnguges re those lnguges tht my e generted from regulr expression. 1.1 Forml Definition of Regulr Expression R is regulr expression if R is: 1. for some in the lphet ±. (This corresponds to the lnguge fg.) 2. ffl (This corresponds to the lnguge contining only the empty string ffl: i.e., ffflg.) 3. ; (This corresponds to the empty lnguge.) 4. (R1 [ R2), where R1 nd R2 re regulr expressions. 5. (R1 ffi R2), where R1 nd R2 re regulr expressions. 6. (R1 Λ ), where R1 is regulr expression. In this definition, regulr expressions re defined in terms of smller regulr expressions. A definition of this type is clled n inductive definition: It tells you how to uild up igger regulr expressions from smller ones. 1.2 Some Exmples of Regulr Expressions The vlue of regulr expression is lnguge. Given ± = f0; 1g: 1. 0 Λ 10 Λ = fw j w hs exctly single1g 2. ± Λ 1± Λ = fw j w hs t lest one 1g 3. 1± Λ = fw j w egins with 1g 4. ± Λ 001± Λ = fw j w contins the string 001 s sustringg 1
2 5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9. 1 Λ ; = ; Conctenting the empty set to ny set yields the empty set. 10. ; Λ = ffflg The result of the str opertion on n empty lnguge is the empty string. 11. Question (±±±) Λ = 12. Question 0± Λ 0 [ 1± Λ 1 [ 0 [ 1= 1.3 Some Properties of Regulr Expressions Let R e ny regulr expression: 1. R [;= R Adding the empty lnguge to ny other lnguge leves tht lnguge unchnged. 2. R ffi ffl = R Conctenting the empty string to ny string will not chnge the string. 3. R [ ffl my notethe sme s R. If R =, then L(R) =fg nd L(R [ ffl) =f; fflg. 4. R ffi;my not e the sme s R. If R =, then L(R) =fg ut L(R ffi;)=;. 1.4 Equivlence with Finite Automt Regulr expressions nd finite utomt re equivlent in their descriptive power. Tht is, ny regulr expression cn e converted into finite utomton tht recognizes the lnguge it descries, nd vice vers. Theorem (Sipser's Theorem 1.28) A lnguge is regulr if nd only if some regulr expression descries it. 2
3 2 The Pumping Lemm lemm = def (theorem) n uxiliry proposition (theorem) used in the demonstrtion of nother proposition 2.1 Wht is the Pumping Lemm useful for? ffl We know tht lnguge is regulr if we cn construct finite stte utomton for it. ffl Not ll lnguges re regulr. How do we know if lnguge is not regulr? Cn we simply conclude tht the lnguge is not regulr if we cnnot construct n FSA for it? Not relly. Perhps we were unle to construct n FSA for the lnguge ecuse we hdn't tried hrd enough or ecuse we were unlucky. ffl We need some systemtic method for showing tht lnguge is not regulr nd, therefore, tht n FSA cnnot e constructed for it. ffl The Pumping Lemm sttes deep property tht ll regulr lnguges shre. By showing tht lnguge does not hve the property stted y the Pumping Lemm, we cn gurntee tht it is not regulr. 2.2 The Pigeon Hole Principle ffl If p numer of pigeons re plced into fewer thn p holes, some hole hs to hve more thn one pigeon in it. ffl Similrly, ifn FSA hs n numer of sttes, nd this mchine ccepts strings of length n or greter, it will hve to pss through t lest one stte more thn once in order to ccept such strings. Tht is, there will e loop in the mchine. q 1 ;q 2 ;q 3 ;:::;q k ; :::q k ;:::q n 1;q n ffl This mens tht there is some sustring tht is red y the sequence of sttes: q k ; :::; q k ffl Given string with length n or greter, which hs sustring red y looping through q k, we cn construct even longer strings of the lnguge y repeting (pumping) tht sustring over nd over gin. ffl See lso the discussion in Prtee pges
4 2.3 Wht does the Pumping Lemm sy? Sipser's Theorem 1.37: Pumping Lemm If A is regulr lnguge, then there is numer p (the pumping length) where, if s is ny string in A of length t lest p, then s my edivided into three pieces, s = xyz, stisfying the following conditions: 1. for ech i 0;xy i z 2 A, 2. jyj > 0, nd 3. jxyj»p Trnsltion ffl The Pumping Lemm sys tht if lnguge A is regulr, then ny string in the lnguge will hve certin property, provided tht it is `long enough' (tht is, longer thn some length p, which is the pumping length). Inside ny string in A tht's longer thn p, we will e le to find piece tht cn e repeted (pumped) s mny times s we wnt, nd the result will lwys e string in A. Moreover, this piece cn e found within the first p letters of our string. ffl So, given ny string s in A longer thn p, we cn find sustring in s tht cn e pumped. We'll cll this sustring y. Then nything efore y we'll cll x, nd nything fter y we'll cll z. The whole string cn thus e rewritten s x y z. (Rememer tht x; y; nd z correspond to strings nd not symols of the lphet.) By repeting y zero or more times, we get: xz; xyz; xyyz; xyyyz; :::; xyyyyyyyyyyyyyyz; ::: Wht the Pumping Lemm sys is tht ech of these strings must e in A. ffl Condition 1: for ech i 0;xy i z 2 A" xy 2 z is the sme s xyyz, etc. So this sys tht putting in multiple copies of y (i.e., pumping y) will give you strings tht re still in the lnguge. For i =0,you get no copies of y, i.e., the string xz. ffl Condition 2: jyj > 0" While x or z my hve length zero, the length of y cnnot e zero. Tht is, y is not the empty string. If you llowed y to e the empty string, the theorem would e trivilly true. This is ecuse if y ws the empty string, you would end up with xz, which is just s, the originl string you strted with, no mtter how mny times you pump y. ffl Condition 3: jxyj»p" Since x is the piece efore y, this sys tht ll of y must come from the first p letters of our string s, so tht the comined length of x nd y is t most p. 4
5 2.4 Exmple ffl Let's pply the Pumping Lemm to the following lnguge B. B = fw j w egins with 1 nd ends with 0, with nything in etweeng. Let's ssume tht the pumping length p is 3. Let's tke some string longer thn 3, sy, We cn rek this string down s follows: x =1,y = 01, z = By pumping y, we get: xy 0 z = , xy 1 z = , xy 2 z = , xy 3 z = , xy 4 z = , etc. All of these strings egin with 1 nd end with 0. So, the pumping lemm works for this lnguge nd this string. ffl Question: Wht hppens if we pply the Pumping Lemm to the following lnguge C, ssuming tht the pumping length p is 4? C = f01g 2.5 How to use the Pumping Lemm to prove tht lnguge is not regulr The pumping lemm is most useful when we wnt to prove tht lnguge is not regulr. We do this y using proof y contrdiction. To prove tht lnguge B is not regulr: 1. Assume tht B is regulr. 2. Use the pumping lemm to gurntee the existence of pumping length p such tht ll strings of length p or greter in B cn e pumped. 3. Find string s in B tht hs length p or greter ut tht cnnot e pumped. 4. Demonstrte tht s cnnot e pumped y considering ll wys of dividing s into x, y, nd z, nd for ech division, finding vlue i where xy i z 62 B. ) The existence of s contrdicts the pumping lemm if B were regulr. Hence B cnnot e regulr. 5
6 2.5.2 Exmple 1 (Sipser's Exmple 1.38) (See lso Prtee pges for discussion of this exmple.) Let B e the lnguge f0 n 1 n j n 0g. Show tht B is not regulr, using the pumping lemm. We will do this y ssuming tht B is regulr nd showing tht contrdiction follows. (Therefore, the ssumption we strted out with must hve een wrong, nd thus B is not regulr.) ffl Let p e the pumping length given y the pumping lemm. Choose s to e the string 0 p 1 1 p 1. ffl Becuse s 2 B, nd s hs length greter thn p, the pumping lemm gurntees tht we cn split s into three pieces, s = xyz in such wy thtforny i 0, the string xy i z is in B. We consider three cses to show tht this result is impossile. 1. The string y contins only 0s. In this cse, the string xyyz hs more 0s thn 1s nd so is not memer of B, violting condition 1 of the pumping lemm. This is contrdiction. 2. The string y contins only 1s. In this cse, the string xyyz hs more 1s thn 0s nd so is not memer of B. This is nother contrdiction. 3. The string y contins oth 0s nd 1s. In this cse, the string xyyz my hve the sme numer of 0s nd 1s, ut they will e out of order with some 1s efore 0s. But in our lnguge B, ll the 0s must precede the 1s. Thus, xyyz is not in our lnguge. This is nother contrdiction. ffl There is no other wy to split up the string s, so contrdiction is unvoidle if we mke the ssumption tht B is regulr, nd so B is not regulr. 3 Right Liner Grmmrs Right liner grmmrs re lso clled Type 3 grmmrs. 3.1 Forml Definition of Right Liner Grmmrs ffl A right liner grmmr is 4tuple < T;N;S;R > where: 1. T is finite set of terminls, including the empty string. 2. N is finite set of nonterminls. 3. S is the strt symol. 4. R is finite set of rewrite rules of the form A! xb or A! x, where A nd B stnd for nonterminls nd x stnds for terminl. 6
7 ffl Exmple G1 =< T;N;S;R >, where T = f,g; N = fs,a,bg; nd R = 8 >< >: S! A A! A A! B B! B B! 9 >= >; S A A B B 3.2 Finite Stte Automt nd Right Liner Grmmrs Every FSA hs corresponding right liner grmmr nd vice vers. Tht is, for every FSA, there is n equivlent right liner grmmr tht ccepts the sme lnguge, nd vice vers Converting right liner grmmr to n equivlent FSA 1. S is the strt stte. 2. Associte with ech rule of the form A! xb trnsition in FSA from stte A to stte B reding x. 3. Associte ech rule of the form A! x with trnsition from stte A reding x to finl stte, F. ffl Exmple: Representing G1 ove s FSA: S A B F 7
8 3.2.2 Converting FSA to right liner grmmr 1. The sttes of the FSA ecome the nonterminls of the grmmr, nd the symols of the lphet of the FSA ecome the terminls of the grmmr. 2. q0 ecomes the strt symol S. 3. For ech trnsition ffi(q i ;x) = q j, we put in the grmmr rule q i! xq j. (E.g., the trnsition ffi(a; 0) = B ecomes A! 0B.) 4. For ech trnsition ffi(q i ;x)=q j, Where q j is finl stte, we dd to the grmmr the rule q i! x. (E.g., the trnsition ffi(d; 1) =E where E 2 F, ecomes D! 1.) ffl Exmple: q0 q1 G2 =< T;N;q0;R > where T = f,g; N = fq0,q1g; nd R = 8 >< >: q0! q0 q0! q1 q1! q1 q1! q0 q0! q1! 3.3 English is not regulr lnguge. ffl Exmple 1 Let L = fthe ct died, The ct the dog chsed died, The ct the dog the rt it chsed died, The ct the dog the rt the elephnt dmired it chsed died...g The lnguge L cn siclly e descried s: (noun) n (ver) n. This is nested dependency structure, nd it corresponds to f0 n 1 n j n 0g. We hve lredy shown ove tht this lnguge is not regulr using the pumping lemm. ffl Exmple 2 Let L2 = fjohn nd Mry like to et nd sleep, respectively; John, Mry, nd Sue like to et, sleep, nd dnce, respectively; John, Mry, Sue, nd Bo like to et, sleep, dnce, nd cook, respectively...g 8 9 >= >;
9 This is crossseril dependency structure, lso descried y (noun) n (ver) n, which gin corresponds to f0 n 1 n j n 0g. Of course, we hve lredy seen tht this lnguge is not regulr using the pumping lemm. ffl Other exmples: sujectver greement either...or if...then See the discussion in Prtee pges nd of course Pinker pges
Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages
5//6 Grmmr Automt nd Lnguges Regulr Grmmr Contextfree Grmmr Contextsensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive
More informationTheory 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 informationTheory of Computation Regular Languages
Theory of Computtion Regulr Lnguges BowYw Wng Acdemi Sinic Spring 2012 BowYw 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 informationLecture 08: Feb. 08, 2019
4CS46: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 informationHarvard University Computer Science 121 Midterm October 23, 2012
Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closedook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is
More informationAutomata and Languages
Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Contextfree Grmmr Contextsensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive
More informationConvert 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 informationChapter 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 information1.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 informationCS 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 informationCSCI 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 informationHomework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)
More informationMinimal 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 informationCS 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 informationRegular 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 CSI3104W11 1
More informationCMPSCI 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 informationCHAPTER 1 Regular Languages. Contents
Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Nondeterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr
More informationFor convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir
CSCI 2400 Models of Computtion, Section 3 Solutions to Homework 4 Problem 1. ll the solutions below refer to the Pumping Lemm of Theorem 4.8, pge 119. () L = f n b l k : k n + lg Let's ssume for contrdiction
More informationAUTOMATA 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 informationAssignment 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 informationFormal 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:1018:30 Techer: Dniel Hedin, phone 021107052 The exm
More information1.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 information1 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 informationCHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Nondeterministic Finite Automata (NFA)
Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Nondeterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr
More informationChapter 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 informationHomework Solution  Set 5 Due: Friday 10/03/08
CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution  et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte nonfinl.
More informationIntermediate 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 informationLet's start with an example:
Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte
More informationFundamentals 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 informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 14) Weeks
More informationFirst Midterm Examination
2425 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 informationClosure Properties of Regular Languages
Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L
More informationHomework 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 information1. 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 informationPART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA
PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA RIGHT LINEAR LANGUAGES. Right Liner Grmmr: Rules of the form: A α B, A α A,B V N, α V T + Left Liner Grmmr: Rules of the form: A Bα, A α A,B V N, α V T
More informationTalen 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 informationCISC 4090 Theory of Computation
9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions
More informationFinite Automatacont d
Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automtcont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww
More informationCS103B 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 informationCSCI 340: Computational Models. Transition Graphs. Department of Computer Science
CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t
More informationState 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 informationNondeterministic Finite Automata
Nondeterministic Finite Automt Eliminting nondeterminism Rdoud University Nijmegen Nondeterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent
More information3 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 informationCS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p
More informationName Ima Sample ASU ID
Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:359: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 informationa,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 informationFirst Midterm Examination
Çnky University Deprtment of Computer Engineering 203204 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 informationNondeterministic Finite Automata
Nondeterministic Finite Automt From Regulr Expressions to NFA Eliminting nondeterminism Rdoud University Nijmegen Nondeterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion
More informationCS 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 informationRegular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15
Regulr Lnguge Nonregulr Lnguges The Pumping Lemm Models of Comput=on Chpter 10 Recll, tht ny lnguge tht cn e descried y regulr expression is clled regulr lnguge In this lecture we will prove tht not ll
More informationDesigning 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 informationCS 311 Homework 3 due 16:30, Thursday, 14 th October 2010
CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w
More informationCS 330 Formal Methods and Models
CS 0 Forml Methods nd Models Dn Richrds, George Mson University, Fll 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 8 1. Prove q (q p) p q p () (4pts) with truth tle. p q p q p (q p) p q
More information1 From NFA to regular expression
Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work
More informationNFAs 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 informationNon 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 informationCS 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 informationSome Theory of Computation Exercises Week 1
Some Theory of Computtion Exercises Week 1 Section 1 Deterministic Finite Automt Question 1.3 d d d d u q 1 q 2 q 3 q 4 q 5 d u u u u Question 1.4 Prt c  {w w hs even s nd one or two s} First we sk whether
More informationCS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6
CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, section 003, George Mson University, Fll 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 7 1. Prove (p q) (p q), () (5pts) using truth tles. p q
More informationLanguages & Automata
Lnguges & Automt Dr. Lim Nughton Lnguges A lnguge is sed on n lphet which is finite set of smols such s {, } or {, } or {,..., z}. If Σ is n lphet, string over Σ is finite sequence of letters from Σ, (strings
More informationCMSC 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 informationpadic Egyptian Fractions
padic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Setup 3 4 pgreedy Algorithm 5 5 pegyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction
More informationTypes 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 informationChapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1
Chpter 1, Prt 1 Regulr Lnguges CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 1 Finite Automt A finite utomton is system for processing ny finite sequence of symols, where the symols re chosen from finite
More informationTypes 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 informationFinite 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 informationRegular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene*
Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion
More informationChapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)
C K Ngpl Forml Lnguges nd utomt Theory Chpter 4 Regulr Grmmr nd Regulr ets (olutions / Hints) ol. (),,,,,,,,,,,,,,,,,,,,,,,,,, (),, (c) c c, c c, c, c, c c, c, c, c, c, c, c, c c,c, c, c, c, c, c, c, c,
More informationNFAs 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 HrPeled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,
More informationTutorial Automata and formal Languages
Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we
More informationBases for Vector Spaces
Bses for Vector Spces 22625 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything
More informationParse trees, ambiguity, and Chomsky normal form
Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for contextfree grmmrs
More informationNonDeterministic Finite Automata. Fall 2018 Costas Busch  RPI 1
NonDeterministic 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 informationConverting Regular Expressions to Discrete Finite Automata: A Tutorial
Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 20130103 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert
More informationThoery of Automata CS402
Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...
More informationTable of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...
Tle of contents: Lecture N0.... 3 ummry... 3 Wht does utomt men?... 3 Introduction to lnguges... 3 Alphets... 3 trings... 3 Defining Lnguges... 4 Lecture N0. 2... 7 ummry... 7 Kleene tr Closure... 7 Recursive
More informationCoalgebra, 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 information1. 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 informationMore 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 informationset is not closed under matrix [ multiplication, ] and does not form a group.
Prolem 2.3: Which of the following collections of 2 2 mtrices with rel entries form groups under [ mtrix ] multipliction? i) Those of the form for which c d 2 Answer: The set of such mtrices is not closed
More informationThe 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 information2.4 Linear Inequalities and Interval Notation
.4 Liner Inequlities nd Intervl Nottion We wnt to solve equtions tht hve n inequlity symol insted of n equl sign. There re four inequlity symols tht we will look t: Less thn , Less thn or
More informationNondeterminism 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 informationExercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.
1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,
More informationNFAs continued, Closure Properties of Regular Languages
lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions
More informationWorked out examples Finite Automata
Worked out exmples Finite Automt Exmple Design Finite Stte Automton which reds inry string nd ccepts only those tht end with. Since we re in the topic of Non Deterministic Finite Automt (NFA), we will
More informationCS 310 (sec 20)  Winter Final Exam (solutions) SOLUTIONS
CS 310 (sec 20)  Winter 2003  Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)
More informationFormal Languages and Automata
Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt ChunMing Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University
More informationCS 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 informationContextFree Grammars and Languages
ContextFree Grmmrs nd Lnguges (Bsed on Hopcroft, Motwni nd Ullmn (2007) & Cohen (1997)) Introduction Consider n exmple sentence: A smll ct ets the fish English grmmr hs rules for constructing sentences;
More informationFinite 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 informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15453)  Spring L. Blum
15453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES nd REGULAR EXPRESSIONS TUESDAY Jn 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w hs equl numer of
More informationI1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3
2 The Prllel Circuit Electric Circuits: Figure 2 elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is
More informationNFA 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 informationScanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:
Scnner Specifying ptterns source code tokens scnner prser IR A scnner must recognize the units of syntx Some prts re esy: errors mps chrcters into tokens the sic unit of syntx x = x + y; ecomes
More informationAnatomy 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 525 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn
More informationCSC 473 Automata, Grammars & Languages 11/9/10
CSC 473 utomt, Grmmrs & Lnguges 11/9/10 utomt, Grmmrs nd Lnguges Discourse 06 Decidbility nd Undecidbility Decidble Problems for Regulr Lnguges Theorem 4.1: (embership/cceptnce Prob. for DFs) = {, w is
More informationChapter 7. Kleene s Theorem. 7.1 Kleene s Theorem. The following theorem is the most important and fundamental result in the theory of FA s:
Chpte 7 Kleene s Theoem 7.1 Kleene s Theoem The following theoem is the most impotnt nd fundmentl esult in the theoy of FA s: Theoem 6 Any lnguge tht cn e defined y eithe egul expession, o finite utomt,
More information12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016
CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple
More information