Regular Languages and Applications
|
|
- Eileen Bradley
- 5 years ago
- Views:
Transcription
1 Regulr Lnguges nd Applictions Yo-Su Hn Deprtment of Computer Science Yonsei University 1-1 SNU 4/14
2 Regulr Lnguges An old nd well-known topic in CS Kleene Theorem in 1959 FA (finite-stte utomton) constructions: Thompson utomt, position utomt in 1960s Pttern Mtching Prolem in 1970s... in 1980s REVISIT Stte Complexity, Prime Decomposition, Pttern Mtching since mid 1990s 2-1 SNU 4/14
3 Regulr Lnguges An old nd well-known topic in CS Kleene Theorem in 1959 FA (finite-stte utomton) constructions: Thompson utomt, position utomt in 1960s Pttern Mtching Prolem in 1970s... in 1980s REVISIT Stte Complexity, Prime Decomposition, Pttern Mtching since mid 1990s XML, Bioinformtics - New Applictions 2-2 SNU 4/14
4 Overview Bsic Notions Position Construction nd XML DTD Regulr-Expression Pttern Mtching Stte Complexity Future Directions nd Conclusions 3-1 SNU 4/14
5 Regulr Expressions Regulr expressions re very convenient form tht represents (infinite) sets of strings clled regulr sets. Given finite lphet Σ, regulr expression over Σ is defined recursively s follows: 1., the empty-set symol, is regulr expression. 2. λ, the empty-string symol, is regulr expression. 3. Σ is regulr expression. 4. E +F (union), where E nd F re regulr expressions, is regulr expression. 5. E F (ctention), where E nd F re regulr expressions, is regulr expression. 6. E (Kleene str), where E is regulr expression, is regulr expression. 4-1 SNU 4/14
6 Finite-stte Automt (FAs) A finite-stte utomton A is specified y tuple (Q, Σ, δ, s, F ); Q finite set of sttes Σ finite lphet δ(p, ) = q set of trnsition rules s Q the strt stte F Q set of finl sttes 5-1 SNU 4/14
7 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } 6-1 SNU 4/14
8 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = 6-2 SNU 4/14
9 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 2 } 6-3 SNU 4/14
10 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 2 } 6-4 SNU 4/14
11 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = 6-5 SNU 4/14
12 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 3 } 6-6 SNU 4/14
13 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 4, q 6 } 6-7 SNU 4/14
14 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 7 } 6-8 SNU 4/14
15 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 8, q 9 } 6-9 SNU 4/14
16 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = Q = {q 9 } 6-10 SNU 4/14
17 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } T = ccepted!! Q = {q 9 } F 6-11 SNU 4/14
18 Finite-stte Automt - exmple q 4 q 5 q 1 q 2 q 3 q 9 q 6 q 7 q 8 q 10 s = q 1 F = {q 9, q 10 } L = L( ( + ( + ))) 6-12 SNU 4/14
19 REs into Finite-stte Automt The well-known Thompson construction y Ken Thompson in E = λ E = E = λ M(E 1 ) λ λ M(E 2 ) λ E 1 + E 2 λ M(E 1 ) M(E 2 ) E 1 E 2 λ M(E) λ λ E λ 7-1 SNU 4/14
20 REs into Finite-stte Automt The well-known Thompson construction y Ken Thompson in E = λ E = E = esy to understnd nd uild-up too mny λ trnsitions λ M(E 1 ) λ λ M(E 2 ) λ E 1 + E 2 λ M(E 1 ) M(E 2 ) E 1 E 2 λ M(E) λ λ E λ 7-2 SNU 4/14
21 Position Automt - nother utomton construction Proposed y Glushkov nd McNughton nd Ymd in 1960 independently. The construction is sed on the positions of chrcters of given regulr expression. 8-1 SNU 4/14
22 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) 9-1 SNU 4/14
23 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
24 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
25 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
26 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
27 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
28 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
29 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) SNU 4/14
30 Position Automt - n exmple E = ( + ) c( + ) E = (1 + 2) 3(4 + 5) c c c SNU 4/14
31 Position Automt The construction looks nice! All in-trnsitions of stte hve the sme lel. The numer of sttes = E + 1 Less sttes thn the Thompson utomt nd, thus usully fster! E = ( + ) c( + ) c c c SNU 4/14
32 Where do position utomt led us? 11-1 SNU 4/14
33 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic SNU 4/14
34 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-2 SNU 4/14
35 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-3 SNU 4/14
36 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-4 SNU 4/14
37 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-5 SNU 4/14
38 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-6 SNU 4/14
39 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-7 SNU 4/14
40 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-8 SNU 4/14
41 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N 12-9 SNU 4/14
42 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Given n one-unmiguous regulr expression E nd n input string w, we cn red w using one lookhed with respect to E. E = SEO(UL) N S E O U L U L N SNU 4/14
43 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. Not ll regulr expressions re one-unmiguous. E = SEO(UL) UNI S E O U L U L N Not ll regulr lnguges re one-unmiguous. There re some regulr lnguges tht cnnot e defined y n one-miguous regulr lnguges. e.g. L(( + ) ( + ) k ), k SNU 4/14
44 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. <?xml version="1.0"?> <!DOCTYPE BOOK [ <!ELEMENT p (#PCDATA)> <!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION PART)+)> <!ELEMENT OPENER (TITLE_TEXT)*> <!ELEMENT TITLE_TEXT (#PCDATA)> <!ELEMENT SUBTITLE (#PCDATA)> <!ELEMENT INTRODUCTION (HEADER, p+)+> <!ELEMENT PART (HEADER, CHAPTER+)> <!ELEMENT SECTION (HEADER, p+)> <!ELEMENT HEADER (#PCDATA)> <!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)> <!ELEMENT CHAPTER_NUMBER (#PCDATA)> <!ELEMENT CHAPTER_TEXT (p)+> ]> SNU 4/14
45 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. <?xml version="1.0"?> <!DOCTYPE BOOK [ <!ELEMENT p (#PCDATA)> <!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION PART)+)> <!ELEMENT OPENER (TITLE_TEXT)*> <!ELEMENT TITLE_TEXT (#PCDATA)> <!ELEMENT SUBTITLE (#PCDATA)> <!ELEMENT INTRODUCTION (HEADER, p+)+> content models <!ELEMENT PART (HEADER, CHAPTER+)> <!ELEMENT SECTION (HEADER, p+)> <!ELEMENT HEADER (#PCDATA)> <!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)> <!ELEMENT CHAPTER_NUMBER (#PCDATA)> <!ELEMENT CHAPTER_TEXT (p)+> ]> SNU 4/14
46 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. <?xml version="1.0"?> <!DOCTYPE BOOK [ <!ELEMENT p (#PCDATA)> <!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION PART)+)> <!ELEMENT OPENER (TITLE_TEXT)*> <!ELEMENT TITLE_TEXT (#PCDATA)> <!ELEMENT SUBTITLE (#PCDATA)> BOOK <!ELEMENT ::= INTRODUCTION (HEADER, p+)+> OPENER <!ELEMENT (SUBTITLE+λ) PART (HEADER, (INTRODUCTION+λ) CHAPTER+)> (SECTION + PART)(SECTION + PART) <!ELEMENT SECTION (HEADER, p+)> <!ELEMENT HEADER (#PCDATA)> <!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)> <!ELEMENT CHAPTER_NUMBER (#PCDATA)> <!ELEMENT CHAPTER_TEXT (p)+> ]> SNU 4/14
47 One-Unmiguous Regulr Lnguges Proposed y Brüggemnn-Klein nd Wood. A regulr lnguge L is one-unmiguous if there is regulr expression E such tht L = L(E) nd the position utomton of E is deterministic. <?xml version="1.0"?> <!DOCTYPE BOOK [ <!ELEMENT p (#PCDATA)> <!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION PART)+)> <!ELEMENT OPENER (TITLE_TEXT)*> <!ELEMENT TITLE_TEXT (#PCDATA)> <!ELEMENT SUBTITLE (#PCDATA)> BOOK <!ELEMENT ::= INTRODUCTION (HEADER, p+)+> OPENER <!ELEMENT (SUBTITLE+λ) PART (HEADER, (INTRODUCTION+λ) CHAPTER+)> (SECTION + PART)(SECTION + PART) <!ELEMENT SECTION (HEADER, p+)> <!ELEMENT HEADER One-unmiguous (#PCDATA)> regulr expression!! <!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)> <!ELEMENT CHAPTER_NUMBER (#PCDATA)> <!ELEMENT CHAPTER_TEXT (p)+> ]> SNU 4/14
48 One-Unmiguous Regulr Lnguges vs XML DTD Regulr expressions for content models of DTD re one-unmiguous XML DTDs re LL(1) grmmrs [Wood 96] LL(k) grmmrs hve proper hierrchy [AU 72] k-unmiguous regulr lnguges?? 13-1 SNU 4/14
49 One-Unmiguous Regulr Lnguges vs XML DTD Regulr expressions for content models of DTD re one-unmiguous XML DTDs re LL(1) grmmrs [Wood 96] LL(k) grmmrs hve proper hierrchy [AU 72] k-unmiguous regulr lnguges?? We hve k-lookhed for processing n input string. X M L I 6-lookhed N S T A N C E current stte 13-2 SNU 4/14
50 k-lookhed Regulr Lnguges Two wys for defining k-lookhed regulr lnguges. The first is sed on lookhed of t most k 1 symols to determine the next, t most one, mtching position in given regulr expression: deterministic k-lookhed regulr expressions The second is similr except tht when we use lookhed of k symols, we must mtch the next k positions uniquely: k-lockdeterministic regulr expressions 14-1 SNU 4/14
51 Deterministic k-lookhed regulr lnguges fter reding i+1 t stte q i i i+1 i+2 i+k i+k+1 k-lookhed i i+1 i+2 t stte q i+1 k-lookhed i+k i+k SNU 4/14
52 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) 16-1 SNU 4/14
53 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) # 16-2 SNU 4/14
54 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) # 16-3 SNU 4/14
55 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed. 0? 1 2? 3 E = ( + ) # 16-4 SNU 4/14
56 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) # 16-5 SNU 4/14
57 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) # 16-6 SNU 4/14
58 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) # 16-7 SNU 4/14
59 Deterministic k-lookhed regulr lnguges A regulr lnguge L is deterministic k-lookhed if there is deterministic k-lookhed regulr expression for L. A regulr expression is deterministic k-lookhed if its position utomton is deterministic k-lookhed E = ( + ) E is deterministic 2-lookhed. # 16-8 SNU 4/14
60 Deterministic k-lookhed regulr lnguges Thm. L((+) (+) k ), for k 0, is deterministic (k+1)-lookhed SNU 4/14
61 Deterministic k-lookhed regulr lnguges Thm. L((+) (+) k ), for k 0, is deterministic (k+1)-lookhed. k = SNU 4/14
62 17-3 SNU 4/14 Deterministic k-lookhed regulr lnguges Thm. L((+) (+) k ), for k 0, is deterministic (k+1)-lookhed. k = 1 k = 1 k = 2
63 Deterministic k-lookhed regulr lnguges Thm. L((+) (+) k ), for k 0, is deterministic (k+1)-lookhed. There exists hierrchy for deterministic k-lookhed regulr lnguges k k 1 k 2 k SNU 4/14
64 k-lock-deterministic regulr lnguges i i+1 i+2 i+k i+k+1 t stte q i k-lookhed fter reding i+1 i+k i i+1 i+2 t stte q i i+k i+k+1 k-lookhed 19-1 SNU 4/14
65 k-lock-deterministic regulr lnguges We define regulr lnguge L to e k-lock-deterministic if there exists k-lock utomton A = (Q, Σ, Γ, δ, s, F ) tht stisfies the following conditions: 1. A is position utomton over Γ. 2. A is deterministic lock utomton. 3. L = L(A ). It is esy to verify tht position utomton A for n 1-deterministic regulr lnguge is 1-lock-deterministic SNU 4/14
66 k-lock-deterministic regulr lnguges Thm. There is proper hierrchy in k-lock-deterministic regulr lnguges. Sketch of Proof. A (k 1)-lock-deterministic regulr lnguge is k- lock-deterministic y definition. Thus, it is enough to show tht there is k-lock-deterministic regulr lnguge tht is not (k 1)-lockdeterministic. k k 1 k 2 k SNU 4/14
67 k 3 sttes q 1 q 2 q 3 q 4 q 5 A q 1 q 3 A q 4 q SNU 4/14
68 Two Wys... Thm. k-lock-deterministic regulr lnguges re proper sufmily of deterministic k-lookhed regulr lnguges. k-lookhed determinism k-lock determinism Generliztions of One-Deterministic Regulr Lnguges, Yo-Su Hn nd Derick Wood, Informtion nd Computtion, Vol. 206, , SNU 4/14
69 XML DTD vs XML Schem There s no vs XML Schem re much more flexile nd powerful Thus, there re lso much more difficult nd confusing 24-1 SNU 4/14
70 XML DTD vs XML Schem There s no vs XML Schem re much more flexile nd powerful Thus, there re lso much more difficult nd confusing XML DTD XML Schem 24-2 SNU 4/14
71 XML DTD vs XML Schem There s no vs XML Schem re much more flexile nd powerful Thus, there re lso much more difficult nd confusing XML DTD 1-lookhed determinism XML Schem k-lookhed determinism 24-3 SNU 4/14
72 XML DTD vs XML Schem There s no vs XML Schem re much more flexile nd powerful Thus, there re lso much more difficult nd confusing XML DTD 1-lookhed determinism XML Schem k-lookhed determinism 24-4 SNU 4/14
73 XML DTD vs XML Schem There s no vs XML Schem re much more flexile nd powerful Thus, there re lso much more difficult nd confusing XML DTD 1-lookhed determinism XML Schem? k-lookhed determinism 24-5 SNU 4/14
74 Pttern Mtching - n ppliction of regulr lnguges Given regulr expression pttern P nd text T, find ll sustrings of T tht re in L(P ). T = AGCT AAT CCCT GAGAGT CCAGT T AGT CCCAT P = T (AG + C) T 25-1 SNU 4/14
75 Pttern Mtching - n ppliction of regulr lnguges Given regulr expression pttern P nd text T, find ll sustrings of T tht re in L(P ). T = AGCT AAT CCCT GAGAGT CCAGT T AGT CCCAT P = T (AG + C) T 25-2 SNU 4/14
76 Pttern Mtching New Domins: WEB, Bioinformtics, Huge DB, Imges or Source Codes 26-1 SNU 4/14
77 Pttern Mtching - relted work Given text T nd regulr expression E, The recognition prolem: We cn report ll end positions of mtching sustrings of T in O(mn) time [Aho] or in O(mn/ log n) time [Myers]. The identifiction prolem: We cn report ll (strt, end) positions of mtching sustrings of T in O(mn 2 ) time [Aho] SNU 4/14
78 Pttern Mtching - recognition prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) T = 28-1 SNU 4/14
79 Pttern Mtching - recognition prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) T = Σ E 28-2 SNU 4/14
80 Pttern Mtching - recognition prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) T = 28-3 SNU 4/14
81 Pttern Mtching - recognition prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) T = Given E nd T, we cn find ll end positions of mtching sustrings of T in O(mn) time using O(m) spce, where E = m nd T = n [Aho] SNU 4/14
82 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) T = 29-1 SNU 4/14
83 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = 29-2 SNU 4/14
84 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = 29-3 SNU 4/14
85 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = 29-4 SNU 4/14
86 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = 29-5 SNU 4/14
87 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = 29-6 SNU 4/14
88 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = Running Time = No. of mtching end positions O(mn) = O(n) O(mn) = O(mn 2 ) SNU 4/14
89 Pttern Mtching - identifiction prolem Given E over Σ, we prepend Σ to E; this llows mtching to egin t ny position in T. E = ( + ) E R = ( + ) T = Running Time = No. of mtching end positions O(mn) = O(n) O(mn) = O(mn 2 ). We cn solve the idenftifiction prolem in O(mn 2 ) worst-cse time using O(m) spce [Aho] SNU 4/14
90 Prefix nd Infix Given two strings x nd y over Σ, we sy x is prefix of y if there exists z Σ such tht xz = y. x is n infix of y if there exists u, v Σ such tht uxv = y; we often cll x sustring of y SNU 4/14
91 Prefix nd Infix Given two strings x nd y over Σ, we sy x is prefix of y if there exists z Σ such tht xz = y. x is n infix of y if there exists u, v Σ such tht uxv = y; we often cll x sustring of y. y = seoul 30-2 SNU 4/14
92 Prefix nd Infix Given two strings x nd y over Σ, we sy x is prefix of y if there exists z Σ such tht xz = y. x is n infix of y if there exists u, v Σ such tht uxv = y; we often cll x sustring of y. y = seoul seo is prefix of y SNU 4/14
93 Prefix nd Infix Given two strings x nd y over Σ, we sy x is prefix of y if there exists z Σ such tht xz = y. x is n infix of y if there exists u, v Σ such tht uxv = y; we often cll x sustring of y. y = seoul eou is n infix of y SNU 4/14
94 Prefix nd Infix Given two strings x nd y over Σ, we sy x is prefix of y if there exists z Σ such tht xz = y. x is n infix of y if there exists u, v Σ such tht uxv = y; we often cll x sustring of y. We define pttern P to e prefix-free if no string in P is prefix of ny other strings in P. infix-free if no string in P is n infix of ny other strings in P SNU 4/14
95 Infix-free Regulr-Expression Mtching L IN L P RE L REG L REG L P RE L IN 31-1 SNU 4/14
96 Infix-free Regulr-Expression Mtching L IN L P RE L REG Given n infix-free regulr expression E nd text T : y = seoul eou is n infix of y. L REG E L P RE T L IN 31-2 SNU 4/14
97 Infix-free Regulr-Expression Mtching L IN L P RE L REG Given n infix-free regulr expression E nd text T : y = seoul eou is n infix of y. L REG E L P RE T = the recognition process L IN 31-3 SNU 4/14
98 Infix-free Regulr-Expression Mtching L IN L P RE L REG Given n infix-free regulr expression E nd text T : y = seoul eou is n infix of y. L REG E L P RE T = the recognition process L IN 31-4 SNU 4/14
99 Infix-free Regulr-Expression Mtching L IN L P RE L REG Given n infix-free regulr expression E nd text T : y = seoul eou is n infix of y. L REG E L P RE E R = T = the recognition process L IN 31-5 SNU 4/14
100 Infix-free Regulr-Expression Mtching L IN L P RE L REG Given n infix-free regulr expression E nd text T : y = seoul eou is n infix of y. L REG E L P RE E R = T = L IN the recognition process Becuse of infix-freeness, ech pir of (, ) from left to right must e mtching sustring SNU 4/14
101 Infix-free Regulr-Expression Mtching L IN L P RE L REG Given n infix-free regulr expression E nd text T : y = seoul eou is n infix of y. L REG E L P RE E R = T = L IN the recognition process Becuse of infix-freeness, ech pir of (, ) from left to right must e mtching sustring. We cn find ll mtching sustrings in O(mn) time [HWW07]. Prefix-Free Regulr Lnguges nd Pttern Mtching, Yo-Su Hn, Yjun Wng nd Derick Wood Theoreticl Computer Science Vol. 389, , SNU 4/14
102 Prefix-free Regulr-Expression Mtching L IN L P RE L REG If E is infix-free, we hve n O(mn) running time lgorithm If E is (norml) regulr expression, we hve n O(mn 2 ) running time lgorithm If E is prefix-free, then there re t most n mtching sustrings of T tht elong to L(E), where n is the size of T SNU 4/14
103 Prefix-free Regulr-Expression Mtching L IN L P RE L REG If E is infix-free, we hve n O(mn) running time lgorithm If E is (norml) regulr expression, we hve n O(mn 2 ) running time lgorithm If E is prefix-free, then there re t most n mtching sustrings of T tht elong to L(E), where n is the size of T. c c c c T = SNU 4/14
104 Prefix-free Regulr-Expression Mtching L IN L P RE L REG If E is infix-free, we hve n O(mn) running time lgorithm If E is (norml) regulr expression, we hve n O(mn 2 ) running time lgorithm If E is prefix-free, then there re t most n mtching sustrings of T tht elong to L(E), where n is the size of T. c c c c T = 13 ccc is prefix of ccc. This contrdicts tht L(E) is prefix-free SNU 4/14
105 Prefix-free Regulr-Expression Mtching L IN L P RE L REG If E is infix-free, we hve n O(mn) running time lgorithm If E is (norml) regulr expression, we hve n O(mn 2 ) running time lgorithm If E is prefix-free, then there re t most n mtching sustrings of T tht elong to L(E), where n is the size of T. Cn we hve n O(mn) time lgorithm? c c c c T = 13 ccc is prefix of ccc. This contrdicts tht L(E) is prefix-free SNU 4/14
106 Prefix-free Regulr-Expression Mtching L IN L P RE L REG If E is infix-free, we hve n O(mn) running time lgorithm If E is (norml) regulr expression, we hve n O(mn 2 ) running time lgorithm If E is prefix-free, then there re t most n mtching sustrings of T tht elong to L(E), where n is the size of T. Cn we hve n O(mn) time lgorithm? c c c c T = 13 ccc is prefix of ccc. This contrdicts tht L(E) is prefix-free SNU 4/14
107 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E T SNU 4/14
108 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E T = the recognition process 33-2 SNU 4/14
109 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E T = the recognition process 33-3 SNU 4/14
110 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process 33-4 SNU 4/14
111 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process 33-5 SNU 4/14
112 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process prllel processing strts 33-6 SNU 4/14
113 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process T = Running Time = No. of mtching end positions O(mn) = O(n) O(mn) = O(mn 2 ). prllel processing strts 33-7 SNU 4/14
114 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process T = Running Time = No. of mtching end positions O(mn) = O(n) O(mn) = O(mn 2 ). prllel processing strts 33-8 SNU 4/14
115 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process T = Running Time = No. of mtching end positions O(mn) = O(n) O(mn) = O(mn 2 ). prllel processing strts 33-9 SNU 4/14
116 Prefix-free Regulr-Expression Mtching Sketch of our lgorithm: E E R = T = the recognition process Becuse of prefix-freeness, no two process cn hve the sme stte of E t the sme time. This implies tht single reverse scn is enough to find corresponding strt positions for ech end position. set of sttes for 12 set of sttes for SNU 4/14
117 Prefix-free Regulr-Expression Mtching Given prefix-free regulr expression E nd text T, we cn identify ll mtching sustrings of T tht elong to L(E) in O(mn) worst-cse time - [HWW07]. Prefix-Free Regulr Lnguges nd Pttern Mtching, Yo-Su Hn, Yjun Wng nd Derick Wood Theoreticl Computer Science Vol. 389, , SNU 4/14
118 Stte Complexity Wht is the stte complexity of regulr lnguge L? 35-1 SNU 4/14
119 Stte Complexity Wht is the stte complexity of regulr lnguge L? Stte complexity is descriptionl complexity of L L hs unique miniml DFA A We define the stte complexity of L to e the numer of sttes in A 35-2 SNU 4/14
120 Stte Complexity Wht is the stte complexity of regulr lnguge L? Stte complexity is descriptionl complexity of L L hs unique miniml DFA A We define the stte complexity of L to e the numer of sttes in A We cn estimte needed resource SNU 4/14
121 Stte Complexity Prolem Given two (ritrry) regulr lnguges L 1 nd L 2, wht is the stte complexity of L 1 L 2? 36-1 SNU 4/14
122 Stte Complexity Prolem Given two (ritrry) regulr lnguges L 1 nd L 2, wht is the stte complexity of L 1 L 2? Upper ound m 1 m SNU 4/14
123 Stte Complexity Prolem Given two (ritrry) regulr lnguges L 1 nd L 2, wht is the stte complexity of L 1 L 2? Upper ound t most m 1 m 2 f(m 1, m 2 ) 36-3 SNU 4/14
124 Stte Complexity Prolem Given two (ritrry) regulr lnguges L 1 nd L 2, wht is the stte complexity of L 1 L 2? Upper ound t most m 1 m 2 f(m 1, m 2 ) Lower ound 36-4 SNU 4/14
125 Stte Complexity Prolem Given two (ritrry) regulr lnguges L 1 nd L 2, wht is the stte complexity of L 1 L 2? Upper ound t most m 1 m 2 f(m 1, m 2 ) Lower ound Present two (generl) L 1 nd L 2 such tht the stte complexity of L 1 L 2 lwys reches the upper ound SNU 4/14
126 Stte Complexity Prolem Given two (ritrry) regulr lnguges L 1 nd L 2, wht is the stte complexity of L 1 L 2? Upper ound t most m 1 m 2 f(m 1, m 2 ) Lower ound Present two (generl) L 1 nd L 2 such tht the stte complexity of L 1 L 2 lwys reches the upper ound. Tight ound: UB = LB, the stte complexity of the intersection of two regulr lnguges is f(m 1, m 2 ) 36-6 SNU 4/14
127 Stte Complexity - Motivtion 1970s 2011 In recent yers, there hve een mny new pplictions of FAs, such s in nturl lnguge nd speech processing, softwre engineering, nd imge genertion nd encoding tht need lrge numer of sttes. the Bell Ls multilingul TTS system: 26.6MB for Germn, 30.0MB for French nd 39.0MB for Chinese SNU 4/14
128 Stte Complexity - motivtion New Helper: FA mnipultion softwre systems such s Gril+, Automte nd FireLite 38-1 SNU 4/14
129 Stte Complexity - motivtion New Helper: FA mnipultion softwre systems such s Gril+, Automte nd FireLite We clculte the upper ound SNU 4/14
130 Stte Complexity - motivtion New Helper: FA mnipultion softwre systems such s Gril+, Automte nd FireLite We clculte the upper ound. We guess lower ound nd verify it, nd repet this step until we find mtching lower ound SNU 4/14
131 Stte Complexity - motivtion New Helper: FA mnipultion softwre systems such s Gril+, Automte nd FireLite We clculte the upper ound. We guess lower ound nd verify it, nd repet this step until we find mtching lower ound. helper 38-4 SNU 4/14
132 Stte Complexity opertion finite lnguges regulr lnguges L 1 L 2 O(mn) mn L 1 L 2 O(mn) mn Σ \ L 1 m m L 1 L 2 (m n + 3)2 n 2 1 (2m 1)2 n 1 L 1 2 m m 4, for m 4 2 m m 2 L R p 1 1 if m = 2p 2 p 1 if m = 2p 1 2 m 39-1 SNU 4/14
133 Union of Finite Lnguges Given two miniml DFAs A nd B for non-empty finite lnguges L 1 nd L 2, we cn construct DFA for L(A) L(B) sed on the Crtesin product of sttes s follows: Let A = (Q 1, Σ, δ 1, s 1, F 1 ) nd B = (Q 2, Σ, δ 2, s 2, F 2 ). M = (Q 1 Q 2, Σ, δ, (s 1, s 2 ), F ), where for ll p Q 1 nd q Q 2 nd Σ, δ((p, q), ) = (δ(p, ), δ(q, )) nd F = (F 1 Q 2 ) (Q 1 F 2 ). M is deterministic SNU 4/14
134 Union of Finite Lnguges - Crtesin Product of Sttes 1,1 1,2 1,3 1,n-1 1,n 2,1 The m 1th stte in A is the finl stte whose outtrnsitions go to the sink stte, the mth stte. m-1,1 m,1 m-1,n-1 m,n-1 m-1,n m,n 41-1 SNU 4/14
135 Union of Finite Lnguges - Crtesin Product of Sttes 1,1 1,2 1,3 1,n-1 1,n 2,1 The m 1th stte in A is the finl stte whose outtrnsitions go to the sink stte, the mth stte. For stte (i, j) in M, L i,j (M) = L i (A) L j (B). m-1,1 m,1 m-1,n-1 m,n-1 m-1,n m,n 41-2 SNU 4/14
136 Union of Finite Lnguges - Crtesin Product of Sttes 1,1 1,2 1,3 1,n-1 1,n 2,1 The m 1th stte in A is the finl stte whose outtrnsitions go to the sink stte, the mth stte. For stte (i, j) in M, L i,j (M) = L i (A) L j (B). m-1,1 m,1 m-1,n-1 m,n-1 m-1,n m,n ll sttes re unrechle from stte (1,1) since A nd B re non-returning SNU 4/14
137 Union of Finite Lnguges - Crtesin Product of Sttes 1,1 1,2 1,3 1,n-1 1,n 2,1 The m 1th stte in A is the finl stte whose outtrnsitions go to the sink stte, the mth stte. For stte (i, j) in M, L i,j (M) = L i (A) L j (B). m-1,1 m,1 m-1,n-1 m,n-1 m-1,n m,n ll sttes equivlent since L m 1,n 1 = L m 1,n = L m,n 1 = {λ}. ll sttes re unrechle from stte (1,1) since A nd B re non-returning SNU 4/14
138 Union of Finite Lnguges - Crtesin Product of Sttes 1,1 1,2 1,3 1,n-1 1,n 2,1 The m 1th stte in A is the finl stte whose outtrnsitions go to the sink stte, the mth stte. For stte (i, j) in M, L i,j (M) = L i (A) L j (B). m-1,1 m,1 m-1,n-1 m,n-1 m-1,n m,n ll sttes equivlent since L m 1,n 1 = L m 1,n = L m,n 1 = {λ}. Lemm ll sttes 1. mn (m+n 2) 2 re unrechle from= stte mn(1,1) (m + n) sttes re sufficient forsince L(A) A nd L(B). B re non-returning SNU 4/14
139 Union of Finite Lnguges Lemm 1. mn (m + n) sttes re sufficient for L(A) L(B). The next question is whether or not the ound is rechle in generl SNU 4/14
140 Union of Finite Lnguges Lemm 1. mn (m + n) sttes re sufficient for L(A) L(B). The next question is whether or not the ound is rechle in generl. The nswer is YES nd NO SNU 4/14
141 Union of Finite Lnguges Lemm 2. The upper ound mn (m + n) cnnot e reched with fixed lphet when m nd n re ritrrily lrge. Proof. Let A hve {p 0, p 1,..., p m 1 } nd B hve {q 0, q 1,..., q n 1 }. We order the sttes such tht if p j is rechle from p i, then i < j. Let i {1,..., m 1}. Any string tht reches p i from p 0 cn go through only the sttes p 1,..., p i 1 in etween nd cnnot visit the sme stte twice. Hence, there re t most t + t t i = t(ti 1) t 1 = def D(i) strings tht cn rech p i from p SNU 4/14
142 Union of Finite Lnguges Lemm 2. The upper ound mn (m + n) cnnot e reched with fixed lphet when m nd n re ritrrily lrge. Proof. Let A hve {p 0, p 1,..., p m 1 } nd B hve {q 0, q 1,..., q n 1 }. We order the sttes such tht if p j is rechle from p i, then i < j. Let i {1,..., m 1}. Any string tht reches p i from p 0 cn go through only the sttes p 1,..., p i 1 in etween nd cnnot visit the sme stte twice. Hence, there re t most t + t t i = t(ti 1) t 1 = def D(i) strings tht cn rech p i from p 0. Since M is deterministic, for ny fixed i for 1 i < m 1, t most D(i) of the pir-sttes (p i, q j ) re rechle from (p 0, q 0 ) in M. Thus, if n 2 > D(i), then some pir-sttes with p i s the first component re not rechle. Therefore, the ound mn (m + n) is not rechle SNU 4/14
143 Union of Finite Lnguges Lemm 2. The upper ound mn (m + n) cnnot e reched with fixed lphet when m nd n re ritrrily lrge. Wht if the size of n lphet is NOT fixed? 44-1 SNU 4/14
144 Union of Finite Lnguges Lemm 2. The upper ound mn (m + n) cnnot e reched with fixed lphet when m nd n re ritrrily lrge. Wht if the size of n lphet is NOT fixed? Lemm 3. The upper ound mn (m + n) is rechle if the size of the lphet cn depend on m nd n SNU 4/14
145 Union of Finite Lnguges Lemm 3. The upper ound mn (m + n) is rechle if the size of the lphet cn depend on m nd n. We prove the lemm y presenting two finite lnguges whose union reches the ound. Let Σ = {, c} { i,j 1 i m 2, 1 j n 2 nd (i, j) (m 2, n 2)} Let A = (Q 1, Σ, δ 1, p 0, {p m 2 }), where Q 1 = {p 0, p 1,..., p m 1 } nd δ 1 is defined s follows: δ 1 (p i, ) = p i+1, for 0 i m 2. δ 1 (p 0, i,j ) = p i, for 1 i m 2 nd 1 j n 2, (i, j) (m 2, n 2). Let B = (Q 2, Σ, δ 2, q 0, {q n 2 }), where Q 2 = {q 0, q 1,..., q n 1 } nd δ 2 is defined s follows: δ 2 (q i, c) = q i+1, for 0 i n 2. δ 2 (q 0, i,j ) = q j, for 1 j n 2 nd 1 i m 2, (i, j) (m 2, n 2) SNU 4/14
146 Union of Finite Lnguges Lemm 3. The upper ound mn (m + n) is rechle if the size of the lphet cn depend on m nd n. A, 11, 12, , 22, 23 31, 32, 33 41, 42 B c, 11, 21, 31, 41 c c c , 22, 32, 42 13, 23, 33 An exmple of two miniml DFAs for finite lnguges whose sizes re 6 nd 5, respectively, where stte 5 ove nd stte 4 elow re sink sttes 46-1 SNU 4/14
147 Union of Finite Lnguges Lemm 3. The upper ound mn (m + n) is rechle if the size of the lphet cn depend on m nd n. Let L = L(A) L(B). We shows tht there exists set R consisting of mn (m+n) strings over Σ tht re pirwise inequivlent modulo the right invrint congruence of L. Let R = R 1 R 2 R 3, where R 1 = { i 0 i m 1}. R 2 = {c j 1 j n 3}. (Note tht R 2 does not include strings c 0, c n 2 nd c n 1.) R 3 = { i,j 1 i m 2 nd 1 j n 2 nd (i, j) (m 2, n 2)}. It is esy to verify tht ll strings in R re pirwise inequivlent. complete proof is given in the proceedings.) Then, R = mn (m + n). (The 47-1 SNU 4/14
148 Union of Finite Lnguges Theorem 1. Given two miniml DFAs A nd B for finite lnguges, mn (m + n) sttes re necessry nd sufficient in the worst-cse for the miniml DFA of L(A) L(B), where m = A nd n = B SNU 4/14
149 Union of Finite Lnguges Lemm 2 shows tht the upper ound is unrechle if Σ is fixed wheres Lemm 3 shows tht the upper ound is rechle if Σ depends on m nd n. Then, wht is the stte complexity of union with fixed sized lphet? 49-1 SNU 4/14
150 Union of Finite Lnguges Lemm 4. There exist DFAs A nd B, with m nd n sttes respectively, tht recognize finite lnguges over Σ such tht the miniml DFA for L(A) L(B) requires c(min{m, n}) 2 sttes. Proof. Let s 1 e ritrry nd r = log s. We define the finite lnguge L 1 = {w 1 w 2 w 1 = 2r, w 2 = odd(w 1 ) {, }, even(w 1 ) {c, d} }. L 1 cn e recognized y DFA A with t most 10s sttes SNU 4/14
151 Union of Finite Lnguges L 1 = {w 1 w 2 w 1 = 2r, w 2 = odd(w 1 ) {, }, even(w 1 ) {c, d} }. c, d c, d c, d c, d c, d c, d expnding tree for w 1 prt c, d c, d c, d c, d c, d c, d c, d c, d merging tree for w 2 prt A DFA A tht recognizes L 1 when r = 3. We omit the sink stte nd its in-trnsitions SNU 4/14
152 Union of Finite Lnguges Symmetriclly, we define L 2 = {w 1 w 2 w 1 = 2r, odd(w 1 ) {, }, w 2 = even(w 1 ) {c, d} }. The lnguge L 2 consists of strings uv, where u = 2r, odd chrcters of u re in {, }, even chrcters of u re in {c, d} nd even(u) coincides with v. By similr rgument, L 2 cn e recognized y DFA B with t most 10s sttes SNU 4/14
153 Union of Finite Lnguges Now let L = L 1 L 2. Let u 1 nd u 2 e distinct strings of length 2r such tht odd(u i ) {, } nd even(u i ) {c, d} for i = 1, 2. If odd(u 1 ) odd(u 2 ): u 1 odd(u 1 ) L 1 L ut u 2 odd(u 1 ) / L. Hence, u 1 nd u 2 re not equivlent modulo the right invrint congruence of L. If even(u 1 ) even(u 2 ): u 1 even(u 1 ) L 2 L ut u 2 even(u 1 ) L. The ove implies tht the right invrint congruence of L hs t lest 2 r 2 r s 2 different clsses. Therefore, if m = n = 10s is the size of the miniml DFAs for the finite lnguges L 1 nd L 2, then we know tht the miniml DFA for L = L 1 L 2 needs t lest n2 sttes SNU 4/14
154 RECAP Structurl properties of the k-lookhed determinism tht might led to n efficient XML Schem prser Fst regulr-expression pttern mtching lgorithms Stte Complexity 54-1 SNU 4/14
155 Future Directions nd Conclusions Hierrchy of k-lookhed determinism XML Schem prser regulr-expression pttern mtching system for source codes pttern mtching + indexing pure theory prcticl ppliction stte complexity 55-1 SNU 4/14
156 THANK YOU ANY QUESTIONS?? 56-1 SNU 4/14
Prefix-Free Regular-Expression Matching
Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings
More informationGrammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages
5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive
More informationHarvard University Computer Science 121 Midterm October 23, 2012
Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is
More informationFormal Languages and Automata
Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University
More informationTheory of Computation Regular Languages
Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of
More informationTheory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38
Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control
More informationMinimal DFA. minimal DFA for L starting from any other
Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA
More informationCMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014
CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA
More informationNFAs continued, Closure Properties of Regular Languages
Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,
More informationAnatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute
Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn
More informationDesigning finite automata II
Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of
More informationMyhill-Nerode Theorem
Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute
More informationAUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton
25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q
More informationAutomata and Languages
Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive
More informationAssignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages
Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd
More informationLecture 09: Myhill-Nerode Theorem
CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives
More informationRegular expressions, Finite Automata, transition graphs are all the same!!
CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1
More informationLexical Analysis Finite Automate
Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition
More informationLecture 08: Feb. 08, 2019
4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny
More informationCHAPTER 1 Regular Languages. Contents
Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More
More informationFormal languages, automata, and theory of computation
Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm
More informationNFAs continued, Closure Properties of Regular Languages
lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions
More informationAutomata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.
Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent
More informationNondeterminism and Nodeterministic Automata
Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely
More informationFinite-State Automata: Recap
Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under
More informationClosure Properties of Regular Languages
Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L
More informationRegular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*
Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationFinite Automata-cont d
Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww
More information1 Nondeterministic Finite Automata
1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you
More informationState Minimization for DFAs
Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid
More informationConverting Regular Expressions to Discrete Finite Automata: A Tutorial
Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert
More informationCHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)
Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr
More informationCS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University
CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted
More information5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.
Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.
More informationCS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018
CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA
More informationChapter 2 Finite Automata
Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht
More informationHomework 3 Solutions
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More informationMore on automata. Michael George. March 24 April 7, 2014
More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose
More informationIntermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4
Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one
More information3 Regular expressions
3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic
More information11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?
CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction
More informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.
More informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over
More informationCS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)
CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts
More informationChapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1
Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more
More information1.4 Nonregular Languages
74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationJava II Finite Automata I
Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression
More informationCS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata
CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or
More informationCSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science
CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationExercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.
1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,
More informationFirst Midterm Examination
24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet
More information1 From NFA to regular expression
Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work
More informationCISC 4090 Theory of Computation
9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions
More informationCoalgebra, Lecture 15: Equations for Deterministic Automata
Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined
More informationa,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1
CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother
More informationDeterministic Finite Automata
Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationNFAs 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 informationCSCI 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 informationCS 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 informationCS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS
CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent
More information12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014
CS125 Lecture 12 Fll 2014 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion
More informationNon-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1
Non-Deterministic Finite Automt Fll 2018 Costs Busch - RPI 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q q2 1 q 0 q 3 Fll 2018 Costs Busch - RPI 2 Nondeterministic Finite Automton (NFA) Alphbet
More information12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016
CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple
More informationLet's start with an example:
Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed
More informationCS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p
More informationFABER Formal Languages, Automata and Models of Computation
DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte
More informationSome Theory of Computation Exercises Week 1
Some Theory of Computtion Exercises Week 1 Section 1 Deterministic Finite Automt Question 1.3 d d d d u q 1 q 2 q 3 q 4 q 5 d u u u u Question 1.4 Prt c - {w w hs even s nd one or two s} First we sk whether
More informationOverview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch.
Overview H9 Vertlerouw H 9: Prsing: op-down & LL(1) do 3 mei 2001 56 heo Ruys h. 8 - Prsing 8.1 ontext-free Grmmrs 8.2 op-down Prsing 8.3 LL(1) Grmmrs See lso [ho, Sethi & Ullmn 1986] for more thorough
More informationNondeterministic Biautomata and Their Descriptional Complexity
Nondeterministic Biutomt nd Their Descriptionl Complexity Mrkus Holzer nd Sestin Jkoi Institut für Informtik Justus-Lieig-Universität Arndtstr. 2, 35392 Gießen, Germny 23. Theorietg Automten und Formle
More informationCS 275 Automata and Formal Language Theory
CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)
More informationTutorial Automata and formal Languages
Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we
More informationFinite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh
Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is
More informationFinite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh
Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions
More informationGNFA GNFA GNFA GNFA GNFA
DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS
The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook
More informationName Ima Sample ASU ID
Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to
More informationFirst Midterm Examination
Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does
More informationHomework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)
More informationNFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.
NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD
More informationDFA Minimization and Applications
DFA Minimiztion nd Applictions Mondy, Octoer 15, 2007 Reding: toughton 3.12 C235 Lnguges nd Automt Deprtment of Computer cience Wellesley College Gols for ody o Answer ny P3 questions you might hve. o
More informationThoery of Automata CS402
Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...
More information1.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ɛ-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 informationFundamentals of Computer Science
Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,
More informationDeterministic 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 informationLecture 9: LTL and Büchi Automata
Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, section 003, George Mson University, Fll 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 7 1. Prove (p q) (p q), () (5pts) using truth tles. p q
More informationKleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15
Models of Comput:on Lecture #8 Chpter 7 con:nued Any lnguge tht e defined y regulr expression, finite utomton, or trnsi:on grph cn e defined y ll three methods We prove this y showing tht ny lnguge defined
More informationTable of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...
Tle of contents: Lecture N0.... 3 ummry... 3 Wht does utomt men?... 3 Introduction to lnguges... 3 Alphets... 3 trings... 3 Defining Lnguges... 4 Lecture N0. 2... 7 ummry... 7 Kleene tr Closure... 7 Recursive
More informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks
More information