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

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

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 1 : Introduction

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 2 : Regular Expressions & DFAs

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 14 : Turing Machines

Minimization of DFAs

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Theory of Computation

What we have done so far

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

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

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

Computational Models: Class 3

Computational Models - Lecture 4

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

Notes on State Minimization

Theory of Computation (I) Yijia Chen Fudan University

Computational Models - Lecture 3

Computational Models - Lecture 3 1

3515ICT: Theory of Computation. Regular languages

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

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

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

Theory of Computation (II) Yijia Chen Fudan University

DM17. Beregnelighed. Jacob Aae Mikkelsen

Finite Automata and Regular Languages

DD2371 Automata Theory

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

Name: Student ID: Instructions:

Nondeterministic Finite Automata

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

Finite Automata and Regular languages

V Honors Theory of Computation

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Lecture 4 Nondeterministic Finite Accepters

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

The Pumping Lemma and Closure Properties

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

Chapter 6: NFA Applications

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

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

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

CSE 105 THEORY OF COMPUTATION

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

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

COMP4141 Theory of Computation

CSE 105 THEORY OF COMPUTATION

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

Closure under the Regular Operations

Automata and Languages

TDDD65 Introduction to the Theory of Computation

Computer Sciences Department

Computational Models - Lecture 4 1

CSE 105 THEORY OF COMPUTATION

CS 455/555: Finite automata

The View Over The Horizon

Computational Models - Lecture 3 1

Lecture 17: Language Recognition

Theory of Languages and Automata

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

Automata Theory. CS F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages. David Galles

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

Chapter Five: Nondeterministic Finite Automata

Inf2A: Converting from NFAs to DFAs and Closure Properties

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

Automata and Computability. Solutions to Exercises

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

Introduction to Theory of Computing

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)

Computational Models Lecture 5

VTU QUESTION BANK. Unit 1. Introduction to Finite Automata. 1. Obtain DFAs to accept strings of a s and b s having exactly one a.

CSCE 551 Final Exam, Spring 2004 Answer Key

Foundations of Informatics: a Bridging Course

Lecture 4: More on Regexps, Non-Regular Languages

Automata and Computability. Solutions to Exercises

Finite Automata - Deterministic Finite Automata. Deterministic Finite Automaton (DFA) (or Finite State Machine)

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Computational Models - Lecture 4 1

Classes and conversions

CSE 105 Theory of Computation Professor Jeanne Ferrante

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Nondeterministic Finite Automata

Theory of Computation (IV) Yijia Chen Fudan University

Question Bank UNIT I

CS154. Non-Regular Languages, Minimizing DFAs

CSE 135: Introduction to Theory of Computation Optimal DFA

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Computational Models - Lecture 5 1

Fooling Sets and. Lecture 5

Final exam study sheet for CS3719 Turing machines and decidability.

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

Automata extended to nominal sets

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

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

Transcription:

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 finite automata +Closure properties, 4. Nondeterministic finite automata 5. Minimization 6. Determinization+Kleene s theorem 7. Regular Expressions+GNFA 8. The pumping lemma 9. Myhill-Nerode theorem 1. Duality 11. Labelled transition systems 13. MIDTERM 14. Context-free languages 15. Pushdown automata 16. Parsing 17. The pumping lemma for CFLs 18. Introduction to computability 19. Models of computation Basic computability theory 2. Reducibility, undecidability and Rice s theorem 21. Undecidable problems about CFGs 22. Post Correspondence Problem 23. Validity of FOL is RE / Gödel s and Tarski s thms 24. Universality / The recursion theorem 25. Degrees of undecidability 26. Introduction to complexity

Myhill-Nerode Theorem John R. Myhill Anil Nerode

Myhill-Nerode Theorem Let x and y be strings and L be a language. We say that x and y are distinguishable by L if there exists a z such that xz L and yz L or yz L and xz L. If x and y are indistinguishable by L we write x L y, ( L is an equivalence relation ). If x, y are distinguishable by L we write x L y.

Distinguishable Strings 11 L 1 q 1 1 q 2 1 q 3,1 q 4,1 q 5 1 there exists a z such that xz L and yz L. z= is such that 11 L while 1 L.

Indistinguishable Strings 11 L 1 q 1 1 q 2 1 q 3,1 q 4,1 q 5 1 There does not exist a z such that xz L and yz L nor yz L and xz L. For all z, xz and yz are both in L or neither in L.

Myhill-Nerode Theorem Let L be a language and X a set of strings. We say that X is pairwise distinguishable by L if eve r y two elem ents in X are distinguishable by L (For all x, x in X, x L x ). Define the index of L to be the size of a m a x i m u m s e t X t h at i s p a i r w i s e distinguishable by L. The index may be finite or infinite.

