More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41

Size: px
Start display at page:

Download "More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41"

Transcription

1 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall / 41

2 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider L = a + L (b + c). L is not regular. If L would be regular, then we can prove that L is regular (using the closure properties we will see next). However, the Pumping lemma does apply for L with n = 1. This shows the Pumping lemma is not a sufficient condition for a language to be regular. (NTU EE) Regular Languages Fall / 41

3 Use of closure properties to show non-regularity We can easily prove L 1 = {0 n 1 n n > 0} is not a regular language. L 2 = the set of strings with an equal number of 0 s and 1 s isn t either, but that fact is trickier to prove. Regular languages are closed under. If L 2 were regular, then L 2 L(0 1 ) = L 1 would be, but it isn t. (NTU EE) Regular Languages Fall / 41

4 Closure properties Let L and M be regular. Then L = L(R) = L(D) and M = L(S) = L(F) for regular expressions R and S, and DFA D and F. We have seen that RL are closed under the following operations: Union : L M = L(R + S) or L M = L(D F) Complement : L = L( D) Intersection : L M = L M or L M = L(D F) Difference : L M = L M Concatenation : LM = L(RS) Closure : L = L(R ) Prefix : Prefix(L) = {x y Σ, xy L} (Hint: in D, make final all states in a path from the start state to final state) quotient, morphism, inverse morphism, substitution,... (NTU EE) Regular Languages Fall / 41

5 Quotient Definition 2 L 1, L 2 Σ, L 1 /L 2 = {x Σ y L 2, xy L 1 }. Note: Pref (L) = L/Σ. Theorem 3 L, R Σ. If R is regular, then R/L is also regular. Proof Idea: F = {q Q y L, ˆδ(q, y) F} Example 4 L = {a n2 n 0}. L/L = {a n2 m 2 m, n 0} = a(aa) + (a 4 ). (NTU EE) Regular Languages Fall / 41

6 Morphisms h : Σ h : Σ h : 2 Σ 2 h(xy) = h(x)h(y), h(ɛ) = ɛ h(l) = x L {h(x)} Example 5 h(0) = ab, h(1) = ba, h(2) = ɛ. h(00212) = ababba; h({0 n 21 n n 0}) = {(ab) n (ba) n n 0} Theorem 6 h(k L) = h(k) (L); h(k L) = h(k) h(l); h(k ) = h(k). (NTU EE) Regular Languages Fall / 41

7 Inverse Morphisms h : Σ, K h 1 (K) = {x Σ h(x) K} Theorem 7 Regular languages are closed under inverse morphism. Proof Idea: (NTU EE) Regular Languages Fall / 41

8 Shuffle Definition 8 x ɛ = ɛ x = {x} ax by = a(x by) b(ax y) K L = x K,y L x y abb aca = {aabbca, aabcba, aabcab, aacabb, aacbab, aacbba, abbaca, ababca, abacba, abacab, acabba, acabab, acaabb}. Theorem 9 If K, L are regular, so is K L. (NTU EE) Regular Languages Fall / 41

9 Shuffle (cont d) Proof. (NTU EE) Regular Languages Fall / 41

10 1 2 L Definition L = {x Σ y Σ, xy L; y = x }. Theorem 11 If L is regular, so is 1 2 L. Proof. guess middle state, simulate halves in parallel Q = {q 0 } Q Q Q (Note: middle, 1st, 2nd) δ (q 0, ɛ) = {[q, q 0, q] q Q} ɛ-move δ ([q, p, r], a) = {[q, δ(p, a), δ(r, b)] b Σ} F = {[q, q, p] q Q, p F} (NTU EE) Regular Languages Fall / 41

11 Exponential Blow-Up in Subset Construction There is an NFA N with n + 1 states that has no equivalent DFA with fewer than 2 n states. L(N) = {x 1 c 2 c 3 c n : x {0, 1}, c i {0, 1}}. Suppose an equivalent DFA D with fewer than 2 n states exists. D must remember the last n symbols it has read. There are 2 n bitsequences a 1 a 2 a n. q, a 1 a 2 a n, b 1 b 2 b n : q ˆδ N (q 0, a 1 a 2 a n ), q ˆδ N (q 0, b 1 b 2 b n ), a 1 a 2 a n b 1 b 2 b n (NTU EE) Regular Languages Fall / 41

