Negative bases and automata

We study expansions in non-integer negative base -{\beta} introduced by Ito and Sadahiro. Using countable automata associated with (-{\beta})-expansions, we characterize the case where the (-{\beta})-shift is a system of finite type. We prove that, if {\beta} is a Pisot number, then the (-{\beta})-shift is a sofic system. In that case, addition (and more generally normalization on any alphabet) is realizable by a finite transducer. We then give an on-line algorithm for the conversion from positive base {\beta} to negative base -{\beta}. When {\beta} is a Pisot number, the conversion can be realized by a finite on-line transducer.


Introduction
Expansions in integer negative base −b, where b 2, seem to have been introduced by Grünwald in [8], and rediscovered by several authors, see the historical comments given by Knuth [11]. The choice of a negative base −b and of the alphabet {0, . . . , b−1} is interesting, because it provides a signless representation for every number (positive or negative). In this case it is easy to distinguish the sequences representing a positive integer from the ones representing a negative integer: denoting (w.) −b := k i=0 w k (−b) k for any w = w k · · · w 0 in{0, . . . , b − 1} * with no leading 0's, we have N = {(w.) −b | |w| is odd}. The classical monotonicity between the lexicographical ordering on words and the represented numerical values does not hold anymore in negative base, for instance 3 = (111.) −2 , 4 = (100.) −2 and 111 > lex 100. Nevertheless it is possible to restore such a correspondence by introducing an appropriate ordering on words, in the sequel denoted by ≺ alt , and called the alternate order.
Representations in negative base also appear in some complex base number systems, for instance base β = 2i since β 2 = −4 (see [5] for a study of their properties from an automata theoretic point of view). Thus, beyond the interest in the problem in itself, the authors also wish the study of negative bases to be an useful preliminar step to better understanding the complex case.
Ito and Sadahiro recently introduced expansions in non-integer negative base −β in [10]. They have given a characterization of admissible sequences, and shown that the (−β)-shift is sofic if and only if the (−β)-expansion of the number − β β+1 is eventually periodic. In this paper we pursue their work. The purpose of this contribution is to show that many properties of the positive base (integer or not) numeration systems extend to the negative base case, the main difference being the sets of numbers that are representable in the two different cases. The results could seem not surprising, but this study put into light the important role played by the order on words: the lexicographic order for the positive bases, the alternate order for the negative bases.
Very recently there have been several contributions to the study of numbers having only positive powers of the base in their expansion, the so-called (−β)-integers, in [1], [14], and [21].
We first establish some properties of the negative integer base −b, that are more or less folklore. This allows to introduce the definitions of alternate order and of short-alternate order, that are natural to order numbers by their (−β)-expansions.
We then prove a general result which is not related to numeration systems but to the alternate order, and which is of interest in itself. We define a symbolic dynamical system associated with a given infinite word s satisfying some properties with respect to the alternate order on infinite words. We design an infinite countable automaton recognizing it. We then are able to characterize the case when the symbolic dynamical system is sofic (resp. of finite type). Using this general construction we can prove that the (−β)-shift is a symbolic dynamical system of finite type if and only if the (−β)-expansion of − β β+1 is purely periodic. We also show that the entropy of the (−β)-shift is equal to log β.
We then focus on the case where β is a Pisot number, that is to say, an algebraic integer greater than 1 such that the modulus of its Galois conjugates is less than 1. The natural integers and the Golden Mean are Pisot numbers. We extend all the results known to hold true in the Pisot case for β-expansions to the (−β)-expansions. In particular we prove that, if β is a Pisot number, then every number from Q(β) has an eventually periodic (−β)-expansion, and thus that the (−β)-shift is a sofic system.
When β is a Pisot number, it is known that addition in base β -and more generally normalization in base β on an arbitrary alphabet -is realizable by a finite transducer [4]. We show that this is still the case in base −β.
The conversion from positive integer base to negative integer base is realizable by a finite right sequential transducer. When β is not an integer, we give an on-line algorithm for the conversion from base β to base −β, where the result is not admissible. When β is a Pisot number, the conversion can be realized by a finite on-line transducer.
A preliminary version of Sections 4 and 5 has been presented in [6].

