1 Structural induction, finite automata, regular expressions

Size: px
Start display at page:

Download "1 Structural induction, finite automata, regular expressions"

Transcription

1 Discrete Structures Prelim 2 smple uestions s CS2800 Questions selected for spring Structurl induction, finite utomt, regulr expressions 1. We define set S of functions from Z to Z inductively s follows: Rule 1. For ny n Z, the trnsltion (or offset) function t n : x x + n is in S. Rule 2. For ny k 0 Z, the scling function r k : x kx is in S. Rule 3. If f nd g re elements of S, then the composition f g S. Rule 4. If f S nd f hs right inverse g, then g is lso in S. In other words, S consists of functions tht trnslte nd scle integers, nd compositions nd right inverses thereof. Note: This semester, we mde bigger distinction between the elements of n inductively defined set nd the mening of n inductively defined set. We probbly would hve phrsed this uestion s follows: Let S be given by s S ::= t n r k s 1 s 2 rinv s nd inductively, let the function defined by s (written F s : Z) be given by the rules F tn (x) ::= x + n, F rk (x) ::= ks, F s1 s 2 (x) ::= F s1 F s2 nd let F rinv s ::= g where g is right inverse of F s. () [1 point] Show tht the function f : x 3x + 17 is in S. By rule 1, the function t 17 : x x + 17 is in S, nd by rule 2, r 3 : x 3x is in S. By rule 3, therefore, t 17 r 3 : x 3x + 17 is in S. (b) Use structurl induction to prove tht for ll f S, f is injective. You my use without proof the fct tht the composition of injective functions is injective. We must show tht ll functions formed with ech of the rules re injective. Let P (s) be the sttement s is injective. P (t k ) holds, becuse t k hs two sided inverse t k, nd is therefore injective. P (r k ) holds, becuse we reuired tht k 0. Therefore, if kx 1 = kx 2, we cn cncel k to find x 1 = x 2. P (f g) holds, ssuming P (f) nd P (g), becuse the composition of injections is n injection. If g is the right inverse of f, then P (g) holds, becuse g hs left-inverse (nmely f) nd is therefore injective. (c) Give surjection φ from S to Z (proof of surjectivity not necessry). Remember tht this surjection must mp function to n integer, nd for every integer there must be function tht mps to it. 1

