Sequences, Groups, and Number Theory pp 89141  Cite as
FirstOrder Logic and Numeration Systems
Abstract
The BüchiBruyère theorem states that a subset of \(\mathbb {N}^d\) is brecognizable if and only if it is bdefinable. This result is a powerful tool for showing that many properties of bautomatic sequences are decidable. Going a step further, firstorder logic can be used to show that many enumeration problems of bautomatic sequences can be described by bregular sequences. The latter sequences can be viewed as a generalization of bautomatic sequences to integervalued sequences. These techniques were extended to two wider frameworks: Urecognizable subsets of \(\mathbb {N}^d\) and βrecognizable subsets of \(\mathbb {R}^d\). In the second case, real numbers are represented by infinite words, and hence, the notion of βrecognizability is defined by means of Büchi automata. Again, logicbased characterization of Urecognizable (resp. βrecognizable) sets allows us to obtain various decidability results. The aim of this chapter is to present a survey of this very active research domain.
3.1 Introduction
In computer science and in mathematics in general, we are concerned with the following questions: How do we have sets of numbers at our disposal? How can we manipulate them? Which sets of numbers should be considered simple? In which sense? In order to approach such questions, we first need to represent numbers. The basic consideration is as follows: properties of numbers are translated into syntactical (or combinatorial) properties of their representations. This is where numeration systems come into play. For example, the famous theorem of Cobham (and Semenov for its multidimensional version) tells us that nontrivial properties of numbers are dependent on the base we choose.
In this chapter, we will consider multidimensional subsets of numbers whose sets of representations are accepted by finite automata. Representations of numbers will always be taken from one of the following families of numeration systems: the unary systems, the integer bases b ≥ 2, and, more generally, the positional numeration systems based on increasing sequences U = (U_{ n })_{n≥0}, the abstract numeration systems S based on regular languages, and finally the real bases β > 1. Depending on the cases, we shall refer to such sets as 1recognizable sets, brecognizable sets, Urecognizable sets, Srecognizable sets, and βrecognizable sets.
Many descriptions of recognizable sets were given in various works [78, 96, 113, 114, 211, 503]. Here, we focus on characterizations of recognizable subsets (first of \(\mathbb {N}^d\) and then of \(\mathbb {R}^d\)) in terms of firstorder logic. We start by presenting the BüchiBruyère theorem, which states that a subset of \(\mathbb {N}^d\) is brecognizable if and only if it is bdefinable, that is, definable by a firstorder formula of the structure \(\langle \mathbb {N},+,V_b\rangle \) where V_{ b } is a basedependent predicate (see below for formal definitions). We explain how this result turns out to be a powerful tool for showing that many properties of bautomatic sequences are decidable. We illustrate our purpose with many examples of decidable problems on bautomatic sequences. Going a step further, we show that firstorder logic can also be used to prove that many enumeration problems of bautomatic sequences can be described by bregular sequences. The latter sequences are at the core of Chapters 2 and 4. Firstorder logic is also mentioned in Chapters 9 and 10 in the context of the domino problem and of Wang tiles.
In the last (and longest) part of this chapter, we give an extensive presentation of (multidimensional) βrecognizable sets of real numbers. Those sets are defined by means of Büchi automata. Again, we give a logicbased characterization of these sets and show how we can use it to obtain various decidability results. We end by showing the links between the socalled βselfsimilar sets, the attractors of some (basedependent) graphdirected iterated function systems, and certain sets recognizable by Büchi automata. Let us mention here that the numeration systems in real bases β > 1 are referred to as the main motivation of Chapter 7.
Besides these logicbased characterizations and their applications, we mention (usually without proofs) various results concerning recognizable sets. Among them, in the vein of Eilenberg’s result [211], we explicitly list the possible growth functions of (unidimensional) Srecognizable sets. Let us emphasize that this is done in the very general framework of abstract numeration systems and, thus, encompasses the previous known results about brecognizable sets only. In particular, this result permits us to exclude right away a huge amount of (unidimensional) subsets from the class of Srecognizable sets, and further, it also permits us to exhibit many subsets which are never Srecognizable, that is, no matter which abstract numeration system we choose. Finally, let us mention that along the lines, we present four open problems.
3.2 Recognizable Sets of Nonnegative Integers
3.2.1 Unary Representations
Perhaps the simplest way of representing a natural number n is to repeat a symbol n times. This approach presents an obvious drawback: it requires way too much memory space in practice to store a number and, even worse, to do computations with them. Even though they are highly unpractical, unary representations are of some theoretical interest, for example in computability theory. Let a be some fixed symbol. The unary numeration system \(\mathrm {rep}_1\colon \mathbb {N}\to a^*\) is defined by rep_{1}(n) = a^{ n } for all \(n\in \mathbb {N}\). The set of all possible representations is \(L_1=\mathrm {rep}_1(\mathbb {N})=a^*\).
Definition 3.2.1
A subset X of \(\mathbb {N}^d\) is 1recognizable if the language rep_{1}(X) is regular.
In dimension 1, the 1recognizable sets are exactly the finite union of arithmetic progressions, as they correspond to regular languages over a unary alphabet. In the multidimensional case, it is already more complicated to capture the essence of 1recognizable sets; see Section 3.2.5.
3.2.2 Integer Bases
Throughout this chapter, b designates an integer greater than or equal to 2.
The following proposition is a generalization of Proposition V.3.1 in [211].
Proposition 3.2.2
 1.
The language rep_{ b }(X) is regular.
 2.
The language 0^{∗}rep_{ b }(X) is regular.
 3.
There exists a regular language \(L\subseteq (A_b^{\ d})^*\) such that 0^{∗}(0^{∗})^{−1}L = 0^{∗}rep_{ b }(X).
 4.
There exists a regular language \(L\subseteq (A_b^{\ d})^*\) such that val_{ b }(L) = X.
 5.
