Title: CIRCULAR WORDS AND AUTOMATA MINIMIZATION
1CIRCULAR WORDS AND AUTOMATA MINIMIZATION
- G. Castiglione, A. Restivo, M. Sciortino
- University of Palermo
WORDS 2007, Marseille 17-21 september 2007
2Contents
- Circular words
- Circular standard words
- Hopcrofts algorithm for the minimization of a
finite states automaton - Cyclic automaton
- Fibonacci finite words and tightness of the
Hopcrofts algorithm.
3Circular words
- A0,1 binary alphabet.
- u,v ? A conjugate ? z,w in A s.t. vzw and
uwz - conjugation is an equivalence relation let w ?
A, - by (w) we denote the class of all the
conjugates of the word w and we call it circular
word - a factor of (w) is a factor of ww of length not
greater than w - u is a special factor of (w) if both u0 and u1
are factors of (w).
Example
00 is a special factor
(01001100)
4Circular standard words 1
- Recall the notion of standard word
- d1, d2,,dn, a sequence of natural integers
d10, digt0 - snn0 sequence of words over A0,1 where
- s10, sn1 sndn sn-1 for n
1 - Each finite word sn is called standard word.
- (d1, d2,,dn, ) directive sequence
- (1,1,,1,) corresponds to Fibonacci words.
- (w) is a circular standard word if w is a
standard word.
5Circular standard words 2
- Proposition. Let v be a word of length n2. (v)
is a standard - circular word iff for k0,,n-1, (v) has exactly
k1 factors of - length k
- Proposition. Let v be a word of length n2. (v)
is a standard - circular word iff (v) has n-1 factors of length
n-2 and v is - primitive.
For k2, there are 3 distinct factors of length 2
(10010010)is standard
The factor 010010 has 2 occurrences.
(10010010)is standard
.
cf. Borel,Reutenauer, 2006
6Circular standard words 3
- Corollary. Let v be a word of length n.
- (v) is standard iff ? k0,,n-2, (v) has a unique
special - factor of length k.
Special factors k0 e k1 0 k2 10 k3 010 k4 0
010 k5 10010 k6 010010
(10010010)is standard
7Minimal Automaton
- A(Q,S,d,F) be a finite automaton. Given p in
Q we define - Lp(A)v? S d (p,v)? F
- For each regular language there exists a
unique minimal deterministic automaton. It is
computed by using the Nerode equivalence. - pq if Lp(A) Lq(A)
- The Nerode equivalence
- is a congruence of A i.e.? a? S, pq ? d (p,a)
d (q,a) - is the coarsest congruence of A that saturates F
i.e. such that F is union of classes of the
congruence.
8Minimal Automaton
- Let A(Q,S,d,q0,F) automaton that recognizes the
language L and ? Q1,Q2,,Qm the partition of
Q corresponding to Nerode equivalence. The
minimal automaton recognizing L is
MA(QM,S,dM,q0M,FM) where - QM Q1,Q2,,Qm
- q0Mq0
- dM(q,a)d(q,a) , ? q? Q and ? a? S
- FMq q ? F
9The Moore construction
The Nerode equivalence is computed by the Moore
construction. For any integer k0 Lpkv?Lp
vk We define k on Q as follows p k q if
Lpk Lqk
Theorem. Let Qn. The Nerode equivalence is
equal to n-2.
Let µ(A)mink k k1
By the theorem it follows that µ(A) ? n-2.
10Hopcrofts Algorithm
Hopcrofts Algorithm computes the minimal
automaton and it is based on splitting operation
of the equivalence classes.
Given a partition ? Q1,Q2,,Qm of Q, we say
that the pair (Qi,a) splits the class Qj if
da-1(Qi)? Qj??. In this case Qj is splitted in
Qj da-1(Qi)? Qj and Qj Qj \ da-1(Qi)
Q
Qi
Qj
Qj
- A partition ? Q1,Q2,,Qm is a congruence iff
- for any 1i,j m and any a ? S, the pair (Qi,a)
does not splits Qj .
11Hopcrofts Algorithm
- The algorithm computes the coarsest congruence
that saturates F. It starts from the partition ?
F,Fc (that, trivially, saturates F) and
refines it by splitting operations until it
obtains the congruence i.e. until no split is
possible.
12Hopcrofts Algorithm
The algorithm maintains the current partition ?
and the waiting set S containing the pairs for
which it has to check whether some classes are
splitted.
- At the first step ? F,Fc and
S(min(F,Fc),a) - The main loop of the algorithm takes and deletes
a pair of S. - If a class B is splitted, it is replaced in ? by
the two new classes obtained from the split.
Furthermore, if (B,a) is in S it is replaced by
(B,a) and (B,a) otherwise the pair
(min(B,B),a) is added to S. - When S is empty, no split is possible and the
current partition is the coarsest congruence.
13Cyclic Automata
- (w) a circular word wa1a2an over A0,1.
- Aw(Q,S,d,F) automaton associated to w
- Q1,2,,n
- Sa
- d(i,a)(i1), iltn
- d(n,a)1
- F i ?Q ai1
w 11101000
Aw
14Hopcrofts Algorithm
w 11101000 de Brujin word
Notation Qu the set of positions of cyclic
occurrence of u in w.
Aw
S1,2,3,5
S1,2, 4,8
S4,8, 1, 8
S1, 8, 3, 7
S8, 3, 7
S3, 7
S7
S
Q
15Hopcrofts Algorithm
- The algorithm has some degrees of freedom
because at each step it allows a free choice of
the pair of S to process. - As regards to the running time, the splitting
with respect a pair (C,a) takes a time
proportional to the cardinality of C. Hence, the
running time of the algorithm is proportional to
the sum of the cardinality of all sets processed
of S. - The complexity of the algorithm is O(nlogn)
Hopcroft - The complexity is tight for the cyclic automata
associated to de Brujin words Berstel-Carton. - For the same automata with n states there would
be executions that run in linear time and other
executions that run in nlogn. - Are there automata on which all the executions
of the algorithm do not run in linear time?
16Hopcrofts Algorithm
w 11101000 de Brujin word
We say Qu to be a splitting set if ? Qv that
splits Qu.
Proposition. If Qu is a splitting set of states
of Aw then u is a prefix of a special factor of
w.
Corollary. If Qv that splits Qu and uv then
u is a cyclic special factor of w and the
resulting sets are Qu0 and Qu1 .
Q
FcQ04,6,7,8
FQ11,2,3,5
Q103,5
Q111,2
Q006,7
Q014,8
Q1005
Q1013
Q1102
Q1101
Q0006
Q0017
Q0104
Q0118
17Hopcrofts Algorithm
w 11101000 de Brujin word
Aw
µ(Aw)logn-1
Q
18The algorithm and Standard Words
Recall Corollary. Let v be a word of length n.
(v) is standard iff ? k0,,n-2, (v) has a
unique special factor of length k.
- Proposition. If w is a standard word the
executions of the Hopcrofts - algorithm are uniquely determined. In particular,
at each step 1kn-2 - ?k Qv v is a special factor of length k and
Sk1.
19Hopcrofts Algorithm
Proposition. If Qu is a splitting set of states
of Aw then u is a prefix of a special factor of
w.
µ(Aw)max u u is a special factor of w
Corollary. Let v be a word of length n. (v) is
standard iff ? k0,,n-2, (v) has a unique
special factor of length k.
(w) is standard iff µ(Aw)n-2
20Fibonacci words
- Recall the notion of Fibonacci finite word
- fnn0 sequence of words over A0,1 where
- f01, f11,
- fn1 fn fn-1 for n 2
- Each finite word fn is called finite Fibonacci
word.
21The Algorithm and Fibonacci Words 1
f50 10 0 10 10
a conjugate of f6
f60100101001001
f4 0 1 0 0 1
Q0
Q10
Q10010
Q1010010
Q0010
Q010
Q010010
Q01010010
Q001010010
Q1001010010
Q01001010010
22The algorithm and Fibonacci words 2
Notation Fnfn, Fibonacci numbers C(Fn) the
size of S in the minimization of the automata Afn
Proposition. For each n2, C(Fn)
C(Fn-1)C(Fn-2) Fn-2 C(F0) C(F1)0.
(recurrence relation of Fibonacci convolution
sequence)
C(Fn)1/5((n-1) Fn2nFn-1) FnFn/ sqrt(5)
23The algorithm and Fibonacci words 3
Theorem. Hopcrofts algorithm on cyclic automata
associated to finite Fibonacci words runs in
time O(nlogn).
24Standard words ?
w 0000001 wn
Q
1,2,3,4,5,6
7
1,2,3,4,5
6
C(n)n-1
5
1,2,3,4
µ(Aw)n-2
1,2
2
1
25Thanks for your attention! ?