DFA Minimization. DFA minimization: the idea. Not in Sipser. Background: Questions: Assignments: Previously: Today: Then:

Similar documents
Proof of Pumping Lemma. PL Use. Example. Since there are only n different states, two of q 0, must be the same say q i

MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

CS 103 BFS Alorithm. Mark Redekopp

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT

d e c b a d c b a d e c b a a c a d c c e b

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

Last time: introduced our first computational model the DFA.

Present state Next state Q + M N

The University of Sydney MATH 2009

1 Introduction to Modulo 7 Arithmetic

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

Lecture 20: Minimum Spanning Trees (CLRS 23)

In which direction do compass needles always align? Why?

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

Weighted Graphs. Weighted graphs may be either directed or undirected.

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

Math 166 Week in Review 2 Sections 1.1b, 1.2, 1.3, & 1.4

QUESTIONS BEGIN HERE!

OpenMx Matrices and Operators

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

QUESTIONS BEGIN HERE!

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

CS 461, Lecture 17. Today s Outline. Example Run

Minimal DFA. minimal DFA for L starting from any other

Seven-Segment Display Driver

Constructive Geometric Constraint Solving

EE1000 Project 4 Digital Volt Meter

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

(4, 2)-choosability of planar graphs with forbidden structures

Organization. Dominators. Control-flow graphs 8/30/2010. Dominators, control-dependence. Dominator relation of CFGs

Strongly connected components. Finding strongly-connected components

Problem solving by search

CS150 Sp 98 R. Newton & K. Pister 1

(Minimum) Spanning Trees

Convert the NFA into DFA

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

Tangram Fractions Overview: Students will analyze standard and nonstandard

Designing A Concrete Arch Bridge

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

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

Minimum Spanning Trees

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017

Indices. Indices. Curriculum Ready ACMNA: 209, 210, 212,

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

Graph Search (6A) Young Won Lim 5/18/18

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

Graph Algorithms and Combinatorial Optimization Presenters: Benjamin Ferrell and K. Alex Mills May 7th, 2014

DFA (Deterministic Finite Automata) q a

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

Formal Languages and Automata

CS September 2018

VLSI Testing Assignment 2

CS 241 Analysis of Algorithms

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

Having a glimpse of some of the possibilities for solutions of linear systems, we move to methods of finding these solutions. The basic idea we shall

Finite Automata-cont d

Fundamentals of Computer Science

Theory of Computation Regular Languages

Nondeterministic Automata vs Deterministic Automata

COMP 250. Lecture 29. graph traversal. Nov. 15/16, 2017

Lecture 08: Feb. 08, 2019

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

Dental PBRN Study: Reasons for replacement or repair of dental restorations

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

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

Functions and Graphs 1. (a) (b) (c) (f) (e) (d) 2. (a) (b) (c) (d)

0.1. Exercise 1: the distances between four points in a graph

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk

Myhill-Nerode Theorem

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

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

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

STRUCTURAL GENERAL NOTES

Outline. Binary Tree

Instruction Scheduling

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

Minimum Spanning Trees

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

Face Detection and Recognition. Linear Algebra and Face Recognition. Face Recognition. Face Recognition. Dimension reduction

Transcription:

Assinmnts: DFA Minimiztion CMPU 24 Lnu Tory n Computtion Fll 28 Assinmnt 3 out toy. Prviously: Computtionl mols or t rulr lnus: DFAs, NFAs, rulr xprssions. Toy: How o w in t miniml DFA or lnu? Tis is t lst topi in t irst prt o t ours! Tn: Tusy w ll rviw or Exm. Not in Sipsr Rin rom Hoprot t l. is on t ours wsit. Usr nm n psswor r t sm s or ssinmnt solutions. Wy r w in it? DFA minimiztion: t i Bkroun: A rulr lnu n pt y mny DFAs Qustions: Is tr uniqu simplst DFA or rulr lnu? I so, n w onstrut it? Tin is lik iliustr

T i Ys, tr is uniqu miniml DFA n w n onstrut it! Miniml? Miniml numr o stts. Uniqu? Uniqu up to rnmin o stts. I.., s sm sp. Isomorpi. Distinuisl strins Lt L ny lnu in Σ*. For ny two strins x n y Σ*, w n pply t inistinuisility rltion I L, su tt x I L y i n only i or ny z Σ*, itr ot xz n yz r in L, or ot xz n yz r in L (t omplmnt o L). Stts n strins W n tink o stt in n utomton s rprsntin rtin miniml mount o inormtion w n to rmmr out t strin w r prossin. E stt n intii y t st o strins tt us us to rmmr xtly tt inormtion, I.., t st o strins tt us us to t tt stt in t ronition loritm A stt is n strtion nywy, so wy not tink o stt s st o strins? Distinuisl stts I w s stts s sts o strins, it s sy to s tt istinuisility pplis to stts s wll. Stts p n q r inistinuisl i or ll strins z, itr ot δ (p,z) F n δ (q,z) F or δ (p,z) F n δ (q,z) F p q z z or p q z z

