Finite Automata and Regular Languages

Size: px
Start display at page:

Download "Finite Automata and Regular Languages"

Transcription

1 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 sets, closure properties, Myhill-Nerode Theorem,... H. Yen (NTUEE) Theory of Computation Fall / 67

2 Definitions and Notation An alphabet is finite set of set of symbols or letters. Eg. A = {a, b, c}, Σ = {0, 1}. A string or word over an alphabet A is a finite sequence of letters from A. Eg. aaba is string over {a, b, c}. Empty string denoted by ɛ. Set of all strings over A denoted by A. What is the size or cardinality of A? Infinite but Countable: Can enumerate in lexicographic order: ɛ, a, b, c, aa, ab,... Operation of concatenation on words: String u followed by string v: written u v or simply uv. Eg. aabb aaa = aabbaaa. H. Yen (NTUEE) Theory of Computation Fall / 67

3 Definitions and Notation A language over an alphabet Σ is a set L of strings over Σ, i.e., L Σ. Eg. for Σ = {a, b, c}: L = {abc, aaba}. L 1 = {ɛ, b, aa, bb, aab, aba, baa, bbb,...}. L 2 = {}. L 3 = {ɛ}. How many languages are there over a given alphabet A? Uncountably infinite Example (Some languages) Chinese, Swedish, English, Spanish, French,... Any programming language, {ɛ} and Σ are languages over any Σ The set of prime natural numbers {1, 3, 5, 7, 11,...} H. Yen (NTUEE) Theory of Computation Fall / 67

4 Some Operations on Languages Union, Intersection,... : As for any set Concatenation: L 1 L 2 = {u v u L 1, v L 2 }. Closure: Eg. {abc, aaba} {ɛ, a, bb} = {abc, aaba, abca, aabaa, abcbb, aababb}. L = n N where L 0 = {ɛ}, L n+1 = L n L. Note: We have = {ɛ} and L = L 0 L 1 L 2... = {ɛ} {x 1...x n n > 0, x i L} L n H. Yen (NTUEE) Theory of Computation Fall / 67

5 Definitions and notation: DFA A Deterministic Finite Automaton (DFA) A is a 5-tuple (Q, Σ, q 0, δ, F ) where Q is a finite set of states, Σ is the input alphabet, q 0 Q is the start state (or initial state), δ : Q Σ Q is the transition function, and F Q is the set of final states (or accepting states). H. Yen (NTUEE) Theory of Computation Fall / 67

6 Example Let the DFA (Q, Σ, δ, q 0, F ) be given by: Q = {q 0, q 1, q 2 } Σ = {0, 1} F = {q 2 } δ : Q Σ Q δ(q 0, 0) = q 1 ; δ(q 1, 0) = q 1 ; δ(q 2, 0) = q 2 ; δ(q 0, 1) = q 0 ; δ(q 1, 1) = q 2 ; δ(q 2, 1) = q 2 What does the DFA do? H. Yen (NTUEE) Theory of Computation Fall / 67

7 How to Represent a DFA? Transition diagram: Transition table: The start state is indicated with. The final states are indicated with H. Yen (NTUEE) Theory of Computation Fall / 67

8 When Does a DFA Accept a Word? When reading the word the automaton moves according to δ. Definition: If after reading the input it stops in a final state, it accepts the word. Example Only the word then is accepted. We have a (non-accepting) stop or dead state q 5. H. Yen (NTUEE) Theory of Computation Fall / 67

9 Example: DFA Let Σ = {0, 1}. We want to accept words in L = {x010y x, y Σ }, i.e., words that contain 010 as a subword. H. Yen (NTUEE) Theory of Computation Fall / 67

