CS154. Non-Regular Languages, Minimizing DFAs

Size: px
Start display at page:

Download "CS154. Non-Regular Languages, Minimizing DFAs"

Transcription

1 CS54 Non-Regular Languages, Minimizing FAs

2 CS54 Homework is due! Homework 2 will appear this afternoon 2

3 The Pumping Lemma: Structure in Regular Languages Let L be a regular language Then there is a positive integer P s.t. for all strings w L with w P there is a way to write w = xyz, where:. y > (that is, y ε) 2. xy P 3. For all i, xy i z L Why is it called the pumping lemma? The word w gets pumped into longer and longer strings 3

4 Proof: Let M be a FA that recognizes L Let P be the number of states in M Let w be a string where w L and w P We show: w = xyz y. y > 2. xy P 3. xy i z L for all i x z q q j q k q w Claim: There must exist j and k such that j < k P, and q j = q k 4

5 Applying the Pumping Lemma Let s prove that EQ = { w w has equal number of s and s} is not regular. By contradiction. Assume EQ is regular. Let P be as in pumping lemma. Let w = P P ; note w EQ. If EQ is regular, then there is a way to write w as w = xyz, y >, xy P, and for all i, xy i z is also in EQ Claim: The string y must be all zeroes. Why? Because xy P and w = xyz = P P But then xyyz has more s than s Contradiction!

6 Applying the Pumping Lemma Let s prove that SQ = { n2 n } is not regular Assume SQ is regular. Let w = P2 If SQ is regular, then we can write w = xyz, y >, xy P, and for any i, xy i z is also in SQ So xyyz SQ. Note that xyyz = P2 + y Note that < y P So xyyz = P 2 + y P 2 + P < P 2 + 2P + = (P+) 2 and P 2 < xyyz < (P+) 2 Therefore xyyz is not a perfect square! Hence P2 + y = xyyz SQ, so our assumption must be false. That is, SQ is not regular!

7 oes this FA have a minimal number of states? NO 8

8 9

9 Is this minimal? How can we tell in general?

10 Theorem: For every regular language L, there is a unique (up to re-labeling of the states) minimal-state FA M* such that L = L(M*). Furthermore, there is an efficient algorithm which, given any FA M, will output this unique M*. If this were true for more general models of computation, that would be an engineering breakthrough!!

11 Note: There isn t a uniquely minimal NFA 2

12 Extending transition function δ to strings Given FA M = (Q, Σ, δ, q, F), we extend δ to a function : Q Σ* Q as follows: (q, ε) = (q, σ) = q δ(q, σ) (q, σ σ k+ ) = δ( (q, σ σ k ), σ k+ ) (q, w) = the state of M reached after reading in w, starting from state q Note: (q, w) F M accepts w ef. w Σ* distinguishes states q and q 2 iff (q, w) F (q 2, w) F 3

13 Extending transition function δ to strings Given FA M = (Q, Σ, δ, q, F), we extend δ to a function : Q Σ* Q as follows: (q, ε) = (q, σ) = q δ(q, σ) (q, σ σ k+ ) = δ( (q, σ σ k ), σ k+ ) (q, w) = the state of M reached after reading in w, starting from state q Note: (q, w) F M accepts w ef. w Σ* Σ* distinguishes states q and q 22 iff iff exactly oneof of (q,, w), (q 22,, w) is is a final state 4

14 istinguishing two states ef. w Σ* distinguishes states q and q 2 iff exactly one of (q, w), (q 2, w) is a final state I m in q or q 2, but which? How can I tell? 5

15 istinguishing two states ef. w Σ* distinguishes states q and q 2 iff exactly one of (q, w), (q 2, w) is a final state Here read this I m in q or q 2, but which? How can Ok, I I m tell? accepting! Must have been q W 6

16 Fix M = (Q, Σ, δ, q, F) and let p, q Q efinition: State p is distinguishable from state q iff there is w Σ* that distinguishes p and q iff there is w Σ* so that exactly one of (p, w), (q, w) is a final state State p is indistinguishable from state q iff p is not distinguishable from q iff for all w Σ*, (p, w) F (q, w) F Pairs of indistinguishable states are redundant 7

17 q, q Which pairs of states are distinguishable here? q 3 q 2 ε distinguishes all final states from non-final states 8

18 q, q q 2 Which pairs of states are distinguishable here? q 3 The string distinguishes q and q 3 9