12 Exponential Blow-Up (Cont d) a 1 a i1 1a i+1 a n b 1 b i1 0b i+1 b n Now ˆδ N (q 0, a 1 a i 1 1a i+1 a n 0 i 1 ) = ˆδ N (q 0, b 1 b i 1 0b i+1 b n 0 i 1 ) And ˆδ N (q 0, a 1 a i 1 1a i+1 a n 0 i 1 ) F D A contradiction! ˆδ N (q 0, b 1 b i 1 0b i+1 b n 0 i 1 ) F D (NTU EE) Regular Languages Fall / 41

13 Decision Properties A decision property for a class of languages is an algorithm that takes a formal description of a language (e.g., a DFA) and tells whether or not some property holds. Example: Is language L empty? The representation is a DFA (or a RE that you will convert to a DFA). Can you tell if L(A) = for DFA A? (NTU EE) Regular Languages Fall / 41

14 Why Decision Properties When we talked about protocols represented as DFAs, we noted that important properties of a good protocol were related to the language of the DFA. Example: Does the protocol terminate? = Is the language finite? Example: Can the protocol fail? = Is the language nonempty? (NTU EE) Regular Languages Fall / 41

15 The Membership Question Our first decision property is the question: is string w in regular language L? Assume L is represented by a DFA A. Simulate the action of A on the sequence of input symbols forming w (NTU EE) Regular Languages Fall / 41

16 The Emptiness Problem Given a regular language, does the language contain any string at all. Assume representation is DFA. Construct the transition graph. Compute the set of states reachable from the start state. If any final state is reachable, then yes, else no. (NTU EE) Regular Languages Fall / 41

17 The Infiniteness Problem Is a given regular language infinite? Start with a DFA for the language. Key idea: if the DFA has n states, and the language contains any string of length n or more, then the language is infinite. Otherwise, the language is surely finite. Limited to strings of length n or less. There are an infinite number of strings of length > n, and we cant test them all. Second key idea: if there is a string of length > n (= number of states) in L, then there is a string of length between n and 2n 1. Test for membership all strings of length between n and 2n 1. If any are accepted, then infinite, else finite. (NTU EE) Regular Languages Fall / 41

18 The Equivalence Problem Given regular languages L and M, is L = M? Algorithm involves constructing the product DFA from DFA s for L and M. Let these DFA s have sets of states Q and R, respectively. Product DFA has set of states Q R. I.e., pairs [q, r] with q in Q, r in R. Make the final states of the product DFA be those states [q, r] such that exactly one of q and r is a final state of its own DFA. Thus, the product accepts w iff w is in exactly one of L and M. The product DFA s language is empty iff L = M. (NTU EE) Regular Languages Fall / 41

19 The Containment Problem Given regular languages L and M, is L M? Algorithm also uses the product automaton. How do you define the final states [q, r] of the product so its language is empty iff L M? - Answer: q is final; r is not. (NTU EE) Regular Languages Fall / 41

20 The Minimum-State DFA for a Regular Language In principle, since we can test for equivalence of DFA s we can, given a DFA A find the DFA with the fewest states accepting L(A). Test all smaller DFA s for equivalence with A. But that s a terrible algorithm. Efficient State Minimization Construct a table with all pairs of states. If you find a string that distinguishes two states (takes exactly one to an accepting state), mark that pair. Algorithm is a recursion on the length of the shortest distinguishing string. (NTU EE) Regular Languages Fall / 41

21 State Minimization Basis: Mark a pair if exactly one is a final state. Induction: mark [q, r] if there is some input symbol a such that [δ(q, a), δ(r, a)] is marked. After no more marks are possible, the unmarked pairs are equivalent and can be merged into one state. Note: (Transitivity of Indistinguishable) If state p is indistinguishable from q, and q is indistinguishable from r, then p is indistinguishable from r. (NTU EE) Regular Languages Fall / 41

