The Course covers: Lexical Analysis Syntax Analysis Semantic Analysis Runtime environments Code Generation Code Optimization. CS 540 Spring 2013 GMU 2

Size: px
Start display at page:

Download "The Course covers: Lexical Analysis Syntax Analysis Semantic Analysis Runtime environments Code Generation Code Optimization. CS 540 Spring 2013 GMU 2"

Transcription

1 CS 540 Spring 2013

2 Th Cours covrs: Lxicl Anlysis Syntx Anlysis Smntic Anlysis Runtim nvironmnts Cod Gnrtion Cod Optimiztion CS 540 Spring 2013 GMU 2

3 Pr-rquisit courss Strong progrmming ckground in C, C++ or Jv CS 310 Forml Lngug (NFAs, DFAs, CFG) CS 330 Assmly Lngug Progrmming nd Mchin Architctur CS 367 CS 540 Spring 2013 GMU 3

4 Oprtionl Informtion Offic: Enginring Building, Rm E-mil: Clss W Pg: Blckord Discussion ord: Piss Computr Accounts on zus.vs.gmu.du (link on Usful Links ) CS 540 Spring 2013 GMU 4

5 CS 540 Cours Grding Progrmming Assignmnts (45%) 5% + 10% + 10% + 20% Exms midtrm nd finl (25%, 30%) CS 540 Spring 2013 GMU 5

6 Rsourcs Txtooks: Compilrs: Principls, Tchniqus nd Tools, Aho, Lm, Sthi & Ullmn, 2007 (rquird) lx & ycc, Lvin t. l. Slids Smpl cod for Lx/YACC (C, C++, Jv) CS 540 Spring 2013 GMU 6

7 Distnc Eduction CS 540 Spring 13 sssion is dlivrd to th Intrnt sction (Sction 540-DL) onlin y NEW Studnts in distnc sction will ccss to onlin lcturs nd cn ply ck th lcturs nd downlod th PDF slid fils Th distnc duction studnts will givn th midtrm nd finl xm on cmpus, on th sm dy/tim s in clss studnts. Exm loctions will nnouncd closr to th xm dts. CS 540 Spring 2013 GMU 7

8 Lctur 1: Introduction to Lngug Procssing & Lxicl Anlysis CS 540

9 Wht is compilr? A progrm tht rds progrm writtn in on lngug nd trnslts it into nothr lngug. Sourc lngug Trgt lngug Trditionlly, compilrs go from high-lvl lngugs to low-lvl lngugs. CS 540 Spring 2013 GMU 9

10 Compilr Architctur In mor dtil: Intrmdit Lngug Sourc Lngug Front End lngug spcific Bck End mchin spcific Trgt Lngug Sprtion of Concrns Rtrgting CS 540 Spring 2013 GMU 10

11 Compilr Architctur Intrmdit Lngug Intrmdit Lngug Sourc lngug Scnnr (lxicl nlysis) tokns Prsr (syntx nlysis) Syntctic structur Smntic Anlysis (IC gnrtor) Cod Optimizr Cod Gnrtor Trgt lngug Symol Tl CS 540 Spring 2013 GMU 11

12 Lxicl Anlysis - Scnning Sourc lngug Scnnr (lxicl nlysis) tokns Prsr (syntx nlysis) Smntic Anlysis (IC gnrtor) Cod Gnrtor Cod Optimizr Tokns dscrid formlly Brks input into tokns Rmov whit spc Symol Tl CS 540 Spring 2013 GMU 12

13 Input: rsult = + * c / d Tokns: rsult, =,, +,, *, c, /, d idntifirs oprtors CS 540 Spring 2013 GMU 13

14 Sttic Anlysis - Prsing Sourc lngug Scnnr (lxicl nlysis) tokns Prsr (syntx nlysis) Syntctic structur Smntic Anlysis (IC gnrtor) Cod Gnrtor Trgt lngug Cod Optimizr Syntx dscrid formlly Tokns orgnizd into syntx tr tht dscris structur Error chcking (syntx) Symol Tl CS 540 Spring 2013 GMU 14