2 Let φ(s) ::= s(0). This is surjection, becuse t n (0) = 0 + n = n, so for ny n there exists s S (nmely t n ) with φ(s) = n. 2. Seeking to void the limittions of regulr expressions, student designs set S of super expressions. Just s with regulr expressions, ech super expression s S mtches set of strings, denoted by L(s). The set S nd the function L re defined inductively s follows: A chrcter clss is denoted [ n ] (where the i re single chrcters, i.e. elements of Σ). It mtches single chrcter which is ny of the i. For exmple, [012] mtches 0, 1, nd 2, but does not mtch 12. Formlly, [ n ] S nd L([ n ]) = { 1, 2,..., n }. If s S, positive repetition of s is denoted s+. It mtches one or more strings, ech of which is mtched by s. For exmple, [45]+ mtches 4, 54, nd 555 but does not mtch. Formlly, s+ S nd L(s+) = {x 1 x 2 x n n 1 nd x i L(s)}. If s 1 S nd s 2 S then the difference of s 1 nd s 2 is denoted by s 1 \ s 2. It mtches ll strings tht s 1 mtches but s 2 does not. For exmple, ([123]+)\[123] mtches 1322 nd 11 but not 1, 2, or 3. Formlly, s 1 \ s 2 S nd L(s 1 \ s 2 ) = L(s 1 ) \ L(s 2 ). If s 1 S nd s 2 S then the conctention of s 1 nd s 2 is denoted by s 1 s 2. It mtches ny string tht is formed by conctenting string mtched by s 1 with string mtched by s 2. For exmple [012][34] mtches 03 nd 24 but not 0 or 32. Formlly, s 1 s 2 S nd L(s 1 s 2 ) = {xy x L(s 1 ) nd y L(s 2 )}. () Let Σ = {0, 1, 2}. Let s be the super expression ([01][12])+ \ ([012][012]). Write (norml) regulr expression r such tht L(r) = L(s). To explin the nswer, I ll refer to string mtching [01][12] s unit. We must mtch strings contining two or more units. A unit is mtched by the (norml) regulr expression (0 + 1)(1 + 2). Therefore, two or more units is mtched by (0 + 1)(1 + 2)(0 + 1)(1 + 2)((0 + 1)(1 + 2)). (b) Prove by structurl induction tht every super expression s S hs n euivlent regulr expression. You my use without proof the fct tht the union, intersection, nd complement of regulr lnguges re regulr. Let P (s) be the sttement there exists r RE such tht L(r) = L(s). We must show P ([ 1... n ]), P (s + ) (ssuming P (s)), P (s 1 \ s 2 ) (ssuming P (s 1 ) nd P (s 2 )), nd P (s 1 s 2 ) (gin, ssuming P (s 1 ) d P (s 2 )) P ([ 1... n ]) holds, becuse L([ 1... n ]) = L( n ). P (s 1 \ s 2 ) holds; we ssume inductively tht s 1 nd s 2 re regulr. We know tht L(s 1 \ s 2 ) = L(s 1 ) \ L(s 2 ) = L(s 1 ) L(s 2 ), which is regulr, becuse the intersection nd complement of regulr lnguges is regulr. Finlly, we must show tht L(s 1 s 2 ) is regulr. We inductively ssume tht s 1 nd s 2 re regulr. Therefore, there exist r 1 nd r 2 with L(r 1 ) = L(s 1 ) nd L(r 2 ) = L(s 2 ). By definition, this shows tht L(r 1 r 2 ) = L(s 1 s 2 ), so s 1 s 2 is regulr. 3. Given DFAs M 1 = (Q 1, Σ, δ 1, 01, F 1 ) nd M 2 = (Q 2, Σ, δ 2, 02, F 2 ), we cn construct mchine M 12 with L(M 12 ) = L(M 1 ) L(M 2 ) s follows: Let Q = Q 1 Q 2 = the set of ll ordered pirs ( 1, 2 ), where 1 Q 1 nd 2 Q 2. Let 0 Q = ( 01, 02 ). 2

