Average Case Analysis of Moore s State Minimization Algorithm

Similar documents
Average Case Analysis of Moore s State Minimization Algorithm

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Minimal DFA. minimal DFA for L starting from any other

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

How to simulate Turing machines by invertible one-dimensional cellular automata

The Regulated and Riemann Integrals

Theory of Computation Regular Languages

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Convert the NFA into DFA

Lecture 09: Myhill-Nerode Theorem

State Minimization for DFAs

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

p-adic Egyptian Fractions

Formal Languages and Automata

Math 1B, lecture 4: Error bounds for numerical methods

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

CMSC 330: Organization of Programming Languages

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

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

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

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

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

Review of Calculus, cont d

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

Lecture 1. Functional series. Pointwise and uniform convergence.

Nondeterminism and Nodeterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata

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

Model Reduction of Finite State Machines by Contraction

C. C^mpenu, K. Slom, S. Yu upper boun of mn. So our result is tight only for incomplete DF's. For restricte vlues of m n n we present exmples of DF's

Frobenius numbers of generalized Fibonacci semigroups

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

CS 275 Automata and Formal Language Theory

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

Chapter 5 : Continuous Random Variables

1 The Lagrange interpolation formula

Random subgroups of a free group

Continuous Random Variables

A tutorial on sequential functions

New Expansion and Infinite Series

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

1 Online Learning and Regret Minimization

7.2 The Definite Integral

Chapter 2 Finite Automata

Riemann Sums and Riemann Integrals

The First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a).

20 MATHEMATICS POLYNOMIALS

1 Nondeterministic Finite Automata

Riemann Sums and Riemann Integrals

Lecture 3 ( ) (translated and slightly adapted from lecture notes by Martin Klazar)

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

8 Laplace s Method and Local Limit Theorems

Entropy and Ergodic Theory Notes 10: Large Deviations I

Formal languages, automata, and theory of computation

1.9 C 2 inner variations

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

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

Jim Lambers MAT 169 Fall Semester Lecture 4 Notes

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

Improper Integrals, and Differential Equations

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

An approximation to the arithmetic-geometric mean. G.J.O. Jameson, Math. Gazette 98 (2014), 85 95

N 0 completions on partial matrices

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

Reversals of Signal-Posterior Monotonicity for Any Bounded Prior

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

1.4 Nonregular Languages

Theoretical foundations of Gaussian quadrature

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

Handout: Natural deduction for first order logic

II. Integration and Cauchy s Theorem

A PROOF OF THE FUNDAMENTAL THEOREM OF CALCULUS USING HAUSDORFF MEASURES

Chapter 14. Matrix Representations of Linear Transformations

DFA minimisation using the Myhill-Nerode theorem

Review of basic calculus

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

Integral points on the rational curve

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

Duality # Second iteration for HW problem. Recall our LP example problem we have been working on, in equality form, is given below.

Lecture 3: Equivalence Relations

Generalized Fano and non-fano networks

Bases for Vector Spaces

Math 8 Winter 2015 Applications of Integration

COMPUTER SCIENCE TRIPOS

Classical Mechanics. From Molecular to Con/nuum Physics I WS 11/12 Emiliano Ippoli/ October, 2011

1.3 Regular Expressions

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

arxiv: v1 [math.ra] 1 Nov 2014

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

Myhill-Nerode Theorem

Review of Riemann Integral

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

arxiv:math/ v2 [math.ho] 16 Dec 2003