Distinguishable Strings q 1 1 q 2 1 q 3,1 q 4,1 q 5 1 While this automaton has 5 states, the index of L is only 4: ε, 1, 11 and 111 111 L while 11 L, 111 L while 1 L, 111 L while ε L, 111 L while 11 L, 111 L while 1 L, 111 L while 11 L.

Myhill-Nerode Theorem a. If L is recognized by a DFA with k states, then L has index at most k. b. If the index of L is a finite number k, then it is recognized by a DFA with k states. c. L is regular iff it has finite index. This index is the size of the smallest DFA recognizing L.

Myhill-Nerode Theorem a. If L is recognized by a DFA with k states, then L has index at most k. (a) Let M be a k state DFA recognizing L. Suppose L has index larger than k. Some X with k+1 elements is distinguishable by L. But since the number of states < k+1 there must exist x,y in X such that δ(q,x) = δ(q,y). But then, x and y are not distinguishable. A contradiction.

Myhill-Nerode Theorem a. If L is recognized by a DFA with k states, then L has index at most k. (a) Let M be a k state DFA recognizing L. Suppose L has index larger than k. Some X with k+1 elements is distinguishable by L. But since the number of states < k+1 there must exist x,y in X such that δ(q,x) = δ(q,y). But then, x and y are not distinguishable. A contradiction.

Myhill-Nerode Theorem b. If the index of L is a finite number k, then it is recognized by a DFA with k states. (b) Let X={s 1,...,s k } be pairwise distinguishable by L. Let Q={q 1,...,q k } be the states of a DFA recognizing L and define δ(q i,a)=q j s.t. s j L s i a. Let q be the q i s.t. s i L ε. Let F={ q i s i L }. M is s.t. { s δ(q,s)=q i } = { s s L s i }.

Myhill-Nerode Theorem c. L is regular iff it has finite index. This index is the size of the smallest DFA recognizing L. (c) L is regular implies the existence of a DFA recognizing L. By (a), L has index at most k. If L has index k then by (b) there exists a DFA with k states (i.e. L is regular). As for the minimality, if the index of L is not the size of the minimal DFA then there exists a DFA with index-1 states recognizing L. But this is impossible by part (a).

Minimizing via Myhill-Nerode Theorem Let L be a regular language. Compute the index of L by finding the set X of all the strings that are pairwise distinguishable by L. All strings considered as x, y, xz and yz may be shorter than the number of states of a DFA accepting L. Every string which is longer is equivalent to a shorter one obtained by pumping down.

Computing Index q 1 1 q 2 1 q 3,1 q 4,1 q 5 1 If we consider all 63=2 4-1 strings of length up to 5, we get: ε L L L L L 1 L 11 L 11 L 111 L L 1 L 11 L 11 L 111 L 1 L 11 L 11 L 111 L 11 L 111 L 111 L 1111 1 L 1 L 1 L 1 L 1 L 11 L 111 L 111 L 1111 1 L 11 L 1 L 11 L 1 L 11 L 1 L 11 1 L 11 L 11 L 111 L 1 L 11 L 11 L 111 L 11 L 111 L 111 L 1111 L 1 L 11 L 11 L 111 L 11 L 111 L 111 L 1111 L 111 L 1111 L 1111 L 11111

Minimizing via Myhill-Nerode Theorem Let L be a regular language. Compute the index of L by finding the set X of all the strings that are pairwise distinguishable by L. Using part (b) of the Myhill-Nerode Theorem we construct a minimal DFA to accept L.

Minimal DFA (b) Let X={s 1,...,s k } be pairwise distinguishable by L. Let Q={q 1,...,q k } be the states of a DFA recognizing L and define δ(q i,a)=q j s.t. s j L s i a. Let q be the q i s.t. s i L ε. Let F={ q i s i L }. M is s.t. { s δ(q,s)=q i } = { s s L s i }.,1 q 1,1 q 1 q 1 q 1 1

Application of the Myhill-Nerode Theorem Given two regular expressions R and R we can find out whether they generate the same regular language or not : From R and R, compute NFAs N and N accepting L(R) and L(R ) (Lemma 1.55). Compute equivalent DFAs M and M (Thm 1.39). Using part (b) we construct minimal DFAs W and W for each of them. L(R)=L(R ) iff W W ( means "identical up to renaming of states").

Application of the Myhill-Nerode Theorem B = { n 1 n n } is non-regular because it has infinite index. Consider the set X={ n n }. It s an infinite set that is pairwise distinguishable by B. Proof: For all n, n is distinguishable from all previous i, i n-1, because there exists a z=1 n such that n z B while i z B, i n-1. QED

Application of the Myhill-Nerode Theorem F = { ww w * } is non-regular because it has infinite index. Consider the set X={ n 1 n }. It s an infinite set that is pairwise distinguishable by F. Proof: For all n, n 1 is distinguishable from all previous i 1, i n-1, because there exists a z= n 1 such that n 1z B while i 1z B, i n-1. QED

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