DFA Minimization and Applications

Similar documents
Minimal DFA. minimal DFA for L starting from any other

More on automata. Michael George. March 24 April 7, 2014

Finite-State Automata: Recap

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

In-depth introduction to main models, concepts of theory of computation:

Theory of Computation Regular Languages

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

State Minimization for DFAs

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

FABER Formal Languages, Automata and Models of Computation

Non-deterministic Finite Automata

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Deterministic Finite Automata

Formal Languages and Automata

GNFA GNFA GNFA GNFA GNFA

CHAPTER 1 Regular Languages. Contents

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Harvard University Computer Science 121 Midterm October 23, 2012

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Fundamentals of Computer Science

Non-deterministic Finite Automata

Homework 3 Solutions

CISC 4090 Theory of Computation

Chapter 2 Finite Automata

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Midterm 1 Practice. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

Some Theory of Computation Exercises Week 1

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Lecture 08: Feb. 08, 2019

Java II Finite Automata I

CMSC 330: Organization of Programming Languages

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Finite Automata-cont d

Prefix-Free Regular-Expression Matching

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Regular expressions, Finite Automata, transition graphs are all the same!!

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Formal Language and Automata Theory (CS21004)

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

NFAs continued, Closure Properties of Regular Languages

Lexical Analysis Finite Automate

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Myhill-Nerode Theorem

Designing finite automata II

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Non-Deterministic Finite Automata

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

3 Regular expressions

Let's start with an example:

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Regular Languages and Applications

input tape head moves current state

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Worked out examples Finite Automata

CS 330 Formal Methods and Models

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Thoery of Automata CS402

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

Turing Machines Part One

CSC 311 Theory of Computation

Formal languages, automata, and theory of computation

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

Convert the NFA into DFA

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

Revision Sheet. (a) Give a regular expression for each of the following languages:

CS375: Logic and Theory of Computing

Lecture 9: LTL and Büchi Automata

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Closure Properties of Regular Languages

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

DFA minimisation using the Myhill-Nerode theorem

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

CS 330 Formal Methods and Models

1 Nondeterministic Finite Automata

Lecture 09: Myhill-Nerode Theorem

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

1 From NFA to regular expression

Deterministic Finite-State Automata

CS 330 Formal Methods and Models

NFAs continued, Closure Properties of Regular Languages

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Nondeterminism and Nodeterministic Automata

Transcription:

DFA Minimiztion nd Applictions Mondy, Octoer 15, 2007 Reding: toughton 3.12 C235 Lnguges nd Automt Deprtment of Computer cience Wellesley College Gols for ody o Answer ny P3 questions you might hve. o ome informtion out hursdy s midterm. o DFA minimiztion o ome pplictions of regulr expressions nd utomt: Automt design using Forln Efficient tring erching Pttern Mtching with Regulr Expressions DFA Minimiztion 17-2 1

he Midterm o he midterm will e n in-clss exm during the lecture period on hu. Oct. 18. o It will cover mteril through tody s lecture (#17) nd prolem sets 1 3. o It is open ook/open notes. o Prolems will e esier thn most prolem set prolems. o tudy ll the prolem set solutions! o You re encourged to form study groups! o Where to find prctice prolems? toughton s course we site: Exercise ets nd Exms ipser Chpter 1 Exercises (not Prolems), some of which hve solutions DFA Minimiztion 17-3 Midterm Prolems you hould Prepre For o A simple proof y induction. o A simple proof y contrdiction/digonliztion. o Resoning out logic, sets, reltions, functions, ijections, nd closures (reflexive, symmetric, trnsitive). o Resoning out sizes nd continment of sets/lnguges. o Reding/writing simple ML functions, possily using the Forln functions you ve used in ssignments. o nderstnding the forml definition of FAs nd DFAs (i.e., qudruple of sttes, strt stte, ccepting stte, nd trnsitions). o implifying regulr expressions (only very simple simplifictions) o Converting etween English descriptions of lnguges, regulr expressions, FAs, EFAs, NFAs, DFAs. o Opertions involving products of DFAs: intersection, union, equivlence. DFA Minimiztion 17-4 2

Are nd Equivlent? K, M L R,, DFA Minimiztion 17-5 Are nd Equivlent? ke heir Product! K, M L R,, x ( K, ) ( R, L ) ( L, O ) ( M, ) (, ),, DFA Minimiztion 17-6 3

Miniml DFAs K, M L R,, A DFA is miniml if it hs the smllest numer of sttes of ny DFA ccepting its lnguge. Is miniml? Is miniml? DFA Minimiztion 17-7 tte Merging K, M L R,, A DFA is not miniml iff two sttes cn e merged to form single stte without chnging the mening of the DFA. Accepting sttes nd non-ccepting sttes cn never e merged. Which sttes in cn e merged? DFA Minimiztion 17-8 4

tte Merging in R Merge with R,,, (, ) Merge with {, }, R {, } DFA Minimiztion 17-9 ttes Cn t Alwys e Merged Itertively DFA 9 V X W Y imultneously merge V with X nd W with Y, Z { V, X } {W, Y }, Z DFA Minimiztion 17-10 5

DFA Minimiztion Algorithm: tep 1 List ll pirs of sttes thn must not e merged = pirs of one ccepting nd one non-ccepting stte. Other pirs might e mergele they re considered mergele until proven otherwise R,, nmergele (, R ), ( R, ), (, ), (, ), (, ), (, ), (, R ), ( R, ), (, ), (, ), (, ), (, ) Might-Be-Mergele (, ), ( R, R ), (, ), (, ), (, ), (, ), (, ), ( R, ), (, R ), ( R, ), (, R ), (, ), (, ) DFA Minimiztion 17-11 DFA Minimiztion Algorithm: tep 2 Move from Might-Be-Mergele to nmergele ny pir (A,B) such tht there is trnsition to (C,D) in nmergele: nmergele (, R ), ( R, ), (, ), (, ), (, ), (, ), (, R ), ( R, ), (, ), (, ), (, ), ( A, B ) (, ) ( C, D ) ( R, ), (, R ), ( R, ), (, R ), R, (, ), ( R, R ), (, ), (, R ), Might-Be-Mergele (, ), (, ), (, ), (, ), ( R, ), (, R ), ( R, ), (, ), (, ), DFA Minimiztion 17-12 6

DFA Minimiztion Algorithm: tep 3 Merge the non-trivil pirs remining int Might-Be-Mergele Might-Be-Mergele (, ), ( R, R ), (, ), (, ), (, ), (, ), (, ), (, ), (, ) R,, Merge with nd with {, } R {, }, DFA Minimiztion 17-13 DFA Minimiztion: More Prctice DFA 9 V X W Y, Z DFA Minimiztion 17-14 7

Designing DFAs with Forln sing Forln, design miniml DFA tht ccepts ny string of s nd s tht is one of the following: Any string eginning with two s. Any string ending in two s. Any string contining the sustring. Any string whose third-to-lst chrcter is. DFA Minimiztion 17-15 8