19 q, q q 2 Which pairs of states are distinguishable here? q 3 The string distinguishes q and q 2 2

20 Fix M = (Q, Σ, δ, q, F) and let p, q, r Q efine a binary relation on the states of M: p q iff p is indistinguishable from q p q iff p is distinguishable from q Proposition: is an equivalence relation p p (reflexive) p q q p (symmetric) p q and q r p r (transitive) Proof? 2

21 Fix M = (Q, Σ, δ, q, F) and let p, q, r Q Proposition: is an equivalence relation Therefore, the relation partitions Q into disjoint equivalence classes Q q [q] := { p p q } q 22

22 23

23 Algorithm: MINIMIZE-FA Input: FA M Output: FA M MIN such that: L(M) = L(M MIN ) M MIN has no inaccessible states M MIN is irreducible For all states p q of M MIN, p and q are distinguishable Theorem: M MIN is the unique minimal FA that is equivalent to M 24

24 Intuition: The states of M MIN will be the equivalence classes of states of M We ll uncover these equivalent states with a dynamic programming algorithm 25

25 The Table-Filling Algorithm Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p, q) p, q Q and p q} (2) EQUIV M = { [q] q Q } High-Level Idea: We know how to find those pairs of states that the string ε distinguishes Use this and iteration to find those pairs distinguishable with longer strings The pairs of states left over will be indistinguishable 26

26 The Table-Filling Algorithm Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p, q) p, q Q and p q} (2) EQUIV M = { [q] q Q } q q Base Case: For all (p, q) such that p accepts and q rejects p q q i q n q q q i q n 27

27 q q q i q n q q q i q n The Table-Filling Algorithm Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p, q) p, q Q and p q} (2) EQUIV M = { [q] q Q } Base Case: For all (p, q) such that p accepts and q rejects p q Iterate: If there are states p, q and symbol σ Σ satisfying: δ (p, σ) = p mark p q δ (q, σ) = q Repeat until no more s can be added 28

28 q q q 2 q 3 q q q 2 q 3, q q q 2 q 3 29

29 q q q q q 3 q 2 q 2 q 3 q q q 2 q 3 3

30 Claim: If (p, q) is marked by the Table-Filling algorithm, then p q Proof: By induction on the number of steps in the algorithm before (p,q) is marked If (p, q) is marked at the start, then one state s in F and the other isn t, so ε distinguishes p and q Suppose (p, q) is marked at a later point. Then there are states p, q such that:. (p, q ) are marked p q (by induction) So there s a string w s.t. (p, w) F (q, w) F 2. p = δ(p,σ) and q = δ(q,σ), where σ Σ The string σw distinguishes p and q! 3

31 Claim: If (p, q) is not marked by the Table-Filling algorithm, then p q Proof (by contradiction): Suppose the pair (p, q) is not marked by the algorithm, yet p q (call this a bad pair ) Then there is a string w such that w > and: (p, w) F and (q, w) F (Why is w >?) Of all such bad pairs, let p, q be a pair with the shortest distinguishing string w 32

32 Claim: If (p, q) is not marked by the Table-Filling algorithm, then p q Proof (by contradiction): Suppose the pair (p, q) is not marked by the algorithm, yet p q (call this a bad pair ) Of all such bad pairs, let p, q be a pair with the shortest distinguishing string w (p, w) F and (q, w) F We have w = σw, for some string w and some σ Σ Let p = δ(p,σ) and q = δ(q,σ) (Why is w >?) Then (p, q ) is also a bad pair, but with a SHORTER distinguishing string, w! 33

33 Algorithm MINIMIZE Input: FA M Output: Equivalent minimal-state FA M MIN. Remove all inaccessible states from M 2. Run Table-Filling algorithm on M to get: EQUIV M = { [q] q is an accessible state of M } 3. efine: M MIN = (Q MIN, Σ, δ MIN, q MIN, F MIN ) Q MIN = EQUIV M, q MIN = [q ], F MIN = { [q] q F } δ MIN ( [q], σ ) = [ δ( q, σ ) ] Claim: L(M MIN ) = L(M) 34

34 q q q 4, q, q 5 q q 2 q 3 q 3 q 4 q 5 q q q 3 q 4 q 5 36

35 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5 37