10 Extended Transition Function Definition of ˆδ We extend δ : Q Σ Q to ˆδ : Q Σ Q inductively by ˆδ(q, w) = ˆδ(q, ɛ) = q w = ɛ ˆδ(q, ax) = ˆδ(δ(q, a), x) w = ax, a Σ, x Σ Note: ˆδ(q, a) = δ(q, a) since the string a = aɛ. ˆδ(q, a) = ˆδ(q, aɛ) = ˆδ(δ(q, a), ɛ) = δ(q, a) Another definition ˆδ ˆδ (q, w) = ˆδ (q, ɛ) = q ˆδ (q, xa) = δ(ˆδ (q, x), a) w = ɛ w = xa, a Σ, x Σ H. Yen (NTUEE) Theory of Computation Fall / 67

11 Some Properties Proposition For any words x and y, and for any state q we have that ˆδ(q, xy) = ˆδ(ˆδ(q, x), y). Proof. We prove the result by induction on x. Basis case: ˆδ(q, ɛy) = ˆδ(q, y) = ˆδ(ˆδ(q, ɛ), y). Inductive step: Our IH is that ˆδ(q, xy) = ˆδ(ˆδ(q, x), y) for any word y and any state q. We should prove that ˆδ(q, (ax)y) = ˆδ(ˆδ(q, ax), y). ˆδ(q, (ax)y) = ˆδ(q, a(xy)) by def of concat = ˆδ(δ(q, a), xy) by def of ˆδ = ˆδ(ˆδ(δ(q, a), x), y) by IH = ˆδ(ˆδ(q, ax), y) by def of ˆδ H. Yen (NTUEE) Theory of Computation Fall / 67

12 Language Accepted by a DFA Definition The language accepted by the DFA M = (Q, Σ, δ, q 0, F ), denoted by L(M), is the set {x x Σ, ˆδ(q 0, x) F }. Example is accepted but is not. Definition A language L Σ is called regular if there is a DFA M over Σ such that L(M) = L. H. Yen (NTUEE) Theory of Computation Fall / 67

13 Configuration A configuration of a finite automaton A = (Q, Σ, δ, q 0, F ) is given by a state of its control unit and the content of its tape that was not read yet. The set of all configurations (Conf) is Q Σ For an input word w Σ, (q 0, w) is the initial configuration, and (q f, ɛ) is an final configuration where q f F. Definition (q, w) (q, w ) iff w = aw and q = δ(q, a) for some a Σ. Definition A computation of an automaton is a sequence of configurations C 0, C 1, C 2,..., C k where C i are configurations, C 0 is an initial configuration, C k is a final configuration, and for all i, we have C i C i+1. H. Yen (NTUEE) Theory of Computation Fall / 67

14 Relation Definition The relation is the reflexive and transitive closure of the relation, i.e., it is the smallest reflexive and transitive relation containing the relation. We also write q w q to denote that ˆδ(q, w) = q, i.e., starting in state q goes to state q by reading word w. NOTE: (q, w) (q, ɛ) iff ˆδ(q, w) = q iff q w q, for DFA. Definition The language accepted by the DFA M = (Q, Σ, δ, q 0, F ) is the set L(M) = {x Σ ˆδ(q 0, x) F } = {x Σ (q 0, x) (q f, ɛ), q f F } = {x Σ q 0 x qf, q f F } H. Yen (NTUEE) Theory of Computation Fall / 67

15 Accepting a Word H. Yen (NTUEE) Theory of Computation Fall / 67

16 Product of Automata Definition Given two DFA D 1 = (Q 1, Σ, δ 1, q 1, F 1 ) and D 2 = (Q 2, Σ, δ 2, q 2, F 2 ) with the same alphabet Σ, we can define the product D = (Q, Σ, δ, q 0, F ), also denoted by D 1 D 2, as follows: Q = Q 1 Q 2 δ((r 1, r 2 ), a) = (δ 1 (r 1, a), δ 2 (r 2, a)) q 0 = (q 1, q 2 ) F = F 1 F 2 Proposition ˆδ(r 1, r 2 ), x) = (ˆδ 1 (r 1, x), ˆδ 2 (r 2, x)). Proof by Induction. H. Yen (NTUEE) Theory of Computation Fall / 67