Words and automata
An alphabet is a totally ordered set. In this paper the alphabets are always finite. A finite sequence of elements of an alphabet A is called a word, and the set of words on A is the free monoid A * . The empty word is denoted by ε. The set of infinite (resp. bi-infinite) words on A is denoted by A N (resp. A Z ).
Let v be a word of A * , denote by v n the concatenation of v to itself n times, and by v ω the infinite concatenation vvv · · · . A word of the form uv ω is said to be eventually periodic. A (purely) periodic word is an eventually periodic word of the form v ω . A finite word v is a factor of a (finite, infinite or bi-infinite) word x if there exists u and w such that We recall some definitions on automata, see [3] and [18] for instance. An automaton over A, A = (Q, A, E, I, T ), is a directed graph labelled by elements of A. The set of vertices, traditionally called states, is denoted by Q, I ⊂ Q is the set of initial states, T ⊂ Q is the set of terminal states and and if there is a unique initial state. A subset H of A * is said to be recognizable by a finite automaton, or regular, if there exists a finite automaton A such that H is equal to the set of labels of paths starting in an initial state and ending in a terminal state.
Recall that two words u and v are said to be right congruent modulo H if, for every w, uw is in H if and only if vw is in H. It is well known that H is recognizable by a finite automaton if and only if the congruence modulo H has finite index.
Let A and A ′ be two alphabets. A transducer is an automaton T = (Q, A * × A ′ * , E, I, T ) where the edges of E are labelled by couples in A * × A ′ * . It is said to be finite if the set Q of states and the set E of edges are finite. If (p, (u, v), q) ∈ E, we write p u|v −→ q. The input automaton (resp. output automaton) of such a transducer is obtained by taking the projection of edges on the first (resp. second) component. A transducer is said to be sequential if its input automaton is deterministic.
An on-line transducer is a particular kind of sequential transducer. An on-line transducer with delay δ, A = (Q, A × (A ′ ∪ ε), E, {q 0 }), is a sequential automaton composed of a transient part and of a synchronous part, see [15]. The set of states is equal to Q = Q t ∪ Q s , where Q t is the set of transient states and Q s is the set of synchronous states. In the transient part, every path of length δ starting in the initial state q 0 is of the form q 0 x j in A, for 1 j δ, and the only edge arriving in a state of Q t is as above. In the synchronous part, edges are labelled by elements of A × A ′ . This means that the transducer starts reading words of length δ and outputting nothing, and after that delay, outputs serially one digit for each input digit. If the set of states Q and the set of edges E are finite, the on-line automaton is said to be finite.
The same notions can be defined for automata and transducer processing words from right to left : they are called right automata or transducers.

Symbolic dynamics
Let us recall some definitions on symbolic dynamical systems or subshifts (see [13,Chapter 1] or [12]). The set A Z is endowed with the lexicographic order, denoted < lex , the product topology, and the shift σ, defined by σ((x i ) i∈Z ) = (x i+1 ) i∈Z . A set S ⊆ A Z is a symbolic dynamical system, or subshift, if it is shift-invariant and closed for the product topology on A Z . A bi-infinite word z avoids a set of word X ⊂ A * if no factor of z is in X. The set of all words which avoid X is denoted S X . A set S ⊆ A Z is a subshift if and only if S is of the form S X for some X.
The same notion can be defined for a one-sided subshift of A N . Let F (S) be the set of factors of elements of S, let I(S) = A + \ F (S) be the set of words avoided by S, and let X(S) be the set of elements of I(S) which have no proper factor in I(S). The subshift S is sofic if and only if F (S) is recognizable by a finite automaton, or equivalently if X(S) is recognizable by a finite automaton. The subshift S is of finite type if S = S X for some finite set X, or equivalently if X(S) is finite.
The topological entropy of a subshift S is where B n (S) is the number of elements of F (S) of length n. When S is sofic, the entropy of S is equal to the logarithm of the spectral radius of the adjacency matrix of the finite automaton recognizing F (S).

Numeration systems
The reader is referred to [13,Chapter 7] and to [7] for a detailed presentation of these topics. Representations of real numbers in a non-integer base β were introduced by Rényi [17] under the name of βexpansions. Let x be a real number in the interval [0, 1]. A representation in base β (or a β-representation) of x is an infinite word (x i ) i 1 such that A particular β-representation -called the β-expansion -can be computed by the "greedy algorithm" : denote by ⌊y⌋, ⌈y⌉ and {y} the lower integer part, the upper integer part and the fractional part of a number y. Set r 0 = x and let for i 1, An equivalent definition is obtained by using the β-transformation of the unit interval which is the mapping If a representation ends in infinitely many zeros, like v0 ω , the ending zeros are omitted and the representation is said to be finite.
In the case where the β-expansion of 1 is finite, there is a special representation playing an important role. Let d β (1) = (t i ) i 1 and set d * Denote by D β the set of β-expansions of numbers of [0, 1). It is a shift-invariant subset of A N β . The β-shift S β is the closure of D β and it is a subshift of A Z β . When β is an integer, S β is the full β-shift A Z β .
It is known that the entropy of the β-shift is equal to log β.
Let C be an arbitrary finite alphabet of integer digits. The normalization function in base β on C is the partial function which maps an infinite word y = (y i ) i 1 over C, such that 0 y = i 1 y i β −i 1, onto the β-expansion of y. It is known [4] that, when β is a Pisot number, normalization is computable by a finite transducer on any alphabet C. Note that addition is a particular case of normalization, with C = {0, . . . , 2(⌈β⌉ − 1)}.