3 Let F = F 1 F 2 = {( 1, 2 ) 1 F 1 nd 2 F 2 }. Let δ 12 (( 1, 2 ), ) = (δ 1 ( 1, ), δ 2 ( 2, )). Let M 12 = (Q, Σ, δ 12, 0, F ). Use structurl induction to prove tht for ll x Σ, δ 12 (( 1, 2 ), x) = ( δ1 ( 1, x), δ ) 2 ( 2, x). The min chllenge here is wding through the nottionl jungle to understnd wht the problem ctully sys. Once you ve done this, the proof is short nd strightforwrd. Here it is in ll its glory: We will prove the result by structurl induction on x, s suggested. Both the set of strings Σ nd the extended trnsition function δ re defined recursively (see the definitions t the end). The bse cse for x is the empty string. We cn simply red off the corresponding line in the definition of δ, which tells us tht δ 1 ( 1, ) = 1, δ 2 ( 2, ) = 2, nd δ 12 (( 1, 2 ), ) = ( 1, 2 ). Hence δ 12 (( 1, 2 ), ) = ( 1, 2 ) = ( δ1 ( 1, ), δ ) 2 ( 2, ), so the sttement is true in the bse cse. Now ssume the sttement is true for some string x, nd consider the next lrger string x. Agin reding off the pproprite line in the definition of δ, we know tht δ 1 ( 1, x) = δ 1 ( δ 1 ( 1, x), ), nd δ 2 ( 2, x) = δ 2 ( δ 2 ( 2, x), ) Wht is δ 12 (( 1, 2 ), x)? Well, we lso hve δ 12 (( 1, 2 ), x) = δ 12 ( δ 12 (( 1, 2 ), x), ) (definition of δ 12 ) = δ 12 (( δ1 ( 1, x), δ ) ) 2 ( 2, x), (inductive hypothesis) ( ) )) = δ 1 ( δ1 ( 1, x),, δ 2 ( δ2 ( 2, x), (definition of δ 12 ) = ( δ1 ( 1, x), δ ) 2 ( 2, x) (definition of δ 1, δ 2 ) This proves the sttement for ll strings x Σ by (structurl) induction. 4. () Drw finite utomton (DFA, NFA or -NFA) with lphbet {0, 1} to recognize the lnguge {x {0, 1} x contins the substring 010} An NFA is probbly the esiest to construct. 0, 1 0, 1 0 strt (b) Drw finite utomton (DFA, NFA or -NFA) with lphbet {, b} to recognize the sme lnguge s the regulr expression (b b). 3

4 We cn blindly pply the regex -NFA construction from the proof of Kleene s Theorem to get something like this: b strt 0 1 f b Of course this is bit messy, more compressed version might look like this: 11 b strt 1 b Prove tht L = {0 n 10 n n N} is not regulr. Suppose tht this lnguge is ccepted by some deterministic finite utomton with N sttes. Consider the string x = 0 n 10 n. Since x is in the lnguge nd x N, by the Pumping Lemm, there exist strings u, v, nd w such tht x = uvw, v 1, uv N, nd M ccepts uv i w for ll i > 0. Since uv N, it must be the cse tht uv is string of 0 s, nd tht w contins the 1 in 0 N 10 N. Thus, if i > 1, uv i w hs more thn N 0s to the left of the 1 nd only N 0s to the right of the 1, nd thus is not in the lnguge. This contrdicts the ssumption tht the lnguge is ccepted by M (since M ccepts string not in the lnguge). 6. Let r be regulr expression. Show tht there exists regulr expression r with L(r ) = L(r) (the complement of L(r)). If your proof involves the construction of regulr expression or utomton, you must prove tht the lnguge of the regulr expression/utomton is wht you clim it is (using the 4

5 definitions). First, note tht L(r) is lnguge, which mens tht it s set of strings. So its complement consists of ll the strings in L(r) tht re not in Σ. (Mny of you took complement to men the result of switching the 0s nd 1s in the strings in L(r). This is not wht complement mens in this context; moreover, this pproch fils if Σ {0, 1}. Unfortuntely, you typiclly got 0, 1, or 2 out of 6 if you did this, depending on wht else you did.) By Kleene s theorem, there is DFA M = (Q, Σ, δ, 0, F ) with L(M) = L(R). We cn form new utomton M by flipping the ccept nd reject sttes of M: M = (Q, Σ, δ, 0, Q \ F ). I clim L(M ) = L(M). Indeed, x L(M ) ˆδ( 0, x) Q \ F ˆδ( 0, x) / F x / L(M) (You typiclly lost 1 point if you didn t give proof.) Applying Kleene s theorem gin tells us tht since there is DFA with L(M ) = L(r) there must be regulr expression r with L(r ) = L(r). 7. Build deterministic finite utomton tht recognizes the set of strings of 0 s nd 1 s, tht only contin single 0 (nd ny number of 1 s). Describe the set of strings tht led to ech stte. 0 strt ,1 The strings leding to i contin i 0 s. 8. Given string x, we cn define the chrcter doubling of x to be x with every chrcter doubled: for exmple cd(bc) = bbcc. Formlly, cd() =, nd cd(x) = cd(x). We cn then define the chrcter doubling of lnguge L to be the set of ll strings formed by doubling the chrcters of strings in L; formlly cd(l) = {cd(x) x L}. Given DFA M = (Q, Σ, δ, 0, F ), we cn construct new DFA M cd tht recognizes cd(l(m)) by dding new stte to the middle of every trnsition from on chrcter : 1 2 becomes () Formlly describe the components (Q cd, Σ cd, δ cd, 0cd, F cd ) of M cd in terms of the components of M. Be sure to describe δ cd on ll inputs (you my need to dd one or more dditionl sttes). Q cd = Q { Q, A} {X} δ cd : (, ) ; δ cd : (, ) δ(, ); δ cd : (, b) X if b, nd δ cd : (X, ) X. The remining components re unchnged: Σ cd = Σ, 0cd = 0, nd F cd = F. (b) Use structurl induction on x to prove tht for ll x, δ( 0, x) = δ cd ( 0cd, cd(x)). 5

6 Let P (x) be the sttement tht δ( 0, x) = δ cd ( 0, cd(x)). I will prove x, P (x) by structurl induction. To show P (), note tht δ( 0, ) = 0. Moreover, cd() =, so δ cd ( 0, cd()) = δ cd ( 0, ) = 0 = δ( 0, ), s reuired. To show P (x), we ssume the inductive hypothesis P (x). we compute: δ cd ( 0, cd(x)) = δ cd ( 0, cd(x)) by definition of cd = δ cd (δ cd ( δ cd ( 0, cd(x)), ), ) by definition of δ cd = δ cd (δ cd ( δ( 0, x), ), ) by definition of δ cd = δ cd (, ) ( δ(0,x)) by definition of δ cd = δ( δ( 0, x), ) by definition of δ cd = δ( 0, x) by definition of δ 9. We cn lso define the string doubling of x to be xx. For exmple, sd(bc) = bcbc. Show tht the set of regulr lnguges is not closed under string doubling. In other words, give regulr lnguge L nd prove tht sd(l) = {sd(x) x L} is not regulr. You cn use ny theorem proved in clss to help prove this result. Let L = 0 1. Clerly L is regulr. Moreover, sd(l) = {0 n 10 n 1 n N}. This lnguge is not regulr. To see this, ssume for the ske of contrdiction tht it is. Then there exists some nturl number m s in the pumping lemm. Let x = 0 m 10 m 1. Clerly x sd(l), nd x m, so we cn split x into u, v, nd w, s in the pumping lemm. We know tht uv n, so v cn only contin 0 s. Then x = uv 2 w contins more 0 s before the first 1 thn fter, nd thus x / sd(l). But the pumping lemm sys tht x sd(l); this is contrdiction, nd thus sd(l) is not regulr. 10. Hppy Ct hs been shown the following proof, nd hs promptly turned into Grumpy Ct. Briefly but clerly identify the error which hs induced grumpiness. To prove: The lnguge of the regulr expression 0 1 is, in fct, not DFA-recognizble. Proof. Let L be the lnguge of 0 1. Assume there is some DFA M with n sttes tht recognizes L. Let x = 0 n Clerly, x L nd x n. Therefore ccording to the Pumping Lemm, we cn split x into three prts u, v nd w, such tht uv n, v 1, nd uv i w L for ll nturl numbers i. Let v = n. Since uv n, it must be the cse tht u =, nd v = 0 n 1 1. Then uv 2 w = 0 n 1 10 n 1 11, which is clerly not in L. This contrdicts our ssumption tht there is DFA which recognizes the lnguge. The pumping lemm sys there exists some v, but we hve chosen specific v. It my be tht the pumping lemm gives some other v (such s 0). 2 Probbility problems 1. () Give the definition of vrince in terms of expecttion. 6

7 I would lso ccept Vr(X) = E(X 2 ) E 2 (X). Vr(X) = E((X E(X)) 2 ) (b) Let X nd Y be rndom vribles with E(X) = E(Y ) = 0. Prove tht Vr(X+Y ) = Vr(X)+Vr(Y ). Mke (nd clerly stte) dditionl ssumptions if necessry. We must reuire tht X nd Y re independent. Therefore E(XY ) = 0. Then we hve Vr(X + Y ) = E ( (X + Y E(X + Y )) 2) by definition = E ( (X + Y ) 2) since E(X + Y ) = E(X) + E(Y ) = 0 = E(X 2 + 2XY + Y 2 ) rithmetic = E(X 2 ) + 2E(XY ) + E(Y 2 ) expecttion of the sum is sum of expecttions = E(X 2 ) + E(Y 2 ) since E(XY ) = 0 (independence) = Vr(X) + Vr(Y ) by definition nd fct tht E(X) = E(Y ) = 0 2. () The verge humn height is 5 feet nd 4 inches, nd the vrince is 2 sured inches. How lrge smple must I tke so tht my estimte of the verge will (with 90% probbility) be correct to within hlf inch? Let H denote the height rndom vrible, nd let E be the estimted verge. The lw of lrge numbers sttes tht P( E E(H) ) σ 2 (H)/n 2. Plugging in hlf inch for epsilon nd solving for n, we see tht if n 2/( ) tht the probbility of being incorrect is no lrger thn 0.1. (b) A certin high school is divided into two tems: 35% of the students re beliebers, nd the remining 65% re directioners. 90% of the songs on belieber s plylist will be Justin Bieber songs, while the other 10% will be by One Direction. Directioners re bit more brod-minded: 80% of their songs will be One Direction songs, while the remining 20% will be Justin Bieber songs. A student is selected t rndom, nd rndom song is selected from their plylist. It turns out to be Bby by Justin Bieber. Wht is the probbility tht the student ws directioner? Let D be the event tht the student is directioner, nd let B be the event tht the student is belieber. Let S D be the event tht the selected song ws One Direction song, nd S B be the event tht the selected song ws Justin Bieber song. We re given P (B) = 35% P (D) = 65% P (S D D) = 80% P (S D B) = 10% P (S B D) = 20% P (S B B) = 90% 7

8 We wish to find P (D S B ). The correct nswer is given by Byes rule: P (D S B ) = P (S B D)P (D) P (S B ) = P (S B D)P (D) P (S B D)P (D) + P (S B B)P (B) = Suppose tht coin hs probbility.6 of lnding heds. You flip it 100 times. The coin flips re ll mutully independent. () Wht is the expected number of heds? Let X i be the outcome of the ith coin toss; X i = 1 if the ith coin toss lnds heds nd 0 otherwise. The totl number of heds is Y = X X 100. We re interested in E(Y ). By linerity, E(Y ) = E(X 1 ) + + E(X 100 ) = 100(.6) = 60. (b) Wht upper bound does Mrkov s Theorem give for the probbility tht the number of heds is t lest 80? Mrkov s Theorem sys tht Pr(Y 80) E(Y )/80 = 60/80 = 3/4. (c) Wht is the vrince of the number of heds for single toss? Clculte the vrince using either of the euivlent definitions of vrince. Let X i be n indictor vrible tht is 1 is the ith toss is heds, nd 0 otherwise. We re given P (X i = 1) = 0.6. The expecttion of X i is = 0.6. Note tht Xi 2 = X i, so E(Xi 2) = 0.6 s well. Therefore V r(x i) = E(X i ) 2 E(X i ) 2 = = (d) Wht is the vrince of the number of heds for 100 tosses? You my use the fct tht if X 1,..., X n re mutully independent, then Vr( X i ) = Vr(X i ); you don t need to prove this. V r(y ) = V r(x 1 )+ +V r(x 100 ). Since V r(x i ) =.24 for i = 1,..., 100, V r(y ) = = 24. (e) Wht upper bound does Chebyshev s Theorem give for the probbility tht the number of heds is either less thn 40 or greter thn 80? By Chebyshev s Theorem. Pr( Y E(Y ) 20) Vr(Y )/400. Since E(Y ) = 60, Pr(Y 80 Y 40) 24/400 =.06. 8

1 Structural induction

1 Structural induction Discrete Structures Prelim 2 smple questions Solutions CS2800 Questions selected for Spring 2018 1 Structurl induction 1. We define set S of functions from Z to Z inductively s follows: Rule 1. For ny

More information

Harvard University Computer Science 121 Midterm October 23, 2012

Harvard University Computer Science 121 Midterm October 23, 2012 Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is

More information

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38 Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control

More information

Theory of Computation Regular Languages

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

More information

More on automata. Michael George. March 24 April 7, 2014

More on automata. Michael George. March 24 April 7, 2014 More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose

More information

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn

More information

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Homework 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 information

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018 CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

More information

1.3 Regular Expressions

1.3 Regular Expressions 56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1 Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more

More information

1.4 Nonregular Languages

1.4 Nonregular Languages 74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll

More information

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun: CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

More information

Some Theory of Computation Exercises Week 1

Some 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 information

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS 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 information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

More information

1 From NFA to regular expression

1 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 information

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

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

More information

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

More information

Solution for Assignment 1 : Intro to Probability and Statistics, PAC learning

Solution for Assignment 1 : Intro to Probability and Statistics, PAC learning Solution for Assignment 1 : Intro to Probbility nd Sttistics, PAC lerning 10-701/15-781: Mchine Lerning (Fll 004) Due: Sept. 30th 004, Thursdy, Strt of clss Question 1. Bsic Probbility ( 18 pts) 1.1 (

More information

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton 25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q

More information

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

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

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

More information

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

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

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

More information

State Minimization for DFAs

State Minimization for DFAs Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid

More information

3 Regular expressions

3 Regular expressions 3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll

More information

Math 426: Probability Final Exam Practice

Math 426: Probability Final Exam Practice Mth 46: Probbility Finl Exm Prctice. Computtionl problems 4. Let T k (n) denote the number of prtitions of the set {,..., n} into k nonempty subsets, where k n. Argue tht T k (n) kt k (n ) + T k (n ) by

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

More information

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Converting Regular Expressions to Discrete Finite Automata: A Tutorial Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert

More information

Discrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17

Discrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17 EECS 70 Discrete Mthemtics nd Proility Theory Spring 2013 Annt Shi Lecture 17 I.I.D. Rndom Vriles Estimting the is of coin Question: We wnt to estimte the proportion p of Democrts in the US popultion,

More information

Finite-State Automata: Recap

Finite-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 information

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions

More information

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

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

More information

Lecture 09: Myhill-Nerode Theorem

Lecture 09: Myhill-Nerode Theorem CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives

More information

Name Ima Sample ASU ID

Name Ima Sample ASU ID Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to

More information

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny

More information

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir CSCI 2400 Models of Computtion, Section 3 Solutions to Homework 4 Problem 1. ll the solutions below refer to the Pumping Lemm of Theorem 4.8, pge 119. () L = f n b l k : k n + lg Let's ssume for contrdiction

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES nd REGULAR EXPRESSIONS TUESDAY Jn 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w hs equl numer of

More information

Automata and Languages

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

More information

Deterministic Finite Automata

Deterministic Finite Automata Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

More information

Chapter 2 Finite Automata

Chapter 2 Finite Automata Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht

More information

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 17

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 17 CS 70 Discrete Mthemtics nd Proility Theory Summer 2014 Jmes Cook Note 17 I.I.D. Rndom Vriles Estimting the is of coin Question: We wnt to estimte the proportion p of Democrts in the US popultion, y tking

More information

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30 Tlen en Automten Test 1, Mon 7 th Dec, 2015 15h45 17h30 This test consists of four exercises over 5 pges. Explin your pproch, nd write your nswer to ech exercise on seprte pge. You cn score mximum of 100

More information

Closure Properties of Regular Languages

Closure 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 information

CSCI FOUNDATIONS OF COMPUTER SCIENCE

CSCI FOUNDATIONS OF COMPUTER SCIENCE 1 CSCI- 2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2015 My 7, 2015 2 Announcements Homework 9 is due now. Some finl exm review problems will be posted on the web site tody. These re prcqce problems not

More information

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

Homework Solution - Set 5 Due: Friday 10/03/08

Homework Solution - Set 5 Due: Friday 10/03/08 CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl.

More information

Turing Machines Part One

Turing Machines Part One Turing Mchines Prt One Hello Hello Condensed Condensed Slide Slide Reders! Reders! Tody s Tody s lecture lecture consists consists lmost lmost exclusively exclusively of of nimtions nimtions of of Turing

More information

Turing Machines Part One

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

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

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

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

More information

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

11.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 information

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent

More information

Let's start with an example:

Let'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 information

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

NFAs continued, Closure Properties of Regular Languages

NFAs 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 information

Worked out examples Finite Automata

Worked 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 information

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q

More information

Coalgebra, Lecture 15: Equations for Deterministic Automata

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

More information

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

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

More information

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3)

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3) cs3102: Theory of Computtion Clss 5: Non-Regulr PS1, Prolem 8 Menu Non-regulr lnguges Spring 2010 University of Virgini Dvid Evns PS1 Generl Comments Proofs re for mking convincing rguments, not for ofusction.

More information

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks

More information

Fundamentals of Computer Science

Fundamentals of Computer Science Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,

More information

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

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

More information

DISCRETE MATHEMATICS HOMEWORK 3 SOLUTIONS

DISCRETE MATHEMATICS HOMEWORK 3 SOLUTIONS DISCRETE MATHEMATICS 21228 HOMEWORK 3 SOLUTIONS JC Due in clss Wednesdy September 17. You my collborte but must write up your solutions by yourself. Lte homework will not be ccepted. Homework must either

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automt Prt Three Hello Hello Wonderful Wonderful Condensed Condensed Slide Slide Reders! Reders! The The first first hlf hlf of of this this lecture lecture consists consists lmost lmost exclusively

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2011.2.1 COMPUTER SCIENCE TRIPOS Prt IA Tuesdy 7 June 2011 1.30 to 4.30 COMPUTER SCIENCE Pper 2 Answer one question from ech of Sections A, B nd C, nd two questions from Section D. Submit the nswers

More information

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 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 information

Where did dynamic programming come from?

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

More information

CISC 4090 Theory of Computation

CISC 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 information

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

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

More information

Handout: Natural deduction for first order logic

Handout: Natural deduction for first order logic MATH 457 Introduction to Mthemticl Logic Spring 2016 Dr Json Rute Hndout: Nturl deduction for first order logic We will extend our nturl deduction rules for sententil logic to first order logic These notes

More information

1 Probability Density Functions

1 Probability Density Functions Lis Yn CS 9 Continuous Distributions Lecture Notes #9 July 6, 28 Bsed on chpter by Chris Piech So fr, ll rndom vribles we hve seen hve been discrete. In ll the cses we hve seen in CS 9, this ment tht our

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook

More information

Chapter 0. What is the Lebesgue integral about?

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

More information

Math 135, Spring 2012: HW 7

Math 135, Spring 2012: HW 7 Mth 3, Spring : HW 7 Problem (p. 34 #). SOLUTION. Let N the number of risins per cookie. If N is Poisson rndom vrible with prmeter λ, then nd for this to be t lest.99, we need P (N ) P (N ) ep( λ) λ ln(.)

More information

Lecture 6 Regular Grammars

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

More information

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

More information

1 Functions, relations, and infinite cardinality

1 Functions, relations, and infinite cardinality Discrete Structures Prelim 2 sample questions s CS2800 Questions selected for fall 2017 1 Functions, relations, and infinite cardinality 1. True/false. For each of the following statements, indicate whether

More information

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

PART 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 information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Revision Sheet. (a) Give a regular expression for each of the following languages:

Revision 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 information

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1 Exm, Mthemtics 471, Section ETY6 6:5 pm 7:4 pm, Mrch 1, 16, IH-115 Instructor: Attil Máté 1 17 copies 1. ) Stte the usul sufficient condition for the fixed-point itertion to converge when solving the eqution

More information

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Regular 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 information