17 An Example Example H. Yen (NTUEE) Theory of Computation Fall / 67

18 Language Accepted by a Product Automaton Theorem Given two DFA D 1 and D 2, then L(D 1 D 2 ) = L(D 1 ) L(D 2 ). Proof. ˆδ(q 0, x) = (ˆδ 1 (q 1, x), ˆδ 2 (q 2, x)) F iff ˆδ 1 (q 1, x) F 1 and ˆδ 2 (q 2, x) F 2, that is, x L(D 1 ) and x L(D 2 ), so x L(D 1 ) L(D 2 ). H. Yen (NTUEE) Theory of Computation Fall / 67

19 Variation of the Product Definition We define D 1 D 2 similarly to D 1 D 2 but with a different notion of accepting state: a state (r 1, r 2 ) is accepting iff r 1 F 1 or r 2 F 2 Theorem Given two DFA D 1 and D 2, then L(D 1 D 2 ) = L(D 1 ) L(D 2 ). H. Yen (NTUEE) Theory of Computation Fall / 67

20 Complement Definition Given the automaton D = (Q, Σ, δ, q 0, F ) we define the complement D of D as the automaton D = (Q, Σ, δ, q 0, Q F ). Theorem Given a DFA D we have that L( D) = Σ L(D). Proof. L( D) Σ L(D) w L( D) ˆδ(q 0, w) (Q F ) ˆδ(q 0, w) F w L(D) w Σ L(D) L( D) Σ L(D) H. Yen (NTUEE) Theory of Computation Fall / 67

21 Closure properties Theorem The class of regular languages is closed under 1 complement, 2 intersection, 3 union, 4 concatenation, 5 Kleene iteration. (4) and (5) will be shown later. H. Yen (NTUEE) Theory of Computation Fall / 67

22 Nondeterministic Finite Automata A nondeterministic finite automaton (NFA) M is a 5-tuple (Q, Σ, q 0, δ, F ), where Example Q is a finite set of states, Σ is the input alphabet, q 0 Q is the start state (or initial state), δ : Q Σ 2 Q is the transition relation, and F Q is the set of final states (or accepting states). Given a state and the next symbol, the automata can move to many states. H. Yen (NTUEE) Theory of Computation Fall / 67

23 Extending the Transition Function to Strings Definition ˆδ : Q Σ 2 Q ˆδ(q, ɛ) = {q} ˆδ(q, ax) = p δ(q,a) ˆδ(p, x) That is, if δ(q, a) = {p 1,..., p n } then ˆδ(q, ax) = ˆδ(p 1, x)... ˆδ(p n, x) Definition The language accepted by the NFA N = (Q, Σ, δ, q 0, F ) is the set L(N) = {x Σ ˆδ(q 0, x) F }. That is, a word x is accepted if ˆδ(q 0, x) contains at least one accepting state. H. Yen (NTUEE) Theory of Computation Fall / 67

24 DFA and NFA A DFA can be turned into an NFA that accepts the same language. If δ(q, a) = p, let the NFA have δ(q, a) = {p}. Then the NFA is always in a set containing exactly one state - the state the DFA is in after reading the same input. Surprisingly, for any NFA there is a DFA that accepts the same language. Proof is the subset construction. The number of states of the DFA can be exponential in the number of states of the NFA. Thus, NFA! s accept exactly the regular languages. H. Yen (NTUEE) Theory of Computation Fall / 67

25 Subset Construction Subset construction Given an NFA N = (Q N, Σ, δ N, q 0, F N ), we will construct a DFA D = (Q D, Σ, δ D, {q 0 }, F D ) such that L(D) = L(N) Q D = {S : S Q N } F D = {S : S Q N, and S F N } S Q N, a Σ, δ D (S, a) = p S δ N (p, a) The DFA states have names that are sets of NFA states. But as a DFA state, an expression like {p, q} must be read as a single symbol, not as a set. Analogy: a class of objects whose values are sets of objects of another class. H. Yen (NTUEE) Theory of Computation Fall / 67