THE QUADRATIC RECIPROCITY LAW OF DUKE-HOPKINS. Circa 1870, G. Zolotarev observed that the Legendre symbol ( a p

Recitation 3: More Applications of the Derivative

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

Infinite Geometric Series

Reinforcement Learning

Chapter 0. What is the Lebesgue integral about?

Computing k-th Lyndon Word and Decoding Lexicographically Minimal de Bruijn Sequence

Transcription:

Averge Cse Anlysis of Moore s Stte Minimiztion Algorithm Frédérique Bssino LIPN UMR 7030, Université Pris 3 - CNRS, 99, venue Jen-Bptiste Clément, 93430 Villetneuse, Frnce. Frederique.Bssino@lipn.univ-pris3.fr Julien Dvid LIPN UMR 7030, Université Pris 3 - CNRS, 99, venue Jen-Bptiste Clément, 93430 Villetneuse, Frnce. Julien.Dvid@lipn.univ-pris3.fr Cyril Nicud LIGM UMR 8049 - CNRS, Université Pris Est, 5, bd Descrtes, 77454 Mrne-l-Vllé Cedex 2, Frnce. Cyril.Nicud@univ-pris-est.fr July 25, 20 Abstrct. We prove tht the verge complexity of Moore s stte minimiztion lgorithm is O(knlog n), where n is the number of sttes of the input nd k the size of the lphbet. This result holds for whole fmily of probbilistic models on utomt, including the uniform distribution over deterministic nd ccessible utomt, s well s uniform distributions over clssicl subclsses, such s complete utomt, cyclic utomt, utomt where ech stte is finl with probbility γ (0,), nd mny other vritions. Key Words. stte minimiztion lgorithms, Moore s lgorithm, verge complexity, finite utomt. Introduction Deterministic utomt re convenient wy to represent regulr lnguges nd cn be used to perform efficiently most usul computtions involving regulr lnguges. Therefore, finite-stte utomt pper in mny fields of computer science, such s linguistics, dt compression, bioinformtics, etc.. One cn ssocite unique smllest deterministic utomton to ny given regulr lnguge. This utomton is clled its miniml utomton. This cnonicl representtion of regulr lnguges is compct nd provides n esy wy to check equlity between regulr lnguges. As consequence, stte minimiztion lgorithms, which compute the miniml utomton of regulr lnguge given by deterministic utomton, re of gret interest.

Moore proposed solution [] tht cn be seen s sequence of prtition refinements. Strting from prtition of the set of sttes of size n into t most two prts, successive refinements led to prtition whose elements re the subsets of indistinguishble sttes; these sets cn be merged to form smller utomton tht recognizes the sme lnguge. Since there re t most n such refinements, nd since ech of these refinements is done in liner time, the worst-cse complexity of Moore s stte minimiztion lgorithm is qudrtic. Hopcroft s stte minimiztion lgorithm [2] lso uses prtition refinements to compute the miniml utomton. It selects crefully the prts tht re split t ech step. Using pproprite dt structures, its worst-cse complexity is O(kn log n). It is the best known minimiztion lgorithm nd therefore it hs been studied intensively: in [3, 4] different proofs of its correctness re given, in [5, 6, 7] the tightness of the complexity upper bound for vrious fmilies of utomt is proved, in [8, 9] precise description of the dt structures tht re needed to rech the O(kn log n) complexity is given. In [0, ] two O(m log n) solutions for incomplete utomt re given, where m denotes the number of defined trnsitions, using improvements in Hopcroft s strtegy together with dvnced dt structures. Note tht Hopcroft nd Ullmn described nother minimiztion lgorithm which is much esier to implement in [2]: for every pir of sttes of the input utomton, it tests whether the two sttes re equivlent or not. Its complexity is Θ(kn 2 ). Brzozowski s lgorithm [3, 4] is nother minimiztion lgorithm. It works differently thn the other ones. It hs the dvntge to be ble to tke non-deterministic utomt s inputs. It is bsed on two successive determiniztion steps, nd though its worst-cse complexity is proved to be exponentil, it hs been noticed tht it is often sub-exponentil in prctice. For further detils on ll these lgorithms, the reder is invited to consult [5] where txonomy of minimiztion lgorithms is presented. Also note tht for some specific fmilies of utomt, minimiztion cn be done in liner time. See for instnce [6] for cyclic utomt, [7] for unry utomt nd [8] for locl utomt. 6 5.5 Number of itertions 5 4.5 4 3.5 3 2.5 2.5 Moore Stndrd Devition 0 000 2000 3000 4000 5000 6000 7000 8000 9000 0000 Size of Automt Figure : The experimentl results were obtined with the C++ librry REGAL (vilble t: http://regl.univ-mlv.fr/) to rndomly nd uniformly generte deterministic, ccessible nd complete utomt [9, 20, 2]. For ech size the vlues re computed from 20000 rndom utomt over 2-letter lphbet. In this pper we study the verge time complexity of Moore s lgorithm. From n experimentl point of view, it seems tht for the uniform distribution, the verge 2

number of prtition refinements increses very slowly s the size of the input grows (Fig.). In the following we prove tht Moore s lgorithm performs only O(log n) refinements on verge, nd therefore hs verge complexity O(kn log n). Our result holds for ny probbilistic model tht stisfies the following conditions: the underlying grph of the utomt nd the set of finl sttes re chosen independently from one nother nd every stte is finl with fixed probbility γ (0, ). We cll such probbilistic model Bernoulli model. For instnce, our result holds for the uniform distribution on possibly incomplete utomt, the uniform distribution on strongly connected (resp. cyclic, group, etc.) utomt, since they re ll Bernoulli models. The O(kn log n) verge time complexity therefore holds for vrious probbilistic models, nd the gol of this pper is to stte result tht holds for s mny distributions s possible. Choosing one specific model my llow more precise nlysis; this is wht the second uthor did in [22], proving tht the verge complexity is O(kn log log n) for the uniform distribution over deterministic nd complete utomt (not necessrily ccessible), but such result cnnot be generlized directly to, for instnce, cyclic utomt. A preliminry version of this work, where some proofs were omitted nd the sttements were less generl, hs been presented in [23]. The pper is orgnized s follows. After reclling the bsics of minimiztion lgorithms in Section 2, we estblish some results on Moore s lgorithm when pplied to utomt tht re lredy miniml in Section 3. Section 4 is devoted to the sttement nd the proof of our min result, strting with description of the probbilistic models under which it holds. In Section 5, we present some extensions nd other models tht do not necessrily stisfy the hypothesis of our result, in order to illustrte the limits of wht cn be done with the techniques introduced in this pper. A conclusion is proposed in Section 6, with some perspectives nd open problems. 2 Preliminries This section is devoted to bsic notions relted to the minimiztion of utomt. We refer the reder to the literture ([2]) for more detils bout this topic. Only few definitions nd results tht will be useful for our purpose re reclled here. 2. Definitions nd nottions A finite deterministic utomton, or deterministic utomton, A = (A,Q,, q 0, F) is quintuple where Q is finite set of sttes, A = {,..., k } is finite set of letters clled lphbet, the trnsition function is function from Q A to Q, q 0 Q is the initil stte nd F Q is the set of finl sttes. An utomton is complete when its trnsition function is totl. The trnsition function cn be extended by morphism to ll the words of A : p ε = p for ny p Q nd for ny u, v A, p (uv) = (p u) v. A word u A is recognized by n utomton when q 0 u F. The set of ll the words recognized by A is denoted by L(A). An utomton is ccessible when for ny stte p Q, there exists word u A such tht q 0 u = p. It is co-ccessible when for ny stte p Q, there exists u A such tht p u F. A trnsition structure is n utomton where the set of finl sttes is not specified. Given such trnsition structure T = (A,Q,, q 0) nd subset F of Q, we denote by (T, F) the utomton (A, Q,, q 0, F). For given deterministic nd ccessible n- stte trnsition structure there re exctly 2 n distinct deterministic nd ccessible 3

utomt tht cn be built from this trnsition structure. Ech of them corresponds to the choice of its set of finl sttes. For ny fixed lphbet A nd ny integer n, we denote by D n the set of ll n- stte deterministic nd ccessible utomt on A nd by T n the set of ll deterministic nd ccessible n-stte trnsition structures on A. We lso define D = n D n nd T = n T n. In the following we only consider deterministic nd ccessible utomt nd deterministic nd ccessible trnsition structures. Consequently, these objects will often just be respectively clled utomt nd trnsition structures. We lso consider, without loss of generlity, tht the set of sttes of n n-stte utomton or trnsition structure is lwys Q = {,..., n}. When stting result on the verge time complexity of Moore s lgorithm, n is implicitly lwys the number of sttes of the utomton, nd k the size of the lphbet. The crdinlity of finite set E is denoted by E. For boolen condition (which we lso cll property) Cond, the Iverson brcket [Cond] is equl to if the condition Cond is stisfied nd 0 otherwise. If P = {E,..., E m} is prtition of set E, the E i s re clled the prts of E. 2.2 Completion of n utomton Moore s lgorithm dels with deterministic ccessible nd complete utomt. Though ll utomt considered in this rticle re deterministic nd ccessible, we will consider in the sequel severl distributions on possibly incomplete utomt. In tht cse, simple preprocessing is needed before pplying stte minimiztion lgorithm. More precisely, if the utomton is not complete, just dd sink stte, which becomes the trget stte of every undefined trnsition. This trnsformtion, which will be clled the completion step in the following, is done in time O(kn), in the worst cse, where k is the size of the lphbet nd n the number of sttes of the utomton. 2.3 The Myhill-Nerode equivlence reltion for complete utomt Let A = (A, Q,, q 0, F) be complete utomton. For ny non-negtive integer i, two sttes p, q Q re i-equivlent, denoted by p i q, when for ll words u of length smller thn or equl to i, [p u F ] = [q u F ]. Two sttes re equivlent when for ll u A, [p u F ] = [q u F ]. This equivlence reltion is clled the Myhill-Nerode equivlence reltion [24], nd is denoted by p q. Recll tht n equivlence reltion defined on the set of sttes Q of n utomton is sid to be right invrint when u A, (p,q) Q 2, p q p u q u. The following proposition summrizes the properties of the Myhill-Nerode equivlence reltion tht will be used in the following sections. Proposition. Let A = (A, Q,, q 0, F) be complete n-stte utomton. The following properties hold:. For ll i N, i+ is prtition refinement of i, tht is, for ll p, q Q, if p i+ q then p i q. 2. For ll i N nd for ll p,q Q, p i+ q if nd only if p i q nd for ll A, p i q. 4

3. If, for some i N, the (i + )-equivlence reltion is equl to the i-equivlence reltion then for every j i, the j-equivlence reltion is equl to the Myhill- Nerode equivlence reltion. 4. If n 2, the (n 2)-equivlence reltion is equl to the Myhill-Nerode equivlence reltion. If n = 0 or n = or if F is either empty or Q, then 0 =. 5. The Myhill-Nerode equivlence reltion is right invrint. For ny complete utomton A D, denote by Nerode(A) the smllest integer m such tht the m-equivlence reltion m is equl to the Myhill-Nerode equivlence reltion. Let A = (A, Q,, q 0, F) be n utomton nd be right invrint equivlence reltion on Q. The quotient utomton of A by is the utomton A/ = (A,Q/,, [q 0], {[f] f F }), where Q/ is the set of equivlence clsses, [q] is the clss of q Q, nd is defined for ny A nd ny q Q by [q] = [q ]. The well-formedness of this definition follows from the right invrince of the equivlence reltion. Theorem. For ny deterministic ccessible nd complete utomton A, the utomton A/ is the unique smllest deterministic nd complete utomton (in terms of the number of sttes) tht recognizes the sme lnguge s the utomton A. The quotient utomton A/ of Theorem is clled the miniml utomton of L(A). The uniqueness of the miniml utomton is up to lbelling of the sttes. Theorem shows tht the miniml utomton is fundmentl notion in lnguge theory: it is the most spce efficient representtion of regulr lnguge by deterministic nd complete utomton, nd its uniqueness defines bijection between regulr lnguges nd miniml utomt. Note tht for our definition, miniml utomton is lwys complete; the lterntive definition, where the miniml utomton must be trim, is lso used in the literture. 2.4 Moore s stte minimiztion lgorithm for complete utomt In this section we describe n lgorithm due to Moore [], which computes the miniml utomton of regulr lnguge represented by deterministic ccessible nd complete utomton. The nlysis of the verge complexity of this lgorithm is the min purpose of this rticle. Recll tht Moore s lgorithm builds the prtition of the set of sttes of the input utomton corresponding to the Myhill-Nerode equivlence reltion. The lgorithm relies minly on Properties 2 nd 3 of Proposition : The prtition π is initilized ccording to the 0-equivlence reltion 0, then in ech itertion the prtition corresponding to the (i+)-equivlence reltion i+ is computed from the one corresponding to the i-equivlence reltion i, using Property 2. The lgorithm stops when no new prtition refinement is obtined, nd the result is the Myhill-Nerode equivlence reltion ccording to Property 3. The miniml utomton cn then be computed from the resulting prtition since it is the quotient utomton of the input utomton by the Myhill-Nerode equivlence reltion. The lgorithm is detiled in Figure 2. Note tht fter i itertions in the min loop of the lgorithm, the reltion i hs been computed, nd π is the ssocited prtition. 5

Moore s lgorithm if F = then 2 return (A, {},,, ) 3 if F = {,..., n} then 4 return (A, {},,, {}) 5 forll p {,..., n} do 6 π [p] := [p F ] 7 π := undefined 8 while π π do 9 π := π 0 compute π from π return the quotient of A by π The computtion of the new prtition is done using the following property on the ssocited equivlence reltions: ( p i q, p i+ q A, p i q. To ech stte p is ssocited signture s[p] such tht p i+ q if nd only if s[p] = s[q]. The sttes re then sorted ccording to their signture, in order to compute the new prtition. The use of lexicogrphic sort yields complexity in Θ(kn) for this prt of the lgorithm. In this description of Moore s lgorithm, denotes the function such tht = for ll A. Lines -4 correspond to the specil cses where F = or F = Q. In the process, π is the new prtition nd π the former one. Lines 5-6 re the initiliztion of π to the prtition of 0, π is initilly undefined. Lines 8-0 form the min loop of the lgorithm where the new prtition is computed, using the second lgorithm below. The number of itertions of Moore s lgorithm is the number of times these lines re executed. Computing π from π forll p {,..., n} do s[p] := (π[p], π[p ],..., π[p k ]) 2 3 compute the permuttion σ tht sorts the sttes ccording to s[ ] 4 i := 0 5 π [σ()] := i 6 forll p {2,..., n} do 7 if s[σ(p)] s[σ(p )] then 8 i := i + 9 0 π [σ(p)] := i return π Figure 2: Description of Moore s lgorithm. The worst-cse time complexity of Moore s lgorithm is Θ(kn 2 ). Lemm below is more precise sttement tht will be used in the proof of the min theorem (Theorem 2). If A D, then the number of itertions of the min loop when Moore s lgorithm is pplied to A, denoted by Moore(A), is directly relted to Nerode(A), s stted in the following lemm. Lemm. For ny utomton A of D n, the following properties hold: The number of itertions Moore(A) of the min loop in Moore s lgorithm is equl to 0 if L(A) = or L(A) = A nd is equl to Nerode(A) + otherwise. Moore(A) is lwys less thn or equl to n. If L(A) nd L(A) A, then the time complexity W(A) of Moore s lgorithm pplied to A is Θ(Moore(A)kn). Proof. If F is empty or equl to {,..., n}, then Nerode(A) = 0, nd the time complexity to compute the size of F is Θ(n). 6

A A A 2... A A n n Figure 3: The miniml utomton of the lnguge A n A, for n 3. The sttes nd 2 re (n 3)-equivlent, but not (n 2)-equivlent: Moore s lgorithm performs n itertions before hlting. The loop is iterted exctly Nerode(A)+ times when the set F of finl sttes is neither empty nor equl to {,..., n}, becuse the lgorithm needs one more itertion to obtin tht π = π. Moreover, by Property 4 of Proposition, Nerode(A) is less thn or equl to n 2. The initiliztion nd the construction of the quotient utomton re both done in Θ(kn). The complexity of ech itertion of the min loop is in Θ(kn): this cn be chieved using lexicogrphic sort lgorithm, nd yields the nnounced result for W(A). Lemm gives proof tht the worst-cse complexity of Moore s lgorithm is O(kn 2 ), s there re no more thn n itertions in the process of the lgorithm, for n lrge enough. More precisely, the worst-cse complexity of the lgorithm is Θ(kn 2 ); this cn be shown using the utomt depicted in Figure 3. When the utomton tht must be minimized is not complete, the completion step described in Section 2.2 is pplied before running Moore s lgorithm. The time complexity of the completion step followed by Moore s lgorithm is of the sme order of mgnitude s the one of the stte minimiztion lone. 3 Moore s lgorithm on miniml utomt Before nlyzing the verge behvior of Moore s lgorithm, which is the min purpose of this pper, we estblish two results on wht hppens when it is used on miniml utomt. First, we prove tht the number of itertions of Moore s lgorithm depends only on the recognized lnguge, nd therefore it is the sme for ll deterministic ccessible nd complete utomt recognizing the sme lnguge. Next we estblish lower bound of the number of itertions of Moore s lgorithm when it is pplied to miniml utomt, which will be useful in the forthcoming discussions. Lemm 2. The number of itertions of Moore s lgorithm pplied to ny deterministic ccessible nd complete utomton is equl to the number of itertions of this lgorithm when it is pplied to the ssocited miniml utomton. Proof. Let A = (A, Q,, q 0, F) be the utomton nd A min = (A, Q/,,[q 0], F ) be the ssocited miniml utomton. If the lnguge recognized by A nd A min is either A or, by Lemm we hve Moore(A) = Moore(A min) = 0. Otherwise, by Lemm, Moore(A) = Nerode(A) +. Moreover, by definition one hs n o Nerode(A) = min i 0 (p,q) Q 2 : p q u A i : [p u] [q u]. 7

Since by definition p q if nd only if [p] [q] nd since for ll p Q nd ll u A, [p u] = [[p] u], one cn write n o Nerode(A) = min i 0 (p,q) Q 2 : [p] [q] u A i : [[p] u] [[q] u]. Thus Moore(A) = Moore(A min), concluding the proof. According to the previous lemm, it is interesting to study the behvior of Moore s lgorithm when pplied to miniml utomt. The worst-cse complexity of the lgorithm is still Θ(kn 2 ), since the utomton depicted in Figure 3 is miniml. Since ll the sttes of miniml utomton re lone in their equivlence clss, minimum number of itertions in the lgorithm is required to distinguish ll of them, s proved in the following proposition. Proposition 2. Moore s lgorithm pplied to miniml n-stte utomton hs complexity in Ω( k nlog log n) for n lphbet of size k 2 nd in Ω(nlog n) for log k one-letter lphbet. Proof. The lgorithm ends when ech stte of the miniml utomton A is isolted in prt of the prtition, nd needs one more itertion to find out tht the prtition hs not chnged. The number of prts is equl to the number of sttes in A. For ny integer i nd ny stte p, consider the mpping φ (i) p : A i {0, } defined by φ p (i) (u) = [p u]. Since there re k j words of length j, the number of distinct words of length t most i, for fixed integer i, is i k j = j=0 ( k i+ k when k 2, i + when k =. Therefore, there re t most 2 ki+ k (resp. 2 i+ ) distinct φ (i) p, for finite lphbets of size t lest two (resp. equl to one). Since p i q if nd only if φ (i) p = φ (i) q, there re t most 2 ki+ k (resp. 2 i+ ) distinct prts in the prtition t the i-th itertion of Moore s lgorithm. When n 2, the set of finl sttes of the miniml utomton A is non trivil nd the lgorithm hlts one itertion fter the n prts hve been computed. Hence 8 < n 2 kmoore(a) k when k 2, : n 2 Moore(A) when k =, concluding the proof, since the cost of n itertion is Θ(kn). 4 Averge cse nlysis 4. Probbilistic Model Our min theorem is estblished for fmily of distributions tht we cll Bernoulli model on utomt. We define them formlly in this section. Since we re deling with finite sets only, every universe on which probbilities re defined is lso finite; probbility lw on such finite universe U cn be defined by probbility mss function p : U [0, ], tht is, function such tht P x U p(x) =. The ssocited probbility lw, tht we lso denote by p, is defined for ll U by p() = x p(x). 8

Recll tht every utomton A D n cn be seen s pir (T A, F A), where T A T n is trnsition structure nd F A {,..., n} is set of finl sttes. If for given non-empty finite set E, we choose subset of E by selecting every element of E with probbility γ, where γ (0,), we get probbility on subsets of E, which is formlly described in the following definition. Definition. Let E be non-empty finite set. For ny γ (0,), the probbility r defined on subsets of E by r() = γ ( γ) E is clled the Bernoulli distribution of prmeter γ on elements of E. Definition 2. For ny n, probbility p defined on D n is Bernoulli model when there exists probbility q defined on T n nd rel number γ (0, ) such tht, for ny A D n, p(a) = q(t A) r(f A), with A = (T A, F A), where r is the Bernoulli distribution of prmeter γ on sttes. This mens tht the trnsition structures follow ny probbility lw q on T n, nd tht ech stte is finl ccording to Bernoulli lw of prmeter γ, independently from the other sttes nd from the trnsition structure. If we wnt to specify the prmeter, we shll sy tht p is Bernoulli model of prmeter γ. Since we re interested in the symptotic complexity of n lgorithm, we re working on sequence of probbilities, one for ech D n, with n. We cn void too much formlism using the following definition. Definition 3. Let γ (0, ). Let p : D [0, ] be mpping such tht for ny n, the restriction of p to D n is Bernoulli model of prmeter γ. Then p is Bernoulli model on D (of prmeter γ). Note tht it is importnt in the bove definition tht γ is fixed nd therefore does not depend on n. In nlysis of lgorithms, one is often interested in uniform distributions on inputs or on subfmilies of inputs. A uniform distribution on non-empty finite set E is probbility p such tht, for ny e E, p(e) = / E. Becuse of the required independency between trnsition structures nd sets of finl sttes in Definition 2, the uniform distribution on subset E of D n is not lwys Bernoulli model. Nonetheless, s stted in the following lemm, Bernoulli models cn be obtined by restricting the llowed trnsition structures. Lemm 3. Let P be property defined on T. For ny n, let E n D n be the subset of n-stte utomt whose trnsition structures stisfy P. For ny n such tht E n, the uniform distribution on E n is Bernoulli model. Proof. Let p be the probbility defined for ny A D n, with A = (T A, F A), by p(a) = [P(T A )] t n 2 n, where t n is the number of trnsition structures in T n tht stisfy P. Then p is the uniform distribution on E n nd it is Bernoulli model with q(t) = [P(T)]/t n nd γ = 2. Acyclic utomt, strongly connected utomt, group utomt, etc. re exmples of fmilies of utomt tht re defined by property on the trnsition structures only. As consequence, the uniform distribution on such clss of utomt is Bernoulli model. 9

4.2 Min Result The min result is the following: Theorem 2. For ny Bernoulli model on D, the verge time complexity of Moore s stte minimiztion lgorithm, possibly preceded by completion step, is O(knlog n). As consequence of Theorem 2 nd Lemm 3, we hve the following corollry: Corollry. The verge complexity of Moore s stte minimiztion lgorithm, possibly preceded by completion step, is O(knlog n) for the following distributions: The uniform distribution on deterministic nd ccessible utomt. The uniform distribution on deterministic, ccessible nd complete utomt. The uniform distribution on deterministic, ccessible nd cyclic utomt. The uniform distribution on deterministic nd ccessible inverse utomt (the ction of ech letter is prtil injection on the set of sttes). Any of the bove, using Bernoulli model of fixed prmeter γ (0,) for the sets of finl sttes. A typicl exmple tht does not meet the condition of Theorem 2 is the uniform distribution on complete nd co-ccessible utomt, since the co-ccessibility condition depends on the set of finl sttes (see Section 5.4 for more detils). 4.3 Outline of the proof The proof of Theorem 2 cn be summrized informlly s follows. We first consider fixed n-stte complete trnsition structure T. We estblish necessry conditions for set of finl sttes F to be such tht Moore s lgorithm requires t lest l itertions when pplied to the utomton (T, F). Under Bernoulli model, the probbility tht n utomton stisfies these conditions is proved to be exponentilly smll in l. Therefore, for good choice of l = Θ(log n), we cn prove tht the probbility for set of finl sttes F to induce more thn l itertions in Moore s lgorithm is O( n ): the contribution to the verge vlue of such sets is negligible. Hence most of the time, less thn l itertions re performed before the lgorithm hlts. This is stted in Proposition 3 nd Proposition 4. Moreover, the upper bound obtined for the verge number of itertions does not depend on the trnsition structure T. Therefore, since the distribution of trnsition structures nd sets of finl sttes re independent under Bernoulli model, simple computtion using the uniform bound completes the proof of Theorem 2. 4.4 Comptible prtitions to obtin t lest l itertions In this section, we introduce some definitions nd preliminry results tht will be used in the min proof. The notion of comptible prtition will be of gret importnce in the following. Definition 4. Let E be non-empty finite set nd P = {E,..., E m} be prtition of E. A subset of E is comptible with P when it is union of prts of P: there exists I {,..., m} such tht = S i I Ei. 0

Let T be fixed complete trnsition structure of T n nd l be n integer such tht l < n. Let lso p, q, p, q {,..., n} be four sttes of T. Define F l (p,q, p, q ) s the set of sets of finl sttes F for which in the utomton (T, F) the sttes p nd q re (l )-equivlent, but not l-equivlent, becuse of word of length l mpping p to p nd q to q, where p nd q re not 0-equivlent. In other words F l (p, q, p, q ) is the following set: F l (p,q, p, q ) = {F {,..., n} for the utomton (T, F), p l q nd [p F ] [q F ] nd u A l,(p u = p nd q u = q )}. We ssume for the discussion below tht F l (p, q, p, q ) is not empty; the cses where it is empty re trivil nd re hndled esily. We build prtition P l (p,q, p, q ), denoted P l for short, tht represents necessry conditions for set of sttes to belong to F l (p, q, p, q ). Let u = u... u l, with u i A, be the smllest (for the lexicogrphic order) word of length l such tht p u = p nd q u = q. For every i {0,..., l}, we build prtition P i of the set of sttes {,..., n} in the following wy: P 0 = {{},..., {n}} is the prtition into n prts, where ech stte is lone in its prt. For ny i {0,..., l }, the prtition P i+ is obtined from P i by merging the prts of the sttes p v nd q v, where v is the prefix of length i of u: if E is the prt of p v nd E the prt of q v, P i+ is obtined from P i by removing the prts E nd E nd by dding the prt E E. Note tht if p v nd q v re in the sme prt, then P i+ = P i, but we will show tht it cnnot hppen. Lemm 4. If F l (p, q, p, q ), then the prtition P l (p, q, p, q ) hs exctly n l prts, nd every element of F l (p,q, p, q ) is comptible with P l (p, q, p, q ). Proof. Let (p i) 0 i l nd (q i) 0 i l denote the sequences of sttes such tht for every i {0,..., l}, p i = p v nd q i = q v, where v is the prefix of length i of u. In prticulr, p 0 = p, q 0 = q, p l = p nd q l = q. Note tht for every F F l (p, q, p, q ) nd every i {0,..., l }, p i l i q i but p i l i q i, since by definition p l q nd p l q. Therefore we cn prove by induction on i {0,..., l } tht if x nd y re in the sme prt of P i then x l i y, in ny utomton (T, F) such tht F F l (p,q, p, q ): Since P 0 contins only trivil prts, it is true for i = 0. For the induction step, we prove tht if it is true t rnk i {0,..., l 2}, then it is lso true t rnk i +. Indeed, let x nd y be in the sme prt of P i+. If x nd y re lso in the sme prt of P i, the induction hypothesis pplies, x l i y nd therefore x l (i+) y. Otherwise, x nd y re in different prts of P i, which mens tht in P i, x is in the sme prt s p i nd y is in the sme prt s q i (or we swp x nd y by symmetry); by induction hypothesis, x l i p i nd y l i q i. Hence x l (i+) p i nd y l (i+) q i, nd since p i l i q i, we obtin tht x l (i+) y, concluding the proof by induction. The property shown bove proves tht p i nd q i re not in the sme prt of P i, since they re not (l i)-equivlent, for ny choice of set of finl sttes F F l (p,q, p, q ). Therefore, for every i {0,..., l }, P i+ P i. Hence, direct induction shows tht the number of prts in P i is exctly n i, for ny i {0,..., l}.

Moreover, if x nd y re in the sme prt of P l, we hve proved tht x 0 y for ny F F l (p, q, p, q ). This mens tht both x nd y re in F or neither of them re in F. Therefore F is union of prts of P l nd F is comptible with P l. Figure 4 illustrtes the proof of Lemm 4 with the construction of grph. This is the wy the min proof ws done in [23]. b b b b b 2 3 4 5 b 6 7 8 9,b b b bb bb 2 3 ε 6 7 4 8 5 9 b b () b (b) Figure 4: Illustrtion of Lemm 4 for n = 9, l = 5, p = 3, q = 7, p = 3 nd q = 8. () u = bb is the smllest word of length 5, for the lexicogrphic order, such tht 3 u = 3 nd 7 u = 8. The set F 5 (3, 7, 3, 8) is not empty, since it contins t lest {4, 8}. The bold trnsitions re the ones followed when reding u from p nd from q. (b) For every prefix v of u, with v u, we put n edge between p v nd q v. The prtition P l corresponds to the connected components of the resulting grph: two sttes in the sme connected component must be either both finl or both not finl, for the utomton to be in F l (p, q, p, q ). 4.5 Min proof In this section, we present the proof of our min theorem. We consider seprtely the cse of complete nd incomplete trnsition structures. 4.5. Complete trnsition structures Lemm 5. Let r be Bernoulli distribution of prmeter γ (0, ) on elements of non-empty finite set E. Let P be prtition of E in m prts. The probbility, under r, tht subset of E is comptible with P is t most β n m, where β = mx(γ, γ). Proof. Let P = {E,..., E m}. Since every comptible with P is union of prts of the prtition, such n is determined by choosing the subset I of {,..., m} stisfying = i IE i. Furthermore, using properties of the Bernoulli model, we cn work on ech E i independently: for every i {,..., m}, either E i = or E i ; the probbility tht the elements of E i re ll in is γ E i, nd the probbility tht they ll re not in is ( γ) E i. With β = mx(γ, γ), the probbility of hving either event is therefore γ E i + ( γ) E i γβ E i + ( γ)β E i = β E i. Therefore, by independency, the probbility tht is comptible with P is bounded from bove by Q m i= β E i = β n m. 2

Proposition 3 (Complete trnsition structures). Let k, n nd let T T n be complete trnsition structure over k-letter lphbet. For the Bernoulli distribution of prmeter γ on finl sttes, the verge number of itertions of the min loop of Moore s lgorithm pplied to (T, F) is bounded from bove by 5log β n + 2, where β = mx(γ, γ). Proof. Denote by F l the set of sets of finl sttes such tht the execution of Moore s lgorithm on (T, F) requires more thn l itertions. Equivlently, A F l if nd only if Nerode(A) l, by Lemm. A necessry nd sufficient condition for F to be in F l is tht there exists two sttes p nd q such tht p l q nd p l q. Therefore, there is word u of length l such tht [p u] [q u]. Hence F F l (p, q, p u, q u) nd [ F l = F l (p,q, p, q ). p,q,p,q {,...,n} In this union the sets F l (p,q, p, q ) re not disjoint, but this chrcteriztion of F l is precise enough to obtin useful upper bound for the probbility of belonging to F l. By Lemm 4, for every p,q, p, q {,..., n}, every F F l (p, q, p, q ) is comptible with prtition P l (p, q, p, q ) into n l prts. Let r be the Bernoulli distribution of prmeter γ on {,..., n}. By Lemm 5 we hve r(f l ) r(f l (p, q, p, q )) n 4 β l. () p,q,p,q {,...,n} Moreover, the verge number of itertions of the min loop of Moore s lgorithm is by definition r(f) Moore(T, F) = r(f) Moore(T, F) + r(f) Moore(T, F), F {,...,n} F F <l F F l where F <l is the complement of F l in the set of ll subsets of {,..., n}. By Lemm, for ny F F <l, Moore(T, F) l. Therefore, r(f) Moore(T, F) l r(f) l. F F <l F F <l Bounding Moore(T, F) from bove by n when F F l (see Lemm ) nd estimting r(f l ) with Eqution (), we get tht F F l r(f) Moore(T, F) n 5 β l. Finlly, choosing l = 5 log β n, we obtin tht F {,...,n} This concludes the proof. r(f) Moore(T, F) 5log β n + n 5 β 5 log β n 5log β n + 2. 3

4.5.2 Incomplete trnsition structures Recll tht before pplying Moore s lgorithm to n incomplete utomton, sink stte which is not finl is dded, s described in Section 2.2. Strting from such n n-stte utomton A = (T, F), the result is n (n + )-stte complete utomton A = (T, F), where T is complete. The proof for incomplete trnsition structures is roughly the sme s before, but the distribution on set of finl sttes hs chnged, since the new sink stte is lwys non-finl: though very similr, this is not Bernoulli distribution nymore. Let r be the Bernoulli distribution of prmeter γ on elements of {,..., n}. We denote by r the probbility it induces on {,..., n+}, when sets contining n+ hve probbility zero: for ny {,..., n+}, r() = r() if n+ / nd r() = 0 if n+. Hence if we fix T T n nd consider the utomton A = (T, F), where the finl sttes of F re distributed following r, the finl sttes of the utomton A re distributed following r. We first estblish result similr to Lemm 5. Lemm 6. Let r be Bernoulli distribution of prmeter γ (0, ) on elements of {,..., n}, for n. Let P be prtition of {,..., n + } into m prts. The probbility, under r, tht subset of {,..., n + } is comptible with P is t most β n+ m, where β = mx(γ, γ). Proof. Let P = {E,..., E m} nd ssume without loss of generlity tht n + E. Since for r, n+ cnnot be in subset hving positive probbility, it is necessry tht E = for rndom tht is comptible with P. This hppens with probbility ( γ) E. For the remining elements, observe tht r induces n independent Bernoulli distribution on {,..., n} \ E, tht must be comptible with the prtition {E 2,..., E m}. By Lemm 5, the probbility of this event is bounded from bove by β E 2 +...+ E m (m ). By independency, is comptible with P with probbility bounded from bove by ( γ) E β E 2 +...+ E m (m ) β n+ m. Proposition 4 (Incomplete trnsition structures). Let k, n nd let T T n be n incomplete trnsition structure over k-letter lphbet. For the Bernoulli distribution of prmeter γ on finl sttes, the verge number of itertions of the min loop of Moore s lgorithm pplied to (T, F), where T is obtined by completing T, is bounded from bove by 5log β (n + ) + 2. Proof. The proof mimics the one of Proposition 3, but with n + insted of n, since we hve the dditionl sink stte (the bound obtined in Lemm 6 is comptible with the n + shift). The finl upper bound is therefore 5log β (n + ) + 2, concluding the proof. 4.5.3 Proof of Theorem 2 We hve ll the ingredients to prove our min theorem. Proof. Let C n nd C n respectively denote the sets of complete nd incomplete trnsition structures of T n. If p is Bernoulli model on D of prmeter γ, then by definition, for every (T, F) D n, p((t,f)) = q(t) r(f) for probbility q over T n nd where r is Bernoulli model 4

of prmeter γ on elements of {,..., n}. The verge number of itertions in Moore s lgorithm, for n-stte utomt is therefore p(a) Moore(T, F) + p(a) Moore(T, F), (T,F) D n T C n (T,F) D n T C n where T is the complete utomton ssocited with T. For complete utomt, we hve p(a) Moore(T, F) = q(t) (T,F) D n T C n T C n F {,...,n} r(f) Moore(T, F). By Proposition 3, the ltter sum is bounded from bove by 5log β n + 2, hence by 5log β (n + ) + 2. Moreover, P T C n q(t) = q(c n), therefore p(a) Moore(T, F) q(c n) 5log (n + ) + 2. β (T,F) D n T C n For incomplete utomt, recll tht the definition of r is given in Section 4.5.2, nd we hve p(a) Moore(T, F) = q(t) r(f) Moore(T, F). T C n F {,...,n+} (T,F) D n T C n By Proposition 4, we obtin p(a) Moore(T, F) q(c n) 5log (n + ) + 2 β. (T,F) D n T C n Therefore, since q(c n) + q(c n) =, the verge number of itertion is O(log n), nd by Lemm, the verge complexity of Moore s lgorithm is bounded from bove by O(knlog n), concluding the proof. 5 Additionl results In this section we nlyze severl specific distributions on utomt, to emphsize the limits of the method presented in this pper. 5. Vritions on Bernoulli models In fct, Theorem 2 cn be estblished for more generl distributions of utomt. But this requires hevier formlism, describing new fmilies of distributions tht resemble Bernoulli models lot. The min point is tht the proofs of Proposition 3 nd Proposition 4 rely on properties formlized in Lemm 5 nd Lemm 6: for the considered distributions of finl sttes, the probbility tht size-n set of finl sttes is comptible with given prtition P with m prts is exponentilly smll in m. Hence, the proof of Theorem 2 cn redily be dpted whenever the probbilistic model on D stisfies: i. The trnsition structures nd the set of finl sttes re chosen independently. 5

ii. The trnsition structures follow ny distribution on T. iii. The probbility r on sets of finl sttes stisfies the following property: there exist α > 0 nd β (0, ) such tht, for ny prtition P = {E,..., E m} of {,..., n}, the probbility tht {,..., n} is comptible with P is t most αβ n m. The bounds given in Proposition 3 nd Proposition 4 chnge bit, by some dditive constnt terms depending on α nd β. As n exmple, consider the uniform distribution r on non-trivil subsets of {,..., n}: For n =, let r({}) = r( ) = ; for n 2, define for ny {,..., n}, 2 ( 0 if = or = {,..., n}, r() = 2 n 2 otherwise. Let us estblish property iii. for this distribution. For ny prtition P in m prts of {,..., n}, denote by C P the set of subsets of {,..., n} tht re comptible with P. Note tht C P nd {,..., n} C P. Hence, for n 2, By Lemm 5 pplied with γ = 2, Therefore, for ny n 2, r() = CP 2 2 n 2 CP 2 n 2. C P C P 2 n = CP 2 n r() 2 n 2 n 2 C P «n m. 2 «n m 2 2 «n m. 2 Hence, the uniform distribution on utomt with non-trivil sets of finl sttes stisfies the condition i., ii. nd iii. bove, with α = 2 nd β =. The verge complexity 2 of Moore s lgorithm is O(knlog n) for this distribution too. 5.2 Unry utomt In the reminder, we will use the uniform probbilistic model on complete unry utomt. It is quite simple nd well-known [7], nd therefore useful to design exmples or counterexmples. In this section we recll some bsic fcts bout these unry utomt nd their verge properties. An utomton is unry utomton when it is defined on one-letter lphbet. We fix one-letter lphbet A = {} nd denote by U the set of complete utomt on A, nd by U n the set of the n-stte utomt of U. As described in [7], in the trnsition structure of complete n-stte unry utomton U over the lphbet {}, the n sttes re q i = q 0 i, for i {0,..., n }, nd the trnsition structure is determined by the choice of q c = q n. The prt {q 0,..., q c }, which cn be empty if c = 0, is clled the queue of the utomton, nd the prt {q c,..., q n } is its cycle. Tking into ccount the n! distinct wys to lbel the sttes, the number of distinct lbelled trnsition structures in U n is n n!. Thus U n = n2 n n!. For the uniform distribution on U, the probbility of ny n-stte utomton is therefore =. U n n2 n n! We will use the following result: 6

Proposition 5 ([7]). For the uniform distribution on U, the probbility for n-stte utomton to be miniml is symptoticlly equivlent to 2. 5.3 Tightness for unry utomt nd lower bound for the model In this section we prove tht the bound O(knlog n) is optiml for the uniform distribution on U, nd for similr distributions when k 2. Proposition 6. For the uniform distribution on deterministic ccessible nd complete unry n-stte utomt, the verge time complexity of Moore s stte minimiztion lgorithm is Θ(nlog n). Proof. By Theorem 2, nd since k =, the verge time complexity is O(nlog n). By Proposition 2, there exists positive constnt C > 0 such tht, for ny n, the complexity of Moore s lgorithm pplied to miniml n-stte unry utomton is t lest Cnlog n. Let m n denote the number of miniml n-stte unry utomt. Tking into ccount the contribution of miniml utomt only, the verge complexity of Moore s lgorithm is bounded from below by m n U Cnlog n Cnlog n, n 2 where the equivlence follows from Proposition 5. Hence, the verge complexity is Ω(nlog n), concluding the proof. An importnt consequence of Proposition 6 is tht Theorem 2 is optiml without further conditions on the probbilistic model: For k =, this is the cse for the uniform distribution on U, by Proposition 6. For k 2, let U be the set of complete utomt on A, such tht for every stte p, for every letters, b A, p = p b. Hence, n element of U is complete unry utomton, whose trnsitions hve been duplicted. By Lemm 3, the uniform distribution on U is Bernoulli model. Moreover, we get the following result s consequence of Proposition 6: Corollry 2. For ny k-letter lphbet A, with k 2, the verge time complexity of Moore s lgorithm for the uniform distribution on U is Θ(knlog n). Proof. Ech utomton of U cn be seen s n element of U whose trnsitions hve been duplicted. The process of Moore s lgorithm pplied to such n utomton uses exctly the sme number of itertions s if performed on the ssocited element in U. Since the induced distribution on ssocited utomt is the uniform distribution on U, Proposition 6 holds, the cost being multiplied by k becuse ech itertion costs k times s much instructions s in the unry cse. Theorem 2 gives the upper bound, concluding the proof. 5.4 An exmple where trnsition structures nd sets of finl sttes re not independent: co-ccessible utomt In this section we consider the uniform distribution on complete nd co-ccessible utomt. This probbilistic model is not Bernoulli model, nor simple version of Bernoulli model, since trnsition structures nd sets of finl sttes re not independent: n exmple of two 2-stte trnsition structures hving different impossible sets of finl sttes is depicted in Figure 5. However, the verge complexity of Moore s lgorithm is still O(kn log n). The proof we propose below is bsed on the specific shpe of typicl trnsition structure 7

2 2 Figure 5: On the left, the sets of finl sttes nd {} re not possible for the utomton to be co-ccessible. On the right, only the empty set is not llowed. under the uniform distribution on T n. The key rgument is tht the proportion of coccessible utomt mongst complete ones is not negligible, which is consequence of result by Korshunov [25]: Theorem 3 ([25]). For ny lphbet A of size k 2, there exists rel constnt 0 < c k <, which only depends on k, such tht for the uniform distribution on complete trnsition structures, the probbility for trnsition structure to be strongly connected tends to c k s the number of sttes tends to infinity. The result of this section is the following. Proposition 7. For the uniform distribution on complete nd co-ccessible utomt, the verge time complexity of Moore s stte minimiztion lgorithm is O(knlog n). Proof. Let C n D n denote the set of complete n-stte utomt, nd let A n C n denote the set of complete nd co-ccessible n-stte utomt. For l, let A <l n (resp. A l n ) denote the subset of A n consisting of the utomt A such tht Moore(A) l (resp. Moore(A) > l), s in the proof of Proposition 3. First, note tht A n = Θ( C n ): For k =, n element of C n = U n is in A n if nd only if its cycle contins t lest one finl stte. Therefore, if q n = q c, the utomton is not co-ccessible if nd only if the n c sttes in the cycle re not finl. Hence, n C n \ A n = n! 2 c = (2 n )n! = o( C n ). c=0 For k 2, this is consequence of Theorem 3: if trnsition structure is strongly connected then ny choice of set of finl sttes but the empty set leds to coccessible utomton. Hence, if S n denotes the number of strongly connected elements of C n, then there re t lest ( 2 n )S n co-ccessible elements in C n, the sttement follows since S n = Θ( C n ) by Theorem 3. The uniform distribution on C n is Bernoulli model on utomt which re complete, hence the result of Proposition 3 holds. In the proof, it is shown tht for such distribution nd for l = 5log 2 n, the probbility tht Moore(A) > l is O( ). n Since we re considering uniform distribution, probbilities re directly relted to crdinls, so tht the number of n-stte utomt A of C n such tht Moore(A) > l is in O( Cn ), for l = 5log n 2 n. Hence A l n is O( Cn ). n Therefore, since every element of A n hs probbility A n under the uniform distribution, nd since Moore(A) n, the verge number of itertions for l = 5log 2 n 8

is A n Moore(A) = A A A n n n A<l A A <l n Moore(A) + A n n A l + n A l l + n A n n A n O A A l n n Cn Moore(A) «. Hence, since A n = Θ( C n ) we get concluding the proof. A n A A n Moore(A) l + O() = O(log n), 5.5 Unry utomt with exctly one finl stte Under Bernoulli model, utomt tend to hve lrge number of finl sttes. It is nturl to wonder wht hppens when Moore s lgorithm is pplied to utomt with smll number of finl sttes; the proposition below proves tht we cnnot expect to lwys hve O(knlog n) bound for such models. Proposition 8. For the uniform distribution on complete unry utomt with exctly one finl stte, the verge time complexity of Moore s stte minimiztion lgorithm is Θ(n 2 ). Proof. We use the nottions of Section 5.2. Let A be n element of U n, with q c = q n, tht hs only one finl stte q f. First note tht there re n 2 n! such utomt: n choices for c nd f nd n! wys to lbel the sttes with {,..., n}. Assume tht f 2. Then the sttes q 0 nd q stisfy q 0 f 2 q but q 0 f q, since the sttes q 0,..., q f re not finl nd q f is. Hence, for such n utomton, Moore(A) f. Therefore, the verge number of itertions for n-stte utomt with one finl stte, for the uniform distribution, is n 2 n! (T,F) U n F = Moore(A) n n f = Θ(n). n 2 c=0 f=2 We used the fct tht there re exctly n! such utomt for given c nd f. 6 Conclusion nd open problems We hve seen tht Moore s stte minimiztion lgorithm hs n verge complexity O(kn log n) in mny situtions. Its verge time complexity therefore mtches the worst-cse complexity of the best known minimiztion lgorithm for complete utomt, due to Hopcroft. One my wonder if we re in sitution like quicksort versus optiml sorting lgorithms, where the best worst-cse lgorithms re not lwys the best choices. In our sitution there is no evidence of such phenomenon; Hopcroft s lgorithm is closely relted to Moore s lgorithm, s stted in [9], nd might therefore be fst when Moore s lgorithm is. We hve lso seen tht our result cnnot be improved without dding new conditions on the probbilistic model. Assuming uniformity on complete trnsition structures, the second uthor proved O(kn log log n) behvior in [22]. An open question 9

here is to prove tht this result lso holds for ccessible nd complete trnsition structures, the combintorics behind this problem being much more difficult when the utomt re ccessible. 20 8 Number of itertions 6 4 2 0 8 6 4 Moore Stndrd Devition 2 0 000 2000 3000 4000 5000 6000 7000 8000 9000 0000 Size of Automt Figure 6: Experimentl study of the verge number of itertions in Moore s lgorithm for the uniform probbilistic model over deterministic ccessible nd complete utomt with only one finl stte. For ech size, the vlues re computed from 20000 rndom utomt on 2-letter lphbet. Another open question is rised by Figure 6. Considering the uniform probbilistic model on complete utomt with only one finl stte, on two-letter lphbet, the verge number of itertions seems to be subliner, wheres it is Θ(n) for oneletter lphbet (Proposition 8). This model is not Bernoulli model, so it would be interesting to know whether there re O(log n) verge itertions in this cse lso. Acknowledgment The uthors wish to thnks the nonymous referees for insightful comments nd suggestions. They were supported by the ANR (GAMMA - project BLAN07-2 95422 nd MAGNUM - project ANR-200-BLAN-0204.) References [] Moore, E.F.: Gednken experiments on sequentil mchines. In: Automt Studies. Princeton U. (956) 29 53. [2] Hopcroft, J.E.: An n log n lgorithm for minimizing sttes in finite utomton. Technicl report, Stnford, CA, USA (97) [3] Gries, D.: Describing n lgorithm by Hopcroft. Act Inf. 2 (973) 97 09. [4] Knuutil, T.: Re-describing n lgorithm by Hopcroft. Theor. Comput. Sci. 250(-2) (200) 333 363. [5] Berstel, J., Bosson, L., Crton, O.: Continunt polynomils nd worst-cse behvior of Hopcroft s minimiztion lgorithm. Theor. Comput. Sci. 40(30-32) (2009) 28 2822 [6] Cstiglione, G., Restivo, A., Sciortino, M.: Hopcroft s Algorithm nd Cyclic Automt. In Mrtín-Vide, C., Otto, F., Fernu, H., eds.: Second Interntionl 20

Conference on Lnguge nd Automt Theory nd Applictions (LATA 2008). Volume 596 of Lecture Notes in Computer Science., Springer (2008) 72 83. [7] Cstiglione, G., Restivo, A., Sciortino, M.: On Extreml Cses of Hopcroft s Algorithm. Theor. Comput. Sci 4(38-39) (200) 344 3422 [8] Blum, N.: An O(n log n) Implementtion of the Stndrd Method for Minimizing n-stte Finite Automt. Inf. Process. Lett. 57(2) (996) 65 59. [9] Lothire, M.: Applied Combintorics on Words. Volume 05 of Encyclopedi of mthemtics nd its pplictions. Cmbridge University Press. (2005) [0] Vlmri, A., Lehtinen, P.: Efficient Minimiztion of DFAs with Prtil Trnsition Functions. In Albers, S., Weil, P., eds.: 25th Annul Symposium on Theoreticl Aspects of Computer Science (STACS 2008). Volume 0800 of Dgstuhl Seminr Proceedings., Interntionles Begegnungs- und Forschungszentrum fuer Informtik (IBFI), Schloss Dgstuhl, Germny (2008) 645 656. [] Bel, M.P., Crochemore, M.: Minimizing incomplete utomt. In: Seventh Interntionl Workshop on Finite-Stte Methods nd Nturl Lnguge Processing (FSMNLP 08). (2008) 9 6. [2] Hopcroft, J.E., Ullmn, J.D.: Introduction to Automt Theory, Lnguges nd Computtion. Addison-Wesley (979) [3] Brzozowski, J.A.: Cnonicl regulr expressions nd miniml stte grphs for definite events. In: Symposium on the Mthemticl Theory of Automt. Volume 2., Polytechnic Institute of Brooklyn, New York, Polytechnic Press (962) 529 56. [4] Chmprnud, J.M., Khorsi, A., Prnthoen, T.: Split nd join for minimizing: Brzozowski s lgorithm. In: The Prgue Stringology Conference 02. (2002) 96 04. [5] Wtson, B.W.: A txonomy of finite utomt minimiztion lgorithms. Technicl Report of Fculty of Mthemtics nd Computer Science, Eindhoven University of Technology, The Netherlnds (994) [6] Revuz, D.: Minimistion of cyclic deterministic utomt in liner time. Theor. Comput. Sci. 92() (992) 8 89. [7] Nicud, C.: Averge stte complexity of opertions on unry utomt. In Kutylowski, M., Pcholski, L., Wierzbicki, T., eds.: 24th Interntionl Symposium on Mthemticl Foundtions of Computer Science 999 (MFCS 99). Volume 672 of Lecture Notes in Computer Science., Springer (999) 23 240. [8] Bel, M.P., Crochemore, M.: Minimizing locl utomt. In G. Cire, M.F., ed.: IEEE Interntionl Symposium on Informtion Theory (ISIT 07). (2007) 376 380. [9] Bssino, F., Nicud, C.: Enumertion nd rndom genertion of ccessible utomt. Theor. Comput. Sci. 38 (2007) 86 04. [20] Bssino, F., Dvid, J., Nicud, C.: REGAL: librry to rndomly nd exhustively generte utomt. In: 2th Interntionl Conference Implementtion nd Appliction of Automt (CIAA 2007). Volume Lecture Notes in Computer Science 4783. (2007) 303 305. [2] Bssino, F., Dvid, J., Nicud, C.: Enumertion nd rndom genertion of possibly incomplete deterministic utomt. Pure Mthemtics nd Applictions 9 (200) 6 2