36 Thm: M MIN is the unique minimal FA equivalent to M Claim: Suppose for a FA M, L(M )=L(M MIN ) and M has no inaccessible states and M is irreducible. Then there is an isomorphism between M and M MIN If M is a minimal FA, then M has no inaccessible states and is irreducible. So the Claim implies: If M is a minimal FA for M, then there is an isomorphism between M and M MIN. So the Thmholds! Corollary: If M has no inaccessible states and is irreducible, then M is minimal. Proof: Let M min be minimal for M. Then L(M) = L(M min ), no inaccessible states in M, and M is irreducible. By Claim, both M min and M are isomorphic to M MIN! 38

CS 154, Lecture 4: Limitations on DFAs (I), Pumping Lemma, Minimizing DFAs

CS 154, Lecture 4: Limitations on DFAs (I), Pumping Lemma, Minimizing DFAs CS 154, Lecture 4: Limitations on FAs (I), Pumping Lemma, Minimizing FAs Regular or Not? Non-Regular Languages = { w w has equal number of occurrences of 01 and 10 } REGULAR! C = { w w has equal number

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AN COMPUTABILITY FA NFA EFINITION Regular Language Regular Expression How can we prove that two regular expressions are equivalent? How can we prove that two FAs (or two

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

Minimization of DFAs

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

More information

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

Proving languages to be nonregular

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

More information

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

More on Regular Languages and Non-Regular Languages

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

More information

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

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

More information

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

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

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

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES and REGULAR EXPRESSIONS TUESDAY Jan 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w has equal number

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

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

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

CS 154 NOTES CONTENTS

CS 154 NOTES CONTENTS CS 154 NOTES ARUN DEBRAY MARCH 13, 2014 These notes were taken in Stanford s CS 154 class in Winter 2014, taught by Ryan Williams, by Arun Debray. They were updated in 2016. Error and typo notices can

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

Chapter 2: Finite Automata

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

More information

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression) CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression) Objectives Prove the Pumping Lemma, and use it to show that there are non-regular languages

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

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

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

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

More information

CSCE 551 Final Exam, Spring 2004 Answer Key

CSCE 551 Final Exam, Spring 2004 Answer Key CSCE 551 Final Exam, Spring 2004 Answer Key 1. (10 points) Using any method you like (including intuition), give the unique minimal DFA equivalent to the following NFA: 0 1 2 0 5 1 3 4 If your answer is

More information

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

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

Formal Language and Automata Theory (CS21004)

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

More information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION IDENTIFYING NONREGULAR LANGUAGES PUMPING LEMMA Carnegie Mellon University in Qatar (CARNEGIE MELLON UNIVERSITY IN QATAR) SLIDES FOR 15-453 LECTURE 5 SPRING 2011

More information

Chapter 2 The Pumping Lemma

Chapter 2 The Pumping Lemma Chapter 2 The Pumping Lemma Fourth Academic Year/ Elective Course-General Electrical Engineering Department College of Engineering University of Salahaddin April 2015 Nonregular Languages Consider the

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

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 1.4 Explain the limits of the class of regular languages Justify why 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

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

CpSc 421 Final Exam December 6, 2008

CpSc 421 Final Exam December 6, 2008 CpSc 421 Final Exam December 6, 2008 Do any five of problems 1-10. If you attempt more than five of problems 1-10, please indicate which ones you want graded otherwise, I ll make an arbitrary choice. Graded

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

CS 154 Introduction to Automata and Complexity Theory

CS 154 Introduction to Automata and Complexity Theory CS 154 Introduction to Automata and Complexity Theory cs154.stanford.edu 1 INSTRUCTORS & TAs Ryan Williams Cody Murray Lera Nikolaenko Sunny Rajan 2 Textbook 3 Homework / Problem Sets Homework will be

More information

Fooling Sets and. Lecture 5

Fooling Sets and. Lecture 5 Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,

More information

Applied Computer Science II Chapter 1 : Regular Languages

Applied Computer Science II Chapter 1 : Regular Languages Applied Computer Science II Chapter 1 : Regular Languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany Overview Deterministic finite automata Regular languages

More information

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA Outline CS21 Decidability and Tractability Lecture 4 January 14, 2019 FA and Regular Exressions Non-regular languages: Puming Lemma Pushdown Automata Context-Free Grammars and Languages January 14, 2019

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

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

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

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

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

DFA to Regular Expressions

DFA to Regular Expressions DFA to Regular Expressions Proposition: If L is regular then there is a regular expression r such that L = L(r). Proof Idea: Let M = (Q,Σ, δ, q 1, F) be a DFA recognizing L, with Q = {q 1,q 2,...q n },

More information