Negative integer base
Let b > 1 be an integer. It is well known, see Knuth [11] for instance, that every integer (positive or negative) has a unique Every real number (positive or negative) has a (−b)-representation, not necessarily unique, since We recall some well-known facts. Let A be a finite alphabet totally ordered, and let min A be its smallest element.

Definition 3.2
The alternate order ≺ alt on infinite words or finite words with same length on A is defined by: if and only if there exists k 1 such that This order was implicitely defined in [8].
The short-alt order is analogous to the short-lex or radix order relatively to the lexicographical order.
We have the following result. Proof: In Fig. 1, The processing is done from right to left by 2-letter blocks. A finite word x k−1 · · · x 0 which is the b-expansion of x is transformed by the transducer into a finite word y k · · · y 0 which is the (−b)-expansion of x. It is straightforward to transform this transducer into a finite right sequential transducer.

Symbolic dynamical systems and the alternate order
We have seen in the previous section that the alternate order is the tool to compare numbers written in a negative base. In this section we give general results on symbolic dynamical systems defined by the alternate order. This is analogous to the symbolic dynamical systems defined by the lexicographical order, see [7]. Let A be a totally ordered finite alphabet.

Definition 4.1
A word s = s 1 s 2 · · · in A N is said to be an alternately shift minimal word (asmin-word for short) if s 1 = max A and s is smaller than, or equal to, any of its shifted images in the alternate order: We construct a countable infinite automaton A S(s) as follows (see Fig. 3, where [a, b] denotes the set {a, a + 1, . . . , b} if a b, ε else. It is assumed in Fig. 3 that s 1 > s j for j 2.) The set of states is N. For each state i 0, there is an edge i si+1 −→ i + 1. Thus the state i is the name corresponding to the path labelled s 1 · · · s i . If i is even, then for each a such that 0 a s i+1 − 1, there is an edge i a −→ j, where j is such that s 1 · · · s j is the suffix of maximal length of s 1 · · · s i a. If i is odd, then for each b such that s i+1 + 1 b s 1 − 1, there is an edge i b −→ j where j is maximal such that s 1 · · · s j is a suffix of s 1 · · · s i b; and if s i+1 < s 1 there is one edge i s1 −→ 1. By contruction, the deterministic automaton A S(s) recognizes exactly the words w such that every suffix of w is alt s and the result below follows. Conversely, suppose that s is not eventually periodic. Then there exists an infinite sequence of indices i 1 < i 2 < · · · such that the sequences s i k s i k +1 · · · are all different for all k 1. Take any pair (i j , i ℓ ), j, ℓ 1. If i j and i ℓ do not have the same parity, then s 1 · · · s ij and s 1 · · · s i ℓ are not right congruent modulo F (S(s)). If i j and i ℓ have the same parity, there exists q 0 such that s ij · · · s ij +q−1 = s i ℓ · · · s i ℓ +q−1 = v and, for instance, (−1) ij +q (s ij +q − s i ℓ +q ) > 0 (with the convention that, if q = 0 then v = ε). Then s 1 · · · s ij −1 vs ij +q ∈ F (S(s)), s 1 · · · s i ℓ −1 vs i ℓ +q ∈ F (S(s)), but s 1 · · · s ij −1 vs i ℓ +q does not belong to F (S(s)). Hence s 1 · · · s ij and s 1 · · · s i ℓ are not right congruent modulo F (S(s)), so the number of right congruence classes is infinite and F (S(s)) is thus not recognizable by a finite automaton. 2