22 Constructing the Minimum-State DFA Suppose q 1,..., q k are indistinguishable states. Replace them by one state q. Then δ(q 1, a),..., δ(q k, a) are all indistinguishable states. Key point: otherwise, we should have marked at least one more pair. Let δ(q, a) = the representative state for that group. (NTU EE) Regular Languages Fall / 41

23 Example: State Minimization (NTU EE) Regular Languages Fall / 41

24 Example: State Minimization Start with marks for the pairs with one of the final states F or G. (NTU EE) Regular Languages Fall / 41

25 Example: State Minimization (NTU EE) Regular Languages Fall / 41

26 Example: State Minimization (NTU EE) Regular Languages Fall / 41

27 Example: State Minimization (NTU EE) Regular Languages Fall / 41

28 Example: State Minimization (NTU EE) Regular Languages Fall / 41

29 Example: State Minimization (NTU EE) Regular Languages Fall / 41

30 Equivalence Relation Definition 12 A binary relation R on a set S is a subset of S S. An equivalence relation on a set satisfies 1 Reflexivity: For all x in S, xrx 2 Symmetry: For x, y S xry yrx 3 Transitivity: For x, y, z S xry yrz xrz Every equivalence relation on S partitions S into equivalence classes. The number of equivalence classes is called the index of the relation. (NTU EE) Regular Languages Fall / 41

31 Right Invariant Definition 13 An equivalence relation on Σ is said to be right invariant with respect to concatenation if x, y Σ and a Σ, xry implies that xarya. (NTU EE) Regular Languages Fall / 41

32 Equivalence relations induced by DFA Let M = (Q, Σ, δ, q 0, F) be a DFA. Define a relation R M as follows: For x, y Σ, xr M y δ(q 0, x) = δ(q 0, y). Is this an equivalence relation? If so, how many equivalence classes does it have? That is, what is its index? (NTU EE) Regular Languages Fall / 41

33 An Example Example 14 (NTU EE) Regular Languages Fall / 41

34 Refinement Definition 15 An equivalence relation R 1 is a refinement of R 2 if R 1 R 2, i.e. (x, y) R 1 (x, y) R 2 (NTU EE) Regular Languages Fall / 41

35 The Myhill-Nerode Theorem Theorem 16 Let L Σ. The following statements are equivalent: 1 L is recognized by a DFA 2 L is the union of some of the equivalence classes of a right invariant equivalence relation of finite index. 3 Define an equivalence relation R L as follows. For x, y Σ, (x, y) R L z Σ, xz L whenever yz L. Then R L has finite index. To prove this, we need to prove that (NTU EE) Regular Languages Fall / 41

36 Proof: 1 2 (1) L is recognized by a DFA (2) L is the union of some of the equivalence classes of a right invariant equivalence relation of finite index. Let M = (Q, Σ, δ, q 0, F) be the DFA that recognizes L. The relation R M defined earlier as follows: For x, y Σ, xr M y δ(q 0, x) = δ(q 0, y) is an equivalence relation which is of finite index and is also right invariant as M is a DFA. L is just the union of the equivalence classes corresponding to the final states of M (NTU EE) Regular Languages Fall / 41

37 Proof: 2 3 (2) L is the union of some of the equivalence classes of a right invariant equivalence relation of finite index. (3) Define an equivalence relation R L as follows. For x, y Σ, (x, y) R L z Σ, xz L whenever yz L. Then R L has finite index. Let E be the equivalence relation in (2). We show that E is a refinement of R L. Hence since E has finite index, so does R L. We show that if (x, y) E then (x, y) R L, i.e. E R L and hence E is a refinement of R L. (x, y) E z Σ, (xz, yz) E by repeated use of right invariance. Hence xz is in an equivalence class in L iff yz is, thereby implying that (x, z) R L. Thus R L has finite index. (NTU EE) Regular Languages Fall / 41

