Closure Properties of Regular Languages

Size: px
Start display at page:

Download "Closure Properties of Regular Languages"

Transcription

1 of Regulr Lnguges Dr. Neil T. Dntm CSCI-561, Colordo School of Mines Fll 2018 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

2 Outline Introduction Closure Properties Stte Minimiztion Hopcroft s Algorithm Brzozowski s Algorithm Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

3 Introduction Outline Introduction Closure Properties Stte Minimiztion Hopcroft s Algorithm Brzozowski s Algorithm Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

4 Introduction Lnguge Clsses nd Properties Lnguge Clss: set of lnguges The regulr lnguges, lso clled the regulr set Lnguge Properties Decision Properties Closure Properties Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

5 Introduction Decision Properties Decision Property: property on lnguge L B Exmple: Is lnguge L empty? L = Need n lgorithm to check property Lets us reson out lnguge / modeled system Does the system terminte? Does the system generte undesired ehvior? Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

6 Introduction Closure Properties Closure Property: n opertor on set outputs memer of the set + : Z Z Z : R R R Lets us compose lnguges Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

7 Outline Introduction Closure Properties Stte Minimiztion Hopcroft s Algorithm Brzozowski s Algorithm Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

8 Conctention, Union, Repetition Conctention Union Repetition ɛ strt ɛ strt N1. ɛ ɛ ɛ strt N2. ɛ ɛ ɛ strt ɛ ɛ strt strt N1 N2.. ɛ ɛ ɛ ɛ ɛ ɛ strt ɛ strt N1 ɛ ɛ. ɛ ɛ ɛ ɛ From the sic regex opertors Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

9 Reverse Outline Given: Finite Automton A Find: Finite Automton R where L (R) = {σ 0... σ n σ n... σ 0 L (A)} Solution: Reverse edges of A Strt stte of A ecomes new ccept stte. New strt stte with ɛ trnsitions to old ccept sttes. reverse strt.. strt Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

10 Exmple: Reverse L () strt q 0 q 1 q 2 L (() R) q 0 q 1 q ɛ 2 q 0 strt Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