Proposition 4.4
The subshift S(s) = {w = (w i ) i∈Z ∈ A Z | ∀n, s alt w n w n+1 · · · } is a subshift of finite type if and only if s is purely periodic.
Proof: Suppose that s = (s 1 · · · s p ) ω . Consider the finite set We show that S(s) = S(s) X . If w is in S(s), then w avoids X, and conversely. Now, suppose that S(s) is of finite type. It is thus sofic, and by Proposition 4.3 s is eventually periodic. If it is not purely periodic, then s = s 1 · · · s m (s m+1 · · · s m+p ) ω , with m and p minimal, and s 1 · · · s m = ε.
. First, suppose there exists 1 j p such that (−1) j (s j − s m+j ) < 0 and s 1 · · · s j−1 = s m+1 · · · s m+j−1 . For k 0 fixed, let w (2k) = s 1 · · · s m (s m+1 · · · s m+p ) 2k s 1 · · · s j ∈ I. We have s 1 · · · s m (s m+1 · · · s m+p ) 2k s m+1 · · · s m+j−1 ∈ F (S(s)). On the other hand, for n 2, s n · · · s m (s m+1 · · · s m+p ) 2k is greater in the alternate order than the prefix of s of same length, thus s n · · · s m (s m+1 · · · s m+p ) 2k s 1 · · · s j belongs to F (S(s)). Hence any strict factor of w (2k) is in F (S(s)). Therefore for any k 0, w (2k) ∈ X(S(s)), and X(S(s)) is thus infinite: S(s) is not of finite type. Now, if such a j does not exist, then for every 1 j p, s j = s m+j , and s = (s 1 · · · s m ) ω is purely periodic. 2 Remark 4.5 Let s ′ = s ′ 1 s ′ 2 · · · be a word in A N such that s ′ 1 = min A and, for each n 1, s ′ n s ′ n+1 · · · alt s ′ . Such a word is said to be an alternately shift maximal word. Let S ′ (s ′ ) = {w = (w i ) i∈Z ∈ A Z | ∀n, w n w n+1 · · · alt s ′ }. The statements in Propositions 4.2, 4.3 and 4.4 are also valid for the subshift S ′ (s ′ ) (with the automaton A S ′ (s ′ ) constructed accordingly).
We show that the alternate order ≺ alt on (−β)-expansions gives the numerical order.

Proposition 5.1 Let x and y be in
The (−β)-shift S −β is the closure of the set of (−β)-admissible words, and it is a subshift of A Z β . Define the sequence d * −β ( 1 β+1 ) as follows: is not a periodic sequence with odd period,

Theorem 5.2 (Ito-Sadahiro [10])
A word (w i ) i∈Z is an element of the (−β)-shift if and only if for each n ). Theorem 5.2 can be restated as follows.
is not a periodic sequence with odd period, then ) is a periodic sequence of odd period, then d * = (0d 1 · · · d 2p (d 2p+1 − 1)) ω and  Remark that it is the automaton which recognizes the celebrated even shift (see [12]).

Entropy of the −β-shift
Examples 5.6 and 5.7 suggest that the entropy of the −β-shift is the same as the entropy of the β-shift because the adjacency matrices of the automata are the same. This is what we show in this section. A standard technique for computing the entropy of a subshift S is to construct a (not necessarily finite) automaton recognizing F (S). Then the submatrices of the adjacency matrix are taken into account and for every n the greatest eigenvalue λ n of the submatrix of order n is computed. A result proved in [9] ensures that the limit λ of the sequence λ n exists and it satisfies h(S) = log λ. Unfortunately the explicit computation of the λ n 's in the general case turns out to be very complicated, so we use tools from the theory of dynamical systems: -the notion of topological entropy for one-dimensional dynamical systems, a one-dimensional dynamical system being a couple (I, T ) consisting in a bounded interval I and a piecewise continuous transformation T : I → I; -a result by Takahashi [22] establishing the relation between topological entropies of one-dimensional dynamical systems and symbolic dynamical systems; -a result by Shultz [20] on the topological entropy of some one-dimensional dynamical systems.
Let us begin with the definition of topological entropy for one-dimensional dynamical systems.
In [22] Takahashi proved the equality between the topological entropy of a piecewise continuous dynamical system and the topological entropy of an appropriate subshift. Before stating such a result we need a definition. The number l is called lap number and it is denoted lap(T ).

Remark 5.10
If the map T is piecewise linear then the lap intervals are unique and they coincide with the intervals of continuity of T .

Theorem 5.11 (Takahashi [22]) Let T be a piecewise continuous transformation over the closed interval
T be the map defined by the relation x → x 1 x 2 · · · with x n satisfying T n (x) ∈ I xn . Define the subshift X T := γ T (I) in A N .
If lap(T ) is finite then: h(X T ) = h(I, T ).
The entropy in the very particular case of a piecewise linear map with constant slope is explicitely given in the following result. Shultz [20, Proposition 3.7]) Let T be a piecewise linear map with slope ±β. Then the topological entropy of T is equal to log β.