38 Proof: 3 1 (3) Define an equivalence relation R L as follows. For x, y Σ, (x, y) R L z Σ, xz L whenever yz L. Then R L has finite index. (1) L is recognized by a DFA Construct a DFA M L = (Q L, Σ, δ L, q 0L, F L ). We first show that R L is right invariant. To see this assume that (x, y) R L. Assume R L is not right invariant. Then there exists a Σ such that (xa, ya) R L. Let z be a distinguishing string for the pair (xa, ya). Then az is a distinguishing string for (x, y) contradicting the assumption that (x, y) R L. Therefore R L is right invariant. (NTU EE) Regular Languages Fall / 41

39 Proof: 3 1 (cont d) Let [x] denote the equivalence class containing x. The state set Q L = {[x] : x Σ }. The transition function δ L is defined as δ L ([x], a) = [xa]. The definition is consistent because had we chosen some other representative [y] of the equivalence class, [xa] = [ya] by right invariance of R L so the transition is to the same state of M L. We need to prove that x L δ L (q 0L, x) F L i.e. x is accepted by M L This is easy as δ L (q 0L, x) = [x] and x is accepted by M L iff [x] F L x L. (NTU EE) Regular Languages Fall / 41

40 Applications of the Myhill-Nerode Theorem The MN theorem can be used to show that a particular language is regular without actually constructing the automaton or to show conclusively that a language is not regular. Example. Is the following language regular 1 L 1 = {xy : x = y, x, y Σ }? 2 Example. What about the language L 2 = {xy : x = y, x, y Σ and y ends with a 1 }? 3 Example. What about the language L 3 = {xy : x = y, x, y Σ and y contains a 1}? (NTU EE) Regular Languages Fall / 41

41 Applications of the Myhill-Nerode Theorem (cont d) 1 For the language L 1 there are two equivalence classes of R L1. The first C 1 contains all strings of even length and the second C 2 all strings of odd length. 2 For L 2 we have the additional constraint that y ends with a 1. Class C 2 remains the same as that for L 1. Class C 1 is refined into classes C 1 which contains all strings of even length that end in a 1 and C 1 which contains all strings of even length which end in a 0. Thus L 1 and L 2 are both regular. 3 For L 3 we have to distinguish for example, between the even length strings in the sequence 01, 0001, ,..., as 00 distinguishes the first string from all the others after it in the sequence (concatenation of 00 to 01 gives a string not in L 3 but concatenation of 00 to all the others gives a string in L 3 ), 0000 distinguishes the second from all the others... (NTU EE) Regular Languages Fall / 41

Finite Automata and Regular Languages

Finite Automata and Regular Languages Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular

More information

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. March 13/18, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Notes on State Minimization

Notes on State Minimization U.C. Berkeley CS172: Automata, Computability and Complexity Handout 1 Professor Luca Trevisan 2/3/2015 Notes on State Minimization These notes present a technique to prove a lower bound on the number of

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1 Properties of Regular Languages BBM 401 - Automata Theory and Formal Languages 1 Properties of Regular Languages Pumping Lemma: Every regular language satisfies the pumping lemma. A non-regular language

More information

Before we show how languages can be proven not regular, first, how would we show a language is regular?

Before we show how languages can be proven not regular, first, how would we show a language is regular? CS35 Proving Languages not to be Regular Before we show how languages can be proven not regular, first, how would we show a language is regular? Although regular languages and automata are quite powerful

More information

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization Regular Language Equivalence and DFA Minimization Equivalence of Two Regular Languages DFA Minimization Decision Property: Equivalence Given regular languages L and M, is L = M? Algorithm involves constructing

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner. Tel Aviv University. November 14, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Warshall s algorithm

Warshall s algorithm Regular Expressions [1] Warshall s algorithm See Floyd-Warshall algorithm on Wikipedia The Floyd-Warshall algorithm is a graph analysis algorithm for finding shortest paths in a weigthed, directed graph

More information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