The Pumping Lemma and Closure Properties

The Pumping Lemma and Closure Properties The Pumping Lemma and Closure Properties Mridul Aanjaneya Stanford University July 5, 2012 Mridul Aanjaneya Automata Theory 1/ 27 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

More information

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs CSE : Foundations of Computing Lecture : Finite State Machine Minimization & NFAs State Minimization Many different FSMs (DFAs) for the same problem Take a given FSM and try to reduce its state set by

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

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

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

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

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 8 January 24, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis So far several models of computation finite automata

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 5 Reductions Undecidable problems from language theory Linear bounded automata given by Jiri Srba Lecture 5 Computability and Complexity 1/14 Reduction Informal Definition

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

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

Nondeterministic finite automata

Nondeterministic finite automata Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in 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

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 Announcement & Reminders HW 2: Grades not available yet, will be soon Solutions posted, read even if you did well

More information

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

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

Name: Student ID: Instructions:

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

More information

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

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

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

V Honors Theory of Computation

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

More information

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

Chapter 2: Finite Automata

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

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

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

Finite Automata and Formal Languages TMV026/DIT321 LP Testing Equivalence of Regular Languages

Finite Automata and Formal Languages TMV026/DIT321 LP Testing Equivalence of Regular Languages Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Lecture 10 Ana Bove April 23rd 2012 Overview of today s lecture: Equivalence of Regular Languages Minimisation of Automata Testing Equivalence

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

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

11-711: Algorithms for NLP Homework Assignment #1: Formal Language Theory Solutions

11-711: Algorithms for NLP Homework Assignment #1: Formal Language Theory Solutions -: Algorithms for NLP Homework Assignment #: Formal Language Theory Solutions Out: September 4, 204 Due: September 8, 204 Problem [5 points] Prove that, for any deterministic FSA A = (Q, Σ, δ, q 0, F,

More information

Sample Midterm. Understanding the questions is part of the exam; you are not allowed to ask questions during the exam.

Sample Midterm. Understanding the questions is part of the exam; you are not allowed to ask questions during the exam. Sample Midterm Name: This exam consists of five questions. Each question is worth 10 points. The exam is worth 40 points. Your exam score is the sum of your four highest question scores. Calculators, cell

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

Answers to the CSCE 551 Final Exam, April 30, 2008

Answers to the CSCE 551 Final Exam, April 30, 2008 Answers to the CSCE 55 Final Exam, April 3, 28. (5 points) Use the Pumping Lemma to show that the language L = {x {, } the number of s and s in x differ (in either direction) by at most 28} is not regular.

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

Regular Languages and Finite Automata

Regular Languages and Finite Automata Regular Languages and Finite Automata Theorem: Every regular language is accepted by some finite automaton. Proof: We proceed by induction on the (length of/structure of) the description of the regular

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.  ETH Zürich (D-ITET) September, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 28 2017 Part 2 out of 5 Last week was all about Deterministic Finite Automaton

More information

CSE 105 Theory of Computation

CSE 105 Theory of Computation CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Undecidability Today s Agenda Review and More Problems A Non-TR Language Reminders and announcements: HW 7 (Last!!)

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Ch 5.1, 5.3 Define and explain core examples of computational problems, including

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

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

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 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS

CS 154 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS CS 154 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS Abstract. These notes were taken during CS 154 (Automata and Complexity Theory) taught by Luca Trevisan and Ryan Williams in

More information

CS154 Final Examination

CS154 Final Examination CS154 Final Examination June 7, 2010, 7-10PM Directions: CS154 students: answer all 13 questions on this paper. Those taking CS154N should answer only questions 8-13. The total number of points on this

More information

Decidability (What, stuff is unsolvable?)

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

More information

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

Please give details of your calculation. A direct answer without explanation is not counted.

Please give details of your calculation. A direct answer without explanation is not counted. Please give details of your calculation. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation 1/26/2016 LECTURE 5 Last time: Closure properties. Equivalence of NFAs, DFAs and regular expressions Today: Conversion from NFAs to regular expressions Proving that a language

More information

CpSc 421 Homework 1 Solutions

CpSc 421 Homework 1 Solutions CpSc 421 Homework 1 Solutions 1. (15 points) Let Σ = {a, b, c}. Figure 7 depicts two finite state machines that read Let L a and L b denote the languages recognized by DFA (a) and DFA (b) respectively.

More information

Further discussion of Turing machines

Further discussion of Turing machines Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

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