Finite Automata-cont d
|
|
- Colin Andrews
- 5 years ago
- Views:
Transcription
1 Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww R x : x,w (0 + 1) + }, where w R denotes the string w written in reverse If L is regulr there is n n s in the PL4RL Pick z = (01) n (10) n 1 = w 1 w 2 w n v, where u = nd w 1 = w 2 = = w n = 01, v = (10) n 1 There is loop somewhere in the pth Then there re i nd j so tht w 1 w 2 (w i+1 w j ) k w n v is in L for ll k CLASS 06-8 CLASS 06-9
2 Pump up However, w 1 w 2 (w i+1 w j ) 2 w n v = w 1 w 2 w j w i+1 w n v = (01) n + j - i (10) n 1 = longer shorter Conclusion Hence w 1 w 2 (w i+1 w j ) 2 w n v L Thus, L does not hve one of the fundmentl properties of regulr lnguge. So L cnnot e regulr The mid-point of the ww R prt needs 00 or 11 ut tht pttern occurs once nd is not ner the center CLASS CLASS Exmple 2 Pick the z Suppose we consider the lnguge L 1 = { 2j 3k : 0 <= j < k } We show tht L 1 is not regulr The nottion 2j indictes tht there is n even numer of s The nottion 3k indictes tht the numer of s is multiple of 3 CLASS We pick the z to e 2n 3n+3 Then z = w 1 w 2 w n v, where w 1 =w 2 = =w n = 2, v = 3n+3 Note tht we CANNOT tke z = 2n 3n+1 ecuse 2n 3n+1 L 1 If L 1 were regulr nd n were the numer from the PL4RL pplied to L then there would exist i, j with 0 < i < j < n nd w 1 w 2 (w i+1 w j ) k w n v L, k > 0 CLASS 06-13
3 Pump up one extr loop We consider w 1 w 2 (w i+1 w j ) 2 w n v p 0 p i = p j w 1 w j wj+1 wn p n v (w i +1 w j ) 2 Conclusion The string w 1 w 2 (w i +1 w j ) 2 w n v hs ONE extr copy of w i+1 w j = 2(j - i ) so the whole string is 2(n + j - i ) 3n+3, which is not in L 1 since n + j - i < n + 1 is flse. NOTE: We used w i = 2, so tht when we pumped up we were sure to keep n even numer of s CLASS CLASS Initil step for finding regulr expression Finding the regulr expression for the lnguge of n NFA Remove ll ded sttes from the DFA or NFA Remove ll unrechle sttes from the DFA or NFA If there is NO pth from the initil stte q 0 to stte q, then q is clled n unrechle stte We ssume ech stte in the DFA or NFA is on pth leding from q 0 to finl stte CLASS 06-17
4 Strt with n NFA Suppose we egin with the NFA from clss 3 q 5 q 1, q 3 q 0 q 4 q 6 Step 1: new single finl stte Add new stte s SINGLE finl stte q 5 with -trnsitions q 1, q 3 q 0 q 4 q 6 CLASS CLASS Remove sttes, one t time Remove stte nd replce it with new rcs leled y regulr expressions here we remove q 6 Remove q 5 Do not remove the initil or finl stte q 1, q 3 q 0 q 4 * CLASS q 5 q 1 q 0 * q 4, CLASS q 3
5 Remove q 1 Remove q 3 Be creful to put replcement for every trnsition tht is lost Wtch for loops + q 0 * q 4, q 3 q 0 * q 4 CLASS CLASS Now it gets tough Just one more... Remove q 4 + Remove This is the form we were iming for q 0 + * + q 0 + ( + )*( + ) + * + * + ( + )*( + *) CLASS CLASS 06-25
6 The regulr expression For wht it s worth [ + * + ( + )*( + *)]* [ + ( + )*( + )] Note tht ( + )*( + ) = ( + )* Sustitute [ + * + ( + )*( + *)]* [ + ( + )*( + )] = [ + * + ( + )*( + *)]* ( + )* since is prt of (+)* [ + ( + )*( + )] = + ( + )* = ( + )* since ( + )* includes CLASS CLASS Still some more Consider [ + * + ( + )*( + *)]* = [ + * + ( + )*]* since nything in ( + )** cn e otined from cycling through ( + )*, nd * You cn lso get * from [ + ( + )*]* At lest we get down to [ + ( + )*]*( + )* We ll stop simplifying here Now it looks like we might e le to reduce this to [ + ( + )*]*...ut this shorter expression contins ll strings k, k > 0, none of which is in [ + ( + )*]*( + )* ecuse the is missing However, s oserved in clss ( + )* [ + ( + )*]* ( + )* So we rech ( + )*( + )* CLASS CLASS 06-29
7 Principles Remove q We hve to uild n utomton with regulr expressions on the edges Strt y dding unique externl finl stte with -trnsitions from wht were finl sttes Go through process of removing internl sttes y comining regulr expressions Remove q q 1 r 1 r 2 q r r 3 r 4 q 3 q 4 Loops on sttes leled r ecome Kleene closures r * CLASS CLASS loops ecome closure opertions Continue until there re two sttes q 1 r 1 r *r 3 q 3 We re left with the initil nd finl sttes r 2 r *r 4 r 2 r *r 3 r 1 r *r 4 q 4 The finl regulr expression is r 1 *r 2 q 0 r1 r 2 CLASS CLASS 06-33
8 Union, Conctention, Kleene Closure Properties of regulr lnguges We know there re regulr expressions for the union, conctention nd Kleene closure of regulr expressions nd ll regulr expressions denote regulr lnguges, so The union, conctention nd Kleene closure of regulr lnguges re ll regulr CLASS Complement The complement of ny regulr lnguge is regulr: Tke regulr lnguge L nd uild FULL DFA M for L (it must e DFA nd ll sttes must e shown) Consider the complementry mchine M 1 where every finl stte of M is non-finl in M 1 nd every nonfinl stte in M is finl in M 1 The sttes nd trnsitions of M 1 re the sme s those of M L(M 1 ) is the complement of L(M) It is cler tht δ*(q 0, w) is finl stte of M 1 if nd only it is not finl stte of M Hence M 1 ccepts w if nd only if M does not ccept w _ Therefore M 1 ccepts exctly L CLASS CLASS 06-37
9 Intersection The intersection of two regulr lnguges is regulr L 1 L 2 = (L 1 L 2 ) The textook constructs DFA for the intersection Decidle properties of regulr lnguges CLASS CLASS Emptiness There is n lgorithm to decide if regulr lnguge is empty: If you re given regulr lnguge L over Σ, you cn otin DFA for the lnguge--ssume tht DFA hs n sttes Check if ny of the (k n -1)/(k - 1) strings of length <n in Σ* is in L, where Σ hs k elements If one does, L is not empty. If none re in L, then L is empty CLASS Proof Proof tht lgorithm works: Suppose L is not empty nd let z e the shortest string in L. If z > n then y the pumping lemm z = uvw nd uw is shorter string lso in L, which mens z ws not the shortest string Thus the shortest string in L must hve length < n, which is wht we look for in the lgorithm
10 Finiteness To check if the regulr lnguge L is finite, we check if there re ny strings z in L with n < z < 2n, where n is the numer of sttes in DFA for L If not, L is finite Proof - 1 Proof of the lgorithm: From the pumping lemm, if there is one string z = uvw in L with n < z, then L is infinite: it contins uv k w for ll k > 0 If there is string in tht rnge, L is infinite CLASS CLASS Proof - 2 We need to see tht there must e such z with z < 2n Let z e the shortest string in L with n < z, we ssert tht z < 2n If not, we know tht z = uvw, z > 2n nd v < n It follows tht uw is in L nd uw > n Hence z ws not the shortest with this property fter ll Minimiztion of the DFA CLASS 06-44
11 CLASS The construction The interesting thing out DFA s is tht every DFA for lnguge L cn e minimized to the sme miniml DFA (the sme up to renming sttes) Tke DFA for L with Q = {q 0, q 1,, q n } We hve to unify sttes tht cnnot e distinguished y δ* CLASS distinguished sttes Two sttes q i nd q j re distinguished y δ* if there is string w in Σ* such tht ONLY ONE of δ*(q i, w) nd δ*(q j, w) is finl If q i nd q j re not distinguished then they cn e unified in the DFA If ll such indistinguishle sttes re unified, we otin well-defined DFA tht recognizes the sme lnguge L Crete tle q 1 Begin with tringulr tle q 3... q n q 0 q 1... q n-2 q n-1 How will it finish We will mrk X where sttes re. distinguishle. If the is no X. for q i nd q j, q i X X X unify them. X. X. X... q j... CLASS CLASS 06-49
12 Round 1 To strt, mrk X for those sttes which re distinguished y The sttes q i nd q j re distinguished y if only one of δ*(q i, ) nd δ*(q j, ) is finl But these sttes re exctly q i nd q j Hence we put n X wherever one of q i nd q j is finl nd the other is not finl Round 2 For every q i nd q j nd every in Σ, consider q i ' = δ*(q i,) nd q j ' = δ*(q j,) IF there is n X for the pir q i ', q j ' [the order of the pir is NOT importnt], then put n X in the cell of the tle for the pir q i, q j Otherwise, write ij in the cell of the tle indexed y q i ' nd q j ' Do this for every pir q i nd q j CLASS CLASS Round 2½ Round 2½ - cont d All the wy through this process, wtch out to see if n X gets plced in cell contining some pirs ij, For exmple suppose q i ' = δ*(q i,) nd q j ' = δ*(q j,) nd we wrote ij in the cell of the tle indexed y q i ' nd q j ' Suppose lter we re considering δ*(q i ',) nd δ*(q j ',) nd we find n X for tht pir Tht will put n X for q i ' nd q j ', nd we use the ij in tht cell to go ck nd put n X in the cell indexed y q i nd q j CLASS CLASS 06-53
13 CLASS Round 2½ - cont d This process is trnsitive, i.e. if cell gets n X nd there is pir of indices mn in tht cell, then we lso dd n X in the cell indexed y q m nd q n CLASS Exmple - I (finl) q 0 q 6 q 1 (finl) q 1 q 3 q 6 (finl) q 8 q 3 q 0 q 9 q 4 q 9 q 4 (finl) q 5 q 9 (finl) q 6 q 0 q 5 q 7 q 9 q 7 (finl) q 8 q 3 q 0 q 9 q 6 q 3 Check your nswer Rechle sttes Note tht if you get interrupted y ny distrction, you will proly mke mistke To verify your nswer, you must drw out the minimized utomton nd mke sure ll the trnsitions re consistent We will see this in n exmple A stte q in DFA or NFA is rechle if there is w Σ* such tht δ*(q 0, w) = q (for the DFA) or q δ*(q 0, w) (for the NFA) CLASS CLASS 06-57
14 Check wht is REACHABLE FROM q 0 (finl) q 0 (Y) q 6 q 1 (finl) q 1 (Y) q 3 q 6 (finl) (Y) q 8 q 3 (Y) q 0 q 9 q 4 q 9 q 4 (finl) q 5 (Y) q 9 (finl) q 6 (Y) q 0 q 5 q 7 q 9 q 7 (finl) q 8 (Y) q 3 q 0 We otin q 1 Remove q 4 nd q 7 ; mke tle q 3 X X X q 5 q 6 q 8 X X X q 9 X X X X X X q 0 q 1 q 3 q 5 q 6 q 8 q 9 (Y) q 6 q 3 CLASS CLASS First column Work on column of q 0 q 1 08 Where numer 05 pir lnds on q 3 X X X n X, go q 5 06 X ck nd q X 08 write X q 8 02 X q 9 X X X X X 05 X q 0 q 1 q 3 q 5 q 6 q 8 Mrk X s Effect of X s on column of q 0 q 1 X q 3 X X X q 5 X 06 X q 6 02 X q 8 X 02 X q 9 X X X X X X q 0 q 1 q 3 q 5 q 6 q 8 CLASS CLASS 06-61
15 Column 2 Work on column of q 1 q 1 X q 3 X 16 X X 12 q 5 X 06 X q ,15 X 16 q 8 X 02 X 12 q 9 X X X 15 X X X q 0 q 1 q 3 q 5 q 6 q 8 Mrk X s Effect of X s on column of q 1 q 1 X DO NOT get X tempted to go q 3 X X X forwrd to q 5 X 06 X mrk X, q 6 18 X 02,15 X 16 e.g. t q 8 X 02 X 12 (6,8) q 9 X X X 15 X X X q 0 q 1 q 3 q 5 q 6 q 8 CLASS CLASS Third column Mrk X s Work on column of q 1 X 26 X q 3 X X X 28 q 5 X 06 X q 6 18 X 02,15 X 16 q 8 X X q 9 X X X X X X q 0 q 1 q 3 q 5 q 6 q 8 Effect on X s on columns of q 1 X 26 X q 3 X X X q 5 X 06 X X q 6 18 X 02,15 X 16 q 8 X 02 X X q 9 X X X 15 X X X q 0 q 1 q 3 q 5 q 6 q 8 CLASS CLASS 06-65
16 Fourth nd fifth Column Column of q 3 nd q 5 q 1 X 26, 58 X q 3 X X X q 5 X 06 X 56 X q 6 18,39 X 02,15 X 16 q 8 X 02 X X q 9 X 56 X X 15, 58 X X X q 0 q 1 q 3 q 5 q 6 q 8 Mrk X s Effect of X s on column of q 5 q 1 X if the cell for q 1, q 6 26, 58 X were not mrked, q 3 X X X we would mrk q 5 X 06 X X it now q 6 18,39 X 02,15 X X 16 q 8 X 02 X X q 9 X X X 15, 58 X X X q 0 q 1 q 3 q 5 q 6 q 8 CLASS CLASS Sixth column Mrk X s Work on column of q 6 q 1 X 26, 58 X q 3 X 68 X X q 5 X X X q 6 18,39 X 02,15 X X q 8 X 02 X X q 9 X X X 15, 58 X X X q 0 q 1 q 3 q 5 q 6 q 8 Effect of X s on column of q 6 q 1 X 26, 58 X q 3 X X X q 5 X 06 X X q 6 18,39 X 02,15 X X q 8 X 02 X X 26 X 12 q 9 X X X 15, 58 X X X q 0 q 1 q 3 q 5 q 6 q 8 CLASS CLASS 06-69
17 Finl tle Cler unused indices, unify: q q 1 X q nd q 3.9 X q 3 X X X q 5 X X X q 6 X X X q 8 X X X X q 9 X X X X X X q 0 q 1 q 3 q 5 q 6 q 8 CLASS CLASS Check consistency Is the finl trnsition tle (or grph) consistent with the initil tle (finl) q q q (finl) q q 3.9 q q 3.9 q q 3.9 q q q 3.9
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 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 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 informationDeterministic 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 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 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 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 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 informationLecture 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 informationNon-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 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 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 CSI3104-W11 1
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 informationHarvard 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 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 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 informationNon-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 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 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 informationCHAPTER 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 informationCHAPTER 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 informationTheory 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 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 Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,
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 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 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 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 1-4) Weeks
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 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 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 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 informationCS375: 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 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 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 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 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 informationName 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 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 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 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 informationFormal Languages and Automata
Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University
More 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 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 informationCS415 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 informationSWEN 224 Formal Foundations of Programming WITH ANSWERS
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 END-OF-YEAR SWEN 224 Forml Foundtions of Progrmming
More 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 informationLexical 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 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 informationLecture 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 informationFinite-State Automata: Recap
Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under
More 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 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 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 informationFirst 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 informationFirst 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 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 informationJava 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 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 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 informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over
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 informationConverting 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 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 informationNon-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 information5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.
Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.
More 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 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 informationFinite 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 informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.
More informationGNFA GNFA GNFA GNFA GNFA
DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with
More 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 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 informationGrammar. 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 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 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:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm
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 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 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 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 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 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 informationMyhill-Nerode Theorem
Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute
More 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 informationCompiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz
University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite
More informationToday s Topics Automata and Languages
Tody s Topics Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn DFA to Regulr Expression GFNA DFAèGNFA GNFA è RE DFA è RE Exmples 2 DFA è RE NFA DFA -NFA REX GNFA 3 Definition
More informationAutomata and Languages
Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Tody s Topics DFA to Regulr Expression GFNA DFAèGNFA GNFA è RE DFA è RE Exmples 2 DFA è RE NFA DFA -NFA REX GNFA 3 Definition
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 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 informationFormal Language and Automata Theory (CS21004)
Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge
More 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 informationNondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA
Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn
More informationCS 573 Automata Theory and Formal Languages
Non-determinism Automt Theory nd Forml Lnguges Professor Leslie Lnder Leture # 3 Septemer 6, 2 To hieve our gol, we need the onept of Non-deterministi Finite Automton with -moves (NFA) An NFA is tuple
More informationKleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15
Models of Comput:on Lecture #8 Chpter 7 con:nued Any lnguge tht e defined y regulr expression, finite utomton, or trnsi:on grph cn e defined y ll three methods We prove this y showing tht ny lnguge defined
More informationCMSC 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 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 informationAutomata 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 informationLexical Analysis Part III
Lexicl Anlysis Prt III Chpter 3: Finite Automt Slides dpted from : Roert vn Engelen, Florid Stte University Alex Aiken, Stnford University Design of Lexicl Anlyzer Genertor Trnslte regulr expressions to
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.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed
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 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 information