11 Reverse Algorithm Function f-reverse(a) Input: A = (Q, Σ, E, q 0, F ) Output: A = (Q, Σ, E, q 0, F ) 1 q 0 newstte(); 2 Q Q {q 0 }; 3 F {q 0 }; 4 Σ Σ; 5 E q j σ qi q σ i q j E }{{} Reverse Edges ɛ q q 0 ; q F }{{} New strt to old ccept Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

12 Exercise: Reverse ( c) d L (( c) d), c strt q 0 q d 1 q 2 L ((( c) d) R) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

13 Regex Reverse Given: Regulr Expression A Find: Reverse of A, denoted s A R Solution: Inductively: Bsis: For symol α eing Σ, ɛ, or : α R = α Induction: For α R in: conctention: (βγ) R = γ R β R union: (β γ) R = β R γ R Kleene-closure: (β ) R = ( β R) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

14 Exmple: Regex Reverse 01 Infix Given: A = (01) Find: A R Solution: A R = (01) R A R = 1 R 0 R A R = 10 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

15 Exmple: Regex Reverse S-Expression (01) R ( r e v e r s e ( conctention 0 1 ) ) 1 R 0 R ( conctention ( r e v e r s e 1) ( reverse 0 ) ) 10 ( conctention 1 0) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

16 Regex Reverse Algorithm Function regex-reverse(e) 1 if e (Σ {ɛ, }) then // Recursive cse 2 switch cr(e) do 3 cse UNION do 4 cons(union, mp (regex-reverse, cdr (e))) 5 cse CONCATENATION do 6 cons(concatenation, mp (regex-reverse, reverse(cdr (e)))) 7 cse KLEENE-CLOSURE do 8 list(kleene-closure, regex-reverse(second(e))) 9 else // Bse cse 10 return e; Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

17 Regex Reverse Code 1 ( defun r e g e x r e v e r s e ( e ) 2 ( typecse e 3 ( l i s t ( cse ( c r e ) 4 ( : union ( cons : union 5 (mp l i s t # r e g e x r e v e r s e 6 ( cdr e ) ) ) ) 7 ( : c o n c t e n t i o n ( cons : c o n c t e n t i o n 8 (mp l i s t # r e g e x r e v e r s e 9 ( r e verse ( cdr e ) ) ) ) ) 10 ( : k l e e n e c l o s u r e ( l i s t : k l e e n e c l o s u r e 11 ( r e g e x r e v e r s e ( second e ) ) ) ) ) ) 12 ( t e ) ) ) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

18 Exercise: Regex Reverse Given: A = (01 10 ) Find: A R Solution: Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

19 Exercise: S-Expression Regex Reverse Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

20 Exercise: S-Expression Regex Reverse (continued) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

21 Complement Given: Regulr Lnguges A. Find: A = {σ σ A} Solution: Flip ccept / non-ccept sttes complement strt. strt. Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

22 Explicit Ded Stte strt L ( + + ) q 0 q 1 q 2 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

23 Exmple: Complement complement strt q 0 q 1 q 2 q ded, strt q 0 q 1 q 2 q ded, Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

24 Complement Algorithm Function df-complement(a) Input: A = (Q, Σ, E, q 0, F ) Output: A = (Q, Σ, E, q 0, F ) 1 Σ Σ; 2 q 0 q 0 ; 3 q ded newstte(); 4 Q Q {q ded } ; // Flip ccept / non-ccept sttes 5 F (Q \ F ) {q ded }; { } 6 E σ σ E q i qded qi qj E ; } {{ } trnsitions to ded stte Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

25 Intersection Given: Regulr Lnguges A nd B Find: C = {σ (σ A) (σ B)} Solution: Use the product DFA C ccepts when oth A nd B ccept F C = {(q i, q j ) Q C q i F A q j F B } Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

26 Exmple: Intersection of L (L) nd L (M) L (L) strt 0 1 0,1 L (M) strt c 1 d Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

27 Intersection Pseudo-lgorithm Function df-intersect(m 1, M 2 ) Input: M 1 = (Q 1, Σ 1, E 1, q (0,1), F 1 ) Input: M 2 = (Q 2, Σ 2, E 2, q (0,2), F 2 ) Output: M = (Q, Σ, E, q 0, F ) 1 Σ Σ 1 Σ 2 ; 2 Q Q 1 Q 2 ; // Crtesin product of sttes 3 q 0 ( q (0,1), q (0,2) ) ; 4 F {(q i, q j ) Q q i F 1 q j F 2 } ; // ccept in oth M 1 nd M 2 5 E ( ) σ ( ) ) ) σ σ q(i,1), q (i,2) q(j,1), q (j,2) (q }{{} (i,1) q(j,1) E 1 (q (i,2) q(j,2) E 2 ; }{{}}{{} Crtesin product edge σ-edge in M 1 σ-edge in M 2 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

28 Intersection Visit Algorithm Function df-intersect-visit(q 1,q 2,Q, E ) Output: (Q, E ) 1 forll σ Σ do 2 q 1 E 1 (q 1, σ) ; // Successor stte on σ in M 1 3 q 2 E 2 (q 2, σ) ; // Successor stte on σ in M 2 4 q (q 1, q 2 ); 5 if (q 1 ) (q 2 ) (q Q ) then 6 Q Q {q }; } 7 E E {(q 1, q 2 ) σ q ; 8 (Q, E ) df-intersect-visit(q 1, q 2, Q, E ) ; // Recurse on successor 9 return (Q, E ) ; Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

29 Exmple: Intersection Visit visit q 1 σ 1 σ 2 1 c 1 1 σ 3, q 2 σ 1 σ 2 2 σ 4 c 2 2 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

30 Difference Given: Finite Automton L nd M Find: Finite Automton R where L (R) = L (L) \ L (M) Solution: Use product DFA Finl sttes where L ccepts nd M does not F R = {(q l, q m ) Q R (q l F L ) (q m F M )} Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

31 Exmple: FA Difference L (L) strt 0,1 L (L) \ L (M) strt 0 (, c) (, d) L (M) strt c 1 d (, c) (, d) 1 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

32 Exercise: Intersection nd Difference Product strt L L M strt M c 1 d Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

33 Exercise: Intersection nd Difference Intersection strt L L (L) L (M) strt M c 1 d Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

34 Exercise: Intersection nd Difference Difference strt L L (L) \ L (M) strt M c 1 d Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

35 Stte Minimiztion Outline Introduction Closure Properties Stte Minimiztion Hopcroft s Algorithm Brzozowski s Algorithm Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

36 Stte Minimiztion Cnonicl DFA Theorem: Cnonicl DFA The minimum stte DFA ccepting ny regulr lnguge L is unique up to n isomorphism (renming of sttes). Proof Outline For ech stte q A in Q A nd q B in Q B, there must exist σ Σ such tht q A = ˆδ(q 0,A, σ) nd q B = ˆδ(q 0,B, σ) Without such σ, we could remove q A or q B to find smller utomton q A will correspond with q B Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

37 Stte Minimiztion Two Minimiztion Algorithms John Hopcroft Jnusz (John) Brzozowski Cornell Wterloo Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

38 Stte Minimiztion Hopcroft s Algorithm Fixed Point Definition: Fixed Point (fixpoint) The fixed point of function is vlue where the function s input nd output re equl. For f : X X, the fixpoint is some vlue x X where f (x) = x. f : Z Z f (x) = x 2 Exmples 0 is fixpoint: f (0) = 0 1 is fixpoint: f (1) = 1 2 is NOT fixpoint: f (2) = 4 g : R R g(σ) = σ R is fixpoint: g() = is NOT fixpoint: g() = Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

39 Stte Minimiztion Hopcroft s Algorithm Hopcroft s Algorithm Outline 1. Prtition sttes initilly into A nd Q \ A 2. Repetedly refine prtitions: 2.1 If prtition p contins sttes tht trnsition to different successor prtitions on symol s, 2.2 Split p into new su-prtitions where ll sttes in ech su-prtition trnsition to the sme successor prtition on s 3. Repet the refinement until reching the fixpoint (no further refinements possile) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

40 Stte Minimiztion Hopcroft s Algorithm Hopcroft s Algorithm Illustrtion Initil Prtitioning Non-ccept Sttes Accept Sttes Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

41 Stte Minimiztion Hopcroft s Algorithm Hopcroft s Algorithm Illustrtion Refinement z z q q s q q s q q c q r refine q q c q r z z z q y z q y q x q z q x q z Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

42 Stte Minimiztion Hopcroft s Algorithm Hopcroft s Algorithm Detils Algorithm 1: Hopcroft s Algorithm Input: Q, Σ, E, s, ; Output: Q, Σ, E, s, ; 1 Q {, Q \ } ; // Initil Prtitioning 2 T ; // Work list 3 while T do 4 q pop(t ) ; // FA sttes, tokens, edges, strt, ccept // Minimum DFA sttes, tokens, edges, strt, ccept 5 forll z Σ do { ( ) } 6 x p Q p z r E, r q // All z predecessor sttes of prtition q 7 if x then 8 Q = ; 9 forll y Q do 10 i = y x ; // Suset of prtition y trnsitioning on z to q 11 j = y \ x; // Suset of prtition y trnsitioning on z to q 12 if i j then 13 Q Q i j; // Replce prtition y with i nd j 14 if y T then T (T \ y) i j ; 15 else if i < j then T T i ; 16 else T T j ; 17 else Q Q y ; // Don t split y 18 Q Q ; Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

43 Stte Minimiztion Hopcroft s Algorithm Hopcroft s Algorithm Illustrtion Refinement, Redux y x z q i = y x z q q s j = y \ x q q s q q c q r refine q q c q r z z z q y z q y q x q z q x q z Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

44 Stte Minimiztion Hopcroft s Algorithm Exmple: Hopcroft s Algorithm Initil DFA strt 0 Add Reject strt 0, D 3 2, 2 Initil Prtition {0,1,3,D} {2},, {1,3}, {2}, {0,D}, {1,3}, {0} {D} {1,3} strt, {0} {2},, {2} Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

45 Stte Minimiztion Hopcroft s Algorithm Exercise: Hopcroft s Algorithm Initil DFA strt Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

46 Stte Minimiztion Hopcroft s Algorithm Exercise: Hopcroft s Algorithm (continued) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

47 Stte Minimiztion Brzozowski s Algorithm Brzozowski s Algorithm Algorithm 2: Brzozowski s Algorithm Input: A ; Output: M ; 1 M nf-to-df(reverse(nf-to-df(reverse(a)))); // FA // Minimum stte DFA Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

48 Stte Minimiztion Brzozowski s Algorithm Exmple: Brzozowski s Algorithm NFA to DFA Initil DFA strt strt, {0} {1,3} {s,2} strt Reverse Reverse ɛ strt s s strt ɛ, {0} NFA to DFA, {0,s } {1,3} {1,3} {s,2} {s,2} Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

49 Stte Minimiztion Brzozowski s Algorithm Exercise: Brzozowski s Algorithm Initil DFA 0 1 strt Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

50 Stte Minimiztion Brzozowski s Algorithm Exmple: Brzozowski s Algorithm (continued) Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll / 50

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

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

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

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

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

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

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

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

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

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

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont. NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD

More 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15 Models of Comput:on Lecture #8 Chpter 7 con:nued Any lnguge tht e defined y regulr expression, finite utomton, or trnsi:on grph cn e defined y ll three methods We prove this y showing tht ny lnguge defined

More 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

ɛ-closure, Kleene s Theorem,

ɛ-closure, Kleene s Theorem, DEGefW5wiGH2XgYMEzUKjEmtCDUsRQ4d 1 A nice pper relevnt to this course is titled The Glory of the Pst 2 NICTA Resercher, Adjunct t the Austrlin Ntionl University nd Griffith University ɛ-closure, Kleene

More 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

Myhill-Nerode Theorem

Myhill-Nerode Theorem Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute

More information

GNFA GNFA GNFA GNFA GNFA

GNFA GNFA GNFA GNFA GNFA DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with

More 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

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

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

Deterministic Finite-State Automata

Deterministic Finite-State Automata Deterministic Finite-Stte Automt Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 12 August 2013 Outline 1 Introduction 2 Exmple DFA 1 DFA for Odd number of

More information

Midterm 1 Practice. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

Midterm 1 Practice. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ Midterm 1 Prctice CS 350 Fll 2018 gilry.org/clsses/fll2018/cs350/ 1 Midterm #1: Thursdy, Septemer 27! Bring less stuff, if possile. Keep ny gs under the tle. You my hve out: pencil, pen, nd/or erser. My

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

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite

More 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

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

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

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

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

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.

More information

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1 Chpter 1, Prt 1 Regulr Lnguges CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 1 Finite Automt A finite utomton is system for processing ny finite sequence of symols, where the symols re chosen from finite

More information

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

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

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

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

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

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

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

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6 CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized

More 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

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

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

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

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

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v. 1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,

More 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

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

In-depth introduction to main models, concepts of theory of computation:

In-depth introduction to main models, concepts of theory of computation: CMPSCI601: Introduction Lecture 1 In-depth introduction to min models, concepts of theory of computtion: Computility: wht cn e computed in principle Logic: how cn we express our requirements Complexity:

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

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

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

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

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

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

More 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

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

Search: The Core of Planning

Search: The Core of Planning Serch: The Core of Plnning Dr. Neil T. Dntm CSCI-498/598 RPM, Colordo School of Mines Spring 208 Dntm (Mines CSCI, RPM) Serch Spring 208 / 75 Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch

More information

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over

More 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

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints) C K Ngpl Forml Lnguges nd utomt Theory Chpter 4 Regulr Grmmr nd Regulr ets (olutions / Hints) ol. (),,,,,,,,,,,,,,,,,,,,,,,,,, (),, (c) c c, c c, c, c, c c, c, c, c, c, c, c, c c,c, c, c, c, c, c, c, c,

More information

Introduction to ω-autamata

Introduction to ω-autamata Fridy 25 th Jnury, 2013 Outline From finite word utomt ω-regulr lnguge ω-utomt Nondeterministic Models Deterministic Models Two Lower Bounds Conclusion Discussion Synthesis Preliminry From finite word

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

Running an NFA & the subset algorithm (NFA->DFA) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

Running an NFA & the subset algorithm (NFA->DFA) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ Running n NFA & the suset lgorithm (NFA->DFA) CS 350 Fll 2018 gilry.org/lsses/fll2018/s350/ 1 NFAs operte y simultneously exploring ll pths nd epting if ny pth termintes t n ept stte.!2 Try n exmple: L

More information

Normal Forms for Context-free Grammars

Normal Forms for Context-free Grammars Norml Forms for Context-free Grmmrs 1 Linz 6th, Section 6.2 wo Importnt Norml Forms, pges 171--178 2 Chomsky Norml Form All productions hve form: A BC nd A vrile vrile terminl 3 Exmples: S AS S AS S S

More information

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t

More information

Regular Expressions (Pre Lecture)

Regular Expressions (Pre Lecture) Regular Expressions (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall 2017 1 / 39 Regular Expressions Outline

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

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

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

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

Regular languages refresher

Regular languages refresher Regulr lnguges refresher 1 Regulr lnguges refresher Forml lnguges Alphet = finite set of letters Word = sequene of letter Lnguge = set of words Regulr lnguges defined equivlently y Regulr expressions Finite-stte

More 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

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

Nondeterministic Automata vs Deterministic Automata

Nondeterministic Automata vs Deterministic Automata Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n

More information