Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Size: px
Start display at page:

Download "Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata"

Transcription

1 Automata and Formal Languages - CM81 Non-Deterministic Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 217-2

2 Non-Deterministic Finite Automata (NFA) Introduction q i a a q j a q k The automaton can be in several states at once Facilitates the design of automata Question: Are the NFAs more powerful than the DFAs? Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 2/38

3 Non-Deterministic Finite Automata (NFA) Example (A NFA accepting all the binary strings that end in 1), 1 q start q 1 1 q 2 q : The automaton guess that the final 1 has not begun. q 1 : The automaton guess that the final 1 has begun. q 2 : The word ends in 1. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 3/38

4 NFA Definition Definition (NFA) A NFA is a quintuple (Q, Σ, δ, q, F ) where Q: A finite set of states Σ: An alphabet of input symbols δ Q Σ P(Q): A transition function q Q: A start state F Q: A set of accepting (or final) states Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 4/38

5 Extension of the Transition Function for NFAs Let N = (Q, Σ, δ, q, F ) be a NFA. The function δ Q Σ P(Q) δ(q, ε) = {q}, δ(q, xa) = p δ(q,x) δ(p, a). δ is recursively defined by Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 5/38

6 Language Accepted by a NFA Definition (Language accepted by a NFA) Let D = (Q, Σ, δ, q, F ) be a DFA. The language accepted by D is L(D) = {w Σ δ(q, w) F }. Hopcroft, J. E., Motwani, R. and Ullman, J. D. (27). Introduction to Automata theory, Languages, and Computation, 2.4. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 6/38

7 Language Accepted by a NFA Definition (Language accepted by a NFA) Let D = (Q, Σ, δ, q, F ) be a DFA. The language accepted by D is L(D) = {w Σ δ(q, w) F }. Let N = (Q, Σ, δ, q, F ) be a NFA. The language accepted by N is L(N) = {w Σ δ(q, w) F }. Hopcroft, J. E., Motwani, R. and Ullman, J. D. (27). Introduction to Automata theory, Languages, and Computation, 2.4. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 7/38

8 Language Accepted by a NFA Definition (Language accepted by a NFA) Let D = (Q, Σ, δ, q, F ) be a DFA. The language accepted by D is L(D) = {w Σ δ(q, w) F }. Let N = (Q, Σ, δ, q, F ) be a NFA. The language accepted by N is Reading L(N) = {w Σ An application: Text search. δ(q, w) F }. Hopcroft, J. E., Motwani, R. and Ullman, J. D. (27). Introduction to Automata theory, Languages, and Computation, 2.4. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 8/38

9 Language Accepted by a NFA Theorem (Hopcroft, Motwani and Ullman [27], Example 2.9) For the NFA of the figure, L(N) = {w {, 1} w ends in 1}., 1 q start q 1 1 q 2 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 9/38

10 Language Accepted by a NFA Theorem (Hopcroft, Motwani and Ullman [27], Example 2.9) For the NFA of the figure, L(N) = {w {, 1} w ends in 1}., 1 q start q 1 1 q 2 Sketch of proof Mutual induction on the following propositions: S (w): q δ(q, w) for all w Σ S 1 (w): q 1 δ(q, w) w ends in S 2 (w): q 2 δ(q, w) w ends in 1 From S 2 (w) and F = {q 2 } then the theorem follows. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 1/38

11 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise a) NFA accepting the set of strings over Σ = {1, 2, 3} such that the final digit has appeared before. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 11/38

12 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise a) NFA accepting the set of strings over Σ = {1, 2, 3} such that the final digit has appeared before. Σ {1} q 1 Σ i start Σ {2} 1 q 2 Σ {3} 3 2 f q i : The automaton guess that the repeated digit is i. q 3 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 12/38

13 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise b) NFA accepting the set of strings over Σ = {, 1, 2} such that the final digit has not appeared before. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 13/38