26 Subset Construction (cont d) Example: H. Yen (NTUEE) Theory of Computation Fall / 67

27 Subset Construction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

28 Subset Construction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

29 Subset Construction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

30 Subset Construction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

31 Subset Construction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

32 Subset Cconstruction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

33 Subset Construction (cont d) Example (cont d): H. Yen (NTUEE) Theory of Computation Fall / 67

34 Proof of Equivalence By Induction on w that δ N (q 0, w) = δ D ({q 0 }, w) Basis: w = ɛ: δ N (q 0, ɛ) = δ D ({q 0 }, ɛ) = {q 0 }. Ind. Hypothesis: Assume IH for strings shorter than w. Ind. Step: Let w = xa; IH holds for x. H. Yen (NTUEE) Theory of Computation Fall / 67

35 Exponential Blow-Up 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 H. Yen (NTUEE) Theory of Computation Fall / 67

36 Exponential Blow-Up (Cont d) a 1 a i1 1a i+1 a n b 1 b i1 0b i+1 b n Now And ˆδ 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 ) ˆδ 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 H. Yen (NTUEE) Theory of Computation Fall / 67

37 NFA with ɛ-transitions We can allow state-to-state transitions on ɛ input. These transitions are done spontaneously, without looking at the input string. Example A convenience at times, but still only regular languages are accepted. H. Yen (NTUEE) Theory of Computation Fall / 67

38 Closure of States CL(q) = set of states you can reach from state q following only arcs labeled ɛ. CL(A) = {A}; CL(E) = {B, C, D, E}. Closure of a set of states = union of the closure of each state. H. Yen (NTUEE) Theory of Computation Fall / 67

39 Extended Delta ˆδ Basis: ˆδ(q, ɛ) = CL(q) Induction: ˆδ(q, xa) = CL(p) Example p δ(ˆδ(q,x),a) ˆδ(A, ɛ) = CL(A) = {A}. ˆδ(A, 0) = CL({E}) = {B, C, D, E}. ˆδ(A, 01) = CL({C, D}) = {C, D}. H. Yen (NTUEE) Theory of Computation Fall / 67

40 Equivalence of ɛ-nfa and DFA Given an ɛ-nfa E = (Q E, Σ, δ E, q 0, F E ), we will construct a DFA D = (Q D, Σ, δ D, q D, F D ) such that L(D) = L(E) Details of the construction: Q D = {S : S Q E, and S = CL(S)} q D = CL(q 0 ) F D = {S : S Q D, and S F E } δ D (S, a) = {CL(p) : p δ(t, a), for some t S} H. Yen (NTUEE) Theory of Computation Fall / 67

41 Regular Expression Regular expressions are an algebraic way to denote languages. Syntax of regular expressions Syntax of regular expresions over an alphabet Σ: r ::= a r + r r r r, where a Σ. Semantics of regular expressions Semantics: associate a language L(r) Σ with regexp r. L( ) = {} L(a) = {a} L(r + r ) = L(r) L(r ) L(r r ) = L(r) L(r ) L(r ) = L(r). H. Yen (NTUEE) Theory of Computation Fall / 67

42 Algebraic Laws for Regular Expressions The following equalities hold for any RE R, S and T: H. Yen (NTUEE) Theory of Computation Fall / 67

43 Kleene s Theorem: RE = DFA Class of languages defined by regular expressions coincides with regular languages. Proof. RE DFA: Use closure properties of regular languages. DFA RE: H. Yen (NTUEE) Theory of Computation Fall / 67

44 DFA RE: Kleene s Construction H. Yen (NTUEE) Theory of Computation Fall / 67

45 DFA RE: Kleene s Construction (cont d) H. Yen (NTUEE) Theory of Computation Fall / 67

46 DFA RE: Kleene s Construction (cont d) H. Yen (NTUEE) Theory of Computation Fall / 67

