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

Similar documents
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. 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

Theory of Computation

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Minimization of DFAs

Computational Models: Class 3

What we have done so far

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

Computational Models - Lecture 4

Notes on State Minimization

Computational Models - Lecture 3

Computational Models - Lecture 3 1

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

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

3515ICT: Theory of Computation. Regular languages

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

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

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

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

Finite Automata and Regular languages

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

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

Name: Student ID: Instructions:

DD2371 Automata Theory

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,

Automata extended to nominal sets

Computer Sciences Department

CSE 105 THEORY OF COMPUTATION

Finite Automata and Regular Languages

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

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

The Pumping Lemma and Closure Properties

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

Pushdown Automata (2015/11/23)

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

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

Lecture 17: Language Recognition

Final exam study sheet for CS3719 Turing machines and decidability.

V Honors Theory of Computation

Theory of Computation

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

Computational Models - Lecture 3 1

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

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

COMP4141 Theory of Computation

Classes and conversions

CSE 135: Introduction to Theory of Computation Optimal DFA

TDDD65 Introduction to the Theory of Computation

Theory of Computation (I) Yijia Chen Fudan University

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.

Automata Theory, Computability and Complexity

Theory of Computation (II) Yijia Chen Fudan University

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

Computability and Complexity

Lecture 5: Minimizing DFAs

Context-Free Languages (Pre Lecture)

Automata and Computability. Solutions to Exercises

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Inf2A: Converting from NFAs to DFAs and Closure Properties

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

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

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

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

UNIT-VI PUSHDOWN AUTOMATA

Closure under the Regular Operations

Automata and Computability. Solutions to Exercises

Foundations of Informatics: a Bridging Course

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

Finite State Automata

Computational Models - Lecture 4 1

Lecture 4: More on Regexps, Non-Regular Languages

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

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Lecture 4 Nondeterministic Finite Accepters

Computational Models - Lecture 5 1

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

Theory of Computation 4 Non-Deterministic Finite Automata

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

CSCE 551 Final Exam, Spring 2004 Answer Key

Lecture 1: Finite State Automaton

Theory of Computation (IV) Yijia Chen Fudan University

The View Over The Horizon

ACS2: Decidability Decidability

Equivalence. See section 4.4 of the text

Advanced Automata Theory 2 Finite Automata

CSE 105 THEORY OF COMPUTATION

Lecture 3: Nondeterministic Finite Automata

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

COM364 Automata Theory Lecture Note 2 - Nondeterminism

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

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Transcription:

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

COMP 33 Fall 27: Lectures Schedule 4. Context-free languages 5. Pushdown automata 6. Parsing 7. The pumping lemma for CFLs 8. Introduction to computability -2. Introduction.5. Some basic mathematics 2-3. Deterministic finite automata +Closure properties, 3-4. Nondeterministic finite automata 5. Minimization+ Myhill-Nerode theorem 9. Models of computation 6. Determinization+Kleene s theorem 7. Regular Expressions+GNFA 8. Regular Expressions and Languages 9-. The pumping lemma. Duality 2. Labelled transition systems 3. MIDTERM Basic computability theory 2. Reducibility, undecidability and Rice s theorem 2. 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

N, {,2} {,3} {} {2} {3} {,4}, {4} {,2,3} {,2,4} {,3,4} {2,3,4} {2,3} {2,4} {3,4} {,2,3,4}

Unreachable States {,2} {,3} {,4} {} {2} {3} {4} {,2,3} {,2,4} {,3,4} {2,3,4} {2,3} {2,4} {3,4} {,2,3,4}

Reachable States {} {,2,3} {,3} {,3,4} {,4} {,2,3,4}

Redondant States 2 3, 4, 5

Redondant States 2,, 5 4

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 euivalence relation ). If x, y are distinguishable by L we write x L y.

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

Indistinguishable Strings L 2 3, 4, 5 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 2 3, 4, 5 While this automaton has 5 states, the index of L is only 4: E,, and L while L, L while L, L while E L, L while L, L while L, L while L.

Myhill-Nerode Theorem a. If L is recognized by a DFA with k states, L has index at most k. b. If the index of L is a finite number k, 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, 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+ elements is distinguishable by L. But since the number of states < k+ there must exist x,y in X such that δ(,x) = δ(,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, 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+ elements is distinguishable by L. But since the number of states < k+ there must exist x,y in X such that δ(,x) = δ(,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, it is recognized by a DFA with k states. (b) Let X={s,...,s k } be pairwise distinguishable by L. Let Q={,..., k } be the states of a DFA recognizing L and define δ( i,a)= j s.t. s j L s i a. Let be the i s.t. s i L E. Let F={ i s i L }. M is s.t. { s δ(,a)= 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- 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 euivalent to a shorter one obtained by pumping down.

Computing Index 2 3, 4, 5 If we consider all 63 strings of length up to 5, we get: E L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L

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,...,s k } be pairwise distinguishable by L. Let Q={,..., k } be the states of a DFA recognizing L and define δ( i,a)= j s.t. s j L s i a. Let be the i s.t. s i L E. Let F={ i s i L }. M is s.t. { s δ(,a)= i } = { s s L s i }. E,,

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 : Given R and R, compute NFA N and N accepting them as in Lemma.55. Compute DFA M and M as in Theorem.39. Using part (b) of the Myhill-Nerode Theorem we construct a minimal DFA W and W for each of them. L(R)=L(R ) iff W W.

Application of the Myhill-Nerode Theorem B = { n 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, because there exists a z= n s.t. n z B while i z B, i<n. QED

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

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