14 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise b) NFA accepting the set of strings over Σ = {, 1, 2} such that the final digit has not appeared before. Σ start Σ {} q i Σ {} q q f Σ {1} Σ {1} 1 Σ {2} q 1 Σ {2} 2 q 2 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 14/38

15 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise c) NFA accepting the set of strings over Σ = {, 1} such that there are two s separated by a number of positions that is multiple of 2. Note that is an allowable multiple of 2. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 15/38

16 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise c) NFA accepting the set of strings over Σ = {, 1} such that there are two s separated by a number of positions that is multiple of 2. Note that is an allowable multiple of 2. Σ q Σ q 1 q 2 start 1 Σ q Σ 3 q Σ 4 q 5 q 6 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 16/38

17 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise b) NFA accepting the set of strings that consist of either 1 repeated one or more times or 1 repeated one or more times. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 17/38

18 Language Accepted by a NFA Example (Hopcroft, Motwani and Ullman [27], Exercise b) NFA accepting the set of strings that consist of either 1 repeated one or more times or 1 repeated one or more times. q q 1 1 q 2 start q 1 3 q 4 q 5 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 18/38

19 The Subset Construction Input: A NFA N = (Q N, Σ, δ N, q, F N ) Output: A DFA D = (Q D, Σ, δ D, {q }, F D ) where Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 19/38

20 The Subset Construction Input: A NFA N = (Q N, Σ, δ N, q, F N ) Output: A DFA D = (Q D, Σ, δ D, {q }, F D ) where Q D = P(Q N ), F D = {S P(Q N ) S F N }, δ D (S, a) = δ N (p, a), for each S P(Q N ) and a Σ. p S Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 2/38

21 The Subset Construction Example Given the following NFA to build the DFA given by the subset construction., 1 q start q 1 1 q 2 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 21/38

22 The Subset Construction Example (cont.) {q, q 1, q 2 } {q 1, q 2 } {q 1 } {q 2 } {q } {q, q 1 } {q, q 2 } start

23 The Subset Construction Example (cont.), 1 {q, q 1, q 2 } {q 1, q 2 } 1 1, {q 1 } {q 2 } {q } 1 {q, q 1 } {q, q 2 } start 1 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 23/38

24 The Subset Construction Example (cont.) 1 1 start {q } {q, q 1 } {q, q 2 } 1 Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 24/38

25 Equivalence of DFAs and NFAs Example (Special case) A NFA recognising the word then : t h e n start q t th the then Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 25/38

26 Equivalence of DFAs and NFAs Example (Special case) A NFA recognising the word then : t h e n start q t th the then The DFA given by the subset construction: t h e n start {q } {t} {th} {the} {then} Σ {t} Σ {h} Σ {e} Σ {n} Σ Σ Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 26/38

27 Equivalence of DFAs and NFAs Let D = (Q D, Σ, δ D, {q }, F D ) be the DFA constructed from a NFA N = (Q N, Σ, δ N, q, F N ) by the subset construction. Theorem (Proof by structural induction on w) δ D ({q }, w) = δ N (q, w). Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 27/38

28 Equivalence of DFAs and NFAs Let D = (Q D, Σ, δ D, {q }, F D ) be the DFA constructed from a NFA N = (Q N, Σ, δ N, q, F N ) by the subset construction. Theorem (Proof by structural induction on w) δ D ({q }, w) = δ N (q, w). Theorem (Hopcroft, Motwani and Ullman [27], Theorem 2.11) L(D) = L(N). Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 28/38

29 Equivalence of DFAs and NFAs Theorem (Hopcroft, Motwani and Ullman [27], Exercise 2.3.5) Let D = (Q, Σ, δ D, q, F ) be a DFA and let N = (Q, Σ, δ N, q, F ) be a NFA, where δ N is defined by: Hence, if if δ D (q, a) = p, then δ N (q, a) = {p}. (1) δ D (q, w) = p, then δ N (q, w) = {p}. (Proof in the next slides) Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 29/38

30 Equivalence of DFAs and NFAs Proof (by structural induction on w) 1. P (w): If δ D (q, w) = p, then δ N (q, w) = {p}. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 3/38