15 Input: rsult = + * c / d Exp ::= Exp + Exp Exp - Exp Exp * Exp Exp / Exp ID Assign ::= ID = Exp Assign ID = Exp Exp + Exp ID Exp * Exp ID Exp / Exp ID ID CS 540 Spring 2013 GMU 15

16 Smntic Anlysis Sourc lngug Scnnr (lxicl nlysis) Prsr (syntx nlysis) Syntctic structur Smntic Anlysis (IC gnrtor) Syntctic/smntic structur Cod Gnrtor Trgt lngug Syntctic/smntic structur Cod Optimizr Mning Typ/Error Chcking Intrmdit Cod Gnrtion strct mchin Symol Tl CS 540 Spring 2013 GMU 16

17 Optimiztion Sourc lngug Scnnr (lxicl nlysis) Prsr (syntx nlysis) Syntctic/smntic structur Smntic Anlysis (IC gnrtor) Cod Optimizr Cod Gnrtor Syntctic/smntic structur Trgt lngug Improving fficincy (mchin indpndnt) Finding optiml cod is NP Symol Tl CS 540 Spring 2013 GMU 17

18 Cod Gnrtion Sourc lngug Scnnr (lxicl nlysis) Prsr (syntx nlysis) Syntctic/smntic structur Smntic Anlysis (IC gnrtor) Cod Gnrtor Trgt lngug Cod Optimizr Syntctic/smntic structur IC to rl mchin cod Mmory mngmnt, rgistr lloction, instruction slction, instruction schduling, Symol Tl CS 540 Spring 2013 GMU 18

19 Issus Driving Compilr Dsign Corrctnss Spd (runtim nd compil tim) Dgrs of optimiztion Multipl psss Spc Fdck to usr Dugging CS 540 Spring 2013 GMU 19

20 Rltd to Compilrs Intrprtrs (dirct xcution) Assmlrs Prprocssors Txt formttrs (non-wysiwyg) Anlysis tools CS 540 Spring 2013 GMU 20

21 Why study compilrs? Bring togthr: Dt structurs & Algorithms Forml Lngugs Computr Architctur Influnc: Lngug Dsign Architctur (influnc is i-dirctionl) Tchniqus usd influnc othr rs (progrm nlysis, tsting, ) CS 540 Spring 2013 GMU 21

22 Rviw of Forml Lngugs Rgulr xprssions, NFA, DFA Trnslting twn formlisms Using ths formlisms CS 540 Spring 2013 GMU 22

23 Wht is lngug? Alpht finit chrctr st (S) String finit squnc of chrctrs cn, th mpty string (Som txts us l s th mpty string) Lngug possily infinit st of strings ovr som lpht cn { }, th mpty lngug. CS 540 Spring 2013 GMU 23

24 Suppos S = {,,c}. Som lngugs ovr S could : {,,c,,c,cc} {,c,cc,ccc,...} { } { } {,,c,} CS 540 Spring 2013 GMU 24

25 Why do w cr out Rgulr Lngugs? Formlly dscri tokns in th lngug Rgulr Exprssions NFA DFA Rgulr Exprssions finit utomt Tools ssist in th procss CS 540 Spring 2013 GMU 25

26 Rgulr Exprssions Th rgulr xprssions ovr finit S r th strings ovr th lpht S + { ), (,, * } such tht: 1. { } (mpty st) is rgulr xprssion for th mpty st 2. is rgulr xprssion dnoting { } 3. is rgulr xprssion dnoting st { } for ny in S CS 540 Spring 2013 GMU 26