Regular Expressions and Language Properties

Regular Expressions and Language Properties Regular Expressions and Language Properties Mridul Aanjaneya Stanford University July 3, 2012 Mridul Aanjaneya Automata Theory 1/ 47 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

More information

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar Büchi Automata and their closure properties - Ajith S and Ankit Kumar Motivation Conventional programs accept input, compute, output result, then terminate Reactive program : not expected to terminate

More information

Outline. Summary. DFA -> Regex. Finish off Regex -> e-nfa -> NFA -> DFA -> Regex Minimization/equivalence (Myhill-Nerode theorem)

Outline. Summary. DFA -> Regex. Finish off Regex -> e-nfa -> NFA -> DFA -> Regex Minimization/equivalence (Myhill-Nerode theorem) Outline Finish off Regex -> e-nfa -> NFA -> DFA -> Regex Minimization/equivalence (Myhill-Nerode theorem) http://www.cs.caltech.edu/~cs20/a October 9, 2002 1 Summary NFA -> DFA If NFA has states Q, construct

More information

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ, Distinguishability Recall A deterministic finite automaton is a five-tuple M = (S,Σ,T,s 0,F) where S is a finite set of states, Σ is an alphabet the input alphabet, T : S Σ S is the transition function,

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1 Unit 6 Non Regular Languages The Pumping Lemma Reading: Sipser, chapter 1 1 Are all languages regular? No! Most of the languages are not regular! Why? A finite automaton has limited memory. How can we

More information

Properties of Regular Languages (2015/10/15)

Properties of Regular Languages (2015/10/15) Chapter 4 Properties of Regular Languages (25//5) Pasbag, Turkey Outline 4. Proving Languages Not to e Regular 4.2 Closure Properties of Regular Languages 4.3 Decision Properties of Regular Languages 4.4

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

COMP4141 Theory of Computation

COMP4141 Theory of Computation COMP4141 Theory of Computation Lecture 4 Regular Languages cont. Ron van der Meyden CSE, UNSW Revision: 2013/03/14 (Credits: David Dill, Thomas Wilke, Kai Engelhardt, Peter Höfner, Rob van Glabbeek) Regular

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

Theory of Computation

Theory of Computation Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L

More information

Lecture 1: Finite State Automaton

Lecture 1: Finite State Automaton Lecture 1: Finite State Automaton Instructor: Ketan Mulmuley Scriber: Yuan Li January 6, 2015 1 Deterministic Finite Automaton Informally, a deterministic finite automaton (DFA) has finite number of s-

More information

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in Fall 1999 Formal Language Theory Dr. R. Boyer Week Four: Regular Languages; Pumping Lemma 1. There are other methods of nding a regular expression equivalent to a nite automaton in addition to the ones

More information

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D ) Search algorithm Clever algorithm even for a single word Example: find abac in abaababac See Knuth-Morris-Pratt and String searching algorithm on wikipedia 2 Subset construction We have defined for a DFA

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed HKN CS/ECE 374 Midterm 1 Review Nathan Bleier and Mahir Morshed For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

CSE 135: Introduction to Theory of Computation Optimal DFA

CSE 135: Introduction to Theory of Computation Optimal DFA CSE 35: Introduction to Theory of Computation Optimal DFA Sungjin Im University of California, Merced 2-9-25 Optimal Algorithms for Regular Languages Myhill-Nerode Theorem There is a unique optimal algorithm

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 9 Ana Bove April 19th 2018 Recap: Regular Expressions Algebraic representation of (regular) languages; R, S ::= a R + S RS R......

More information

Extended transition function of a DFA

Extended transition function of a DFA Extended transition function of a DFA The next two pages describe the extended transition function of a DFA in a more detailed way than Handout 3.. p./43 Formal approach to accepted strings We define the

More information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

More information

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV27/DIT32 LP4 28 Lecture 5 Ana Bove March 26th 28 Recap: Inductive sets, (terminating) recursive functions, structural induction To define an inductive set

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications COMP-33 Theory of Computation Fall 217 -- Prof. Claude Crépeau Lec. 9 : Myhill-Nerode Theorem and applications COMP 33 Fall 212: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of

