Formal Languages and Automata
|
|
- Gerald Banks
- 5 years ago
- Views:
Transcription
1 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 of Technology Tipei, TAIWAN
2 Moile Computing nd Softwre Engineering p. 2/5 Finite Automt A finite utomton (or finite-stte mchine) is severely restricted model of n ctul computer. A finite utomton is chrcterized y hving no temporry storge.
3 Moile Computing nd Softwre Engineering p. 3/5 Contents Deterministic Finite Automt Nondeterministic Finite Automt Equivlence of Deterministic nd Nondeterministic Finite Automt Reduction of the Numer of Sttes in Finite Automt
4 Moile Computing nd Softwre Engineering p. 4/5 Deterministic Finite Automt A deterministic finite utomt (df) is defined y the quintuple where M = (Q, Σ,δ,q 0,F), Q is finite set of internl sttes, Σ is n lphet, δ : Q Σ Q is the trnsition function, q 0 Q is the initil stte, nd F Q is the set of finl sttes.
5 Moile Computing nd Softwre Engineering p. 5/5 Visuliztion of Finite Automt We cn use trnsition grphs to represent finite utomt: vertices sttes edges trnsitions lels on vertices re the nmes of the sttes lels on edges re the vlues of the input symols initil stte hs n incoming edge unleled finl sttes re drwn with doule cycle.
6 Moile Computing nd Softwre Engineering p. 6/5 Exmple 1 Consider the df M = (Q, Σ,δ,q 0,F), where Q = {q 0,q 1,q 2 }, Σ = {0, 1}, F = {q 1 }, nd the trnsition function δ is tulted elow stte input δ(stte,input) q 0 0 q 0 q 0 1 q 1 q 1 0 q 0 q 1 1 q 2 q 2 0 q 2 q 2 1 q 1
7 Moile Computing nd Softwre Engineering p. 7/5 Exmple - Visuliztion of df Remrks: q 0 is n initil stte nd hs n incoming unleled edge. q 1 is finl stte nd with doule cycle.
8 Moile Computing nd Softwre Engineering p. 8/5 String Inputs Extending the df to the notion of computtion y n utomton on n input string consider the extended trnsition function δ : Q Σ Q. A configurtion is determined y the current stte nd the unred prt of the string eing processed.
9 Moile Computing nd Softwre Engineering p. 9/5 Exmple 2 M = ({q 0,q 1 }, {,},δ,q 0, {q 0 }), where the trnsition function δ is tulted elow stte input δ(stte,input) q 0 q 0 q 0 q 1 q 1 q 1 q 1 q 0
10 Moile Computing nd Softwre Engineering p. 10/5 Visuliztion of Exmple 2 Remrks: If the input string is, the initil configurtion is (q 0,).
11 Moile Computing nd Softwre Engineering p. 11/5 Reltions etween δ nd δ δ cn e derived from δ recursively s δ (q,λ) = q δ (q,w) = δ(δ (q,w),) (1) q Q,w Σ, nd Σ. Eqution (1) cn e written lterntively s δ (q,w) = δ (δ(q,),w).
12 Moile Computing nd Softwre Engineering p. 12/5 Configurtion Trnsitions If (q,w) nd (q,w ) re two configurtions of M, then (q,w) M (q,w ) if nd only if w = w for some Σ nd δ(q,) = q. (q,w) yields (q,w ) in one move using M for the reflexive nd trnsitive closure of M, for exmple, (q,w) M (q,w ) denotes tht (q,w) yields (q,w ) fter some numer, including zero, of steps.
13 Moile Computing nd Softwre Engineering p. 13/5 Exmple 3 Consider the df in Exmple 2, M = ({q 0,q 1 }, {,},δ,q 0, {q 0 }), with the input string is. Then, the initil configurtion is (q 0,) nd (q 0,) M (q 0,) M (q 0,) M (q 1,) M (q 0,) (q 0,λ) M Hence, (q 0,) M (q 0,λ).
14 Moile Computing nd Softwre Engineering p. 14/5 Lnguges nd Df s A string w Σ is sid to e ccepted y M if nd only if there is stte q f F s.t. (q 0,w) M (q f,λ). Exmple: is ccepted since q 0 F in the lst exmple. The lnguge ccepted y df M is the set of ll strings on Σ ccepted y M nd is denoted y L(M) nd L(M) = {w Σ : δ (q 0,w) F }. Note: L(M) = {w Σ : δ (q 0,w) F }
15 Moile Computing nd Softwre Engineering p. 15/5 Exmple 4 Remrks: q 2 is trp stte from which the df cn never escpe. L(M) = { n : n 0}
16 Moile Computing nd Softwre Engineering p. 16/5 Exercise Descrie the lnguge ccepted y the following df M = ({q 0,q 1,q 2,q 3 }, {,},δ,q 0, {q 0,q 1,q 2 }), where the trnsition function δ is tulted elow q σ δ(q,σ) q σ δ(q,σ) q 0 q 0 q 2 q 0 q 0 q 1 q 2 q 3 q 1 q 0 q 3 q 3 q 1 q 2 q 3 q 3
17 Moile Computing nd Softwre Engineering p. 17/5 Theorem Let M = (Q, Σ,δ,q 0,F) e df nd G M e the ssocited trnsition grph. Then, q i,q j Q nd w Σ +, δ (q i,w) = q j wlk in G M from q i to q j.
18 Moile Computing nd Softwre Engineering p. 18/5 Exmple 5 Find df tht recognizes the set of ll strings on Σ = {,} strting with the prefix., q 0 q 1 q 2 q 3,
19 Moile Computing nd Softwre Engineering p. 19/5 Exmple 6 Find df tht ccepts ll the strings on {0, 1}, except those contining the sustring , 1 0 q 0 q 1 q q 2
20 Moile Computing nd Softwre Engineering p. 20/5 Regulr Lnguges A lnguge L is clled regulr if nd only if there exists some deterministic finite utomton M such tht L = L(M). Exmple 7: Show tht the lnguge is regulr. L = {w : w {,} } Note tht, to show lnguge is regulr, we need to find df which ccepts it.
21 Moile Computing nd Softwre Engineering p. 21/5 Exmple 7 q 0 q 1 q 2, q 3 Remrks:
22 Moile Computing nd Softwre Engineering p. 22/5 Contents Deterministic Finite Automt Nondeterministic Finite Automt Equivlence of Deterministic nd Nondeterministic Finite Automt Reduction of the Numer of Sttes in Finite Automt
23 Moile Computing nd Softwre Engineering p. 23/5 Nondeterministic Finite Automt A nondeterministic finite utomt (nf) is defined y the quintuple where M = (Q, Σ,δ,q 0,F), Q is finite set of internl sttes, Σ is n lphet, δ : Q (Σ {λ}) 2 Q is the trnsition function (2 Q = the set of ll susets of Q), q 0 Q is the initil stte, nd F Q is the set of finl sttes.
24 Moile Computing nd Softwre Engineering p. 24/5 Aout Nf s λ is llowed to e the second rgument of δ it is possile tht δ(q i,) = λ (i.e. no trnsition) An nf cn lso e presented y stte digrm (grph) A string is ccepted y n nf if there exist some possile moves tht rech to finl stte.
25 Moile Computing nd Softwre Engineering p. 25/5 Exmple 8 q 2 q 1 q 3 q 0 q 4 q 5
26 Moile Computing nd Softwre Engineering p. 26/5 Exmple 9 An nf tht ccepts the set of ll strings contining either two consecutive 0 s or two consecutive 1 s. 0, 1 0, q 0 q 3 q 4 1 q 3 q 4 1 0, 1
27 Moile Computing nd Softwre Engineering p. 27/5 String Inputs The trnsition cn e extended to the notion of computtion on n input string consider the extended trnsition function δ : Q Σ 2 Q. A recursive definition of δ is lso nlogous to the one for df. δ (q i,w) contins q j if nd only if there exists wlk in the stte grph from q i to q j.
28 Moile Computing nd Softwre Engineering p. 28/5 Acceptnce The lnguge ccepted y n nf M is the set of ll strings on Σ ccepted y M nd is defined s L(M) = {w Σ : δ (q 0,w) F }. Exmple 10: In the ove nf, L(M) = {(10) n : n 0}. A configurtion is ded configurtion if the trnsition on it is undefined.
29 Moile Computing nd Softwre Engineering p. 29/5 Resons for Nondeterminism voiding cktrcking helpful in solving prolems esily effective mechnism for descriing some complicted lnguges concisely certin theoreticl results re more esily estlished for nf s
30 Moile Computing nd Softwre Engineering p. 30/5 Contents Deterministic Finite Automt Nondeterministic Finite Automt Equivlence of Deterministic nd Nondeterministic Finite Automt Reduction of the Numer of Sttes in Finite Automt
31 Moile Computing nd Softwre Engineering p. 31/5 Nf s v.s. Df s Intuitively, the fmily of ll nf s includes the fmily of ll df s. We re therefore thinking if for ech nf, there exists corresponding df tht ccepts the sme lnguge.
32 Moile Computing nd Softwre Engineering p. 32/5 Equivlence Two finite utomt M 1 nd M 2 re sid to e equivlent if L(M 1 ) = L(M 2 ). Exmple 11:
33 Moile Computing nd Softwre Engineering p. 33/5 Theorem Let L e set ccepted y n nf. Then there exists df tht ccepts L. Notes: The proof is constructive nd shows wy to convert.
34 Deriving Df from Nf Let M = (Q, Σ,δ,q 0,F) e n nf ccepting L. We cn define df M = (Q, Σ,δ,q 0,F ) s follows: Q = 2 Q ; q 0 = [q 0 ]; F = set of ll sttes in Q contining stte of F ; For n element q = [q 1,q 2,,q i ] Q, δ (q,) is computed y pplying δ to ech stte of q 1,q 2,,q i, nd tking the union. The resulting union is the corresponding stte of δ (q,) in M. Note: Only the meningful sttes re kept. Tht is, we only reserve the stte hving pth from q 0 to itself in the trnsition grph. Moile Computing nd Softwre Engineering p. 34/5
35 Moile Computing nd Softwre Engineering p. 35/5 Exmple 12 δ [q 0 ] [q 1,q 2 ] [ ] [q 1,q 2 ] [q 1,q 2 ] [ ] [ ] [q 0 ] [ ]
36 Moile Computing nd Softwre Engineering p. 36/5 Exmple 13 δ [q 0 ] [q 1 ] [q 2 ] [q 0,q 1 ] [q 1,q 2 ] [q 0,q 1,q 2 ] 0 [q 0,q 1 ] [q 2 ] [ ] [q 0,q 1,q 2 ] [q 2 ] [q 0,q 1,q 2 ] 1 [q 1 ] [q 2 ] [q 2 ] [q 1,q 2 ] [q 2 ] [q 1,q 2 ]
37 Moile Computing nd Softwre Engineering p. 37/5 Contents Deterministic Finite Automt Nondeterministic Finite Automt Equivlence of Deterministic nd Nondeterministic Finite Automt Reduction of the Numer of Sttes in Finite Automt
38 Moile Computing nd Softwre Engineering p. 38/5 Stte Minimiztion Any df defines unique lnguge, ut the converse is not true. To minimize the numer of sttes of given df is to determine n equivlent df tht hs s few sttes s possile. For storge efficiency
39 Unrechle Sttes A stte is unrechle if there is no pth from the strt stte to it. Exmple 14: q 1 q 2 q 3 q 8 q 4 q 5 q 6 q 7, Sttes q 7 nd q 8 re unrechle. For stte minimiztion, sttes q 7 nd q 8 cn e removed. Moile Computing nd Softwre Engineering p. 39/5
40 Moile Computing nd Softwre Engineering p. 40/5 Removing Unrechle Sttes The set of rechle sttes cn e defined s the closure of {s} under the reltion {(p,q) : δ(p,) = q for some Σ}. computed y the following lgorithm: R := s; while there is stte p R nd Σ such tht δ(p,) R do dd δ(p,) to R.
41 Moile Computing nd Softwre Engineering p. 41/5 Exmple 15: Removing unrechle sttes in previous df q 1 q 2 q 3 q 4 q 5 q 6, Note: Sttes q 4 nd q 6 re equivlent.
42 Moile Computing nd Softwre Engineering p. 42/5 Right Congruence (Invrint) Definition: Let L Σ e lnguge, nd let x,y Σ. We sy tht x nd y re equivlent with respective to L, denoted x L y, if for ll z Σ, the following is true: xz L if nd only if yz L. Note: 1. L is n equivlence reltion. 2. x L y if either oth strings elong to L or neither is in L. 3. ppending ny string to oth strings results in two strings tht re either oth in L or oth not in L.
43 Moile Computing nd Softwre Engineering p. 43/5 Exmple 16: q 1 q 2 q 3 q 4 q 5 q 6, L = ( ) 1. If x is string, we denote y [x] the equivlent clss with respective to L to which x elongs. 2. L hs four equivlent clsses: (1) [e] = L, (2) [] = L, (3) [] = L, (4) [] = L( )Σ
44 Equivlence Reltion on Df s Definition: Let M = (Q, Σ,δ,s,F) e df. We sy tht two strings x,y Σ re equivlent with respective to M, denoted x M y, if, intuitively, they oth drive M from s to the sme stte. Formlly, x M y if there is stte q such tht (s,x) M (q,e) nd (s,y) M (q,e). Note: 1. M is n equivlence reltion. 2. Its equivlence clsses cn e identified y the sttes of M. 3. We denote the equivlence clss corresponding to stte q of M s E q. Moile Computing nd Softwre Engineering p. 44/5
45 Moile Computing nd Softwre Engineering p. 45/5 Exmple 17: q 1 q 2 q 3 q 4 q 5 q 6, L = ( ) The equivlence clsses of M re: (1) E q1 = (), (2) E q2 = L, (3) E q3 = L, (4) E q4 = (), (5) E q5 = L( )Σ, (6) E q6 = () L.
46 Moile Computing nd Softwre Engineering p. 46/5 Theorem Theorem: For ny df M = (Q, Σ,δ,s,F) nd ny strings x,y Σ, if x M y, then x L y. M is refinement of L. Exmple 18: Clsses E q5 nd [] coincide, while clsses E q1 nd E q3 re oth susets of [e]. Note: The numer of equivlence clsses of L under is nturl lower ound on the numer of sttes of ny df ccepting L.
47 Moile Computing nd Softwre Engineering p. 47/5 The Myhill-Nerode Theorem Theorem: Let L Σ e regulr lnguge. Then there is df with precisely s mny sttes s there re equivlence clsses in L tht ccepts L. Exmple 19: The stndrd utomton corresponding the L = ( ) is s follows nd hs four sttes. [e] [] {q 1, q 3 } {q 2 } {q 4, q 6 } {q 5 } [] [,],
48 Moile Computing nd Softwre Engineering p. 48/5 Corollry Corollry: A lnguge L is regulr if nd only if L hs finitely mny equivlence clsses. This corollry provides wy to for proving tht lnguge is not regulr. Exmple 20: L = { n n : n 1} is not regulr.
49 Moile Computing nd Softwre Engineering p. 49/5 Indistinguishle Sttes Let M = (Q, Σ,δ,s,F) e df. Definition: Define reltion A M Q Σ s (q,z) A M δ (q,z) F. We cll two sttes p,q Q equivlent (or, indistinguishle), denoted p q if for ll w Σ, (q,w) A M (p,w) A M. Two sttes which re not equivlent re distinguishle.
50 Moile Computing nd Softwre Engineering p. 50/5 Notes on Indistinguishle Sttes if two sttes re equivlent, then the corresponding equivlence clsses of M re susets of the sme equivlence clss of L. the equivlence clsses of re precisely those sets of stte of M tht must clumped together in order to otined the stndrd utomton of L(M).
51 Moile Computing nd Softwre Engineering p. 51/5 Sequence of Equivlence Reltions Definition: For two sttes p,q Q, p n q if the following is true: Note: (q,w) A M (p,w) A M, w with w n. n is corser equivlence reltion thn. Ech equivlence reltion in 0, 1, 2,... is refinement of the previous one. There re precisely two equivlence clsses of 0 : F nd Q F.
52 Moile Computing nd Softwre Engineering p. 52/5 Deriving n Lemm: For ny two sttes p,q Q nd ny integer n 1, p n q if nd only if () p n 1 q, nd () for ll Σ, δ(q,) n 1 δ(p,). Note: This lemm suggests wy to compute
53 Moile Computing nd Softwre Engineering p. 53/5 Constructing the Miniml df Algorithm: Initilly the equivlence clsses of 0 re F nd Q F ; repet for n = 1, 2,... Compute the equivlence clsses of n from those of n 1 until n is the sme s n 1.
54 Moile Computing nd Softwre Engineering p. 54/5 Exmple 21: Agin, we consider the following exmple q 1 q 2 q 3 q 4 q 5 q 6,
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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. 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 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 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 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 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 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 informationDFA minimisation using the Myhill-Nerode theorem
DFA minimistion using the Myhill-Nerode theorem Johnn Högerg Lrs Lrsson Astrct The Myhill-Nerode theorem is n importnt chrcteristion of regulr lnguges, nd it lso hs mny prcticl implictions. In this chpter,
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 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 informationFinite Automata-cont d
Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww
More information80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers
80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES 2.6 Finite Stte Automt With Output: Trnsducers So fr, we hve only considered utomt tht recognize lnguges, i.e., utomt tht do not produce ny output on ny input
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 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 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 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 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 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 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 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. 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 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 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 information11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?
CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction
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 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 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 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 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 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
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 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 informationModel Reduction of Finite State Machines by Contraction
Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, 09123 Cgliri, Itly Phone: +39-070-675-5892 Fx: +39-070-675-5900
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 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 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 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 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 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 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 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 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 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 informationNon-Deterministic Finite Automata
Non-Deterministic Finite Automt http://users.comlb.ox.c.uk/luke. ong/teching/moc/nf2up.pdf 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q1 q2 2 Alphbet ={} Two choices q1 q2 3 Alphbet ={} Two choices
More informationNon Deterministic Automata. Formal Languages and Automata - Yonsei CS 1
Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges
More 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 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 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 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 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 informationRegular Languages and Applications
Regulr Lnguges nd Applictions Yo-Su Hn Deprtment of Computer Science Yonsei University 1-1 SNU 4/14 Regulr Lnguges An old nd well-known topic in CS Kleene Theorem in 1959 FA (finite-stte utomton) constructions:
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 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 information12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014
CS125 Lecture 12 Fll 2014 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple
More 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 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 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 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 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 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 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 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 informationRevision Sheet. (a) Give a regular expression for each of the following languages:
Theoreticl Computer Science (Bridging Course) Dr. G. D. Tipldi F. Bonirdi Winter Semester 2014/2015 Revision Sheet University of Freiurg Deprtment of Computer Science Question 1 (Finite Automt, 8 + 6 points)
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 informationinput tape head moves current state
CPS 140 - Mthemticl Foundtions of CS Dr. Susn Rodger Section: Finite Automt (Ch. 2) (lecture notes) Things to do in clss tody (Jn. 13, 2004): ffl questions on homework 1 ffl finish chpter 1 ffl Red Chpter
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 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 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 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 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 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 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 informationSection: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.
Section: Other Models of Turing Mchines Definition: Two utomt re equivlent if they ccept the sme lnguge. Turing Mchines with Sty Option Modify δ, Theorem Clss of stndrd TM s is equivlent to clss of TM
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 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 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 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 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 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 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 informationLecture 9: LTL and Büchi Automata
Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled
More 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