27 Rgulr Exprssions 4. If P nd Q r rgulr xprssions ovr S, thn so r: P Q (union) If P dnots th st {,,}, Q dnots th st {0,,9} thn P Q dnots th st {,,,0,,9} PQ (conctntion) If P dnots th st {,,}, Q dnots th st {0,,9} thn PQ dnots th st {0,,0,1,,9} Q* (closur) If Q dnots th st {0,,9} thn Q* dnots th st {,0,,9,00, 99, } CS 540 Spring 2013 GMU 27

28 Exmpls If S = {,} ( )( ) ( )* *** * (lso known s +) (*) (*) CS 540 Spring 2013 GMU 28

29 Nondtrministic Finit Automt A nondtrministic finit utomton (NFA) is mthmticl modl tht consists of 1. A st of stts S 2. A st of input symols S 3. A trnsition function tht mps stt/symol pirs to st of stts: S x {S + } st of S 4. A spcil stt s 0 clld th strt stt 5. A st of stts F (sust of S) of finl stts INPUT: string OUTPUT: ys or no CS 540 Spring 2013 GMU 29

30 Exmpl NFA , S = {0,1,2,3} S 0 = 0 S = {,} F = {3} Trnsition Tl: STATE 0 0, CS 540 Spring 2013 GMU 30

31 NFA Excution An NFA sys ys for n input string if thr is som pth from th strt stt to som finl stt whr ll input hs n procssd. NFA(int s0, int input) { if (ll input procssd && s 0 is finl stt) rturn Ys; if (ll input procssd && s 0 not finl stt) rturn No; for ll stts s 1 whr trnsition(s 0,tl[input]) = s 1 if (NFA(s 1,input_lmnt+1) == Ys) rturn Ys; } for ll stts s 1 whr trnsition(s 0,) = s 1 if (NFA(s 1,input_lmnt) == Ys) rturn Ys; rturn No; Uss cktrcking to srch ll possil pths CS 540 Spring 2013 GMU 31

32 Dtrministic Finit Automt A dtrministic finit utomton (DFA) is mthmticl modl tht consists of 1. A st of stts S 2. A st of input symols S 3. A trnsition function tht mps stt/symol pirs to stt: S x S S 4. A spcil stt s 0 clld th strt stt 5. A st of stts F (sust of S) of finl stts INPUT: string OUTPUT: ys or no CS 540 Spring 2013 GMU 32

33 DFA Excution DFA(int strt_stt) { stt currnt = strt_stt; input_lmnt = nxt_tokn(); whil (input to procssd) { currnt = trnsition(currnt,tl[input_lmnt]) if currnt is n rror stt rturn No; input_lmnt = nxt_tokn(); } if currnt is finl stt rturn Ys; ls rturn No; } CS 540 Spring 2013 GMU 33

34 Rgulr Lngugs 1. Thr is n lgorithm for convrting ny RE into n NFA. 2. Thr is n lgorithm for convrting ny NFA to DFA. 3. Thr is n lgorithm for convrting ny DFA to RE. Ths fcts tll us tht REs, NFAs nd DFAs hv quivlnt xprssiv powr. All thr dscri th clss of rgulr lngugs. CS 540 Spring 2013 GMU 34

35 Convrting Rgulr Exprssions to NFAs Th rgulr xprssions ovr finit S r th strings ovr th lpht S + { ), (,, *} such tht: { } (mpty st) is rgulr xprssion for th mpty st Empty string is rgulr xprssion dnoting { } is rgulr xprssion dnoting { } for ny in S CS 540 Spring 2013 GMU 35

36 Convrting Rgulr Exprssions to NFAs If P nd Q r rgulr xprssions with NFAs N p, N q : P Q (union) N p N q PQ (conctntion) N p N q CS 540 Spring 2013 GMU 36

37 Convrting Rgulr Exprssions to NFAs If Q is rgulr xprssion with NFA N q : Q* (closur) N q CS 540 Spring 2013 GMU 37

38 Strting with: Exmpl (* *)* * 1 2 * 3 4 * * CS 540 Spring 2013 GMU 38

39 Exmpl (* *)* * * (* *)* CS 540 Spring 2013 GMU 39