47 DFA RE: Using State Elimination H. Yen (NTUEE) Theory of Computation Fall / 67

48 DFA RE: Using State Elimination (cont d) For each q F we ll be left with an A q that looks like E q = (R + SU T ) SU E q = R The final expression is q F E q. H. Yen (NTUEE) Theory of Computation Fall / 67

49 DFA RE: Using System of Equations H. Yen (NTUEE) Theory of Computation Fall / 67

50 DFA RE: Using System of Equations (cont d) H. Yen (NTUEE) Theory of Computation Fall / 67

51 DFA RE: Using System of Equations (cont d) L q s are a solution to the system of equations In general there could be many solutions to equations. Consider x = A x. In this case, L q s can be seen to the least solution to the equations. H. Yen (NTUEE) Theory of Computation Fall / 67

52 DFA RE: Using System of Equations (cont d) H. Yen (NTUEE) Theory of Computation Fall / 67

53 RE ɛ-nfa Theorem For every regex R we can construct and ɛ-nfa A, s.t. L(A) = L(R). H. Yen (NTUEE) Theory of Computation Fall / 67

54 Induction Proof H. Yen (NTUEE) Theory of Computation Fall / 67

55 An Example We convert (0 + 1) 1(0 + 1) H. Yen (NTUEE) Theory of Computation Fall / 67

56 Equivalence Relation Definition 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. H. Yen (NTUEE) Theory of Computation Fall / 67

57 Right Invariant Definition An equivalence relation on Σ is said to be right invariant with respect to concatenation if x, y Σ and a Σ, xry implies that xarya. H. Yen (NTUEE) Theory of Computation Fall / 67

58 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? H. Yen (NTUEE) Theory of Computation Fall / 67

59 An Example Example H. Yen (NTUEE) Theory of Computation Fall / 67

60 Refinement Definition 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 H. Yen (NTUEE) Theory of Computation Fall / 67

61 The Myhill-Nerode Theorem Theorem 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 H. Yen (NTUEE) Theory of Computation Fall / 67

62 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 H. Yen (NTUEE) Theory of Computation Fall / 67

63 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. H. Yen (NTUEE) Theory of Computation Fall / 67

64 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. H. Yen (NTUEE) Theory of Computation Fall / 67

65 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. H. Yen (NTUEE) Theory of Computation Fall / 67

66 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}? H. Yen (NTUEE) Theory of Computation Fall / 67

67 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... H. Yen (NTUEE) Theory of Computation Fall / 67

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

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall 2016 1 / 41 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider

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

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

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

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

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

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

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

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

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

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

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

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

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

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

CS 121, Section 2. Week of September 16, 2013

CS 121, Section 2. Week of September 16, 2013 CS 121, Section 2 Week of September 16, 2013 1 Concept Review 1.1 Overview In the past weeks, we have examined the finite automaton, a simple computational model with limited memory. We proved that DFAs,

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017 Lecture 4 Ana Bove March 24th 2017 Structural induction; Concepts of automata theory. Overview of today s lecture: Recap: Formal Proofs

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

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

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

Nondeterminism and Epsilon Transitions

Nondeterminism and Epsilon Transitions Nondeterminism and Epsilon Transitions Mridul Aanjaneya Stanford University June 28, 22 Mridul Aanjaneya Automata Theory / 3 Challenge Problem Question Prove that any square with side length a power of

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

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite

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

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

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

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 4 Ana Bove March 23rd 2018 Recap: Formal Proofs How formal should a proof be? Depends on its purpose...... but should be convincing......

More information

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

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

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

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

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

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Mathematical Background Mathematical Background Sets Relations Functions Graphs Proof techniques Sets

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

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

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

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three

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

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

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

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

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

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

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

CS 133 : Automata Theory and Computability

CS 133 : Automata Theory and Computability CS 133 : Automata Theory and Computability Lecture Slides 1 Regular Languages and Finite Automata Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University

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

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata. CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications

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

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite

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

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

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

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

Formal Models in NLP