31 Equivalence of DFAs and NFAs Proof (by structural induction on w) 1. P (w): If δ D (q, w) = p, then δ N (q, w) = {p}. 2. Basis step P (ε): Since δ D (q, ε) = q (by def. of of δ N ) then P (ε). δ D ) and δ N (q, ε) = {q } (by def. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 31/38

32 Equivalence of DFAs and NFAs Proof (cont.) 3. Inductive step: x Σ. a Σ. P (x) P (xa) Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 32/38

33 Equivalence of DFAs and NFAs Proof (cont.) 3. Inductive step: x Σ. a Σ. P (x) P (xa) Inductive hypothesis P (x): If δ D (q, x) = p, then δ N (q, x) = {p}. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 33/38

34 Equivalence of DFAs and NFAs Proof (cont.) 3. Inductive step: x Σ. a Σ. P (x) P (xa) Inductive hypothesis P (x): If Let δ D (q, x) = p, then δ N (q, x) = {p}. δ D (q, x) = p and δ D (p, a) = q, that is, δ D (q, xa) = q. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 34/38

35 Equivalence of DFAs and NFAs Proof (cont.) 3. Inductive step: x Σ. a Σ. P (x) P (xa) Inductive hypothesis P (x): If Let Hence δ D (q, x) = p, then δ N (q, x) = {p}. δ D (q, x) = p and δ D (p, a) = q, that is, δ D (q, xa) = q. Therefore, if δ N (q, xa) = p δ N (q,x) = p {p} δ N (p, a) δ N (p, a) (by def. of δ N ) (by IH) = {q} (by (1)) δ D (q, xa) = q, then δ N (q, xa) = {q}. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 35/38

36 Equivalence of DFAs and NFAs Theorem (Hopcroft, Motwani and Ullman [27], Theorem 2.12) A language L is accepted by some DFA if and only if L is accepted by some NFA. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 36/38

37 Equivalence of DFAs and NFAs Theorem (Hopcroft, Motwani and Ullman [27], Theorem 2.12) A language L is accepted by some DFA if and only if L is accepted by some NFA. Definition (Regular language) A language L is regular if exists a finite automaton A (DFA or NFA) such L = L(A). Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 37/38

38 References Hopcroft, J. E., Motwani, R. and Ullman, J. D. (27). Introduction to Automata theory, Languages, and Computation. 3rd ed. Pearson Education. Automata and Formal Languages - CM81. Non-Deterministic Finite Automata 38/38

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Introduction Equivalences DFA NFA -NFA RE Finite Automata and Regular

More information

Automata and Formal Languages - CM0081 Determinist Finite Automata

Automata and Formal Languages - CM0081 Determinist Finite Automata Automata and Formal Languages - CM0081 Determinist Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Formal Languages: Origins Source areas [Greibach 1981, p. 14] Logic and recursive-function

More information

Automata and Formal Languages - CM0081 Algebraic Laws for Regular Expressions

Automata and Formal Languages - CM0081 Algebraic Laws for Regular Expressions Automata and Formal Languages - CM0081 Algebraic Laws for Regular Expressions Andrés Sicard-Ramírez Universidad EAFIT Semester 2017-2 Algebraic Laws for Regular Expressions Definition (Equivalence of regular

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

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

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

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

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

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

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

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

Chapter 6: NFA Applications

Chapter 6: NFA Applications Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To

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

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

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular Expressions Orit Moskovich Gal Rotem Tel Aviv University October 28, 2015 Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular

More information

Theory of Computation

Theory of Computation Theory of Computation COMP363/COMP6363 Prerequisites: COMP4 and COMP 6 (Foundations of Computing) Textbook: Introduction to Automata Theory, Languages and Computation John E. Hopcroft, Rajeev Motwani,

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

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

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Lecture 6 Section 2.2 Robb T. Koether Hampden-Sydney College Mon, Sep 5, 2016 Robb T. Koether (Hampden-Sydney College) Nondeterministic Finite Automata Mon, Sep 5, 2016

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

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

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

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

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

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

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

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Chap. 1.2 NonDeterministic Finite Automata (NFA) Chap. 1.2 NonDeterministic Finite Automata (NFA) DFAs: exactly 1 new state for any state & next char NFA: machine may not work same each time More than 1 transition rule for same state & input Any one

More information

Deterministic Finite Automata

Deterministic Finite Automata Deterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 2016 Slides by Ranald Clouston and Katya Lebedeva. COMP 2600 Deterministic

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

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013 Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction

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

CS 154 Formal Languages and Computability Assignment #2 Solutions

CS 154 Formal Languages and Computability Assignment #2 Solutions CS 154 Formal Languages and Computability Assignment #2 Solutions Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak www.cs.sjsu.edu/~mak Assignment #2: Question 1

More information

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other three. The wolf eats

More information

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Nondeterministic Finite Automata with empty moves (-NFA) Definition A nondeterministic finite automaton

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

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

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

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

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

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

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

AC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014

AC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014 Q.2 a. Show by using Mathematical Induction that n i= 1 i 2 n = ( n + 1) ( 2 n + 1) 6 b. Define language. Let = {0; 1} denote an alphabet. Enumerate five elements of the following languages: (i) Even binary

More information

Course 4 Finite Automata/Finite State Machines

Course 4 Finite Automata/Finite State Machines Course 4 Finite Automata/Finite State Machines The structure and the content of the lecture is based on (1) http://www.eecs.wsu.edu/~ananth/cpts317/lectures/index.htm, (2) W. Schreiner Computability and

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

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 206 Slides by Katya Lebedeva. COMP 2600 Nondeterministic Finite

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

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov CMP 309: Automata Theory, Computability and Formal Languages Adapted from the work of Andrej Bogdanov Course outline Introduction to Automata Theory Finite Automata Deterministic Finite state automata

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

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

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

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

Finite Automata and Regular Languages (part III)

Finite Automata and Regular Languages (part III) Finite Automata and Regular Languages (part III) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Nondeterministic finite automata can be further generalized by allowing transitions between states without

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

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

CSC236 Week 10. Larry Zhang

CSC236 Week 10. Larry Zhang CSC236 Week 10 Larry Zhang 1 Today s Topic Deterministic Finite Automata (DFA) 2 Recap of last week We learned a lot of terminologies alphabet string length of string union concatenation Kleene star language

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

Chapter 5. Finite Automata

Chapter 5. Finite Automata Chapter 5 Finite Automata 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern-recognition type applications, such as the lexical

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automata and Formal Language Theory Course Notes Part II: The Recognition Problem (II) Chapter II.4.: Properties of Regular Languages (13) Anton Setzer (Based on a book draft by J. V. Tucker and

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

September 7, Formal Definition of a Nondeterministic Finite Automaton

September 7, Formal Definition of a Nondeterministic Finite Automaton Formal Definition of a Nondeterministic Finite Automaton September 7, 2014 A comment first The formal definition of an NFA is similar to that of a DFA. Both have states, an alphabet, transition function,

More information

Lecture 4 Nondeterministic Finite Accepters

Lecture 4 Nondeterministic Finite Accepters Lecture 4 Nondeterministic Finite Accepters COT 4420 Theory of Computation Section 2.2, 2.3 Nondeterminism A nondeterministic finite automaton can go to several states at once. Transitions from one state

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

Computational Models #1 Computational Models #1 Handout Mode Nachum Dershowitz & Yishay Mansour March 13-15, 2017 Nachum Dershowitz & Yishay Mansour Computational Models #1 March 13-15, 2017 1 / 41 Lecture Outline I Motivation

More information

Topics COSC Administrivia. Topics Today. Administrivia (II) Acknowledgements. Slides presented May 9th and 16th,

Topics COSC Administrivia. Topics Today. Administrivia (II) Acknowledgements. Slides presented May 9th and 16th, Topics COSC 2001 Introduction to the Theory of Computation Dr. David Forster Basic concepts of theoretical CS, with practical applications: Regular Languages Context Free Languages Recursively Enumerable

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

C2.1 Regular Grammars

C2.1 Regular Grammars Theory of Computer Science March 22, 27 C2. Regular Languages: Finite Automata Theory of Computer Science C2. Regular Languages: Finite Automata Malte Helmert University of Basel March 22, 27 C2. Regular

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

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata Sungjin Im University of California, Merced 1-27-215 Nondeterminism Michael Rabin and Dana Scott (1959) Michael Rabin Dana

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

arxiv:cs/ v1 [cs.cc] 9 Feb 2007

arxiv:cs/ v1 [cs.cc] 9 Feb 2007 The DFAs of Finitely Different Languages Andrew Badr Ian Shipman February 1, 2008 arxiv:cs/0702053v1 [cs.cc] 9 Feb 2007 Abstract Two languages are finitely different if their symmetric difference is finite.

More information

C2.1 Regular Grammars

C2.1 Regular Grammars Theory of Computer Science March 6, 26 C2. Regular Languages: Finite Automata Theory of Computer Science C2. Regular Languages: Finite Automata Malte Helmert University of Basel March 6, 26 C2. Regular

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

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation 1/19/2016 LECTURE 3 Last time: DFAs and NFAs Operations on languages Today: Nondeterminism Equivalence of NFAs and DFAs Closure properties of regular languages Sofya Raskhodnikova

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

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

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

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Slides modified Yishay Mansour on modification by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 8 Non-Deterministic Finite Automata 0,1 0,1 0 0,ε q q 1 q 2 3 1 q 4 an NFA

More information

Lecture 5: Minimizing DFAs

Lecture 5: Minimizing DFAs 6.45 Lecture 5: Minimizing DFAs 6.45 Announcements: - Pset 2 is up (as of last night) - Dylan says: It s fire. - How was Pset? 2 DFAs NFAs DEFINITION Regular Languages Regular Expressions 3 4 Some Languages

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

Decision, Computation and Language

Decision, Computation and Language Decision, Computation and Language Non-Deterministic Finite Automata (NFA) Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Finite State Automata

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

CSC236 Week 11. Larry Zhang

CSC236 Week 11. Larry Zhang CSC236 Week 11 Larry Zhang 1 Announcements Next week s lecture: Final exam review This week s tutorial: Exercises with DFAs PS9 will be out later this week s. 2 Recap Last week we learned about Deterministic

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

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

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

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

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

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

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 23rd September, 2014 1 / 29 1 Closure properties of regular languages

More information

Finite Automata. Seungjin Choi

Finite Automata. Seungjin Choi Finite Automata Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr 1 / 28 Outline

More information

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata (See 2nd Edition) A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other

More information

Lecture 2: Regular Expression

Lecture 2: Regular Expression Lecture 2: Regular Expression Instructor: Ketan Mulmuley Scriber: Yuan Li January 8, 2015 In the last lecture, we proved that DFA, NFA, and NFA with ϵ-moves are equivalent. Recall that a language L Σ is

More information

Finite Automata and Regular Languages (part II)

Finite Automata and Regular Languages (part II) Finite Automata and Regular Languages (part II) Prof. Dan A. Simovici UMB 1 / 25 Outline 1 Nondeterministic Automata 2 / 25 Definition A nondeterministic finite automaton (ndfa) is a quintuple M = (A,

More information

Discrete Structures - CM0246 Mathematical Induction

Discrete Structures - CM0246 Mathematical Induction Discrete Structures - CM0246 Mathematical Induction Andrés Sicard-Ramírez EAFIT University Semester 2014-2 Motivation Example Conjecture a formula for the sum of the first n positive odd integers. Discrete

More information

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 Theory of Computation  Professor Jeanne Ferrante CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s agenda NFA Review and Design NFA s Equivalence to DFA s Another Closure Property proof for Regular Languages

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