More information

Homomorphisms and Efficient State Minimization

Homomorphisms and Efficient State Minimization Homomorphisms and Efficient State Minimization Mridul Aanjaneya Stanford University July 10, 2012 Mridul Aanjaneya Automata Theory 1/ 23 Homomorphisms A homomorphism on an alphabet is a function that gives

More information

Finite State Automata

Finite State Automata Trento 2005 p. 1/4 Finite State Automata Automata: Theory and Practice Paritosh K. Pandya (TIFR, Mumbai, India) Unversity of Trento 10-24 May 2005 Trento 2005 p. 2/4 Finite Word Langauges Alphabet Σ is

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Inf2A: Converting from NFAs to DFAs and Closure Properties

Inf2A: Converting from NFAs to DFAs and Closure Properties 1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

E.g. The set RE of regular expressions is given by the following rules:

E.g. The set RE of regular expressions is given by the following rules: 1 Lecture Summary We gave a brief overview of inductively defined sets, inductively defined functions, and proofs by structural induction We showed how to prove that a machine is correct using induction

More information

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy: Incorrect reasoning about RL Since L 1 = {w w=a n, n N}, L 2 = {w w = b n, n N} are regular, therefore L 1 L 2 = {w w=a n b n, n N} is regular If L 1 is a regular language, then L 2 = {w R w L 1 } is regular,

More information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.4 Explain the limits of the class of regular languages Justify why the Pumping

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization COMP-33 Theory of Computation Fall 27 -- Prof. Claude Crépeau Lec. 5 : DFA minimization COMP 33 Fall 27: Lectures Schedule 4. Context-free languages 5. Pushdown automata 6. Parsing 7. The pumping lemma

More information

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata Automata and Formal Languages - CM81 Non-Deterministic Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 217-2 Non-Deterministic Finite Automata (NFA) Introduction q i a a q j a q k The

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

More on Regular Languages and Non-Regular Languages

More on Regular Languages and Non-Regular Languages More on Regular Languages and Non-Regular Languages CSCE A35 Decision Properties of Regular Languages Given a (representation, e.g., RE, FA, of a) regular language L, what can we tell about L? Since there

More information

Finite Automata and Languages

Finite Automata and Languages CS62, IIT BOMBAY Finite Automata and Languages Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS62: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2

More information

Name: Student ID: Instructions:

Name: Student ID: Instructions: Instructions: Name: CSE 322 Autumn 2001: Midterm Exam (closed book, closed notes except for 1-page summary) Total: 100 points, 5 questions, 20 points each. Time: 50 minutes 1. Write your name and student

More information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

Ogden s Lemma for CFLs

Ogden s Lemma for CFLs Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Iftach Haitner. Tel Aviv University. October 30, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages Context Free Languages Automata Theory and Formal Grammars: Lecture 6 Context Free Languages Last Time Decision procedures for FAs Minimum-state DFAs Today The Myhill-Nerode Theorem The Pumping Lemma Context-free

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

NOTES ON AUTOMATA. Date: April 29,

NOTES ON AUTOMATA. Date: April 29, NOTES ON AUTOMATA 1. Monoids acting on sets We say that a monoid S with identity element ɛ acts on a set Q if q(st) = (qs)t and qɛ = q. As with groups, if we set s = t whenever qs = qt for all q Q, then

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Introduction to Formal Languages, Automata and Computability p.1/51

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

More information

Lecture 7 Properties of regular languages

Lecture 7 Properties of regular languages Lecture 7 Properties of regular languages COT 4420 Theory of Computation Section 4.1 Closure properties of regular languages If L 1 and L 2 are regular languages, then we prove that: Union: L 1 L 2 Concatenation:

More information

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages CSci 311, Models of Computation Chapter 4 Properties of Regular Languages H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 4.1 Closure Properties of Regular

More information

Chapter 2: Finite Automata