Formal Models in NLP Formal Models in NLP Finite-State Automata Nina Seemann Universität Stuttgart Institut für Maschinelle Sprachverarbeitung Pfaffenwaldring 5b 70569 Stuttgart May 15, 2012 Nina Seemann (IMS) Formal Models

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

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

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

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission. CSE 5 Homework Due: Monday October 9, 7 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in this

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

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

Regular Expressions [1] Regular Expressions. Regular expressions can be seen as a system of notations for denoting ɛ-nfa

Regular Expressions [1] Regular Expressions. Regular expressions can be seen as a system of notations for denoting ɛ-nfa Regular Expressions [1] Regular Expressions Regular expressions can be seen as a system of notations for denoting ɛ-nfa They form an algebraic representation of ɛ-nfa algebraic : expressions with equations

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

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

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

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

Closure under the Regular Operations

Closure under the Regular Operations Closure under the Regular Operations 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

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

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

September 11, Second Part of Regular Expressions Equivalence with Finite Aut Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language

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

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

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation (I) Yijia Chen Fudan University Theory of Computation (I) Yijia Chen Fudan University Instructor Yijia Chen Homepage: http://basics.sjtu.edu.cn/~chen Email: yijiachen@fudan.edu.cn Textbook Introduction to the Theory of Computation Michael

More information

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA) Deterministic Finite Automata Non deterministic finite automata Automata we ve been dealing with have been deterministic For every state and every alphabet symbol there is exactly one move that the machine

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

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

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class CSE 105 THEORY OF COMPUTATION Spring 2018 review class Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with confidence. Identify areas to focus

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

TDDD65 Introduction to the Theory of Computation

TDDD65 Introduction to the Theory of Computation TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se 2012-08-31 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of

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

Classes and conversions

Classes and conversions Classes and conversions Regular expressions Syntax: r = ε a r r r + r r Semantics: The language L r of a regular expression r is inductively defined as follows: L =, L ε = {ε}, L a = a L r r = L r L r

More information

Recap from Last Time

Recap from Last Time Regular Expressions Recap from Last Time Regular Languages A language L is a regular language if there is a DFA D such that L( D) = L. Theorem: The following are equivalent: L is a regular language. There

More information

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.

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

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

Introduction to Finite-State Automata

Introduction to Finite-State Automata Introduction to Finite-State Automata John McDonough Language Technologies Institute, Machine Learning for Signal Processing Group, Carnegie Mellon University March 26, 2012 Introduction In this lecture,

More information

Lecture 4: More on Regexps, Non-Regular Languages

Lecture 4: More on Regexps, Non-Regular Languages 6.045 Lecture 4: More on Regexps, Non-Regular Languages 6.045 Announcements: - Pset 1 is on piazza (as of last night) - If you don t have piazza access but are registered for 6.045, send email to TAs with

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Non-determinism, Regular Expressions CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard

More information

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions TAFL 1 (ECS-403) Unit- II 2.1 Regular Expression: 2.1.1 The Operators of Regular Expressions: 2.1.2 Building Regular Expressions 2.1.3 Precedence of Regular-Expression Operators 2.1.4 Algebraic laws for

More information

Finite Automata and Formal Languages TMV026/DIT321 LP4 2012

Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Finite Automata and Formal Languages TMV26/DIT32 LP4 22 Lecture 7 Ana Bove March 27th 22 Overview of today s lecture: Regular Expressions From FA to RE Regular Expressions Regular expressions (RE) are

More information

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing

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

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10 Regular Languages Andreas Karwath & Malte Helmert 1 Overview Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions Nonregular languages

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

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30

More information

Computational Models - Lecture 1 1

Computational Models - Lecture 1 1 Computational Models - Lecture 1 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. February 29/ March 02, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames

More information

Theory of Computation 4 Non-Deterministic Finite Automata

Theory of Computation 4 Non-Deterministic Finite Automata Theory of Computation 4 Non-Deterministic Finite Automata Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information