40 Convrting NFAs to DFAs Id: Ech stt in th nw DFA will corrspond to som st of stts from th NFA. Th DFA will in stt {s 0,s 1, } ftr input if th NFA could in ny of ths stts for th sm input. Input: NFA N with stt st S N, lpht S, strt stt s N, finl stts F N, trnsition function T N : S N x S + {} st of S N Output: DFA D with stt st S D, lpht S, strt stt s D = -closur(s N ), finl stts F D, trnsition function T D : S D x S S D CS 540 Spring 2013 GMU 40

41 -closur() Dfn: -closur(t) = T + ll NFA stts rchl from ny stt in T using only trnsitions closur({1,2,5}) = {1,2,5} -closur({4}) = {1,4} -closur({3}) = {1,3,4} -closur({3,5}) = {1,3,4,5} CS 540 Spring 2013 GMU 41

42 Algorithm: Sust Construction s D = -closur(s N ) S D = {s D } (unmrkd) -- crt strt stt for DFA whil thr is som unmrkd stt R in S D mrk stt R for ll in S do s = -closur(t N (R,)); if s not lrdy in S D thn dd it (unmrkd) T D (R,) = s; nd for nd whil F D = ny lmnt of S D tht contins stt in F N CS 540 Spring 2013 GMU 42

43 Exmpl 1: Sust Construction NFA 1 2, 5 3 4, CS 540 Spring 2013 GMU 43

44 Exmpl 1: Sust Construction NFA 1,2 1 2, 5 3 4, {1,2} CS 540 Spring 2013 GMU 44

45 Exmpl 1: Sust Construction NFA 1,2 4,5 1 2, 5 3,5 3 4, {1,2} {3,5} {4,5} {3,5} {4,5} CS 540 Spring 2013 GMU 45

46 Exmpl 1: Sust Construction NFA 1,2 4,5 1 2, 5 3, , {1,2} {3,5} {4,5} {3,5} - {4} {4,5} {4} CS 540 Spring 2013 GMU 46

47 Exmpl 1: Sust Construction NFA, 1,2 4, , 5 3, , {1,2} {3,5} {4,5} {3,5} - {4} {4,5} {5} {5} {4} {5} CS 540 Spring 2013 GMU 47

48 Exmpl 1: Sust Construction NFA, 1,2 4, , 5 3,5 4, 3 4, All finl stts sinc th NFA finl stt is includd {1,2} {3,5} {4,5} {3,5} - {4} {4,5} {5} {5} {4} {5} {5} {5} - - CS 540 Spring 2013 GMU 48

49 Exmpl 2: Sust Construction NFA CS 540 Spring 2013 GMU 49

50 Exmpl 2: Sust Construction NFA DFA ,3,4 1,3,4,5 1,4,5 CS 540 Spring 2013 GMU 50

51 Exmpl 3: Sust Construction NFA DFA ,2, ,4 3,5 3 4 CS 540 Spring 2013 GMU 51

52 Convrting DFAs to REs 1. Comin sril links y conctntion 2. Comin prlll links y ltrntion 3. Rmov slf-loops y Kln closur 4. Slct nod (othr thn initil or finl) for rmovl. Rplc it with st of quivlnt links whos pth xprssions corrspond to th in nd out links 5. Rpt stps 1-4 until th grph consists of singl link twn th ntry nd xit nods. CS 540 Spring 2013 GMU 52

53 Exmpl 0 d 1 d d c 5 d 6 c 7 prlll dgs com ltrntion 0 d c d d d c 6 7 CS 540 Spring 2013 GMU 53

54 Exmpl 0 d c d d d c 6 7 sril dgs com conctntion 0 d ( c) d 3 4 d 5 ( c) d CS 540 Spring 2013 GMU 54

55 Exmpl 0 d ( c) d 3 4 d 5 ( c) d Find pths tht cn shortnd 0 d ( c) d d ( c)d CS 540 Spring 2013 GMU 55