Chapter 2: Finite Automata Chapter 2: Finite Automata 2.1 States, State Diagrams, and Transitions Finite automaton is the simplest acceptor or recognizer for language specification. It is also the simplest model of a computer. A

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

Chapter 2: Finite Automata

Chapter 2: Finite Automata Chapter 2: Finite Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter before

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

More information

Advanced Automata Theory 2 Finite Automata

Advanced Automata Theory 2 Finite Automata Advanced Automata Theory 2 Finite Automata Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Advanced Automata Theory 2 Finite

More information

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

More information

Equivalence of DFAs and NFAs

Equivalence of DFAs and NFAs CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Theory (CS21004) Announcements The slide is just a short summary Follow the discussion and the boardwork Solve problems (apart from those we dish out in class) Table of Contents 1 2 3 Languages that are

More information

CS 208: Automata Theory and Logic

CS 208: Automata Theory and Logic CS 28: Automata Theory and Logic b a a start A x(la(x) y(x < y) L b (y)) B b Department of Computer Science and Engineering, Indian Institute of Technology Bombay of 32 Nondeterminism Alternation 2 of

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework

More information

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA) Languages Non deterministic finite automata with ε transitions Recall What is a language? What is a class of languages? Finite Automata Consists of A set of states (Q) A start state (q o ) A set of accepting

More information

Non-deterministic Finite Automata (NFAs)

Non-deterministic Finite Automata (NFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel

More information

Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties

Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties Salil Vadhan September 13, 2012 Reading: Sipser, 1.2. How to simulate NFAs? NFA accepts w if there is at least one accepting computational

More information

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata. Nondeterminism Subset Construction Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an

More information

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering Finite Automata Theorems - Unit I SUSAN ELIAS Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering September 17, 2012 Unit I - Guidelines Formal Definitions Definition

More information

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

2. Elements of the Theory of Computation, Lewis and Papadimitrou, Introduction Finite Automata DFA, regular languages Nondeterminism, NFA, subset construction Regular Epressions Synta, Semantics Relationship to regular languages Properties of regular languages Pumping

More information

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism, CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages

More information

DD2371 Automata Theory

DD2371 Automata Theory KTH CSC VT 2008 DD2371 Automata Theory Dilian Gurov Lecture Outline 1. The lecturer 2. Introduction to automata theory 3. Course syllabus 4. Course objectives 5. Course organization 6. First definitions

More information

CSE 135: Introduction to Theory of Computation Equivalence of DFA and NFA

CSE 135: Introduction to Theory of Computation Equivalence of DFA and NFA CSE 135: Introduction to Theory of Computation Equivalence of DFA and NFA Sungjin Im University of California, Merced 02-03-2015 Expressive Power of NFAs and DFAs Is there a language that is recognized

More information

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

Finite Automata. BİL405 - Automata Theory and Formal Languages 1 Finite Automata BİL405 - Automata Theory and Formal Languages 1 Deterministic Finite Automata (DFA) A Deterministic Finite Automata (DFA) is a quintuple A = (Q,,, q 0, F) 1. Q is a finite set of states

More information

Minimization of DFAs

Minimization of DFAs CS 72: Computability and Complexity Minimization of DFAs Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum, A. Sinclair What is Minimization? Minimized DFA for language L

More information

Decidability (What, stuff is unsolvable?)

Decidability (What, stuff is unsolvable?) University of Georgia Fall 2014 Outline Decidability Decidable Problems for Regular Languages Decidable Problems for Context Free Languages The Halting Problem Countable and Uncountable Sets Diagonalization

More information

Proving languages to be nonregular

Proving languages to be nonregular Proving languages to be nonregular We already know that there exist languages A Σ that are nonregular, for any choice of an alphabet Σ. This is because there are uncountably many languages in total and

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Mahesh Viswanathan Introducing Nondeterminism Consider the machine shown in Figure. Like a DFA it has finitely many states and transitions labeled by symbols from an input

More information

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 1.4 Give an example of a non-regular language Outline two strategies for proving

More information