Exmpl (vry simpl) Consir: p p is istinuisl rom q n r us p is non-ptin n q n r r ptin. So ppnin t mpty strin to t sts o strins t stts rprsnt ls to non-ptin stt in on s n n ptin stt in t otr. q r Cn w istinuis q rom r? No strin innin wit works, us ot stts o to p, n tror ny strin o t orm x tks q n r to t sm stt. No strin innin wit works. Tnilly, δ(q, ) = r n δ(r, ) = q r not istinuisl. Wt ppns is tt, strtin in itr q or r, s lon s w v inputs, w r in on o t ptin stts, n wn is r, w o to t sm stt (p) n tn rrlss o input, t sm stts orvr tr. p q r Equivln lsss For strins: Σ* n prtition into sts o inistinuisl strins For stts: T stts o n utomton Q n prtition into sts o inistinuisl stts Tis ins quivln lsss ovr Σ* or Q W will tlk out quivln lsss in nrl, sin stts n viw s sts o strins. Myill Nro Torm L is rulr lnu i n only i t st o quivln lsss is init Exmpl: L = {x {,}* x ns wit } Consir 3 strins: ε,, n Any two o ts strins r istinuisl wit rspt to L T strin ε istinuiss ε n n lso n T strin istinuiss ε n

So t tr quivln lsss [ε], [], n [] r istint Any strin y is inistinuisl rom on o ts strins I y ns in it is inistinuisl rom I y ns in it is inistinuisl rom Otrwis (i y = ε, y =, or y ns wit ), y is inistinuisl rom ε T ision m or ny input strin pns only on its lst two symols no n to istinuis twn on strin nin in n ny otr strin nin wit, or twn ny two strins nin in So t quivln lsss or tis utomton r ( ) * ( ) * ( ) * ε Bs on t n to rmmr only t inl two symols, oul uil t ollowin FA On t FA s sn two symols, it yls k n ort mon 4 stts rmmrin t lst two symols it sw Cn tis FA simplii? Consir stts n Nitr is n ptin stt Bot n t lst on mor symol to v strin in L Rows in t tl look xtly lik Consir strins tt us t FA to in stts n rsptivly Do not n to istinuis now, us nitr stt is ptin Cnnot istinuis on symol ltr, us t FA is in t sm stt Tror ts two stts r not istinuisl T two n mr stt input ε

Mrin stts Stt A: Mr n Stt B: Mr,, Nw FA wit 4 stts ε A B stt input ε Ol FA wit 7 stts n r now A,, n r now B In t nw tl, rows or ε n A r t sm (i.., n ) Nitr is ptin Inistinuisl Mr ε into A No urtr rutions possil so tis is t miniml FA ε A ε B A A B B B A B A A B B B A B A B Construtin t minimum-stt DFA For roup o inistinuisl stts, pik rprsnttiv. Not roup n lr,.., q, q 2,, q k, i ll pirs r inistinuisl. Inistinuisility is trnsitiv (wy?), so inistinuisility prtitions stts. I p is rprsnttiv, n δ(p, ) = q, in minimum-stt DFA t trnsition rom p on is t rprsnttiv o q s roup (or to q itsl, i q is itr lon in roup or rprsnttiv). Tos svn stts wr just tr stts in trn ot (wit room or n).

Exmpl Strt stt is rprsnttiv o t oriinl strt stt Aptin stts r rprsnttivs o roups o ptin stts. Noti w oul not v mix (ptin & non-ptin) roup. (Wy?) Dlt ny stt tt is not rl rom t strt stt For t DFA ivn rlir, p is in roup y itsl; {q, r} is t otr roup. p q r p, q Forml loritm Aloritm Buil tl to ompr unorr pir o istint stts p, q. E tl ntry s mrk s to wtr p n q r known to not quivlnt, n list o ntris, rorin pnnis: I tis ntry is ltr mrk, lso mrk ts. Ky i: in stts p n q tt r istinuisl us tr is som input w tt tks xtly on o p n q to n ptin stt. Bsis: ny non-ptin stt is istinuisl rom ny ptin stt Inution: p n q r istinuisl i tr is som input symol su tt δ(p, ) is istinuisl rom δ(q, ). All otr pirs o stts r inistinuisl, n n mr into on stt.

Aloritm. Initiliz ll ntris s unmrk n wit no pnnis 2. Mrk ll pirs o inl n non-inl stt 3. For unmrk pir p,q n input symol : Lt r = δ(p, ), s = δ(q, ). I (r, s) unmrk, (p, q) to (r, s) s pnnis, Otrwis mrk (p, q), n rursivly mrk ll pnnis o nwly mrk ntris. 4. Cols unmrk pirs o stts 5. Dlt inssil stts Exmpl. Initiliz tl ntris: Unmrk, mpty list (,) δ(,)? δ(,) δ(,)? δ(,) 2. Mrk pirs o inl & non-inl stts 3. For unmrk pir & symol,

? My 3. For unmrk pir & symol,? No! Mrk (,) s istinuisl 3. For unmrk pir & symol, 3. For unmrk pir & symol, (,) δ(,) is istinuisl rom δ(,) Mrk (,) δ(,)? δ(,) δ(,)? δ(,) 3. For unmrk pir & symol, (,)