56 Exmpl 0 d ( c) d d ( c)d limint slf-loops 0 d ( c) d (( c)d)*d sril dgs com conctntion 0 d ( c) d (( c)d)*d 5 CS 540 Spring 2013 GMU 56

57 Dscriing Rgulr Lngugs Gnrt ll strings in th lngug Gnrt only strings in th lngug Try th following: Strings of {,} tht nd with Strings of {,} tht don t nd with Strings of {,} whr vry is followd y t lst on CS 540 Spring 2013 GMU 57

58 Strings of ( )* tht nd in r: ( )* , NFA DFA CS 540 Spring 2013 GMU 58

59 Strings of ( )* tht don t nd in r:?? DFA/NFA CS 540 Spring 2013 GMU 59

60 Strings of ( )* tht don t nd in * * * * * * * * * CS 540 Spring 2013 GMU 60

61 Suggstions for writing NFA/DFA/RE Typiclly, on of ths formlisms is mor nturl for th prolm. Strt with tht nd convrt if ncssry. In NFA/DFAs, ch stt typiclly cpturs som prtil solution B sur tht you includ ll rlvnt dgs (sk dos vry stt hv n outgoing trnsition for ll lpht symols?) CS 540 Spring 2013 GMU 61

62 Non-Rgulr Lngugs Not ll lngugs r rgulr Th lngug ww whr w=( )* Non-rgulr lngugs cnnot dscrid using REs, NFAs nd DFAs. CS 540 Spring 2013 GMU 62

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, * CmSc 365 Thory of Computtion Finit Stt Automt nd Rgulr Exprssions (Chptr 2, Sction 2.3) ALPHABET oprtions: U, conctntion, * otin otin Strings Form Rgulr xprssions dscri Closd undr U, conctntion nd * (if

More information

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata CSE303 - Introduction to th Thory of Computing Smpl Solutions for Exrciss on Finit Automt Exrcis 2.1.1 A dtrministic finit utomton M ccpts th mpty string (i.., L(M)) if nd only if its initil stt is finl

More information

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016 Wintr 2016 COMP-250: Introduction to Computr Scinc Lctur 23, April 5, 2016 Commnt out input siz 2) Writ ny lgorithm tht runs in tim Θ(n 2 log 2 n) in wors cs. Explin why this is its running tim. I don

More information

Last time: introduced our first computational model the DFA.

Last time: introduced our first computational model the DFA. Lctur 7 Homwork #7: 2.2.1, 2.2.2, 2.2.3 (hnd in c nd d), Misc: Givn: M, NFA Prov: (q,xy) * (p,y) iff (q,x) * (p,) (follow proof don in clss tody) Lst tim: introducd our first computtionl modl th DFA. Tody

More information

DFA (Deterministic Finite Automata) q a