Proposition 5.12 (
We now prove our result.

Theorem 5.13
The topological entropy of S −β is equal to log β.
Proof: Consider the dynamical system (I −β , T −β ). We extend the map T −β to the closure of I −β to fullfill the conditions of Theorem 5.11. By definition of the (−β)-expansion, the subshift X T β coincides with the closure of the set of the (−β)-expansions in A N −β , whose entropy is the same as S −β ⊂ A Z −β . As T −β is piecewise linear, the lap intervals coincide with the (finite) number of continuity intervals. Then, by Theorem 5.11 and by Proposition 5.12, h(S −β ) = h(I −β , T −β ) = log β. 2

The Pisot case
We first prove that the classical result saying that if β is a Pisot number, then every element of Q(β)∩[0, 1] has an eventually periodic β-expansion is still valid for the base −β.
Since r n = T n −β (x) belongs to I −β then |r n | β β+1 < 1. For 2 j d, let Let η = max{|β j | | 2 j d}: since β is a Pisot number, η < 1. Since x k ⌊β⌋ we get Proof: Every state s in Q(2c) is associated with the label of the shortest path f 0 f 1 · · · f n from 0 to s in the automaton. Thus Thus every state of Q(2c) is bounded in norm, and so there is only a finite number of them. 2 The redundancy transducer If β is a Pisot number, then R −β (c) is finite.

Theorem 5.19
If β is a Pisot number, then normalization in base −β on any alphabet C is realizable by a finite transducer.
Proof: The normalization is obtained by keeping in R −β (c) only the outputs y that are (−β)-admissible. By Theorem 5.16 the set of admissible words is recognizable by a finite automaton D −β . The finite transducer N −β (c) doing the normalization is obtained by making the intersection of the output automaton of R −β (c) with D −β . 2

Proposition 5.20
If β is a Pisot number, then the conversion from base −β to base β is realizable by a finite transducer. The result is β-admissible.
Denoteā the signit digit (−a). Then x 1 x 2 x 3 · · · is a β-representation of x on the alphabet A −β = {−⌊β⌋, . . . , ⌊β⌋}. Thus the conversion is equivalent to the normalization in base β on the alphabet A −β , and when β is a Pisot number, it is realizable by a finite transducer by [4]. 6 On-line conversion from positive to negative base Proposition 5.20 shows the actability of the conversion from positive to negative base with a finite transducer for a particular class of bases, i.e. the Pisot numbers. The result is admissible, but this transducer is not sequential.
In the case where the base is a negative integer, we have seen in Section 3 that the conversion from base b to base −b is realizable by a finite right sequential transducer.

On-line conversion in the general case
An on-line algorithm is such that, after a certain delay of latency δ during which the data are read without writing, a digit of the output is produced for each digit of the input, see [15] for on-line arithmetic in integer base. Theorem 6.1 There exists a conversion from base β to base −β which is computable by an on-line algorithm with delay δ, where δ is the smallest positive integer such that The result is not admissible.

Conversion in the Pisot case
We now show that, when β is a Pisot number, there is a finite on-line transducer realizing the conversion.  There is an infinite path in the automaton C starting in q 0 and labelled by if, and only if, j 1 x j β −j = j 1 y j (−β) −j .
For each j 1, q j is an element of Z[β, β −1 ]. For 1 i d let q j (β i ) be the element of Z[β i , β −1 i ] obtained by replacing β by β i in q j . Then q j = q j (β).
First of all, for every j 1, − β β+1 − ⌊β⌋ β δ q j (β) < 1 β+1 by the on-line algorithm. Secondly, for every j 1 and 2 i d, For 2 i d let Then, if |q δ+j−1 (β i )| M i , then |q δ+j (β i )| M i by (4). Now, for 0 j δ and 2 i d, Define a norm on Z[X]/(M β (X)) by q = max 1 i d |q(β i )|. Thus the elements of Q are all bounded in norm, and so Q is finite. 2 In the particular case that β 2 = aβ + 1 (β is thus a Pisot number) we can construct directly a simpler finite left sequential transducer realizing the conversion. Proposition 6.3 If β 2 = aβ + 1, a 1, then the conversion from base β to base −β is realizable by the finite left sequential transducer of Fig. 6.

Proof:
The left sequential transducer in Fig. 6 converts a β-expansion of a real number x in [0, β) of the form x 0 .x 1 x 2 · · · into a (−β)-representation of x of the form y 0 .y 1 y 2 · · · . We take 0 d a, 0 c a − 1, 1 e a. Since the input is admissible, no factor ae, with 1 e a can occur.