2.4 Theoretical Foundations
|
|
- Scott Palmer
- 5 years ago
- Views:
Transcription
1 2 Progrmming Lnguge Syntx 2.4 Theoretil Fountions As note in the min text, snners n prsers re se on the finite utomt n pushown utomt tht form the ottom two levels of the Chomsky lnguge hierrhy. At eh level of the hierrhy, mhines n e either eterministi or noneterministi. A eterministi utomton lwys performs the sme opertion in given sitution. A noneterministi utomton n perform ny of set of opertions. A noneterministi mhine is si to ept string if there exists hoie of opertion in eh sitution tht will eventully le to the mhine sying yes. As it turns out, noneterministi n eterministi finite utomt re eqully powerful: every DFA is, y efinition, egenerte NFA, n the onstrution in Exmple 2.14 emonstrtes tht for ny NFA we n rete DFA tht epts the sme lnguge. The sme is not true of push-own utomt: there re ontext-free lnguges tht re epte y n NPDA ut not y ny DPDA. Fortuntely, DPDAs suffie in prtie to ept the syntx of rel progrmming lnguges. Prtil snners n prsers re lwys eterministi Finite Automt Preisely efine, eterministi finite utomton (DFA) M onsists of (1) finite set Q of sttes, (2) finite lphet Σ of input symols, (3) istinguishe initil stte q 1 Q, (4) set of istinguishe finl sttes F Q, n(5)trnsition funtion δ : Q Σ Q tht hooses new stte for M se on the urrent sttentheurrentinputsymol.m egins in stte q 1. One y one it onsumes its input symols, using δ to move from stte to stte. When the finl symol hs een onsume, M is interprete s sying yes if it is in stte in F; otherwise it is interprete s sying no. We n exten δ in the ovious wy to tke strings, rther thn symols, s inputs, llowing us to sy tht M epts string x if δ(q 1, x) F. WenthenefineL(M), the lnguge epte y M, toetheset C 13
2 C 14 Chpter 2 Progrmming Lnguge Syntx Strt q 1 q 2.. q 3 q 4 Figure 2.33 Miniml DFA for the lnguge onsisting of ll strings of eiml igits ontining single eiml point. Apte from Figure 2.10 in the min text. The symol here is short for 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. EXAMPLE 2.56 Forml DFA for *(.. ) * {x δ(q 1, x) F}. In noneterministi finite utomton (NFA), the trnsition funtion, δ, is multivlue: the utomton n move to ny of set of possile sttes from given stte on given input. In ition, it my move from one stte to nother spontneously ; suh trnsitions re si to tke input symol ɛ. We n illustrte these efinitions with n exmple. Consier the irles-nrrows utomton of Figure C 2.33 (pte from Figure 2.10 in the min text). This is the miniml DFA epting strings of eiml igits ontining single eiml point. Σ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9,.} is the mhine s input lphet. Q = {q 1, q 2, q 3, q 4 } is the set of sttes; q 1 is the initil stte; F = {q 4 } ( singleton in this se) is the set of finl sttes. The trnsition funtion n e represente y set of triples δ = {(q 1, 0, q 2 ),..., (q 1, 9, q 2 ), (q 1,., q 3 ), (q 2, 0, q 2 ),...,(q 2, 9, q 2 ), (q 2,., q 4 ), (q 3, 0, q 4 ),...,(q 3, 9, q 4 ), (q 4, 0, q 4 ),...,(q 4, 9, q 4 )}. In eh triple (q i,, q j ), δ(q i, ) =q j. Given the onstrutions of Exmples 2.12 n 2.14, we know tht there exists n NFA tht epts the lnguge generte y ny given regulr expression, n DFA equivlent to ny given NFA. To show tht regulr expressions n finite utomt re of equivlent expressive power, ll tht remins is to emonstrte tht there exists regulr expression tht genertes the lnguge epte y ny given DFA. We illustrte the require onstrution elow for our eiml strings exmple (Figure C 2.33). More forml n generl tretment of ll the regulr lnguge onstrutions n e foun in stnr utomt theory texts [HMU07, Sip13]. FromDFAtoRegulrExpression To onstrut regulr expression equivlent to given DFA, we employ ynmi progrmming lgorithm tht uils solutions to suessively more omplite suprolems from tle of solutions to simpler suprolems. We egin with set of simple regulr expressions tht esrie the trnsition funtion, δ. Forll sttes i,weefine r 0 ii = m ɛ
3 2.4.1 Finite Automt C 15 where { m } = { δ(q i, ) =q i } is the set of hrters leling the self-loop from stte q i k to itself. If there is no suh self-loop, r 0 ij = ɛ. Similrly, for i j,we efine r 0 ij = m EXAMPLE 2.57 Reonstruting regulr expression for the eiml string DFA where { m } = { δ(q i, ) =q j } is the set of hrters leling the r from q i to q j.ifthereisnosuhr,rij 0 is the empty regulr expression. (Note the ifferene here: we n sty in stte q i y not epting ny input, so ɛ is lwys one of the lterntives in rii 0,utnotinr0 ij when i j.) Given these r 0 expressions, the ynmi progrmming lgorithm inutively lultes expressions rij k with lrger supersripts. In eh, k nmes the highestnumere stte through whih ontrol my pss on the wy from q i to q j. We ssume tht sttes re numere strting with q 1,sowhenk = 0wemusttrnsition iretly from q i to q j, with no intervening sttes. In our smll exmple DFA, r11 0 = r0 33 = ɛ, nr0 22 = r0 44 = ɛ, whih we will revite ɛ. Similrly, r13 0 = r0 24 =., n r12 0 = r0 34 =. Expressions r0 14, r0 21, r0 23, r0 31, r0 32, r0 41, r0 42,nr0 43 re ll empty. For k > 0, the rij k expressions will generlly generte multihrter strings. At eh step of the ynmi progrmming lgorithm, we let r k ij = r k 1 ij r k 1 ik r k 1 kk *r k 1 kj Tht is, to get from q i to q j without going through ny sttes numere higher thn k, we n either go from q i to q j without going through ny stte numere higher thn k 1 (whih we lrey know how to o), or else we n go from q i to q k (without going through ny stte numere higher thn k 1), trvel out from q k n k gin n ritrry numer of times (never visiting stte numere higher thn k 1 in etween), n finlly go from q k to q j (gin without visiting stte numere higher thn k 1). If ny of the onstituent regulr expressions is empty, we omit its term of the outermost lterntion. At the en, our overll nswer is r1f n 1 r1f n 2... r1f n t,wheren = Q is the totl numer of sttes n F = {q f1, q f2,...,q ft } is the set of finl sttes. Beuse r11 0 = ɛ n there re no trnsitions from Sttes 2, 3, or 4 to Stte 1, nothing hnges in the first inutive step in our exmple; tht is, i [ rii 1 = rii 0 ]. The seon step is it more interesting. Sine we re now llowe to go through Stte2,wehver22 2 = r2 22 r2 22 *r2 22 = ( ɛ ) ( ɛ )( ɛ )*( ɛ ) = *. Beuse r21 1, r1 23, r1 32,nr1 42 re empty, however, r2 11, r2 33,nr2 44 remin the sme s r11 1, r1 33,nr1 44.Insimilrvein,wehve r 2 12 = ( ɛ )*( ɛ ) = + r 2 14 = ( ɛ )*. = +. r 2 24 =. ( ɛ )( ɛ )*. = *.
4 C 16 Chpter 2 Progrmming Lnguge Syntx Missing trnsitions n empty expressions from the previous step leve r13 2 = r1 13 =. n r34 2 = r1 34 =. Expressions r2 21, r2 23, r2 31, r2 32, r2 41, r2 42,nr2 43 remin empty. Inthethirinutivestep,wehve r 3 13 =.. ɛ*ɛ =. r14 3 r34 3 = +.. ɛ* = +.. = ɛɛ* = All other expressions remin unhnge from the previous step. Finlly, we hve r 4 14 = ( +.. ) ( +.. )( ɛ )*( ɛ ) = ( +.. ) ( +.. ) * = ( +.. ) * = +. *. + Sine F hs single memer (q 4 ), this expression is our finl nswer. EXAMPLE 2.58 A regulr lnguge with lrge miniml DFA EXAMPLE 2.59 Exponentil DFA low-up Spe Requirements In Setion we note without proof tht the onversion from n NFA to DFA my le to exponentil low-up in the numer of sttes. Certinly this i not hppen in our eiml string exmple: the NFA of Figure 2.8 hs 14 sttes, while the equivlent DFA of Figure 2.9 hs only 7, n the miniml DFA of Figures 2.10 n C 2.33 hs only 4. Consier, however, the suset of ( )* in whih some letter ppers t lest three times. The miniml DFA for this lnguge hs 28 sttes. As shown in Figure C 2.34, 27 of these re sttes in whih we hve seen i, j, nk s, s, n s, respetively. The 28th (n only finl) stte is rehe one we hve seen t lest three of some speifi hrter. By ontrst, there exists n NFA for this lnguge with only eight sttes, s shown in Figure C It requires tht we guess, t the outset, whether we will see three s, three s, or three s. It mirrors the struture of the nturl regulr expression ( )* ( )* ( )* ( )* ( )* ( )* ( )* ( )* ( )* ( )* ( )* ( )*. Of ourse, the eight-stte NFA oes not emerge iretly from the onstrution of Figure 2.7; tht onstrution proues 52-stte mhine with ertin mount of reunny, n with mny extrneous sttes n epsilon proutions. But onsier the similr suset of ( )* in whih some igit ppers t lest ten times. The miniml DFA for this lnguge hs 10,000,000,001 sttes: non-finl stte for eh omintion of zeros through nines with less thn ten of eh, n single finl stte rehe one ny igit hs ppere t lest ten times. One possile regulr expression for this lnguge is
5 2.4.1 Finite Automt C , Strt , ,, ,,, ,,, Figure 2.34 DFA for the lnguge onsisting of ll strings in ( )* in whih some letter ppers t lest three times. Stte nme ijk inites tht i s, j s, n k s hve een seen so fr. Within the ui portion of the figure, most ege lels re elie: trnsitions move to the right, trnsitions go k into the pge, n trnsitions move own. (( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )* 0 ( )*) (( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )* 1 ( )*)... (( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )* 9 ( )*)
6 C 18 Chpter 2 Progrmming Lnguge Syntx Strt,,,,,,,,,, Figure 2.35 NFA orresponing to the DFA of Figure C Our onstrution woul yiel very lrge NFA for this expression, ut lerly mny orers of mgnitue smller thn ten illion sttes! Push-Down Automt A eterministi push-own utomton (DPDA) N onsists of (1) Q, (2) Σ, (3) q 1,n(4)F, sindfa,plus(6)finitelphetγ of stk symols, (7) istinguishe initil stk symol Z 1 Γ, n(5 ) trnsition funtion δ : Q Γ {Σ {ɛ}} Q Γ,whereΓ is the set of strings of zero or more symols from Γ. N egins in stte q 1,withsymolZ 1 in n otherwise empty stk. It repetely exmines the urrent stte q n top-of-stk symol Z. If δ(q,ɛ, Z) is efine, N moves to stte r n reples Z with α in the stk, where (r,α)=δ(q,ɛ, Z). In this se N oes not onsume its input symol. If δ(q,ɛ, Z) is unefine, N exmines n onsumes the urrent input symol. It then moves to stte s n reples Z with β, where(s,β)=δ(q,, Z). N is interprete s epting string of input symols if n only if it onsumes the symols n ens in stte in F. As with finite utomt, noneterministi push-own utomton (NPDA) is istinguishe y multivlue trnsition funtion: n NPDA n hoose ny of set of new sttes n stk symol replements when fe with given stte, input, n top-of-stk symol. If δ(q,ɛ, Z) is nonempty, N n lso hoose new stte n stk symol replement without inspeting or onsuming its urrent input symol. While we hve seen tht noneterministi n eterministi finite utomt re eqully powerful, this orresponene oes not rry over to pushown utomt: there re ontext-free lnguges tht re epte y n NPDA ut not y ny DPDA. The proof tht CFGs n NPDAs re equivlent in expressive power is more omplex thn the orresponing proof for regulr expressions n finite utomt. The proof is lso of limite prtil importne for ompiler onstrution; we o not present it here. While it is possile to rete n NPDA for ny
CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6
CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized
More 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 informationNondeterministic Automata vs Deterministic Automata
Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n
More informationNON-DETERMINISTIC FSA
Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is
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 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 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 informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS
The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their
More informationNondeterministic Finite Automata
Nondeterministi Finite utomt The Power of Guessing Tuesdy, Otoer 4, 2 Reding: Sipser.2 (first prt); Stoughton 3.3 3.5 S235 Lnguges nd utomt eprtment of omputer Siene Wellesley ollege Finite utomton (F)
More informationFinite State Automata and Determinisation
Finite Stte Automt nd Deterministion Tim Dworn Jnury, 2016 Lnguges fs nf re df Deterministion 2 Outline 1 Lnguges 2 Finite Stte Automt (fs) 3 Non-deterministi Finite Stte Automt (nf) 4 Regulr Expressions
More informationCounting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs
Isomorphism of Grphs Definition The simple grphs G 1 = (V 1, E 1 ) n G = (V, E ) re isomorphi if there is ijetion (n oneto-one n onto funtion) f from V 1 to V with the property tht n re jent in G 1 if
More informationAutomata and Regular Languages
Chpter 9 Automt n Regulr Lnguges 9. Introution This hpter looks t mthemtil moels of omputtion n lnguges tht esrie them. The moel-lnguge reltionship hs multiple levels. We shll explore the simplest level,
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 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 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 informationINTRODUCTION TO AUTOMATA THEORY
Chpter 3 INTRODUCTION TO AUTOMATA THEORY In this hpter we stuy the most si strt moel of omputtion. This moel els with mhines tht hve finite memory pity. Setion 3. els with mhines tht operte eterministilly
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 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 informationTechnische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution
Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:
More 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 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 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 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 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 informationCompression of Palindromes and Regularity.
Compression of Plinromes n Regulrity. Kyoko Shikishim-Tsuji Center for Lierl Arts Eution n Reserh Tenri University 1 Introution In [1], property of likstrem t t view of tse is isusse n it is shown tht
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 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 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 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 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 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 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 informationRegular languages refresher
Regulr lnguges refresher 1 Regulr lnguges refresher Forml lnguges Alphet = finite set of letters Word = sequene of letter Lnguge = set of words Regulr lnguges defined equivlently y Regulr expressions Finite-stte
More informationRunning an NFA & the subset algorithm (NFA->DFA) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/
Running n NFA & the suset lgorithm (NFA->DFA) CS 350 Fll 2018 gilry.org/lsses/fll2018/s350/ 1 NFAs operte y simultneously exploring ll pths nd epting if ny pth termintes t n ept stte.!2 Try n exmple: L
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 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 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 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 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 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 informationCS 491G Combinatorial Optimization Lecture Notes
CS 491G Comintoril Optimiztion Leture Notes Dvi Owen July 30, August 1 1 Mthings Figure 1: two possile mthings in simple grph. Definition 1 Given grph G = V, E, mthing is olletion of eges M suh tht e i,
More informationLecture 6: Coding theory
Leture 6: Coing theory Biology 429 Crl Bergstrom Ferury 4, 2008 Soures: This leture loosely follows Cover n Thoms Chpter 5 n Yeung Chpter 3. As usul, some of the text n equtions re tken iretly from those
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 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 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 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 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 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 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 informationPrefix-Free Regular-Expression Matching
Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings
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 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 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 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 informationA Disambiguation Algorithm for Finite Automata and Functional Transducers
A Dismigution Algorithm for Finite Automt n Funtionl Trnsuers Mehryr Mohri Cournt Institute of Mthemtil Sienes n Google Reserh 51 Merer Street, New York, NY 1001, USA Astrt. We present new ismigution lgorithm
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 informationCSE 401 Compilers. Today s Agenda
CSE 401 Compilers Leture 3: Regulr Expressions & Snning, on?nued Mihel Ringenurg Tody s Agend Lst?me we reviewed lnguges nd grmmrs, nd riefly strted disussing regulr expressions. Tody I ll restrt the regulr
More information22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:
22: Union Fin CS 473u - Algorithms - Spring 2005 April 14, 2005 1 Union-Fin We wnt to mintin olletion of sets, uner the opertions of: 1. MkeSet(x) - rete set tht ontins the single element x. 2. Fin(x)
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 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 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 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 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 informationSolutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!
Solutions for HW9 Exerise 28. () Drw C 6, W 6 K 6, n K 5,3. C 6 : W 6 : K 6 : K 5,3 : () Whih of the following re iprtite? Justify your nswer. Biprtite: put the re verties in V 1 n the lk in V 2. Biprtite:
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 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 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 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 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 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 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 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 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 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 informationFABER 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 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 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 information= state, a = reading and q j
4 Finite Automt CHAPTER 2 Finite Automt (FA) (i) Derterministi Finite Automt (DFA) A DFA, M Q, q,, F, Where, Q = set of sttes (finite) q Q = the strt/initil stte = input lphet (finite) (use only those
More information18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106
8. Problem Set Due Wenesy, Ot., t : p.m. in - Problem Mony / Consier the eight vetors 5, 5, 5,..., () List ll of the one-element, linerly epenent sets forme from these. (b) Wht re the two-element, linerly
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 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 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 informationContext-Free Grammars and Languages
Context-Free 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 informationNormal Forms for Context-free Grammars
Norml Forms for Context-free Grmmrs 1 Linz 6th, Section 6.2 wo Importnt Norml Forms, pges 171--178 2 Chomsky Norml Form All productions hve form: A BC nd A vrile vrile terminl 3 Exmples: S AS S AS S S
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 informationLecture 2: Cayley Graphs
Mth 137B Professor: Pri Brtlett Leture 2: Cyley Grphs Week 3 UCSB 2014 (Relevnt soure mteril: Setion VIII.1 of Bollos s Moern Grph Theory; 3.7 of Gosil n Royle s Algeri Grph Theory; vrious ppers I ve re
More informationDescriptional Complexity of Non-Unary Self-Verifying Symmetric Difference Automata
Desriptionl Complexity of Non-Unry Self-Verifying Symmetri Differene Automt Lurette Mris 1,2 nd Lynette vn Zijl 1 1 Deprtment of Computer Siene, Stellenosh University, South Afri 2 Merk Institute, CSIR,
More information6.5 Improper integrals
Eerpt from "Clulus" 3 AoPS In. www.rtofprolemsolving.om 6.5. IMPROPER INTEGRALS 6.5 Improper integrls As we ve seen, we use the definite integrl R f to ompute the re of the region under the grph of y =
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 information@#? Text Search ] { "!" Nondeterministic Finite Automata. Transformation NFA to DFA and Simulation of NFA. Text Search Using Automata
g Text Serh @#? ~ Mrko Berezovský Rdek Mřík PAL 0 Nondeterministi Finite Automt n Trnsformtion NFA to DFA nd Simultion of NFA f Text Serh Using Automt A B R Power of Nondeterministi Approh u j Regulr Expression
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 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 informationData Structures LECTURE 10. Huffman coding. Example. Coding: problem definition
Dt Strutures, Spring 24 L. Joskowiz Dt Strutures LEURE Humn oing Motivtion Uniquel eipherle oes Prei oes Humn oe onstrution Etensions n pplitions hpter 6.3 pp 385 392 in tetook Motivtion Suppose we wnt
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 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 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 informationɛ-closure, Kleene s Theorem,
DEGefW5wiGH2XgYMEzUKjEmtCDUsRQ4d 1 A nice pper relevnt to this course is titled The Glory of the Pst 2 NICTA Resercher, Adjunct t the Austrlin Ntionl University nd Griffith University ɛ-closure, Kleene
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 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 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 information