The language {(rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X} is regular.
 6.
The language #^{∗}{(rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X} is regular.
 7.There exists a regular language L ⊆ ((A_{ b } ∪{#})^{ d })^{∗} such that$$\displaystyle \begin{aligned} \mathtt{\textbf{\#}}^*(\mathtt{\textbf{\#}}^*)^{1}L=\mathtt{\textbf{\#}}^*\{(\mathrm{rep}_b(n_1),\ldots,\mathrm{rep}_b(n_d))^\#\mid (n_1,\ldots,n_d)\in X\}. \end{aligned}$$
Proof
If no word of a language L ⊆ A^{∗} starts with a specific letter a ∈ A, then L is regular if and only if a^{∗}L is as well. This shows 1 ⇔ 2 and 5 ⇔ 6. For 1 ⇒ 4, take L = rep_{ b }(X). For 4 ⇒ 3, observe that if X = val_{ b }(L) for some regular language \(L\subseteq (A_b^{\ d})^*\), then 0^{∗}(0^{∗})^{−1}L = 0^{∗}rep_{ b }(X). 3 ⇒ 2 is clear. For 5 ⇒ 7, take L = {(rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X}. 7 ⇒ 6 is clear. Finally we show 1 ⇔ 5. Given a DFA accepting {(rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X}, we modify it by replacing every # with 0 in every transition. The resulting automaton is an NFA accepting rep_{ b }(X). Now suppose that \(\mathcal {A}\) is a DFA accepting rep_{ b }(X). We modify \(\mathcal {A}\) by replacing every transition labeled \((a_1,\ldots ,a_d)\in A_b^{\ d}\) with k components equal to 0 with 2^{ k } transitions obtained by placing either 0 or # in every component where there was a 0. Let \(\mathcal {B}\) denote the resulting DFA. Now we can build a DFA \(\mathcal {C}\) accepting the words in ((A_{ b } ∪{#})^{ d })^{∗} such that, in every component, each occurrence of # is preceded by # or by nothing, and the last occurrence of # is not followed by 0. The language {(rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X} is the intersection of the languages accepted by \(\mathcal {B}\) and \(\mathcal {C}\); hence, it is regular. □
Definition 3.2.3
A subset X of \(\mathbb {N}^d\) is brecognizable if any of the assertions of Proposition 3.2.2 is satisfied.
Remark 3.2.4
The integer base b numeration systems have the remarkable property that \(\mathbb {N}^d\) is brecognizable since \(\mathbf {0}^*\mathrm {rep}_b(\mathbb {N}^d)=(A_b^{\ d})^*\). It is also true that \(\mathrm {val}_b^{1}(X)=\mathbf {0}^*\mathrm {rep}_b(X)\) for any subset X of \(\mathbb {N}^d\). The latter fact was actually used in the proof of Proposition 3.2.2 (it is needed in the implication 4 ⇒ 3).
It is equivalent to say that the characteristic sequence \(\chi _X\colon \mathbb {N}^d\to \{0,1\}\) is bautomatic:
Definition 3.2.5
A sequence \(x\colon \mathbb {N}^d\to \mathbb {N}\) is bautomatic if there exists a finite deterministic automaton with output (DFAO for short) \(\mathcal {M}=(Q,q_0,A_b^{\ d},\delta ,A,\tau )\) such that, for all \(\mathbf {n}\in \mathbb {N}^d\), x(n) = τ(δ(q_{0}, rep_{ b }(n))).
Note that a DFAO being finite by definition, the image of a bautomatic sequence is necessarily finite. Therefore, bautomatic sequences may be viewed as multidimensional infinite words over a finite alphabet A.
Example 3.2.6
Proposition 3.2.7
Let X be a subset of \(\mathbb {N}^d\) . Then X is brecognizable if and only if χ _{ X } is bautomatic.
Proof
In order to build a DFAO generating χ_{ X } starting from a DFA accepting rep_{ b }(X), it suffices to output 1 when ending in a terminal state and to output 0 when ending in a nonterminal state. In particular, the obtained DFAO outputs 0 if we enter a nongreedy brepresentation. The other direction works well because \(\mathbb {N}^d\) is brecognizable. By declaring terminal those states outputting 1 and nonterminal those states outputting 0, we obtain a DFA that might accept nongreedy brepresentations as well. But if L is the accepted language of this DFA, then val_{ b }(L) = X (which is the fourth item in Proposition 3.2.2). □
Similarly, we have the following result.
Proposition 3.2.8
Let A be a finite alphabet and let \(x\colon \mathbb {N}^d\to A\). Then x is bautomatic if and only if every subset x^{−1}(a) of \(\mathbb {N}^d\) (for a ∈ A) is brecognizable.
Proof
In order to build DFAs accepting a language L such that val(L) = x^{−1}(a) starting from a DFAO generating x, it suffices to declare a state to be final if and only if the corresponding output is a. For the other direction, let A = {a_{1}, …, a_{ k }}, and for each i, let \(\mathcal {M}_i=(Q_i,q_{0,i},F_i,A_b^{\ d},\delta _i)\) be a DFA accepting 0^{∗}rep_{ b }(x^{−1}(a_{ i })). Let \(\mathcal {M}=\mathcal {M}_1\times \cdots \times \mathcal {M}_k\). For all \(\mathbf {n}\in \mathbb {N}^d\), the state reached from the initial state (q_{0,1}, …, q_{0,k}) after reading rep_{ b }(n) contains exactly one final component (in some \(\mathcal {M}_i\)). We define τ(q_{1}, …, q_{ k }) = a_{ i } if there is exactly one i such that q_{ i } ∈ F_{ i } (τ is undefined on other states). Then the DFAO obtained from \(\mathcal {M}\) and τ generates x. □
One way to describe the brecognizable sets is to study their growth functions.
Definition 3.2.9
For a subset X of \(\mathbb {N}\), we let t_{ X }(n) denote the (n + 1)st term of X. The map \(t_X\colon \mathbb {N}\to \mathbb {N}\) is called the growth function of X.
Theorem 3.2.10
Thanks to this result, examples of sets that are not brecognizable for any b have been exhibited. The set \(\{n^2 : n \in \mathbb {N}\}\) of squares is such an example.
There are several equivalent definitions of brecognizable sets using logic, morphisms, finiteness of the bkernel, or formal series. We refer the reader to the survey [114] for an extensive presentation. The equivalence with bdefinable sets will be discussed in Section 3.3.
3.2.3 Positional Numeration Systems
Example 3.2.11
If U : i↦b^{ i }, then we recover the integer base b numeration systems presented in the previous section.
Example 3.2.12
We give the statement of the following proposition without proof since it is similar to that of Proposition 3.2.2.
Proposition 3.2.13
 1.
The language rep_{ U }(X) is regular.
 2.
The language 0^{∗}rep_{ U }(X) is regular.
 3.There exists a regular language \(L\subseteq (A_U^{\ d})^*\) such that$$\displaystyle \begin{aligned} \mathbf{0}^*(\mathbf{0}^*)^{1}L=\mathbf{0}^*\mathrm{rep}_U(X). \end{aligned} $$(3.1)
 4.
The language {(rep_{ U }(n_{1}), …, rep_{ U }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X} is regular.
 5.
The language #^{∗}{(rep_{ U }(n_{1}), …, rep_{ U }(n_{ d }))^{ # }∣(n_{1}, …, n_{ d }) ∈ X} is regular.
 6.There exists a regular language L ⊆ ((A_{ U } ∪{#})^{ d })^{∗} such that$$\displaystyle \begin{aligned} \mathtt{\textbf{\#}}^*(\mathtt{\textbf{\#}}^*)^{1}L=\mathtt{\textbf{\#}}^*\{(\mathrm{rep}_U(n_1),\ldots,\mathrm{rep}_U(n_d))^\#\mid (n_1,\ldots,n_d)\in X\}. \end{aligned}$$
Observe that we lost the fourth characterization of Proposition 3.2.2. For integer bases, the nongreedy representations are only those with leading zeros. For positional numeration systems, there are other kinds of nongreedy representations. For example, 100 and 11 are both Frepresentations of 3. In general, if \(X\subseteq \mathbb {N}\) and \(L\subseteq (A_U^{\ d})^*\) are such that X = val_{ U }(L), then we do not know that (3.1) holds for the same L.
Definition 3.2.14
A subset X of \(\mathbb {N}^d\) is Urecognizable if any of the assertions of Proposition 3.2.13 is satisfied.
Let us mention two open problems concerning positional numeration systems. The first one was already reported in [78, Chapter 2]. As far as we know, the best results achieved in this area are those of [297].
Problem 3.2.15
Characterize those positional numeration systems rep_{ U } such that \(\mathbb {N}\) is Urecognizable.
Here we propose another related problem. However, an answer to any of these two problems does not seem to provide a straightforward answer to the other. We first give a remark.
Remark 3.2.16
For any subset X of \(\mathbb {N}^d\), we have \(\mathrm {rep}_U(X)=\mathrm {val}_U^{1}(X)\cap \mathrm {rep}_U(\mathbb {N}^d)\). Therefore, whenever \(\mathbb {N}\) is Urecognizable (and hence \(\mathbb {N}^d\) is as well), then for any subset X of \(\mathbb {N}^d\), the regularity of \(\mathrm {val}_U^{1}(X)\) implies that of rep_{ U }(X). However, there is no evidence that the converse should be true.
Problem 3.2.17
Characterize those positional numeration systems rep_{ U } such that, for any subset X of \(\mathbb {N}^d\), the regularity of rep_{ U }(X) implies that of \(\mathrm {val}_U^{1}(X)\).
3.2.4 Abstract Numeration Systems
Formally, an abstract numeration system S is given by a regular language L over a totally ordered alphabet (A, <). A nonnegative integer n is represented by the (n + 1)st word in L in radix (or genealogical) order ≺. The question is now to – efficiently – describe the map n↦rep_{ S }(n), which of course depends on the choice of S.
Definition 3.2.18
Note that, for a fixed S, the choice of padding the representations to the right or to the left is arbitrary and gives two different notions of Srecognizability. At first glance, one could think that we just have to consider the reversed representations, but the numeration language L might not be closed under reversal, and even if it were, then the order of the representations could change. Recall that if w = a_{1}⋯a_{w}, then \(\widetilde {w}=a_{w}\cdots a_1\).
Example 3.2.19
Consider S = (a^{∗}b^{∗}∪ a^{∗}c^{∗}, a < b < c). Then the pair (6, 9) is represented by Open image in new window . If we had chosen a right padding instead, (6, 9) would have been represented by Open image in new window , which is not equal to Open image in new window . In fact, the latter word is not even the Srepresentation of any pair of nonnegative integers since ca does not belong to the numeration language.
Abstract numeration systems encompass positional numeration systems having a regular numeration language; see Problem 3.2.15. The next example illustrates that the converse is not true.
Example 3.2.20
We saw that the set \(X=\{n^2 : n \in \mathbb {N}\}\) is not brecognizable for any b. However, this set is Srecognizable for the abstract numeration system S of Example 3.2.19 since rep_{ S }(X) = a^{∗}.
More generally, we have the following result.
Theorem 3.2.21 ([502, 554])
For any polynomial \(P \in \mathbb {Q}[x]\) such that \(P(\mathbb {N}) \subseteq \mathbb {N}\) , there exists an abstract numeration system S such that P is Srecognizable.
Describing the Srecognizable subsets of \(\mathbb {N}^d\) is not easy in general. In the vein of Theorem 3.2.10, the following result, which we give without proof, lists the possible growth orders of such sets. These growth orders depend on the growth of the numeration language, which is either polynomial or exponential as shown by the following lemma.
For any language L over an alphabet A and any nonnegative integer n, we let v_{ L }(n) denote the number of words of length less than or equal to n in L.
Lemma 3.2.22
Proof
The formal series ∑_{n≥0}v_{ L }(n)x^{ n } are \(\mathbb {N}\)recognizable for all regular languages L; see, for instance, [77]; also see Section 3.4.1. Since (v_{ L }(n))_{n≥0} are nondecreasing sequences, the lemma follows from [520, Theorem II.10.2]. □
Theorem 3.2.23 ([147])
Definition 3.2.24
Two real numbers α and β different from 1 are said to be multiplicatively dependent if α = β^{ r } for some \(r\in \mathbb {Q}\), or, equivalently, if \(\frac {\log {\alpha }}{\log {\beta }}\in \mathbb {Q}\). Otherwise, α and β are said to be multiplicatively independent.
The following corollary of Theorem 3.2.23 considers the case of a polynomial numeration language.
Corollary 3.2.25
Let S = (L, A, <) be an abstract numeration system built on a polynomial regular language, and let X be an infinite Srecognizable subset of \(\mathbb {N}\). Then t_{ X }(n) = Θ(n^{ r }) for some rational r ≥ 1.
Proof
By Lemma 3.2.22, the growth functions v_{ L }(n) and \(\mathbf {v}_{\mathrm {rep}_S(X)}(n)\) satisfy (3.2) and (3.3), respectively. The fact that L is polynomial means that α = 1. As 1 ≤ β ≤ α, we have β = 1 as well. Then from Theorem 3.2.23, we obtain \(t_X(n)=\varTheta ( n^{\frac {c}{d}})\). □
By Theorem 3.2.21, we know that any set of the form \(\{n^k\mid n\in \mathbb {N}\}\), with \(k\in \mathbb {N}\), is Srecognizable for some S. In the constructions of [502, 554], the numeration languages are of polynomial growth. Consider the base 4 numeration system, whose numeration language is of exponential growth. By Theorem 3.2.23, if X = val_{4}({1, 3}^{∗}), then t_{ X }(n) = Θ(n^{2}). Indeed, with the notation of Theorem 3.2.23, we have α = 4, β = 2, p = q = 1 (hence f = 2), and c = d = 0.
Proposition 3.2.26
For every rational number r ≥ 1, there exists an abstract numeration system S built on a polynomial regular language and an infinite Srecognizable subset X of \(\mathbb {N}\) such that t_{ X }(n) = Θ(n^{ r }).
Proof
Fix a rational number r ≥ 1. Write \(r=\frac {c}{d}\) where c and d are positive integers. Define \(\mathcal B_\ell \) to be the bounded language \(a_1^*a_2^*\cdots a_\ell ^*\). We have \(\mathbf {v}_{\mathcal B_\ell }(n)=\binom {n+\ell }{\ell }\) for all ℓ ≥ 1 and \(n\in \mathbb {N}\) (e.g., see [149, Lemma 1]). Let S be the abstract numeration system built on \(\mathcal B_c\) with the order a_{1} < a_{2} < ⋯ < a_{ c }, and let \(X=\mathrm {val}_S(\mathcal B_d)\) (since c ≥ d, we have \(\mathcal B_d\subseteq \mathcal B_c\)). Hence we have \(\mathbf {v}_{\mathcal B_c}(n)=\binom {n+c}{c}\) and \(\mathbf {v}_{\mathrm {rep}_S(X)}(n)=\binom {n+d}{d}\) for all \(n\in \mathbb {N}\). Then from Theorem 3.2.23, we obtain \(t_X(n)=\varTheta ( n^{\frac {c}{d}})=\varTheta (n^r)\). □
Theorem 3.2.23 also allows us to exhibit subsets of \(\mathbb {N}\) which are not Srecognizable for any abstract numeration system S. For example, let \(C = \{C_n\mid n \in \mathbb {N} \}\) denote the set of Catalan numbers \(C_n = \frac {1}{n+1}\binom {2n}{n}\). As is well known, we have \(C_n \sim \frac {4^n}{n^{3/2}\sqrt {\pi }} \quad (n\to +\infty )\), which does not correspond to any of the forms described by Theorem 3.2.23. Hence, for all S, the set C is not Srecognizable.
3.2.5 The Cobham–Semenov Theorem
So far we have introduced several numeration systems and have considered the question of describing recognizable sets of nonnegative integers within a fixed numeration system. The celebrated theorem of Cobham concerns, on the contrary, sets of numbers that are simultaneously recognizable in different integer bases. Cobham’s theorem and its numerous generalizations are the subject of several surveys [114, 206]. Nevertheless, due to the importance of this result and its relevance to the subject of the present chapter, we briefly discuss it in this short section.
Definition 3.2.27
Semilinear subsets of \(\mathbb {N}^d\) are the finite unions of sets of the form \(\mathbf {p}_0+\mathbf {p}_1\mathbb {N}+\cdots + \mathbf {p}_\ell \mathbb {N}\), where \(\mathbf {p}_0,\mathbf {p}_1,\ldots ,\mathbf {p}_\ell \in \mathbb {N}^d\).
Recall that b and b′ are multiplicatively independent if \(\frac {\log (b)}{\log (b')}\notin \mathbb {Q}\); see Definition 3.2.24.
Theorem 3.2.28 (Cobham–Semenov [155, 536])
Let b and b′ be multiplicatively independent integer bases. If a subset of \(\mathbb {N}^d\) is simultaneously brecognizable and b′recognizable, then it is semilinear.
As semilinear sets are brecognizable for all integer bases b, we obtain that a subset of \(\mathbb {N}^d\) is brecognizable for all b ≥ 2 if and only if it is semilinear. Note that we cannot replace b ≥ 2 by b ≥ 1 as, for example, the linear set \(X=\{(n,2n)\mid n\in \mathbb {N}\}=(1,2)\mathbb {N}\) is not 1recognizable.
Theorem 3.2.29 ([144])
A subset X of \(\mathbb {N}^d\) is Srecognizable for all abstract numeration systems S if and only if it is 1recognizable.
3.3 FirstOrder Logic and bAutomatic Sequences
In this section, we present an equivalent definition of bautomatic sequences in terms of logic. It is given by the BüchiBruyère theorem. This criterion is of high interest since it represents a powerful tool in order to show that many properties of bautomatic sequences are decidable.
3.3.1 bDefinable Sets of Integers
A (logical) structure \(\mathcal {S}=\langle S, (R_i) \rangle \) consists of a set S, called the domain of the structure, and countably many relations \(R_i\subseteq S^{d_i}\), where the d_{ i }’s are positive integers, called the arities of the R_{ i }’s.

variables x_{1}, x_{2}, x_{3}, … describing elements of the domain S,

the equality = ,

the relations given in the structure \(\mathcal {S}\),

the connectives ∨, ∧, ⇒ , ⇔ , ¬,

the quantifiers ∀, ∃ on variables.
Example 3.3.1
The Presburger arithmetic is described by the firstorder formulæ of the structure \(\langle \mathbb {N},+\rangle \). See Section 3.7.
We shall use particular notation for constant relations and for functional relations. A constant relation is a relation of the form {c}. It will be simply denoted c. A functional relation is a binary relation R such that for any s ∈ S, there is at most one t ∈ S with (s, t) ∈ R. Such a relation R will be denoted f : S → S where it is understood that f(s) = t if there exists t ∈ S such that (s, t) ∈ R and f(s) is undefined otherwise.
Definition 3.3.2
A subset X of \(\mathbb {N}^d\) is bdefinable if it is definable in the logical structure \(\langle \mathbb {N},+,V_b\rangle \), where + is the ternary relation defined by x + y = z and V_{ b } is the function defined by V_{ b }(0) = 1, and for x a positive integer, V_{ b }(x) is the largest power of b dividing x.
Example 3.3.3
One has V_{2}(9) = 1 and V_{2}(24) = 8.
3.3.2 The BüchiBruyère Theorem
Theorem 3.3.4 ([112, 115])
A subset X of \(\mathbb {N}^d\) is brecognizable if and only if it is bdefinable. Moreover, both directions are effective.
For a detailed proof of this result, we refer the reader to [114]. We only sketch the idea of their proof here. They work with automata accepting reversed brepresentations of numbers. From a DFA recognizing X least significant digit first, that is, such that it accepts a language \(L\subseteq (A_b^{\ d})^*\) satisfying \(X=\{\mathrm {val}_b(\widetilde {w})\mid w\in L\}\), they construct a firstorder formula φ of the structure \(\langle \mathbb {N},+,V_b\rangle \) defining X. Conversely, given a firstorder formula φ of the structure \(\langle \mathbb {N},+,V_b\rangle \) defining X, they build a DFA accepting all the reversed brepresentations of the elements in X, that is, accepting the language (rep_{ b }(X))^{∼}0^{∗}.
3.3.3 The FirstOrder Theory of \(\langle \mathbb {N},+,V_b\rangle \) Is Decidable
As a corollary of the BüchiBruyère theorem, the firstorder theory of \(\langle \mathbb {N},+,V_b\rangle \) is decidable: given any closed firstorder formula of \(\langle \mathbb {N},+,V_b\rangle \), we can decide whether it is true or false in \(\mathbb {N}\). As this corollary has a nice short proof, we give it here.
Since there is no constant in the structure, a closed formula of \(\langle \mathbb {N},+,V_b\rangle \) is necessarily of the form ∃xφ(x) or ∀xφ(x). The set X_{ φ } is brecognizable by the BüchiBruyère theorem. This means that we can effectively construct a DFA accepting rep_{ b }(X_{ φ }). The closed formula ∃xφ(x) is true if rep_{ b }(X_{ φ }) is nonempty and false otherwise. As the emptiness of a regular language is decidable [301], we can decide if ∃xφ(x) is true.
The case ∀xφ(x) reduces to the previous one since ∀xφ(x) is logically equivalent to ¬∃x¬φ(x). We can again construct a DFA accepting the brepresentations of X_{¬φ}. The language it accepts is empty if and only if the closed formula ∀xφ(x) is true.
3.3.4 Applications to Decidability Questions for bAutomatic Sequences
Proposition 3.3.5
If we can express a property P(n) of an integer n using quantifiers, logical operations, the operations of addition and subtraction, and comparison of integers or elements of a bautomatic sequence x, then ∃nP(n), ∃^{ ∞ }nP(n), and ∀nP(n) are decidable.
In practice, given a DFAO \(\mathcal {A}\) computing \(x\colon \mathbb {N}^d\to \mathbb {N}\), we can directly compute a DFA recognizing the tuples \((m_1,\ldots ,m_d,n_1,\ldots ,n_d)\in \mathbb {N}^{2d}\) such that x(m_{1}, …, m_{ d }) = x(n_{1}, …, n_{ d }). We compute the product of automata \(\mathcal {A}\times \mathcal {A}\), thus reading tuples of size 2d, and simulate (m_{1}, …, m_{ d }) on the first component and (n_{1}, …, n_{ d }) on the second component, and we accept if the outputs of \(\mathcal {A}\) after reading rep_{ b }(m_{1}, …, m_{ d })^{ # } and rep_{ b }(n_{1}, …, n_{ d })^{ # } are the same and reject otherwise.
In fact, Theorem 3.3.4 allows us to prove a stronger result than the decidability of such properties of bautomatic sequences. What we obtain is that the characteristic sequences of those properties are themselves bautomatic. The following proposition is far from being exhaustive. It only aims to give a flavor of the properties that can be handled by using this technique. For similar results, we refer to [12, 148]. A finite word is unbordered if no proper prefix equals a suffix. A palindrome is a finite word equal to its reversal: \(w=\widetilde {w}\).
Proposition 3.3.6

y(i) = 1 if and only if x has an overlap at position i

y(i) = 1 if and only if x has an unbordered factor of length i

y(i) = 1 if and only if x has a square at position i

y(i) = 1 if and only if x has a palindrome at position i.
Proposition 3.3.7 ([523])
If x is the paperfolding sequence, then the predicate “x has an abelian square at position i of length 2n” is not expressible in \(\langle \mathbb {N},+,V_2\rangle \).
This method for deciding firstorder expressible properties of bautomatic sequences is very bad in terms of complexity. In the worst case, we have a tower of exponentials in the number of states of the given DFAO whose height is the number of alternating quantifiers of the firstorder predicate. Nevertheless, this procedure was implemented by Mousavi and works efficiently in many cases. His open source software package is called Walnut [426]. It can be used in practice in order to prove (and reprove) many results about some particular bautomatic sequences, in a purely mechanical way [248, 249, 250].
3.4 Enumeration
The object of this section is to study enumeration problems about bautomatic sequences. It turns out that the sequences \((a(m))_{m\in \mathbb {N}}\) that count the number of \(n\in \mathbb {N}\) such that P(m, n) is true, for any firstorder predicate P of the logical structure \(\langle \mathbb {N},+,V_b\rangle \), are indeed bregular sequences; this is Theorem 3.4.15. We first introduce bregular sequences over an arbitrary semiring K (also see Chapters 2 and 4). Then we focus on the semirings \(\mathbb {N}\) and \(\mathbb {N}_\infty :=\mathbb {N}\cup \{\infty \}\). We discuss \(\mathbb {N}\)recognizable and \(\mathbb {N}_\infty \)recognizable formal series and their connections to finite automata. This, together with the BüchiBruyère theorem, allows us to prove that counting various quantities related to bautomatic sequences gives rise to bregular sequences. Finally, we discuss the particular case of bsynchronized sequences and show that, in general, the same techniques cannot be used to show that the obtained sequences are bsynchronized: some of them are, whereas some others are not.
3.4.1 bRegular Sequences
A formal series S is a map from A^{∗} to K, where A is a finite alphabet and K is a semiring. The image of a word w is denoted (S, w), as is customary. We also use the notation \(S=\sum _{w\in A^*} (S,w)\,w\).
Definition 3.4.1
Let A be a finite alphabet and K be a semiring. A formal series S : A^{∗}→ K is Krecognizable if there exist an integer m ≥ 1, vectors λ ∈ K^{1×m}, γ ∈ K^{m×1}, and a morphism of monoids μ: A^{∗}→ K^{m×m} such that, for all w ∈ A^{∗}, (S, w) = λμ(w)γ. The triple (λ, μ, γ) is called a linear representation of S, and we say it is of size, or of dimension, m.
The family of Krecognizable series has many stability properties. We list here (without proofs) only those we will explicitly use for our purpose. For more on Krecognizable series, we refer the reader to [77].
The characteristic series of a language L ⊆ A^{∗} is χ_{ L } :=∑_{w ∈ L}w. It can be viewed as a map from A^{∗} to K for any semiring K (as any semiring contains 0 and 1).
Proposition 3.4.2
 1.
L is regular.
 2.
χ _{ L } is \(\mathbb {N}\) recognizable.
 3.
For all semirings K, χ _{ L } is Krecognizable.
The Hadamard product of two formal series S and T is their termwise product: \(S\odot T=\sum _{w\in A^*} (S,w)(T,w)\,w\). In particular, S ⊙ χ_{ L } =∑_{w ∈ L}(S, w) w.
Proposition 3.4.3
If S : A^{∗}→ K is a Krecognizable series and L ⊆ A^{∗} is a regular language, then S ⊙ χ_{ L } is Krecognizable.
Proposition 3.4.4
Every formal series S : A^{∗}→ K with only finitely many terms (S, w)≠0 is Krecognizable.
It follows from the previous two propositions that two formal series that differ only in a finite number of words are either both Krecognizable or both not Krecognizable.
We will need the following lemma.
Lemma 3.4.5
is Krecognizable.
Proof
By an abuse of notation, we sometimes write \(\sum _{\mathbf {n}\in \mathbb {N}^d} x(\mathbf {n})\,\mathrm {rep}_b(\mathbf {n})\) instead of \(\sum _{w\in \mathrm {rep}_b(\mathbb {N}^d)} x(\mathrm {val}_b(w))\, w\). Similarly, \(\sum _{n_1,\ldots ,n_d\in \mathbb {N}} x(n_1,\ldots ,n_d)\,(\mathrm {rep}_b(n_1),\ldots ,\mathrm {rep}_b\) (n_{ d }))^{ # } is the series S : ((A_{ b } ∪{#})^{ d })^{∗}→ K defined by (S, w) = x(n_{1}, …, n_{ d }) if w = (rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # } for some \(n_1,\ldots ,n_d\in \mathbb {N}\) and (S, w) = 0 otherwise.
Proposition 3.4.6
 1.
\(\sum _{w\in (A_b^{\ d})^*} x(\mathrm {val}_b(w))\,w\) is Krecognizable.
 2.
\(\sum _{\mathbf {n}\in \mathbb {N}^d} x(\mathbf {n})\,\mathrm {rep}_b(\mathbf {n})\) is Krecognizable.
 3.
There exists a Krecognizable series \(S\colon (A_b^{\ d})^*\to K\) such that, for all \(\mathbf {n}\in \mathbb {N}^d\), (S, rep_{ b }(n)) = x(n).
 4.
There exists a Krecognizable series T : ((A_{ b } ∪{#})^{ d })^{∗}→ K such that, for all \(n_1,\ldots ,n_d\in \mathbb {N}\), (T, (rep_{ b }(n_{1}), …, rep_{ b }(n_{ d }))^{ # }) = x(n_{1}, …, n_{ d }).
 5.
\(\sum _{n_1,\ldots ,n_d\in \mathbb {N}} x(n_1,\ldots ,n_d)\,(\mathrm {rep}_b(n_1),\ldots ,\mathrm {rep}_b(n_d))^\#\) is Krecognizable.
Proof
The implication 2 ⇒ 3 is clear.
3 ⇒ 1 ∧ 4: Assume that 3 holds and let \(S\colon (A_b^{\ d})^*\to K\) be a Krecognizable series such that, for all \(\mathbf {n}\in \mathbb {N}^d\), (S, rep_{ b }(n)) = x(n). Let (λ, μ, γ) be a linear representation of S, say of size m.
Definition 3.4.7
A sequence \(x\colon \mathbb {N}^d\to K\) is (K, b)regular if any of the assertions of Proposition 3.4.6 is satisfied.
Thanks to the following elementary lemma, we can equivalently consider reversals of representations, i.e., starting with the least significant digit. Here \(\widetilde {\alpha }\) denotes the transpose of the matrix α, and \(\widetilde {\mu }\) is the morphism defined by \(\widetilde {\mu }(a)=\widetilde {\mu (a)}\) for each letter a.
Lemma 3.4.8
If a formal series S : A^{∗}→ K admits the linear representation (λ, μ, γ), then the reversal series \(\widetilde {S}:=\sum _{w\in A^*} (S,\widetilde {w})\,w\) admits the linear representation \((\widetilde {\gamma },\widetilde {\mu },\widetilde {\lambda })\).
Proof
For all \(w=a_1\cdots a_{w}\in A_b^*\), \(\widetilde {\mu (\widetilde {w})} =(\mu (a_{w}\cdots a_1))^\sim =(\mu (a_{w})\cdots \mu (a_1))^\sim =\widetilde {\mu (a_1)}\cdots \widetilde {\mu (a_{w})} =\widetilde {\mu }(a_1)\cdots \widetilde {\mu }(a_{w}) =\widetilde {\mu }(a_1\cdots a_{w}) =\widetilde {\mu }(w)\), hence \((\widetilde {S},w) =(S,\widetilde {w}) =\lambda \mu (\widetilde {w})\gamma =(\lambda \mu (\widetilde {w})\gamma )^\sim =\widetilde {\gamma }\,\widetilde {\mu (\widetilde {w})}\,\widetilde {\lambda } =\widetilde {\gamma }\,\widetilde {\mu }(w)\,\widetilde {\lambda }\). □
In what follows, the semiring K will be either \(\mathbb {N}\) or \(\mathbb {N}_\infty =\mathbb {N}\cup \{\infty \}\) with 0 ⋅∞ = 0. Let us mention the following result, a proof of which can be found in Chapter 2.
Proposition 3.4.9 ([17])
If \(x\colon \mathbb {N}\to \mathbb {N}\) is an \((\mathbb {N},b)\)regular sequence, then there exists some \(c\in \mathbb {N}\) such that x(n) ∈ O(n^{ c }).
3.4.2 \(\mathbb {N}\)Recognizable and \(\mathbb {N}_\infty \)Recognizable Formal Series
We have the following useful characterizations of \(\mathbb {N}\)recognizable and \(\mathbb {N}_\infty \)recognizable formal series. Here π_{ i } denotes the projection onto the ith component.
Theorem 3.4.10
 1.
S is \(\mathbb {N}\) recognizable.
 2.
There exists a regular language L ⊆ (A × Δ)^{∗} (where Δ is a finite alphabet) such that, for all w ∈ A^{+}, (S, w) equals the number of z ∈ L with π_{1}(z) = w.
Proof
We sometimes want to count quantities that might be unbounded in certain entries, as, for example, the length of the longest square (or kpower, overlap, palindrome, unbordered factor, etc.) beginning at position i.
Proposition 3.4.11
If \(S\colon A^*\to \mathbb {N}\) is \(\mathbb {N}_{\infty }\) recognizable, then it is \(\mathbb {N}\) recognizable.
Proof
Let n ≥ 1, \(\lambda \in \mathbb {N}_{\infty }^{1\times n}\), \(\gamma \in \mathbb {N}_{\infty }^{n\times 1}\), and a morphism of monoids \(\mu \colon A^*\to \mathbb {N}_{\infty }^{n\times n}\) such that, for all w ∈ A^{∗}, (S, w) = λμ(w)γ. As, for all w ∈ A^{∗}, \((S,w)\in \mathbb {N}\), any occurrence of ∞ in the computation of λμ(w)γ must belong to a multiplication with 0. Hence we can modify λ, γ, μ to λ′, γ′, μ′ by replacing any occurrence of ∞ by 0. In this way, \(\lambda '\in \mathbb {N}^{1\times n}\), \(\gamma '\in \mathbb {N}^{n\times 1}\), \(\mu '\colon A^*\to \mathbb {N}^{n\times n}\), and, for all w ∈ A^{∗}, (S, w) = λ′μ′(w)γ′. This shows that S is \(\mathbb {N}\)recognizable. □
Lemma 3.4.12
If \(S\colon A^*\to \mathbb {N}_\infty \) is \(\mathbb {N}_\infty \)recognizable, then the language {w ∈ A^{∗}∣(S, w) = ∞} is regular.
Proof
Let (λ, μ, γ) be a linear representation of S. Consider the set {0, p, ∞} (where p is any symbol, intended to represent positive integers). We endow this set with a structure of commutative semiring as follows: 0 + 0 = 1, p + 0 = p + p = p, p + ∞ = ∞ + ∞ = ∞, 0 ⋅ 0 = p ⋅ 0 = ∞⋅ 0 = 0, p ⋅ p = p, and p ⋅∞ = ∞⋅∞ = ∞. Define a morphism of semirings \(\tau \colon \mathbb {N}_\infty \to \{0,p,\infty \}\) by τ(0) = 0, τ(n) = p for \(n\in \mathbb {N}\setminus \{0\}\), and τ(∞) = ∞. Now we define a DFA \(\mathcal {M}=(Q,q_0,F,A,\delta )\) as follows: Q = {0, p, ∞}^{1×n}, q_{0} = [τ(λ_{11})⋯τ(λ_{1n})], F = {q ∈ Q∣q [τ(γ_{11})⋯τ(γ_{n1})]^{ T }} = ∞}, and δ(q, a) = q (τ(μ(a)_{ ij }))_{1≤i,j≤n}. We have δ(q_{0}, w) ∈ F ⇔ τ(λμ(w)γ) = ∞ ⇔ (S, w) = λμ(w)γ = ∞. This proves that \(\mathcal {M}\) accepts {w ∈ A^{∗}∣(S, w) = ∞}. □
Theorem 3.4.13
 1.
S is \(\mathbb {N}_\infty \) recognizable.
 2.
There exists a regular language L ⊆ ((A ∪{#}) × Δ)^{∗} (where #∉A and Δ is a finite alphabet) such that, for all w ∈ A^{+}, (S, w) equals the number of z ∈ L with τ_{ # }(π_{1}(z)) = w, where τ_{ # } is the morphism defined by a↦a for a ∈ A and #↦ε.
Proof
1⇒2. Suppose that S is \(\mathbb {N}_\infty \)recognizable. By Lemma 3.4.12, the language L_{1} = {w ∈ A^{∗}∣(S, w) = ∞} is regular. Now, the series \(S'=S\odot \chi _{\{w\in A^*\mid (S,w)\neq \infty \}}\) is \(\mathbb {N}\)recognizable by Propositions 3.4.3 and 3.4.11. From Theorem 3.4.10, we get a regular language L_{2} ⊆ (A × Δ)^{∗} (for some alphabet Δ) such that, for all w ∈ A^{+}, (S′, w) = Card{z ∈ L_{2}∣π_{1}(z) = w}. Let a ∈ Δ and let #∉A. Then define L_{3} = {z ∈ (A ∪{#}) × Δ)^{∗}∣π_{1}(z) ∈ L_{1}#^{∗}, π_{2}(z) ∈ a^{∗}}. Clearly L_{3} is regular, and, for all w ∈ A^{+}, (S, w) = Card{z ∈ L_{2} ∪ L_{3}∣τ_{ # }(π_{1}(z)) = w}.
3.4.3 Counting bDefinable Properties of bAutomatic Sequences Is bRegular
We are now able to prove the main result of this section, namely, Theorem 3.4.15.
Proposition 3.4.14
If \(x\colon \mathbb {N}^d\to \mathbb {N}\) is \((\mathbb {N}_{\infty },b)\) regular, then it is \((\mathbb {N},b)\) regular.
Proof
Suppose that \(x\colon \mathbb {N}^d\to \mathbb {N}\) is \((\mathbb {N}_{\infty },b)\)regular. Then \(\sum _{w\in (A_b^{\ d})^*} x(\mathrm {val}_b(w))\,w\) is \(\mathbb {N}_{\infty }\)recognizable. By Proposition 3.4.11, the latter formal series is indeed \(\mathbb {N}\)recognizable since \((S,w)=x(\mathrm {val}_b(w))\in \mathbb {N}\) for all \(w\in (A_b^{\ d})^*\). Hence x is \((\mathbb {N},b)\)regular. □
Theorem 3.4.15
is \((\mathbb {N}_{\infty },b)\) regular. If moreover \(a(\mathbb {N}^d)\subseteq \mathbb {N}\) , then a is \((\mathbb {N},b)\) regular.
Proof
The fact that a is \((\mathbb {N},b)\)regular if \(a(\mathbb {N})\subseteq \mathbb {N}\) follows from Proposition 3.4.14. □
As an application, the factor complexity of a bautomatic sequence is \((\mathbb {N},b)\)regular.
Proposition 3.4.16
The factor complexity n↦Card(L_{ n }(x)) of a bautomatic sequence \(x\colon \mathbb {N}\to \mathbb {N}\) is \((\mathbb {N},b)\)regular.
Proof
Let \(x\colon \mathbb {N}\to \mathbb {N}\) be a bautomatic sequence. For all \(n\in \mathbb {N}\), \(\mathrm {Card}(L_n(x))=\mathrm {Card}\{i\in \mathbb {N}\mid \forall j<i,\ x(j)\cdots x(j+n1)\neq x(i)\cdots x(i+n1)\}\). Now let X = {(i, n)∣∀j < i, ∃t < n, x(j + t) ≠ x(i + t)}. Then \(X\subseteq \mathbb {N}^2\) is bdefinable by Theorem 3.3.4, and, for all \(n\in \mathbb {N}\), we have \(\mathrm {Card}(L_n(x))=\mathrm {Card}\{i\in \mathbb {N}\mid (i,n)\in X\}\); hence, the factor complexity of x is \((\mathbb {N},b)\)regular by Theorem 3.4.15. □
In a similar manner, we can show the following. In order not to overburden the text, we do not define these counting functions here and refer the interested reader to [148].
Proposition 3.4.17

The function that maps n to the number of squares (or palindromes, unbordered factors, kpowers) of x beginning at position n is \((\mathbb {N}_{\infty },b)\) regular.

The recurrence function of x is \((\mathbb {N}_{\infty },b)\) regular.

The appearance function of x is \((\mathbb {N},b)\) regular.

The separator length function of x is \((\mathbb {N},b)\) regular.

The permutation complexity of x is \((\mathbb {N},b)\) regular.

The periodicity function of x is \((\mathbb {N}_{\infty },b)\) regular.

The function that maps n to the number of unbordered factors of length n of x is \((\mathbb {N},b)\) regular.
Using the same technique, it can be shown that all these quantities are either O(n) or infinite for at least one n.
Proposition 3.4.18
Let X be a bdefinable subset of \(\mathbb {N}^2\), and let \(a\colon \mathbb {N}\to \mathbb {N}_{\infty }\) be the sequence defined by \(a(n)=\mathrm {Card}\{m\in \mathbb {N}\mid (n,m)\in X\}\) for all \(n\in \mathbb {N}\). Then either a(n) = ∞ for some \(n\in \mathbb {N}\) or a(n) = O(n).
Proof
If \(L\in \mathbb {N}\) is such that for all (m, n) ∈ X, rep_{ b }(m)≤rep_{ b }(n) + L, then for all \(n\in \mathbb {N}\), a(n) ≤ b^{ L }n. If a is not O(n), then for all \(L\in \mathbb {N}\), there exists (m, n) ∈ X such that rep_{ b }(m) > rep_{ b }(n) + L. Therefore (rep_{ b }(m), #^{ K }rep_{ b }(n)) ∈rep_{ b }(X)^{ # } for some K > L. As X is bdefinable, there is a DFA accepting rep_{ b }(X)^{ # }. By choosing L equal to the number of states of this DFA and applying the pumping lemma, we obtain infinitely many elements (m′, n) in X. This means that a(n) = ∞. □
It seems more difficult to obtain similar enumeration results in the multidimensional setting. For example, what about the following question?
Problem 3.4.19
Must the function \(f\colon \mathbb {N}^2\to \mathbb {N}\) that counts the number of rectangular factors of size m × n in a bidimensional bautomatic sequence be \((\mathbb {N},b)\)regular?
3.4.4 bSynchronized Sequences
The family of bsynchronized sequences lies in between the families of bautomatic sequences and bregular sequences; see Proposition 3.4.21 and Theorem 3.4.23 below. Therefore, a natural question in the context developed in the present chapter is whether (various) enumeration problems about bautomatic sequences can or cannot be described by bsynchronized sequences.
Definition 3.4.20
Proposition 3.4.21
Let A be a finite subset of \(\mathbb {N}\) and let \(x\colon \mathbb {N}^d\to A\) . Then x is bsynchronized if and only if it is bautomatic.
Proof
For each a ∈ A, \(x^{1}(a)=\{(n_1,\ldots ,n_d)\in \mathbb {N}^d\mid (n_1,\ldots ,n_d,a)\in G_x\}\) and G_{ x } =⋃_{a ∈ A} (x^{−1}(a) ×{a}). Therefore, the result follows from Proposition 3.2.8 and Theorem 3.3.4. □
Note that the use of Theorem 3.3.4 in the previous proof is somewhat superfluous since we could easily build finite automata recognizing the fibers x^{−1}(a) and the graph G_{ x }.
We have the following useful lemma.
Lemma 3.4.22
If \(x\colon \mathbb {N}^d\to \mathbb {N}\) is a bsynchronized sequence, then there is a bdefinable subset X of \(\mathbb {N}^{d+1}\) such that, for all \(n_1,\ldots ,n_d\in \mathbb {N}\), \(x(n_1,\ldots ,n_d)=\mathrm {Card}\{m\in \mathbb {N}\mid (n_1,\ldots ,n_d,m)\in X\}\).
Proof
Let x be a bsynchronized sequence. Then G_{ x } is bdefinable by Theorem 3.3.4. Therefore, the subset \(X=\{(n_1,\ldots ,n_d,m)\in \mathbb {N}^{d+1}\mid m<x(n_1,\ldots ,n_d)\}=\{(n_1,\ldots ,n_d,m)\in \mathbb {N}^{d+1}\mid \exists \ell \ (n_1,\ldots ,n_d,\ell )\in G_x \text{ and }m<\ell \}\) is bdefinable as well, and of course \(x(n_1,\ldots ,n_d)=\mathrm {Card}\{m\in \mathbb {N}\mid (n_1,\ldots ,n_d,m)\in X\}\) for all \(n_1,\ldots ,n_d\in \mathbb {N}\). □
Theorem 3.4.23
Any bsynchronized sequence is \((\mathbb {N},b)\) regular.
Proposition 3.4.24
If \(x\colon \mathbb {N}\to \mathbb {N}\) is bsynchronized, then x(n) is O(n).
We saw in Proposition 3.4.16 that the factor complexity of a bautomatic sequence is \((\mathbb {N},b)\)regular. In fact, we have the more precise following result, which we give without proof.
Proposition 3.4.25 ([522])
Let \(x\colon \mathbb {N}\to \mathbb {N}\) be a bautomatic sequence. Then the factor complexity of x is bsynchronized.
In view of Propositions 3.4.18 and 3.4.24, one might think that all the quantities of Proposition 3.4.17 are in fact bsynchronized. However, it is not the case.
Proposition 3.4.26
Let \(X=\{2^i\mid i\in \mathbb {N}\}\). Then χ_{ X } is 2automatic, but the function that counts the number of unbordered factors of length n of χ_{ X } is not 2synchronized.
Proof
As rep_{ b }(X) = 10^{∗}, we get that χ_{ X } is 2automatic. Let \(y\colon \mathbb {N}\to \mathbb {N}\) be the function that maps n to the number of unbordered factors of length n of χ_{ X }. Suppose that y is 2synchronized, i.e., that its graph \(G_y=\{(n,y(n))\mid n\in \mathbb {N}\}\) is 2recognizable. Then rep_{2}(G) is accepted by some DFA \(\mathcal {M}\). For all integers n ≥ 2, we have y(2^{ n } + 1) = n + 2; hence, \((10^{n1}1,0^{n\lfloor \log _2(n+2)\rfloor }\mathrm {rep}_2(n+2))\) is accepted by \(\mathcal {M}\). By choosing n −⌊log_{2}(n + 2)⌋ to be larger than the size of \(\mathcal {M}\), the result follows from an application of the pumping lemma. □
3.5 FirstOrder Logic and UAutomatic Sequences

In general, \(\mathbb {N}\) is not Urecognizable.

In general, the addition is not recognized by finite automaton.
Theorem 3.5.3 below shows that a nice setting is given by the socalled Pisot numeration systems.
Definition 3.5.1
A Pisot number is an algebraic integer greater than 1 such that all of its Galois conjugates have moduli less than 1.
Definition 3.5.2
A positional numeration system rep_{ U } is Pisot if the base sequence U satisfies a linear recurrence whose characteristic polynomial is the minimal polynomial of a Pisot number.
Theorem 3.5.3 ([113, 232])
If rep_{ U } is a Pisot numeration system, then the sets \(\mathbb {N}\) and \(\{(x,y,z)\in \mathbb {N}^3\mid x+y=z\}\) are Urecognizable.
Definition 3.5.4
A subset of \(\mathbb {N}^d\) is Udefinable if it is definable in the logical structure \(\langle \mathbb {N},+,V_U\rangle \), where V_{ U }(0) = 1, and for x a positive integer, V_{ U }(x) denotes the smallest U_{ i } occurring in the greedy Urepresentation of x with a nonzero coefficient.
Example 3.5.5
We have V_{ F }(11) = 3 and V_{ F }(26) = 5.
Theorem 3.5.6 ([113])
If rep_{ U } is a Pisot numeration system, then a subset of \(\mathbb {N}^d\) is Urecognizable if and only if it is Udefinable. Consequently, the firstorder theory of \(\langle \mathbb {N},+,V_U\rangle \) is decidable.

f is not ultimately periodic.

f contains no fourth powers.

f is reversal invariant.

f is linearly recurrent.

Characterizations of the squares (or cubes, antisquares, palindromes, antipalindromes) occurring in f.

Characterizations of the least periods of factors (or unbordered factors, Lyndon factors, special factors) of f.

Computation of the critical exponent and initial critical exponent of f.

The lexicographically least element in the shift orbit closure \(\mathcal {S}(f)\) is 0f.
We end this section by a problem.
Problem 3.5.7
Do the results on enumeration of bautomatic sequences described in this section extend to Pisot numeration systems?
3.6 FirstOrder Logic and Real Numbers
In general real numbers are represented by infinite words. In this context, we consider Büchi automata, which allows us to define a notion of (baserelated) recognizability of multidimensional sets of reals. In the continuity of the ideas developed so far, we will show that the socalled βrecognizable sets can again be characterized in terms of firstorder logic, which will provide us with decision procedures for various problems concerning those sets.
3.6.1 Büchi Automata
Büchi automata are defined as NFAs, but the acceptance criterion has to be adapted: an infinite word is accepted if it labels a path going infinitely many times through an accepting state. In the present chapter, we always assume that a Büchi automaton is finite. Without loss of generality, we also always assume that there is only one initial state.
Example 3.6.1
Subsets of \(A^{\mathbb {N}}\) are called ωlanguages, and ωregular languages are defined as ωlanguages which are accepted by (finite) Büchi automata. Regular languages and ωregular languages share some important properties: their families are closed under Boolean operations, morphic image and inverse image under a morphism. Nevertheless, they differ in some other aspects. One of them is determinism. As with DFAs, we can define deterministic Büchi automata. But one has to be careful as the family of ωlanguages that are accepted by deterministic Büchi automata is strictly included in that of ωregular languages.
Example 3.6.2
No deterministic Büchi automaton accepts the ωlanguage accepted by the Büchi automaton of Figure 3.5.
For more on automata reading infinite words, see [476]. Let us stress that, contrary to the present chapter, Büchi automata are not considered finite by default in [476].
3.6.2 Real Bases β
Note that βnumeration systems are also presented in Chapter 8.1.
Example 3.6.3
Consider x = ϕ^{−1}, where ϕ is the Golden Ratio. The words u = 0 ⋆ 001111⋯ , v = 0 ⋆ 0101010⋯, and w = 0 ⋆ 10^{ ω } are all βrepresentations of x.
Now let us define the βexpansion of a vector x of \(\mathbb {R}^d\).
Definition 3.6.4
Let x = (x_{1}, …, x_{ d }) be a vector in \(\mathbb {R}^d\). We define the βexpansion of x as being the word d_{ β }(x) over the alphabet \(\tilde {A}_\beta ^{\ d}\cup \{{\scriptstyle \bigstar }\}\) that belongs to 0^{∗}d_{ β }(x_{1}) × 0^{∗}d_{ β }(x_{2}) ×⋯ × 0^{∗}d_{ β }(x_{ d }) and that does not start with 0 except if x_{ i } < 1 for all i, in which case we consider the word starting with \(\mathbf {0}{\scriptstyle \bigstar }\).
Otherwise stated, the βexpansions of each component are synchronized by possibly using some leading zeros in such a way that all the ⋆ symbols occur at the same position in every βexpansion.
Example 3.6.5
We let \(S_\beta (\mathbb {R}^d)\) be the topological closure of \(\mathbf {0}^*d_\beta (\mathbb {R}^d)\). For \(u{\scriptstyle \bigstar } v \in (\mathbb {Z}^d)^+{\scriptstyle \bigstar }(\mathbb {Z}^d)^{\mathbb {N}}\) with finitely many possible digits, we define \(\mathrm {val}_\beta (u{\scriptstyle \bigstar } v)\) to be the vector in \(\mathbb {R}^d\) obtained by evaluating each component of \(u{\scriptstyle \bigstar } v\).
Definition 3.6.6
For \(X\subseteq \mathbb {R}^d\), we define S_{ β }(X) as \(S_\beta (X)=S_\beta (\mathbb {R}^d)\cap \mathrm {val}_\beta ^{1}(X)\). For \(\mathbf {x}\in \mathbb {R}^d\), the elements in S_{ β }(x) are called the quasigreedy βrepresentations of x.
Here and throughout the text, we write S_{ β }(x) instead of S_{ β }({x}). Note that βexpansions are particular quasigreedy βrepresentations.
Remark 3.6.7
If β is an integer, then S_{ β }(X) is the set of all βrepresentations of elements in X. Otherwise stated, when β is an integer, any βrepresentation is a quasigreedy βrepresentation.
Proposition 3.6.8
Let \(X\subseteq \mathbb {R}^d\). Then X is closed if and only if S_{ β }(X) is closed.
Proof
Suppose first that X is closed. Then \(\mathrm {val}_\beta ^{1}(X)\) is closed since the function \(\mathrm {val}_\beta \colon (\tilde {A}_\beta ^{\ d})^+ {\scriptstyle \bigstar } (\tilde {A}_\beta ^{\ d})^\omega \to \mathbb {R}^d\) is continuous. As \(S_\beta (\mathbb {R}^d)\) is closed by definition, we obtain that \(S_\beta (X)=S_\beta (\mathbb {R}^d)\cap \mathrm {val}_\beta ^{1}(X)\) is closed as well.
Conversely, suppose that S_{ β }(X) is closed, and let x^{(n)} be a sequence of X converging to some x. By the pigeonhole principle, there exists a subsequence x^{(k(n))} of x^{(n)} such that, for all n, x^{(k(n))} −x has a constant sign (potentially 0) on each component. Then the sequence d_{ β }(x^{(k(n))}) converges to some \(u{\scriptstyle \bigstar } v\in S_\beta (X)\). The function val_{ β } being continuous, we have \(\mathrm {val}_\beta (u{\scriptstyle \bigstar } v)=\mathbf {x}\), and hence x ∈ X. This proves that X is closed. □
As usual, we let \(d_\beta ^{\,*}(1)\) denote the lexicographically greatest \(w\in \mathbb {N}^{\mathbb {N}}\) not ending in 0^{ ω } and such that val_{ β }(0 ⋆ w) = 1. The infinite word \(d_\beta ^{\,*}(1)\) has the property of being the supremum of all its shifted sequences; see, for instance, [386]. For all bases β > 1, one has d_{ β }(1) = 1 ⋆ 0^{ ω }, whereas the definition of \(d_\beta ^*(1)\) indeed depends on β. The following theorem is known as Parry’s theorem or Parry’s criterion. A proof of this result can be found in [386].
Theorem 3.6.9 (Parry [469])
Example 3.6.10
We continue Example 3.6.3. We have \(d_\phi ^*(1)=(10)^\omega \). Thanks to Parry’s theorem, the ϕexpansions of real numbers in [0, 1) are of the form 0 ⋆ u, where \(u\in \{0,1\}^{\mathbb {N}}\) does not contain 11 as a factor and does not end in (10)^{ ω }. So the ϕexpansion of x is w, but both v and w belong to S_{ β }(x).
The following proposition characterizes which real numbers admit quasigreedy βrepresentations other than those of the form 0^{ ℓ }d_{ β }(x): they are exactly the real numbers in the set \(\{\frac {x}{\beta ^i}\mid x\in \mathbb {Z}_\beta ,\ i\in \mathbb {N}\}\), where \(\mathbb {Z}_\beta \) is the set of the socalled βintegers. The notion of βintegers will be central in Section 3.6.5 and thus deserves a proper definition.
Definition 3.6.11
A real number x is a βinteger if d_{ β }(x) is of the kind u ⋆ 0^{ ω }. The set of βintegers is denoted by \(\mathbb {Z}_\beta \).
Proposition 3.6.12
Let x ∈ [0, 1). If d_{ β }(x) = 0 ⋆ x_{1}⋯x_{ k }0^{ ω } with k ≥ 1 and x_{ k }≠0, then \(S_\beta (x)=0^*\{ d_\beta (x),\, 0\star x_1\cdots x_{k1}(x_k1)d_\beta ^*(1)\}\), and S_{ β }(x) = 0^{∗}d_{ β }(x) otherwise.
Proof
Now we suppose that d_{ β }(x) = 0 ⋆ x_{1}⋯x_{ k }0^{ ω } with k ≥ 1 and x_{ k }≠0 (in particular, x > 0). From the previous paragraph, we obtain that \(S_\beta (x)\subseteq 0^*\{ d_\beta (x),\, 0\star x_1\cdots x_{k1}(x_k1)d_\beta ^*(1)\}\). The other inclusion holds by Theorem 3.6.9.
If d_{ β }(x) = 0 ⋆ 0^{ ω }, then x = 0 and S_{ β }(0) = 0^{+} ⋆ 0^{ ω }. Finally we suppose that d_{ β }(x) does not end in 0^{ ω }. From the first paragraph, we obtain that if u ⋆ v ∈ S_{ β }(x), then u ∈ 0^{+} and v does not end in \(d_\beta ^*(1)\). This proves S_{ β }(x) = 0^{∗}d_{ β }(x). □
Corollary 3.6.13
 If \(d_\beta (x)=x_\ell \cdots x_0\star x_{1}\cdots x_{k}0^\omega \in A_\beta ^{\ +}\star A_\beta ^{\ \omega }\) with x_{−k}≠0, then$$\displaystyle \begin{aligned} S_\beta(x)=0^*\{d_\beta(x),\, x_\ell\cdots x_0 \star x_{1}\cdots x_{k+1}(x_{k}1)d_1d_2\cdots\} \end{aligned}$$
 If \(d_\beta (x)=x_\ell \cdots x_k0^k \star 0^\omega \in A_\beta ^{\ +}\star A_\beta ^{\ \omega }\) with x_{ k }≠0, then$$\displaystyle \begin{aligned} S_\beta(x)=0^*\{d_\beta(x),\, x_\ell\cdots x_{k+1}(x_k1)d_1\cdots d_k \star d_{k+1}d_{k+2}\cdots\}. \end{aligned}$$

S_{ β }(x) = 0^{∗}d_{ β }(x) in all other cases.
Moreover, we have \(S_\beta (x)=\overline {S_\beta (x)}\).
3.6.3 βRecognizable Sets of Real Numbers
Definition 3.6.14
A subset X of \(\mathbb {R}^d\) is βrecognizable if S_{ β }(X) is ωregular.
The following result shows that leading zeros do not affect the βrecognizability of a subset. We omit the proof as it is similar to that of Proposition 3.2.2.
Proposition 3.6.15

X is βrecognizable.

\(S_\beta (X)\cap \big ((\tilde {A}_\beta ^{\ d}\setminus \{\mathbf {0}\})(\tilde {A}_\beta ^{\ d})^*{\scriptstyle \bigstar }(\tilde {A}_\beta ^{\ d})^\omega \cup \mathbf {0}{\scriptstyle \bigstar }(\tilde {A}_\beta ^{\ d})^\omega \big )\) is ωregular.

There exists an ωregular language \(L\subseteq (\tilde {A}_\beta ^{\ d})^+{\scriptstyle \bigstar }(\tilde {A}_\beta ^{\ d})^\omega \) such that 0^{∗}(0^{∗})^{−1}L = S_{ β }(X).
We also have the following nice criterion.
Proposition 3.6.16
Two βrecognizable subsets of \(\mathbb {R}^d\) coincide if and only if they have the same ultimately periodic quasigreedy βrepresentations.
Proof
The result follows from the wellknown fact that two ωregular languages are equal if and only if they have the same ultimately periodic elements [476]. □
In the case of closed subsets of \(\mathbb {R}^d\), we can require additional conditions on the Büchi automata recognizing them.
Proposition 3.6.17
A βrecognizable subset X of \(\mathbb {R}^d\) is closed if and only if S_{ β }(X) is accepted by a deterministic Büchi automaton all of whose states are final.
Proof
It is easily seen that an ωregular language L is closed if and only if it is accepted by a deterministic Büchi automaton in which each state is final (see, e.g., [476, Proposition 3.9]). Then the result follows from Proposition 3.6.8. □
We note that, in our context of Büchi automata recognizing sets of real numbers, the final/nonfinal status of the states occurring before an edge labeled \({\scriptstyle \bigstar }\) has no impact on the accepted language.
Definition 3.6.18
A Parry number is a real number β greater than 1 for which \(d_\beta ^*(1)\) is ultimately periodic.
Proposition 3.6.19
If β is Parry, then a subset X of \(\mathbb {R}^d\) is βrecognizable if and only if d_{ β }(X) is ωregular.
Proof
As a consequence of Propositions 3.6.16 and 3.6.19, we obtain the following result.
Proposition 3.6.20
If β is Parry, then two βrecognizable subsets of \(\mathbb {R}^d\) coincide if and only if they have the same ultimately periodic βexpansions.
3.6.4 Weakly βRecognizable Sets of Real Numbers
We now consider particular βrecognizable sets of real numbers, namely, the weakly βrecognizable subsets. We note that we have chosen to respect the original terminology of [95, 384], even though the property of being weakly βrecognizable is in fact stronger than being βrecognizable. This terminology comes from the fact that weak Büchi automata are less expressive than Büchi automata: not all ωregular languages are accepted by weak Büchi automata.
Definition 3.6.21
A Büchi automaton is said to be weak if each of its strongly connected components contains either only final states or only nonfinal states.
Definition 3.6.22
A subset X of \(\mathbb {R}^d\) is weakly βrecognizable if S_{ β }(X) is accepted by a weak deterministic Büchi automaton.
The advantage of weak deterministic Büchi automata is that they admit a canonical form [384, 551]. Therefore, they can be viewed as the analogues of DFAs for infinite words. Moreover, the family of ωlanguages accepted by weak deterministic Büchi automata is closed under the Boolean operations of union, intersection, and complementation [408, 551]. However, let us stress that weak Büchi automata cannot be determinized. For example, the Büchi automaton of Figure 3.5 is clearly weak, but as already pointed out, there is no deterministic Büchi automaton accepting the same ωlanguage. This has important consequences in our work, namely, for the choice of Definition 3.6.22, which is highlighted by the following remark.
Remark 3.6.23
It is interesting to note that, for closed subsets of \(\mathbb {R}^d\), the concepts of βrecognizability and weak βrecognizability actually coincide.
Proposition 3.6.24
A closed subset of \(\mathbb {R}^d\) is βrecognizable if and only if it is weakly βrecognizable.
Proof
This is a straightforward consequence of Proposition 3.6.17. □
The following result is a consequence of Theorem 3.6.9. We first fix some notation that will be useful here and in the proof of Theorem 3.6.29 below. For \(r\in \mathbb {R}\), we define sign(r) to be + if r ≥ 0 and − else. If \(\mathbf {x}=(x_1,\ldots ,x_d)\in \mathbb {R}^d\), then sign(x) = (sign(x_{1}), …, sign(x_{ d })). For \(X\subseteq \mathbb {R}^d\) and s ∈ {+, −}^{ d }, we define X_{ s } = {x ∈ X∣sign(x) = s}).
Proposition 3.6.25
If β is a Parry number, then \(\mathbb {R}^d\) is weakly βrecognizable.
Proof
As a consequence of Theorem 3.6.9, a DFA \(\mathcal {A}_\beta \) is canonically associated with any Parry number β. For details on the construction of \(\mathcal {A}_\beta \), we refer the reader to [386]. This DFA accepts the language of factors of those infinite words u such that 0 ⋆ u = d_{ β }(x) for some x ∈ [0, 1). All states of \(\mathcal {A}_\beta \) are final (as any prefix of a factor is again a factor). Moreover, \(\mathcal {A}_\beta \) has a loop labeled 0 on its initial state.
Given s ∈{+, −}^{ d }, we build a weak deterministic Büchi automaton \(\mathcal {A}_{\beta ,\mathbf {s}}\) accepting \(S_\beta \big ((\mathbb {R}^d)_{\mathbf {s}}\big )\). Then the union of those 2^{ d } ωlanguages will be \(S_\beta \big (\mathbb {R}^d)\), which will still be accepted by a weak deterministic Büchi automaton since the class of ωlanguages accepted by such automata is closed under union.
We construct the automaton \(\mathcal {A}_{\beta ,\mathbf {s}}\) by considering two copies of \(\mathcal {A}_\beta \times \cdots \times \mathcal {A}_\beta \) (d times), one for the βinteger part and one for the βfractional part of the βrepresentations. For each state q of \(\mathcal {A}_\beta \times \cdots \times \mathcal {A}_\beta \), we let (q, int) (resp. (q, frac)) denote the state of \(\mathcal {A}_{\beta ,\mathbf {s}}\) that corresponds to q in the βinteger (resp. βfractional) part copy. In all labels of transitions of both copies of \(\mathcal {A}_\beta \times \cdots \times \mathcal {A}_\beta \), we replace the ith component by its opposite value if s_{ i } = −, and we leave it unchanged otherwise.
The initial state of \(\mathcal {A}_{\beta ,\mathbf {s}}\) is a new additional state i and, for each transition labeled \(a \in \tilde {A}_\beta ^{\ d}\) from the initial state to any state (q, int) of the βinteger part copy of \(\mathcal {A}_\beta \times \cdots \times \mathcal {A}_\beta \), there is a new transition labeled a from i to (q, int). The terminal states are all states (q, frac). We complete \(\mathcal {A}_{\beta ,\mathbf {s}}\) by adding, for each state q of \(\mathcal {A}_\beta \times \cdots \times \mathcal {A}_\beta \), a transition from (q, int) to (q, frac) labeled \({\scriptstyle \bigstar }\). □
Example 3.6.26
Theorem 3.6.27 provides a decomposition of weakly βrecognizable subsets into their βinteger and βfractional parts. In the case where the base β is an integer, this decomposition is in fact independent of the chosen integer base; this is Theorem 3.6.29.
To express this decomposition, we introduce the following notation. For \(\mathbf {x}\in \mathbb {Z}_\beta ^d\), we let rep_{ β }(x) be defined by \(d_\beta (\mathbf {x})=\mathrm {rep}_\beta (\mathbf {x}){\scriptstyle \bigstar }\mathbf {0}^\omega \). Note that by Corollary 3.6.13, we have that, for all \(\mathbf {x}\in \mathbb {Z}_\beta ^d\), \(S_\beta (\mathbf {x}) \cap \big ( (\tilde {A}_\beta ^{\ d})^*{\scriptstyle \bigstar } \mathbf {0}^\omega \big )=\mathbf {0}^*\mathrm {rep}_\beta (\mathbf {x}){\scriptstyle \bigstar } \mathbf {0}^\omega \). Symmetrically, for \(u\in A_\beta ^+\), we let \(\mathrm {val}_\beta (u)=\mathrm {val}_\beta (u{\scriptstyle \bigstar }\mathbf {0}^\omega )\).
Recall that a Büchi automaton is said to be trim if it is accessible and coaccessible, i.e., each state can be reached from the initial state and from each state starts an infinite accepting path. From any given Büchi automaton, we can easily build another Büchi automaton which is trim and accepts the same ωlanguage. Moreover, if the original Büchi automaton is weak (resp. deterministic), the obtained trim Büchi automaton is as well.
Theorem 3.6.27
Any weakly βrecognizable subset X of \(\mathbb {R}^d\) is a finite union of sets of the form X^{ I } + X^{ F } where \(X^I\subseteq \mathbb {Z}_\beta ^d\) is such that \(\mathrm {rep}_\beta (X^I)\subseteq (A_\beta ^{\ d})^*\) is regular and X^{ F } ⊆ [0, 1]^{ d } is weakly βrecognizable.
Proof
Let \(X\subseteq \mathbb {R}^ d\) and let \(\mathcal {A}=(Q,q_0,\tilde {A}_\beta ^{\ d}\cup \{{\scriptstyle \bigstar }\},F,\delta )\) be a trim deterministic Büchi automaton accepting S_{ β }(X). No infinite path (starting from any state) of \(\mathcal {A}\) contains more than one occurrence of the letter \({\scriptstyle \bigstar }\). Hence, the set of states Q can be divided into two parts: Q_{1} containing the states occurring before transitions labeled \({\scriptstyle \bigstar }\) and Q_{2} containing the states occurring after those transitions. Note that F ⊆ Q_{2}. Let q_{1}, …, q_{ m } be the states of Q_{2} that can be reached (in one step) by reading the letter \({\scriptstyle \bigstar }\). Without loss of generality, we assume that the ωlanguages accepted from q_{1}, …, q_{ m } are pairwise distinct. This implies that, for all \(u\in \mathbf {0}^*\mathrm {rep}_\beta (X\cap \mathbb {Z}_\beta ^d)\) and all \(\ell \in \mathbb {N}\), \(q_0\cdot \mathbf {0}^\ell u{\scriptstyle \bigstar }= q_0\cdot u{\scriptstyle \bigstar }\). For each i, 1 ≤ i ≤ m, we define \(X^I_i=\{\mathrm {val}_\beta (u)\mid q_0\cdot u{\scriptstyle \bigstar }= q_i\}\), and \(X^F_i=\{\mathrm {val}_\beta (\mathbf {0}{\scriptstyle \bigstar } v)\mid v \text{ is accepted from } q_i\}\). We have \(X=\cup _{i=1}^m X^I_i+X^F_i\). Now, for each i, 1 ≤ i ≤ m, we consider the DFA \(\mathcal {D}_i=(Q_1,q_0,\tilde {A}_\beta ^{\ d},F_i,\delta _1)\) and the Büchi automaton \(\mathcal {B}_i=(Q_2,q_i,\tilde {A}_\beta ^{\ d},F,\delta _2)\), where \(F_i=\{q\in Q_1\mid q\cdot {\scriptstyle \bigstar }=q_i\}\) and δ_{1} (resp. δ_{2}) is equal to the original transition function δ restricted to the domain \(Q_1\times \tilde {A}_\beta ^{\ d}\) (resp. \(Q_2\times \tilde {A}_\beta ^{\ d}\)). Then the language accepted by \(\mathcal {D}_i\) is \(\mathbf {0}^*\mathrm {rep}_\beta (X^I_i)\) and the ωlanguage accepted by \(\mathcal {B}_i\) is \(S_\beta (X^F_i)\cap \big (\mathbf {0}{\scriptstyle \bigstar } \tilde {A}_\beta ^{\ \omega }\big )\). It is now easy to modify \(\mathcal {B}_i\) to obtain a deterministic Büchi automaton accepting \(S_\beta (X^F_i)\). Finally, if in addition \(\mathcal {A}\) has the property of being weak, then the same is true for the obtained deterministic Büchi automata accepting \(S_\beta (X^F_j)\). □
Remark that, in the previous proof, it is not true that the union \(X=\cup _{i=1}^m (X^I_i+X^F_i)\) is disjoint as a Büchi automaton for S_{ β }(X) accepts all quasigreedy βrepresentations of elements in X.
Example 3.6.28
In the Büchi automaton of Figure 3.8, the infinite paths corresponding to the ϕrepresentations d_{ ϕ }(1) = 1 ⋆ 0^{ ω } and \(0\star d_\phi ^*(1)=0\star (01)^\omega \) of 1 go through the two different edges labeled ⋆ . This means that, in the decomposition of Theorem 3.6.27 corresponding to \(X=\mathbb {R}^{\ge 0}\), the number 1 belongs to all of the sets X^{ I } + X^{ F }.
The following result is a stronger version of Theorem 3.6.27 in the restricted case of integer bases. Indeed, in Theorem 3.6.29 below, the sets in the union are independent of the base b, whereas this is not the case in the previous theorem. Unfortunately, this stronger result does not generalize to real bases as in general \(\mathbb {Z}_\beta \) differs from \(\mathbb {Z}_{\beta '}\) if β ≠ β′, even for multiplicatively dependent β, β′. For example, \(2\in \mathbb {Z}_{\varphi ^2}\setminus \mathbb {Z}_\varphi \).
Theorem 3.6.29
Any subset X of \(\mathbb {R}^d\) is a finite union of sets of the form X^{ I } + X^{ F } with \(X^I\subseteq \mathbb {Z}^d\) and X^{ F } ⊆ [0, 1]^{ d } and such that rep_{ b }(X^{ I }) is regular and X^{ F } is weakly brecognizable for all b for which X is weakly brecognizable.
Proof
 1.
\(q_0\cdot u{\scriptstyle \bigstar }= q_j\).
 2.
\(F(X,\mathrm {val}_b(u))=X^F_j\).
 3.
\(I(X,\mathrm {val}_b(u))=X^I_j\).
3.6.5 FirstOrder Theory for Mixed Real and Integer Variables in Base β and Büchi Automata
In order to obtain an analogue of the BüchiBruyère theorem for real numbers represented in base β, we need a suitable logical structure for defining the socalled βdefinable subsets of \(\mathbb {R}^ d\). In this section we present the chosen logical structure.
Definition 3.6.30
For \(a\in \tilde {A}_\beta \), we define a binary relation X_{β,a} as follows. Suppose that \(x,y\in \mathbb {R}\) with d_{ β }(x) = x_{ ℓ }⋯x_{0} ⋆ x_{−1}x_{−2}⋯, then X_{β,a}(x, y) if and only if y = β^{ i } for some \(i\in \mathbb {Z}\), and either i > ℓ and a = 0 or i ≤ ℓ and x_{ i } = a.
In other words, X_{β,a}(x, y) is true whenever y is an integer power of the base β and the digit in ^{ ω }0d_{ β }(x) corresponding to this power is a. The notation ^{ ω }0 means that we add infinitely many zeros to the right of the greedy representation d_{ β }(x). Note that here we use the notation X_{β,a}(x, y) for (x, y) ∈ X_{β,a}.
Recall that \(\mathbb {Z}_\beta \) is the set of βintegers; see Definition 3.6.11.
Definition 3.6.31
Remark 3.6.32
x = 0 is defined by x + x = x.
Remark 3.6.33
Lemma 3.6.34
The structures \(\langle \mathbb {R}, +, \le , 1,X_\beta \rangle \) and \(\langle \mathbb {R}, +, \le , \mathbb {Z}_\beta , X_\beta \rangle \) are equivalent.
Proof
Remark 3.6.35
Remark 3.6.36
The structures \(\langle \mathbb {R},+,\le ,1\rangle \) and \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \) are not logically equivalent : z = 1 is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \), whereas \(z\in \mathbb {Z}\) is not definable in \(\langle \mathbb {R},+,\le ,1\rangle \); see Proposition 3.6.38.
Let us characterize the subsets of \(\mathbb {R}^d\) that are definable in \(\langle \mathbb {R},+,\le ,1\rangle \) and in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \), respectively. We will make use of the following important result.
Theorem 3.6.37 ([221])
The structure \(\langle \mathbb {R},+,\le ,1\rangle \) admits the elimination of quantifiers.
A rational polyhedron of \(\mathbb {R}^d\) is the intersection of finitely many halfspaces whose borders are hyperplanes whose equations have integer coefficients. These sets are sometimes referred to as convex polytopes. Note that a rational polyhedron is not necessarily bounded.
Proposition 3.6.38
The subsets of \(\mathbb {R}^d\) which are definable in \(\langle \mathbb {R},+,\le ,1\rangle \) are the finite unions of rational polyhedra. In particular, the subsets of \(\mathbb {R}\) which are definable in \(\langle \mathbb {R},+,\le ,1\rangle \) are the finite unions of intervals with rational endpoints.
Proof
From Theorem 3.6.37, a subset X of \(\mathbb {R}^d\) is definable in \(\langle \mathbb {R},+,\le ,1\rangle \) if and only if it can be expressed by a finite Boolean combination of linear constraints with rational coefficients. Now consider an equivalent formula in disjunctive normal form. This gives us the desired result. □
We end this section by a characterization of those subsets X of \(\mathbb {R}^d\) which are definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \). Note that the proof of this characterization depends on a subsequent result (namely, Theorem 3.6.44).
Theorem 3.6.39
A subset X of \(\mathbb {R}^d\) is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \) if and only if it is a finite union of sets of the form X^{ I } + X^{ F }, with \(X^I\subseteq \mathbb {Z}^d\) definable in \(\langle \mathbb {Z},+,\le \rangle \) and X^{ F } ⊆ [0, 1]^{ d } definable in \(\langle \mathbb {R},+,\le ,1\rangle \).
Proof
Suppose that X = X^{ I } + X^{ F } where \(X^I\subseteq \mathbb {Z}^d\) is definable in \(\langle \mathbb {Z},+,\le \rangle \) and X^{ F } ⊆ [0, 1]^{ d } is definable in \(\langle \mathbb {R},+,\le ,1\rangle \). By Remark 3.6.36, X^{ F } is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \). If ϕ(y_{1}, …, y_{ d }) is a firstorder formula of \(\langle \mathbb {Z},+,\le \rangle \) defining X^{ I }, then \(\phi (y_1,\ldots ,y_d)\land y_1\in \mathbb {Z} \land \cdots \land y_d\in \mathbb {Z}\) is a firstorder formula of \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \) defining X^{ I }. Thus the predicate (x_{1}, …, x_{ d }) ∈ X is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \) by (∃y_{1})⋯(∃y_{ d })(∃z_{1})⋯(∃z_{ d })(x_{1} = y_{1}+z_{1}∧⋯∧x_{ d } = y_{ d }+z_{ d }∧(y_{1}, …, y_{ d }) ∈ X^{ I }∧(z_{1}, …, z_{ d }) ∈ X^{ F }). Finite unions of definable sets are always definable, in any structure.
For the other direction, suppose that \(X\subseteq \mathbb {R}^d\) is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \). By Theorem 3.6.44, X is weakly brecognizable for all b. By Theorem 3.6.29, X is a finite union of sets of the form X^{ I } + X^{ F }, where \(X^I\subseteq \mathbb {Z}^d\) is such that rep_{ b }(X^{ I }) is regular and X^{ F } ⊆ [0, 1]^{ d } is brecognizable for all b. Then, by Theorem 3.2.28 (which can be adapted to \(\mathbb {Z}^d\) in a straightforward way), each X^{ I } is semilinear, hence definable in \(\langle \mathbb {Z},+,\le \rangle \), and by Theorem 3.6.45, each X^{ F } is definable in \(\langle \mathbb {R},+,\le ,1\rangle \). □
Note that we have used Theorem 3.6.29, which is a stronger version of Theorem 3.6.27. Indeed, we need the sets in the decomposition of X to be independent of the base b.
Finally, in the particular case of bounded subsets of \(\mathbb {R}^d\), we have the following characterizations.
Corollary 3.6.40
 1.
X is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \).
 2.
X is definable in \(\langle \mathbb {R},+,\le ,1\rangle \).
 3.
X is a finite union of rational polyhedra.
3.6.6 Characterizing βRecognizable Sets Using Logic
The following theorem can be viewed as an analogue of Theorem 3.3.4 for real numbers represented in real bases β. Let us emphasize that the base β needs be a Pisot number in order to recognize the addition. We do not present here the details of the normalization in real Pisot bases, but the interested reader is referred to [145, 231].
Theorem 3.6.41 ([145])

If β is a Parry number, then every βrecognizable subset of \(\mathbb {R}^d\) is βdefinable.

If β is a Pisot number, then every βdefinable subset of \(\mathbb {R}^d\) is βrecognizable.
In the context of the present chapter, the relevant direction is given by the second assertion. Indeed, our aim is to build suitable DFAs starting from formulæ expressing various properties of βrecognizable sets of numbers, in order to decide whether a given set satisfies a given property. For this reason, we only give a proof of the second assertion of Theorem 3.6.41. The interested reader will find a proof of the other direction in [145].
Proof (of the second assertion)
The proof goes by induction on the length of the formula defining X. It is sufficient to discuss the logical operations ¬φ, φ ∨ ψ, ∃xϕ as all others can be obtained from these three. At each step of the induction, we need to obtain Büchi automata for S_{ β }(X_{1}), …, S_{ β }(X_{ n }), where X_{1}, …, X_{ n } are the current subsets of \(\mathbb {R}^d\) in the recursive definition of X. Let φ, ψ be such that \(X_\varphi ,\,X_\psi \subseteq \mathbb {R}^d\). We have \(S_\beta (X_{\neg \varphi })=S_\beta (\mathbb {R}^d)\setminus S_\beta (X_\varphi )\) and S_{ β }(X_{φ∨ψ}) = S_{ β }(X_{ φ }) ∪ S_{ β }(X_{ ψ }). If \(\mathcal {B}\) is a Büchi automata accepting S_{ β }(X_{ ϕ }) where ϕ contains a free variable called x, then the ωlanguage L accepted by the Büchi automata obtained from \(\mathcal {B}\) by deleting the component corresponding to x in every label is such that 0^{∗}(0^{∗})^{−1}L = S_{ β }(X_{∃xϕ}). The induction step then follows from Propositions 3.6.15 and 3.6.25 and from the stability of ωregular languages under Boolean operations and projection on components.
Corollary 3.6.42
If β is a Pisot number, then the firstorder theory of \(\langle \mathbb {R},+, \le ,\mathbb {Z}_{\beta },X_{\beta }\rangle \) is decidable.
Proof
A closed firstorder formula of \(\langle \mathbb {R},+,\le ,\mathbb {Z}_{\beta },X_{\beta }\rangle \) is of the form ∃xφ(x) or ∀xφ(x). By Theorem 3.6.41, the sets \(X_\varphi =\{x\in \mathbb {R}\mid \varphi (x) \text{ is true}\}\) and \(X_{\neg \varphi }=\{x\in \mathbb {R}\mid \varphi (x) \text{ is false}\}\) are βrecognizable. As the emptiness of an ωregular language is decidable [476], we can decide whether X_{ φ } is nonempty (resp. X_{¬φ} is empty) and, thus, whether ∃xφ(x) (resp. ∀xφ(x)) is true. □
Like Theorem 3.3.4, this result has many applications: any property of βrecognizable sets that can be expressed by a firstorder predicate in the structure \(\langle \mathbb {R},+, \le ,\mathbb {Z}_{\beta },X_{\beta }\rangle \) is decidable. For example, it is decidable whether a βrecognizable subset of \(\mathbb {R}^d\) is a subgroup of \(\mathbb {R}^d\) with respect to the addition. As another example, we are also able to decide topological properties of βrecognizable sets. Note that, in this context, interesting examples of compact βrecognizable sets are given by a class of fractal sets, called βselfsimilar sets [1]. Indeed, it follows from Theorem 3.6.56 below that βselfsimilar sets are βrecognizable when β is Pisot. This fact is highlighted in Remark 3.6.59.
Proposition 3.6.43
If β is Pisot, then the following properties of βrecognizable subsets X of \(\mathbb {R}^d\) are decidable: X has a nonempty interior, X is open, X is closed, X is bounded, X is compact, X is dense.
Proof
We note that, thanks to Proposition 3.6.17, the property of being closed can be directly verified from a Büchi automaton recognizing the set under consideration. Indeed, given a Büchi automaton accepting S_{ β }(X), we can effectively compute a DFA accepting Pref(S_{ β }(X)). Then, by Proposition 3.6.8, this DFA seen as a Büchi automaton accepts S_{ β }(X) if and only if X is closed. As it is decidable if two Büchi automata accept the same ωlanguage [476], we can decide whether a βrecognizable set X is closed.
3.6.7 Analogues of the Cobham–Semenov Theorem for Real Numbers
Several analogues of Cobham’s theorem were obtained in the context of integer base b representations of real numbers. In this section, we list some of them without proof. We will show the connections between these results, as well as with Theorem 3.6.61. This connection is achieved by using graphdirected iterated function systems (GDIFS) and allows us to provide extensions of the abovementioned results: Theorem 3.6.50 extends to \(\mathbb {R}^d\), Theorem 3.6.61 extends to a large class of GDIFS, and the logical characterization of brecognizable sets of reals used for proving Theorem 3.6.46 extends to the socalled Pisot real bases.
Theorem 3.6.44 ([95])
Let b and b′ be integer bases with different sets of prime divisors. A subset of \(\mathbb {R}^d\) is simultaneously brecognizable and b′recognizable if and only if it is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \).
The hypothesis of sharing no prime divisors is stronger than that of being multiplicatively independent. In order to obtain an analogue of the Cobham theorem for multiplicatively independent integer bases, we need an extra hypothesis, which is the weak brecognizability.
Theorem 3.6.45 ([94])
Let b and b′ be multiplicatively independent integer bases. A subset of [0, 1]^{ d } is simultaneously weakly brecognizable and weakly b′recognizable if and only if it is definable in \(\langle \mathbb {R},+,\le ,1\rangle \).
Note that, together with Theorems 3.6.29 and 3.2.28, Theorem 3.6.45 implies the following result.
Theorem 3.6.46 ([94])
Let b and b′ be multiplicatively independent integer bases. A subset of \(\mathbb {R}^d\) is simultaneously weakly brecognizable and weakly b′recognizable if and only if it is definable in \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \).
In the particular case where d = 1 and we consider only compact subsets of [0, 1], Theorem 3.6.45 is indeed another formulation of Theorem 3.6.50 below. To state this result, we need a definition first.
Definition 3.6.47
Example 3.6.48
Example 3.6.49
Theorem 3.6.50 ([1])
Let b, b′≥ 2 be multiplicatively independent integers. A compact subset of [0, 1] is simultaneously bselfsimilar and b′selfsimilar if and only if it is a finite union of closed intervals with rational endpoints.
The object of the next section is to study the connection between Theorems 3.6.45 and 3.6.50.
3.6.8 Linking Büchi Automata, βSelfSimilarity and GDIFS
We generalize Definition 3.6.47 to real bases β. The set of polynomials in β with integer coefficients is denoted by \(\mathbb {Z}[\beta ]\). Note that it is not equal to the set \(\mathbb {Z}_\beta \) of βintegers as, for example, d_{ φ }(φ − 1) = 0 ⋆ 10^{ ω }, hence \(\varphi 1\in \mathbb {Z}[\varphi ]\setminus \mathbb {Z}_\varphi \).
Definition 3.6.51
Definition 3.6.52
Theorem 3.6.53 ([208, 306])
Definition 3.6.54
The attractor of a GDIFS on complete metric spaces is the list of nonempty compact subsets from Theorem 3.6.53.
We will use the following result.
Theorem 3.6.55 ([70, 231])
The sets \(\big [\frac {c}{\beta 1},\frac {c}{\beta 1} \big ]\cap \mathbb {Z}[\beta ]\) are finite for all \(c\in \mathbb {N}\) if and only if β is a Pisot number.
Theorem 3.6.56 ([145])
 1.
There is a Büchi automaton \(\mathcal {A}\) over the alphabet \(A_\beta ^{\ d}\) such that \(\mathrm {val}_\beta (\mathbf {0}{\scriptstyle \bigstar } L(\mathcal {A}))=X\).
 2.
X belongs to the attractor of a GDIFS on \(\mathbb {R}^d\) whose contraction maps are of the form \(\mathbf {x}\mapsto \frac {\mathbf {x}+\mathbf {t}}{\beta }\) with \(\mathbf {t} \in A_\beta ^{\ d}\).
 3.
X is βselfsimilar.
Proof
2 ⇒ 1. Let (K_{ v }, v ∈ V ) be the attractor of a GDIFS on \(\mathbb {R}^d\) whose contraction maps are of the form \(\mathbf {x}\mapsto \frac {\mathbf {x}+\mathbf {t}}{\beta }\) with \(\mathbf {t} \in A_\beta ^{\ d}\) and suppose that \(X=K_{v_0}\) for some v_{0} ∈ V . Let \(\mathcal {A}\) be the Büchi automaton \((V,v_0,V,A_\beta ^{\ d},\delta )\) where the transitions correspond to the edges of the GDIFS in which we have replaced the labels \(\frac {\mathbf {x}+\mathbf {t}}{\beta }\) by t. As the underlying digraph of a GDIFS is connected and such that there is at least one outgoing edge starting from each vertex, the Büchi automaton \(\mathcal {A}\) is trim. Then, from the proof of 1 ⇒ 2, we obtain that \(K_v= \{\mathrm {val}_\beta (\mathbf {0}{\scriptstyle \bigstar } w)\mid w\in L_v\}\) for all v ∈ V (where L_{ v } is defined as before); hence, \(X=\{\mathrm {val}_\beta (\mathbf {0}{\scriptstyle \bigstar } w)\mid w\in L(\mathcal {A})\}\).
Note that, in the previous theorem, the Pisot condition is needed only for the implications 2 ⇒ 1 and 2 ⇒ 3. Also note that all the equivalences are effective, meaning that from any of the hypotheses 1, 2, or 3, we can effectively construct a Büchi automaton for 1, a GDIFS for 2, and the βkernel for 3.
We are now able to show the connection between Theorems 3.6.45 and 3.6.50.
Proposition 3.6.57
Any bselfsimilar subset of [0, 1]^{ d } is weakly brecognizable.
Proof
The following result generalizes Theorem 3.6.50 to the multidimensional setting.
Theorem 3.6.58 ([142, 145])
Let b, b′≥ 2 be two multiplicatively independent integers. A compact subset of [0, 1]^{ d } is simultaneously bselfsimilar and b′selfsimilar if and only if it is a finite union of rational polyhedra.
Remark 3.6.59
We have seen in Proposition 3.6.57 that any bselfsimilar subset of [0, 1]^{ d } is weakly brecognizable. By using Theorem 3.6.56 and the fact that the normalization is realizable by a lettertoletter transducer [229, 231], we obtain that this fact also holds for Pisot bases β: any βselfsimilar subset of [0, 1]^{ d } is weakly βrecognizable. However, the converse is not true as, for every base β > 1, there exist weak βrecognizable subsets of [0, 1]^{ d } which are not closed. For example, any interval of the form [r, s[ is weakly βrecognizable for all bases β > 1. Hence the hypothesis of bselfsimilarity is strictly stronger than that of brecognizability.
We also obtain the following analogue of the Cobham–Semenov theorem for GDIFS.
Theorem 3.6.60
Let b, b′≥ 2 be multiplicatively independent integers. A compact subset of \(\mathbb {R}^d\) is the attractor of two GDIFS, one with contraction maps of the form \(\mathbf {x}\mapsto \frac {\mathbf {x}+\mathbf {t}}{b}\) with \(\mathbf {t} \in A_b^{\ d}\) and the other with contraction maps of the form \(\mathbf {x}\mapsto \frac {\mathbf {x}+\mathbf {t}}{b'}\) with \(\mathbf {t} \in A_{b'}^{\ d}\), if and only if it is a finite union of rational polyhedra.
Proof
The result is a consequence of Theorem 3.6.56, Proposition 3.6.57, Theorem 3.6.46, and Corollary 3.6.40. □
The previous result has to be compared with the following theorem. Here dim_{ H } denote the Hausdorff dimension, and an iterated function system (IFS for short) is a GDIFS whose graph contains only one vertex. An IFS Φ = (ϕ_{1}, …, ϕ_{ k }) is said to satisfy the open set condition if there exists a nonempty open set V such that ϕ_{1}(V ), …, ϕ_{ k }(V ) are pairwise disjoint subsets of V .
Theorem 3.6.61 ([220])

If dim_{ H }(K) < 1 then \(\frac {\log r_\varPsi }{\log r_\varPhi }\in \mathbb {Q}\).

If dim_{ H }(K) = 1 and K is not a finite union of intervals, then \(\frac {\log r_\varPsi }{\log r_\varPhi }\in \mathbb {Q}\).
We note that Theorem 3.6.60 is more general than Theorem 3.6.61 in two ways as it concerns the more general setting of GDIFS and it is formulated for the ddimensional Euclidean space. It is also weaker as the contraction ratios must be of the form \(\frac {1}{b}\) and \(\frac {1}{b'}\).
3.7 Exercises
The following exercises are related to Section 3.2.
Exercise 3.7.1
Exercise 3.7.2
Consider the base 4 numeration system. Let X = val_{4}(L) where L is the language accepted by the automaton of Figure 3.14. It is 4recognizable by construction. Show that \(t_X(n)=\varTheta \big ((\frac {n}{\log (n)})^2\big )\).
Exercise 3.7.3
Consider the 4recognizable set X = val_{4}({1, 2, 3}^{∗}) and show that \(t_X(n)=\varTheta \Big (n^{\frac {\log (4)}{\log (3)}}\Big )\).
Exercise 3.7.4
Exercise 3.7.5
Exercise 3.7.6
Let X = val_{2}(1^{∗}0^{∗}). Show that \(\mathbf {v}_{1^*0^*}(n)=\binom {n+2}{2}\) for all \(n\in \mathbb {N}\) and that \(t_X(n)=2^{(1+o(1))\sqrt {2n}}\).
The following exercises are related to Section 3.2.5.
Exercise 3.7.7
Show that semilinear sets are brecognizable for all b.
An ultimately periodic subset of \(\mathbb {N}\) is a subset X of \(\mathbb {N}\) for which there exist integers i ≥ 0 (the preperiod) and p ≥ 1 (the period) such that, for all \(x\in \mathbb {N}\), x ∈ X if and only if x + p ∈ X.
Exercise 3.7.8

X is a finite union of arithmetic progressions.

X is ultimately periodic.

X is semilinear.

X is a recognizable subset of \(\mathbb {N}\).

X is 1recognizable.

X is brecognizable for all integers bases b.

X is Srecognizable for all abstract numeration systems S.
The following exercise is related to Section 3.3.
Exercise 3.7.9

x ≤ y is definable in \(\langle \mathbb {N},+\rangle \) but not in \(\langle \mathbb {Z},+\rangle \).

x = y is definable in \(\langle \mathbb {N},+\rangle \) but not in \(\langle \mathbb {Z},+\rangle \).

x = 0 is definable in \(\langle \mathbb {N},+\rangle \) and in \(\langle \mathbb {Z},+\rangle \).

x = 1 is definable in \(\langle \mathbb {N},+\rangle \) but not in \(\langle \mathbb {Z},+\rangle \).

For every \(c\in \mathbb {N}\), x = c is definable in \(\langle \mathbb {N},+\rangle \).

The arithmetic progressions are definable in \(\langle \mathbb {N},+\rangle \).

A subset X of \(\mathbb {N}\) is definable in \(\langle \mathbb {N},+\rangle \) if and only if it is a finite union of arithmetic progressions.

A subset X of \(\mathbb {N}^d\) is definable in \(\langle \mathbb {N},+\rangle \) if and only if it is semilinear.
The following exercises are related to Section 3.6.
Exercise 3.7.10
Show that the structures \(\langle \mathbb {R},+,\le ,\mathbb {Z}\rangle \) and \(\langle \mathbb {R},+,\le ,\mathbb {N}\rangle \) are equivalent.
Exercise 3.7.11
Find a direct argument proving that \(\mathbb {Z}\) is not definable in \(\langle \mathbb {R},+, \le ,1\rangle \) (not using Theorem 3.6.39).
Exercise 3.7.12
Show that the finite unions of rational polyhedra are bselfsimilar for all b.
3.8 Bibliographic Notes
Abstract numeration systems were introduced in [372]. A characterization of Srecognizable subsets of \(\mathbb {N}^d\) was given in [143]. More precise asymptotics than those of Theorem 3.2.23 are given in [147].
Recognizable sets of \(\mathbb {N}^d\) are a particular case of recognizable sets of a general monoid; see [211]. Kleene’s theorem [301] holds only for free monoids, so it holds for \(\mathbb {N}\) but not for \(\mathbb {N}^d\), d ≥ 2. In the case of the free monoid A^{∗}, recognizable sets are regular languages over A.
Other applications of the decidability of the firstorder theory of \(\langle \mathbb {N},+,V_b\rangle \) than those presented in Section 3.3.4 were obtained in [524].
For more on automatic sequences, see the book [14].
The definition of (K, b)regular sequences given in this chapter is that of Berstel and Reutenauer [77]. It differs from the original one of Allouche and Shallit [17] since K is an arbitrary semiring, hence not necessarily a Nœtherian ring. As here we are specifically interested in \(K=\mathbb {N}\) and \(K=\mathbb {N}_\infty \), we need this more general framework.
The notion of bsynchronized sequences was introduced in [130]. Related works are [129, 522]. In particular, see [522] for a proof of Proposition 3.4.25.
Most of the results presented in Section 3.4 come from [148]. The enumeration of properties of automatic sequences were also discussed in the surveys [540, 541].
The definition of βrecognizability in the present chapter differs from that of [145]. I believe that Definition 3.6.14 gives the right notion of βrecognizability as it allows us to prove that \(\mathbb {R}^d\) is βrecognizable when β is a Parry number and to correct some mistakes in [145], in particular Fact 1 and Lemma 23. This choice is also justified by Remark 3.6.23. Finally, this definition is coherent with the original definition of brecognizable sets of reals [96].
The proof of Theorem 3.6.29 is from [93, 111].
Theorem 3.6.55 is stated in [231] in a more general form. Let us also mention the related recent paper [230].
The complexity of all the algorithms provided by the methods presented in this chapter is given by a tower of exponentials whose height is given by the number of alternating quantifiers. However, some specific problems concerning brecognizable sets of integers or real numbers have been shown to be decidable in an efficient way. I refer the interested reader to the following related works: [374, 413, 416].
In [220], a more general version of Theorem 3.6.61 is given. For a generalization of this result to \(\mathbb {R}^d\), but under a more restrictive separation condition, see [213].
Notes
Acknowledgements
I thank Julien Leroy and Narad Rampersad for a careful reading of this chapter and for many helpful comments.
References
 1.Adamczewski, B., Bell, J.P.: An analogue of Cobham’s theorem for fractals. Trans. Am. Math. Soc. 363(8), 4421–4442 (2011)MathSciNetCrossRefGoogle Scholar
 12.Allouche, J.P., Rampersad, N., Shallit, J.: Periodicity, repetitions, and orbits of an automatic sequence. Theor. Comput. Sci. 410(30–32), 2795–2803 (2009)MathSciNetCrossRefGoogle Scholar
 14.Allouche, J.P., Shallit, J.: Automatic Sequences: Theory, Applications, Generalizations. Cambridge University Press, Cambridge (2003)Google Scholar
 17.Allouche, J.P., Shallit, J.O.: The ring of kregular sequences. Theor. Comput. Sci. 98, 163–197 (1992)MathSciNetCrossRefGoogle Scholar
 70.Berend, D., Frougny, C.: Computability by finite automata and Pisot bases. Math. Syst. Theory 27, 275–282 (1994)MathSciNetCrossRefGoogle Scholar
 77.Berstel, J., Reutenauer, C.: Noncommutative rational series with applications. Encyclopedia of Mathematics and Its Applications, vol. 137. Cambridge University Press, Cambridge (2011)Google Scholar
 78.Berthé, V., Rigo, M. (eds.): Combinatorics, automata and number theory. Encyclopedia of Mathematics and Its Applications, vol. 135. Cambridge University Press, Cambridge (2010)Google Scholar
 93.Boigelot, B., Brusten, J.: A generalization of Cobham’s theorem to automata over real numbers. Theor. Comput. Sci. 410(18), 1694–1703 (2009)MathSciNetCrossRefGoogle Scholar
 94.Boigelot, B., Brusten, J., Bruyère, V.: On the sets of real numbers recognized by finite automata in multiple bases. Log. Methods Comput. Sci. 6, 1–17 (2010)Google Scholar
 95.Boigelot, B., Brusten, J., Leroux, J.: A generalization of Semenov’s theorem to automata over real numbers. In: Automated Deduction—CADE22. Lecture Notes in Computer Science, vol. 5663, pp. 469–484. Springer, Berlin (2009)CrossRefGoogle Scholar
 96.Boigelot, B., Rassart, S., Wolper, P.: On the expressiveness of real and integer arithmetic automata (extended abstract). In: ICALP. Lecture Notes in Computer Science, vol. 1443, pp. 152–163. Springer, Berlin (1998)CrossRefGoogle Scholar
 111.Brusten, J.: On the sets of real vectors recognized by finite automata in multiple bases. PhD thesis, University of Liège (2011)Google Scholar
 112.Bruyère, V.: Entiers et automates finis (1985). Mémoire de fin d’études, Université de MonsGoogle Scholar
 113.Bruyère, V., Hansel, G.: Bertrand numeration systems and recognizability. Theor. Comput. Sci. 181, 17–43 (1997)MathSciNetCrossRefGoogle Scholar
 114.Bruyère, V., Hansel, G., Michaux, C., Villemaire, R.: Logic and precognizable sets of integers. Bull. Belg. Math. Soc. 1, 191–238 (1994). Corrigendum, Bull. Belg. Math. Soc. 1 (1994), 577Google Scholar
 115.Büchi, J.R.: Weak secondorder arithmetic and finite automata. Zeitschrift für mathematische Logik und Grundlagen der Mathematik 6, 66–92 (1960). Reprinted in Mac Lane, S., Siefkes, D. (eds.) The Collected Works of J. Richard Büchi. Springer, 1990, pp. 398–424Google Scholar
 129.Carpi, A., D’Alonzo, V.: On factors of synchronized sequences. Theor. Comput. Sci. 411(44–46), 3932–3937 (2010)MathSciNetCrossRefGoogle Scholar
 130.Carpi, A., Maggi, C.: On synchronized sequences and their separators. Theor. Inform. Appl. 35(6), 513–524 (2002) (2001)MathSciNetCrossRefGoogle Scholar
 142.Chan, D.H.Y., Hare, K.G.: A multidimensional analogue of Cobham’s theorem for fractals. Proc. Am. Math. Soc. 142(2), 449–456 (2014)MathSciNetCrossRefGoogle Scholar
 143.Charlier, É., Kärki, T., Rigo, M.: Multidimensional generalized automatic sequences and shapesymmetric morphic words. Discret. Math. 310(6–7), 1238–1252 (2010)MathSciNetCrossRefGoogle Scholar
 144.Charlier, É., Lacroix, A., Rampersad, N.: Multidimensional sets recognizable in all abstract numeration systems. RAIRO Theor. Inform. Appl. 46(1), 51–65 (2012)MathSciNetCrossRefGoogle Scholar
 145.Charlier, É., Leroy, J., Rigo, M.: An analogue of Cobham’s theorem for graph directed iterated function systems. Adv. Math. 280, 86–120 (2015)MathSciNetCrossRefGoogle Scholar
 147.Charlier, É., Rampersad, N.: The growth function of Srecognizable sets. Theor. Comput. Sci. 412(39), 5400–5408 (2011)Google Scholar
 148.Charlier, É., Rampersad, N., Shallit, J.: Enumeration and decidable properties of automatic sequences. Int. J. Found. Comput. Sci. 23(5), 1035–1066 (2012)MathSciNetCrossRefGoogle Scholar
 149.Charlier, É., Rigo, M., Steiner, W.: Abstract numeration systems on bounded languages and multiplication by a constant. Integers 8, A35, 19 (2008)Google Scholar
 155.Cobham, A.: On the basedependence of sets of numbers recognizable by finite automata. Math. Syst. Theory 3, 186–192 (1969)MathSciNetCrossRefGoogle Scholar
 206.Durand, F., Rigo, M.: On Cobham’s theorem. In: Handbook of Automata. European Mathematical Society Publishing House (in press)Google Scholar
 208.Edgar, G.: Measure, Topology, and Fractal Geometry, 2nd edn. Undergraduate Texts in Mathematics. Springer, New York (2008)Google Scholar
 211.Eilenberg, S.: Automata, Languages, and Machines, vol. A. Academic Press, New York (1974)zbMATHGoogle Scholar
 213.Elekes, M., Keleti, T., Máthé, A.: Selfsimilar and selfaffine sets: measure of the intersection of two copies. Ergodic Theory Dyn. Syst. 30(2), 399–440 (2010)MathSciNetCrossRefGoogle Scholar
 220.Feng, D.J., Wang, Y.: On the structures of generating iterated function systems of Cantor sets. Adv. Math. 222(6), 1964–1981 (2009)MathSciNetCrossRefGoogle Scholar
 221.Ferrante, J., Rackoff, C.: A decision procedure for the first order theory of real addition with order. SIAM J. Comput. 4, 69–76 (1975)MathSciNetCrossRefGoogle Scholar
 229.Frougny, C.: Representations of numbers and finite automata. Math. Syst. Theory 25, 37–60 (1992)MathSciNetCrossRefGoogle Scholar
 230.Frougny, C., Pelantova, E.: Betarepresentations of 0 and Pisot numbers. J. Théor. Nombres Bordeaux (in press)Google Scholar
 231.Frougny, C., Sakarovitch, J.: Number representation and finite automata. In: Combinatorics, Automata and Number Theory. Encyclopedia of Mathematics and Its Applications, vol. 135, pp. 34–107. Cambridge University Press, Cambridge (2010)Google Scholar
 232.Frougny, C., Solomyak, B.: On representation of integers in linear numeration systems. In: Pollicott, M., Schmidt, K. (eds.) Ergodic Theory of \({\mathbb {Z}}^d\) Actions (Warwick, 1993–1994). London Mathematical Society Lecture Note Series, vol. 228, pp. 345–368. Cambridge University Press, Cambridge (1996)Google Scholar
 248.Goč, D., Henshall, D., Shallit, J.: Automatic theoremproving in combinatorics on words. Int. J. Found. Comput. Sci. 24(6), 781–798 (2013)MathSciNetCrossRefGoogle Scholar
 250.Goč, D., Mousavi, H., Shallit, J.: On the number of unbordered factors. In: Language and Automata Theory and Applications. Lecture Notes in Computer Science, vol. 7810, pp. 299–310. Springer, Heidelberg (2013)CrossRefGoogle Scholar
 297.Hollander, M.: Greedy numeration systems and regularity. Theory Comput. Syst. 31, 111–133 (1998)MathSciNetCrossRefGoogle Scholar
 301.Hopcroft, J.E., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation. AddisonWesley, Boston (1979)zbMATHGoogle Scholar
 306.Hutchinson, J.E.: Fractals and selfsimilarity. Indiana Univ. Math. J. 30(5), 713–747 (1981)MathSciNetCrossRefGoogle Scholar
 372.Lecomte, P.B.A., Rigo, M.: Numeration systems on a regular language. Theory Comput. Syst. 34, 27–44 (2001)MathSciNetCrossRefGoogle Scholar
 374.Leroux, J.: A polynomial time Presburger criterion and synthesis for number decision diagrams. In: Proceedings of the 20th IEEE Symposium on Logic in Computer Science (LICS 2005), 26–29 June 2005, Chicago, IL, USA, pp. 147–156. IEEE Computer Society (2005)Google Scholar
 384.Löding, C.: Efficient minimization of deterministic weak ωautomata. Inform. Process. Lett. 79(3), 105–109 (2001)MathSciNetCrossRefGoogle Scholar
 386.Lothaire, M.: Algebraic Combinatorics on Words. Encyclopedia of Mathematics and Its Applications, vol. 90. Cambridge University Press, Cambridge (2002)Google Scholar
 408.Maler, O., Staiger, L.: On syntactic congruences for ωlanguages. Theor. Comput. Sci. 183(1), 93–112 (1997)MathSciNetCrossRefGoogle Scholar
 413.Marsault, V., Sakarovitch, J.: Ultimate periodicity of brecognisable sets: a quasilinear procedure. In: Developments in Language Theory. Lecture Notes in Computer Science, vol. 7907, pp. 362–373. Springer, Heidelberg (2013)CrossRefGoogle Scholar
 416.Milchior, A.: Büchi automata recognizing sets of reals definable in firstorder logic with addition and order (2016). ArXiv:1610.06027Google Scholar
 426.Mousavi, H.: Automatic theorem proving in Walnut (2016). ArXiv:1603.06017Google Scholar
 427.Mousavi, H., Schaeffer, L., Shallit, J.: Decision algorithms for Fibonacciautomatic words, I: Basic results. RAIRO Theor. Inform. Appl. 50(1), 39–66 (2016)MathSciNetzbMATHGoogle Scholar
 428.Mousavi, H., Shallit, J.: Mechanical proofs of properties of the Tribonacci word. In: Combinatorics on Words. Lecture Notes in Computer Science, vol. 9304, pp. 170–190. Springer, Cham (2015)Google Scholar
 469.Parry, W.: On the βexpansions of real numbers. Acta Math. Acad. Sci. Hung. 11, 401–416 (1960)MathSciNetCrossRefGoogle Scholar
 476.Perrin, D., Pin, J.E.: Infinite Words. Automata, Semigroups, Logic and Games. Elsevier/Academic Press, Amsterdam (2004)zbMATHGoogle Scholar
 502.Rigo, M.: Construction of regular languages and recognizability of polynomials. Discret. Math. 254, 485–496 (2002)MathSciNetCrossRefGoogle Scholar
 503.Rigo, M.: Formal Languages, Automata and Numeration Systems, Applications to Recognizability and Decidability, vol. 2. ISTE, Wiley (2014)zbMATHGoogle Scholar
 520.Salomaa, A., Soittola, M.: AutomataTheoretic Aspects of Formal Power Series. Springer, New York/Heidelberg (1978). Texts and Monographs in Computer ScienceCrossRefGoogle Scholar
 522.Schaeffer, D.G.L., Shallit, J.: Subword complexity and ksynchronization. In: Developments in Language Theory. 17th International Conference, DLT 2013, MarnelaVallée, France, June 18–21, 2013. Proceedings, no. 7907 in Lecture Notes in Computer Science, pp. 252–263. Springer, Berlin (2013)Google Scholar
 523.Schaeffer, L.: Deciding properties of automatic sequences. Master’s Thesis, University of Waterloo (2013)Google Scholar
 524.Schaeffer, L., Shallit, J.: The critical exponent is computable for automatic sequences. Int. J. Found. Comput. Sci. 23(8), 1611–1626 (2012)MathSciNetCrossRefGoogle Scholar
 536.Semenov, A.L.: Presburgerness of predicates regular in two number systems. Sibirskii Matematicheskii Zhurnal 18, 403–418 (1977, in Russian). English translation in Sib. J. Math. 18, 289–300 (1977)CrossRefGoogle Scholar
 540.Shallit, J.: Decidability and enumeration for automatic sequences: a survey. In: Computer Science—Theory and Applications. Lecture Notes in Computer Science, vol. 7913, pp. 49–63. Springer, Heidelberg (2013)CrossRefGoogle Scholar
 541.Shallit, J.: Enumeration and automatic sequences. Pure Math. Appl. (PU.M.A.) 25(1), 96–106 (2015)Google Scholar
 551.Staiger, L.: Finitestate ωlanguages. J. Comput. Syst. Sci. 27(3), 434–448 (1983)MathSciNetCrossRefGoogle Scholar
 554.Strogalov, A.S.: Regular languages with polynomial growth in the number of words. Diskret. Mat. 2(3), 146–152 (1990)MathSciNetzbMATHGoogle Scholar
 592.Zeckendorf, E.: Représentation des nombres naturels par une somme de nombres de Fibonacci ou de nombres Lucas. Bull. Soc. R. Liége 41, 179–182 (1972)MathSciNetzbMATHGoogle Scholar