3. For unmrk pir & symol,?? My Ys A (,) to (,) s pnnis 3. For unmrk pir & symol, (,) Distinuisl (,) (,) 3. For unmrk pir & symol, (,) My A (,) to (,) s n (,) s pnnis (,) 3. For unmrk pir & symol, (,) Distinuisl (,) (,) (,) (,) (,)

(,) δ(,) = (inl stt) δ(,) = (non-inl stt) Distinuisl (,) Distinuisl (,) Distinuisl 3. For unmrk pir & symol, (,) 3. For unmrk pir & symol, (,) (,) (,) (,) (,) 3. For unmrk pir & symol, (,) Distinuisl Mrk (,) Mrk (,) lso (,) (,)? (,) Distinuisl (,) (,) (,) (,)? Distinuisl Distinuisl Distinuisl (,) (,) (,) (,) (,)

(,) δ(,) = δ(,) = (,) istinuisl (,) istinuisl (,) istinuisl (,) istinuisl Distinuisl Mrk (,) (,) (,) (,) (,) (,) Finl Miniml FA 5. Dlt unrl stts 4. Cols unmrk pirs o stts Non. (,)

NFA minimiztion T minimiztion loritm osn t in uniqu miniml NFA. Mor importntly, in nrl, tr is no uniqu miniml NFA. Exmpl NFAs or + : Dision Proprtis o Rulr Lnus Givn ( rprsnttion,.., RE, FA, o) rulr lnu L, wt n w tll out L? Sin tr r loritms to onvrt twn ny two rprsnttions, w n oos t rprsnttion tt mks t tst sist. Mmrsip Is strin w in rulr lnu L? Coos DFA rprsnttion or L. Simult t DFA on input w. Emptinss Is L =? Us DFA rprsnttion. Us rp-rility loritm to tst i t lst on ptin stt is rl rom t strt stt. Bot miniml, ut not isomorpi. Finitnss Is L init lnu? Not vry init lnu is rulr, ut rulr lnu is not nssrily init. DFA mto: Givn DFA or L, limint ll stts tt r not rl rom t strt stt n ll stts tt o not r n ptin stt. Tst i tr r ny yls in t rminin DFA; i so, L is ininit, i not, tn L is init. RE mto Almost, w n look or * in t RE n sy its lnu is ininit i tr is on, init i not. Howvr, tr r xptions,.. ε* or *. Tus:. Fin su-xprssions quivlnt to y: (Bsis) is; ε n r not. (Inution) E F is i ot E n F r; EF is i itr E or F is; E* nvr is. Elimint su-xprssions quivlnt to y: Rpl E F or F E y F wnvr E is n F isn t. Rpl E* y ε wnvr E is quivlnt to.

3. Now, in su-xprssions tt r quivlnt to ε y: (Bsis) ε is; isn t. (Inution) E F is i ot E n F r; itto EF; E* is i E is. Now, w n tll i L(R) is ininit y lookin or su-xprssion E* su tt E is not quivlnt to ε. Appnix Nots on FA Minimiztion Aloritm Orr o sltin stt pirs ws ritrry. All orrs iv sm ultimt rsult. But, my ror mor or wr pnnis. Coosin stts y workin kwrs rom known nonquivlnt stts prous wst pnnis. Tis loritm: Humn (954), Moor (956). O(n 2 ) tim. Constnt work pr ntry: initil mrk tst n possily ltr sin o its pnnis. Mor iint loritms xist,.., Hoprot (97). Corrtnss o t Minimiztion Aloritm Wy is nw DFA no lrr tn ol DFA? Only rmovs stts, nvr introus nw stts. Ovious. Wy is nw DFA quivlnt to ol DFA? Only intiy stts tt provly v sm vior. Coul prov x L(M) x L(M ) y inutions on rivtions. Wy is miniml DFA uniqu (up to isomorpism)? Dpns on t uniqunss o miniml quivln lsss o strins in t lnu.

Wy t Minimiztion Aloritm Cn t B Btn Suppos w v DFA A, n w minimiz it to onstrut DFA M. But tr is notr DFA N tt pts t sm lnu s A n M, yt s wr stts tn M. Proo y ontrition tt tis n't ppn: Run t stt-istinuisility pross on t stts o M n N totr. Strt stts o M n N r inistinuisl us L(M) = L(N). I {p, q} r inistinuisl, tn tir sussors on ny on input symol r lso inistinuisl. Tus, sin nitr M nor N oul v n inssil stt, vry stt o M is inistinuisl rom t lst on stt o N. Sin N s wr stts tn M, tr r two stts o M tt r inistinuisl rom t sm stt o N, n tror inistinuisl rom otr. But M ws sin so tt ll its stts r istinuisl rom otr. W v ontrition, so t ssumption tt N xists is wron, n M in t s s w stts s ny quivlnt DFA or A. In t (stronr), tr must on-to-on orrsponn twn t stts o ny otr minimum-stt N n t DFA M, sowin tt t minimum-stt DFA or A is uniqu up to rnmin o t stts.