DFA (Deterministic Finite Automata) q a Big pictur All lngugs Dcidl Turing mchins NP P Contxt-fr Contxt-fr grmmrs, push-down utomt Rgulr Automt, non-dtrministic utomt, rgulr xprssions DFA (Dtrministic Finit Automt) 0 q 0 0 0 0 q DFA (Dtrministic

More information

Lecture 4: Lexical and Syntax Analysis

Lecture 4: Lexical and Syntax Analysis CS 515 Progrmming Lngug nd Compilrs I Lctur 4: Lxicl nd Syntx Anlysis Zhng (Eddy) Zhng Rutgrs Univrsity Fll 2017, 9/26/2017 1 2 Lctur 4A: Lxicl nd Syntx Anlysis II (Th lcturs r sd on th slids copyrightd

More information

Notes on Finite Automata Department of Computer Science Professor Goldberg Textbooks: Introduction to the Theory of Computation by Michael Sipser

Notes on Finite Automata Department of Computer Science Professor Goldberg Textbooks: Introduction to the Theory of Computation by Michael Sipser Nots on Finit Automt Dprtmnt of Computr Scinc Profssor Goldrg Txtooks: Introduction to th Thory of Computtion y Michl Sipsr Elmnts of th Thory of Computtion y H. Lwis nd C. Ppdimitriou Ths nots contin

More information

Finite Automata. d: Q S Q. Finite automaton is M=(Q, S, d, q 0, F) Ex: an FA that accepts all odd-length strings of zeros: q 0 q 1. q i. q k.

Finite Automata. d: Q S Q. Finite automaton is M=(Q, S, d, q 0, F) Ex: an FA that accepts all odd-length strings of zeros: q 0 q 1. q i. q k. Finit Automt Bsic id: FA is mchin tht chngs stts whil procssing symols, on t tim. Finit st of stts: Q = {q 0, q 1, q 3,..., q k } Trnsition function: Initil stt: Finl stts: d: Q S Q q 0 Q F Q Finit utomton

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spnning Trs Minimum Spnning Trs Problm A town hs st of houss nd st of rods A rod conncts nd only houss A rod conncting houss u nd v hs rpir cost w(u, v) Gol: Rpir nough (nd no mor) rods such tht:

More information

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 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 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

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

Enforcement of Opacity Security Properties Using Insertion Functions

Enforcement of Opacity Security Properties Using Insertion Functions Enforcmnt of Opcity Scurity Proprtis Using Insrtion Functions Yi-Chin Wu nd Stéphn Lfortun EECS Dprtmnt, Univrsity of Michign CDC 12 Dc. 13 th, 2012 Motivtion Scurity nd privcy concrns in onlin srvics

More information

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018 CSE 373: Mor on grphs; DFS n BFS Mihl L Wnsy, F 14, 2018 1 Wrmup Wrmup: Disuss with your nighor: Rmin your nighor: wht is simpl grph? Suppos w hv simpl, irt grph with x nos. Wht is th mximum numr of gs

More information

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation A Simpl Co Gnrtor Co Gnrtion Chptr 8 II Gnrt o for singl si lok How to us rgistrs? In most mhin rhitturs, som or ll of th oprnsmust in rgistrs Rgistrs mk goo tmporris Hol vlus tht r omput in on si lok

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

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

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

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

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

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

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

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

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

Multi-Section Coupled Line Couplers

Multi-Section Coupled Line Couplers /0/009 MultiSction Coupld Lin Couplrs /8 Multi-Sction Coupld Lin Couplrs W cn dd multipl coupld lins in sris to incrs couplr ndwidth. Figur 7.5 (p. 6) An N-sction coupld lin l W typiclly dsign th couplr

More information

Formal Languages and Automata

Formal Languages and Automata Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University

More 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

FABER Formal Languages, Automata and Models of Computation

FABER Formal Languages, Automata and Models of Computation DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte

More 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

Java II Finite Automata I

Java 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 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

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

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

Non-Deterministic Finite Automata

Non-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 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

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

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp CSE 373 Grphs 1: Conpts, Dpth/Brth-First Srh ring: Wiss Ch. 9 slis rt y Mrty Stpp http://www.s.wshington.u/373/ Univrsity o Wshington, ll rights rsrv. 1 Wht is grph? 56 Tokyo Sttl Soul 128 16 30 181 140

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

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

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

Convert the NFA into DFA

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

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CHAPTER 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 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

a,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

a,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 information

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages:

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages: CS 6353 Compilr Construction, Homwork #1 1. Writ rgular xprssions for th following informally dscribd languags: a. All strings of 0 s and 1 s with th substring 01*1. Answr: (0 1)*01*1(0 1)* b. All strings

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

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

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

COMP108 Algorithmic Foundations

COMP108 Algorithmic Foundations Grdy mthods Prudn Wong http://www.s.liv..uk/~pwong/thing/omp108/01617 Coin Chng Prolm Suppos w hv 3 typs of oins 10p 0p 50p Minimum numr of oins to mk 0.8, 1.0, 1.? Grdy mthod Lrning outoms Undrstnd wht

More information

Instructions for Section 1

Instructions for Section 1 Instructions for Sction 1 Choos th rspons tht is corrct for th qustion. A corrct nswr scors 1, n incorrct nswr scors 0. Mrks will not b dductd for incorrct nswrs. You should ttmpt vry qustion. No mrks

More information

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari Grphs CSC 1300 Disrt Struturs Villnov Univrsity Grphs Grphs r isrt struturs onsis?ng of vr?s n gs tht onnt ths vr?s. Grphs n us to mol: omputr systms/ntworks mthm?l rl?ons logi iruit lyout jos/prosss f

More information

Section 3: Antiderivatives of Formulas

Section 3: Antiderivatives of Formulas Chptr Th Intgrl Appli Clculus 96 Sction : Antirivtivs of Formuls Now w cn put th is of rs n ntirivtivs togthr to gt wy of vluting finit intgrls tht is ct n oftn sy. To vlut finit intgrl f(t) t, w cn fin

More information

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)} Introution Computr Sin & Enginring 423/823 Dsign n Anlysis of Algorithms Ltur 03 Elmntry Grph Algorithms (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) I Grphs r strt t typs tht r pplil to numrous

More information

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

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

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Nondeterminism. 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 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

Lexical Analysis Part III

Lexical Analysis Part III Lexicl Anlysis Prt III Chpter 3: Finite Automt Slides dpted from : Roert vn Engelen, Florid Stte University Alex Aiken, Stnford University Design of Lexicl Anlyzer Genertor Trnslte regulr expressions to

More information

Designing finite automata II

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

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem) 12/3/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 Ciruits Cyl 2 Eulr

More information

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1 CSC 00 Disrt Struturs : Introuon to Grph Thory Grphs Grphs CSC 00 Disrt Struturs Villnov Univrsity Grphs r isrt struturs onsisng o vrs n gs tht onnt ths vrs. Grphs n us to mol: omputr systms/ntworks mthml

More information

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs Prt 10. Grphs CS 200 Algorithms n Dt Struturs 1 Introution Trminology Implmnting Grphs Outlin Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 2 Ciruits Cyl A spil yl

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

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)} s s of s Computr Sin & Enginring 423/823 Dsign n Anlysis of Ltur 03 (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) s of s s r strt t typs tht r pplil to numrous prolms Cn ptur ntitis, rltionships twn

More information

Lecture 11 Waves in Periodic Potentials Today: Questions you should be able to address after today s lecture:

Lecture 11 Waves in Periodic Potentials Today: Questions you should be able to address after today s lecture: Lctur 11 Wvs in Priodic Potntils Tody: 1. Invrs lttic dfinition in 1D.. rphicl rprsnttion of priodic nd -priodic functions using th -xis nd invrs lttic vctors. 3. Sris solutions to th priodic potntil Hmiltonin

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

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy: Scnner Specifying ptterns source code tokens scnner prser IR A scnner must recognize the units of syntx Some prts re esy: errors mps chrcters into tokens the sic unit of syntx x = x + y; ecomes

More information

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim's Alorithm Introution Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #33 3 Alorithm Gnrl Constrution Mik Joson (Univrsity o Clry)

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

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

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

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations Mr Funtins Grphs, Pruts, & Rltins Unirt Grphs An unirt grph is pir f 1. A st f ns 2. A st f gs (whr n g is st f tw ns*) Friy, Sptmr 2, 2011 Ring: Sipsr 0.2 ginning f 0.4; Stughtn 1.1.5 ({,,,,}, {{,}, {,},

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

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

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs. Pths.. Eulr n Hmilton Pths.. Pth D. A pth rom s to t is squn o gs {x 0, x 1 }, {x 1, x 2 },... {x n 1, x n }, whr x 0 = s, n x n = t. D. Th lngth o pth is th numr o gs in it. {, } {, } {, } {, } {, } {,

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

SWEN 224 Formal Foundations of Programming WITH ANSWERS

SWEN 224 Formal Foundations of Programming WITH ANSWERS T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 END-OF-YEAR SWEN 224 Forml Foundtions of Progrmming

More 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

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

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 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks

More information

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued... Progrssiv Printing T.M. CPITLS g 4½+ Th sy, fun (n FR!) wy to tch cpitl lttrs. ook : C o - For Kinrgrtn or First Gr (not for pr-school). - Tchs tht cpitl lttrs mk th sm souns s th littl lttrs. - Tchs th

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

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

Lexical Analysis Finite Automate

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

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

CSC Design and Analysis of Algorithms. Example: Change-Making Problem CSC 801- Dsign n Anlysis of Algorithms Ltur 11 Gry Thniqu Exmpl: Chng-Mking Prolm Givn unlimit mounts of oins of nomintions 1 > > m, giv hng for mount n with th lst numr of oins Exmpl: 1 = 25, 2 =10, =

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

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

CIVL 8/ D Boundary Value Problems - Rectangular Elements 1/7

CIVL 8/ D Boundary Value Problems - Rectangular Elements 1/7 CIVL / -D Boundr Vlu Prolms - Rctngulr Elmnts / RECANGULAR ELEMENS - In som pplictions, it m mor dsirl to us n lmntl rprsnttion of th domin tht hs four sids, ithr rctngulr or qudriltrl in shp. Considr

More information

Linear Algebra Existence of the determinant. Expansion according to a row.

Linear Algebra Existence of the determinant. Expansion according to a row. Lir Algbr 2270 1 Existc of th dtrmit. Expsio ccordig to row. W dfi th dtrmit for 1 1 mtrics s dt([]) = (1) It is sy chck tht it stisfis D1)-D3). For y othr w dfi th dtrmit s follows. Assumig th dtrmit

More information

Formal Language and Automata Theory (CS21004)

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

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem) 4/25/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 2 Eulr s rig prolm

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

On the Role of Fitness, Precision, Generalization and Simplicity in Process Discovery

On the Role of Fitness, Precision, Generalization and Simplicity in Process Discovery On th Rol of Fitnss, Prcision, Gnrliztion n Simplicity in Procss Discovry Joos Buijs Bouwijn vn Dongn Wil vn r Alst http://www.win.tu.nl/coslog/ Avncs in Procss ining ny procss iscovry n conformnc chcking

More information

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph Intrntionl J.Mth. Comin. Vol.1(2014), 80-86 Algorithmi n NP-Compltnss Aspts of Totl Lit Domintion Numr of Grph Girish.V.R. (PES Institut of Thnology(South Cmpus), Bnglor, Krntk Stt, Ini) P.Ush (Dprtmnt

More information

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V Unirt Grphs An unirt grph G = (V, E) V st o vrtis E st o unorr gs (v,w) whr v, w in V USE: to mol symmtri rltionships twn ntitis vrtis v n w r jnt i thr is n g (v,w) [or (w,v)] th g (v,w) is inint upon

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

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

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals Intgrtion Continud Intgrtion y Prts Solving Dinit Intgrls: Ar Undr Curv Impropr Intgrls Intgrtion y Prts Prticulrly usul whn you r trying to tk th intgrl o som unction tht is th product o n lgric prssion

More information

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology! Outlin Computr Sin 331, Spnnin, n Surphs Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #30 1 Introution 2 3 Dinition 4 Spnnin 5 6 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 1 / 20 Mik

More information

Formal Concept Analysis

Formal Concept Analysis Forml Conpt Anlysis Conpt intnts s losd sts Closur Systms nd Implitions 4 Closur Systms 0.06.005 Nxt-Closur ws dvlopd y B. Gntr (984). Lt M = {,..., n}. A M is ltilly smllr thn B M, if B A if th smllst

More information