Thomas Colcombet
email: thomas.colcombet@irisa.fr

On factorisation forests And some applications

Keywords: Formal languages, semigroups, infinite words, trees, monadic second-order logic, infinite structures

The theorem of factorisation forests shows the existence of nested factorisations -a la Ramsey -for finite words. This theorem has important applications in semigroup theory, and beyond. The purpose of this paper is to illustrate the importance of this approach in the context of automata over infinite words and trees. We extend the theorem of factorisation forest in two directions: we show that it is still valid for any word indexed by a linear ordering; and we show that it admits a deterministic variant for words indexed by well-orderings. A byproduct of this work is also an improvement on the known bounds for the original result. We apply the first variant for giving a simplified proof of the closure under complementation of rational sets of words indexed by countable scattered linear orderings. We apply the second variant in the analysis of monadic second-order logic over trees, yielding new results on monadic interpretations over trees. Consequences of it are new caracterisations of prefix-recognizable structures and of the Caucal hierarchy.

Introduction

Factorisation forests were introduced by Simon [START_REF] Simon | Factorization forests of finite height[END_REF]. The associated theorem -which we call the theorem of factorisation forests below -states that for every semigroup morphism from words to a finite semigroup S, every word has a ramseyan factorisation tree of height linearly bounded by |S| (see below). An alternative presentation states that for every morphism ϕ from A + to some finite semigroup S, there exists a regular expression evaluating to A + in which the Kleene exponent L * is allowed only when ϕ(L) = {e} for some e = e 2 ∈ S; i.e. the kleene star is allowed only if it produces a ramseyan factorisation of the word.

The theorem of factorisation forests provides a very deep insight on the structure of finite semigroups, and has therefore many applications. Let us cite some of them. Distance automata are nondeterministic finite automata mapping words to naturals. An important question concerning them is the limitedness problem: decide whether this mapping is bounded or not. It has been shown decidable by Simon using the theorem of factorisation forests [START_REF] Simon | Factorization forests of finite height[END_REF]. This theorem also allows a constructive proof of Brown's lemma on locally finite semigroups [START_REF] Brown | An interesting combinatorial method in the theory of locally finite semigroups[END_REF]. It is also used in the caracterisation of subfamilies of the regular languages, for instance the polynomial closure of varieties in [START_REF] Pin | Polynominal closure and unambiguous product[END_REF]. Or to give general caracterisations of finite semigroups [START_REF] Pin | Semigroups with idempotent stabilizers and application to automata theory[END_REF]. In this last paper, the result is applied for proving McNaughton's determinisation results of automata over infinite words [START_REF] Mcnaughton | Testing and generating infinite sequences by a finite automaton[END_REF]. In the context of languages of infinite words indexed by ω, it has also been used in a complemetation procedure [START_REF] Bojańczyk | Bounds in omega-regularity[END_REF] extending Buchi's lemma [START_REF] Bchi | On a decision method in restricted second order arithmetic[END_REF].

The present paper aims first at advertising the theorem of factorisation forest which, though already used in many papers, is in fact known only to a quite limited community. The reason for this is that all of its proofs rely on the use of Green's relations: Green's relations form an extremely important tool in semigroup theory, but are technical and uncomfortable to work with. The merit of the factorisation forest theorem is that it is usable without any significant knowledge of semigroup theory, while it encapsulates nontrivial parts of this theory. Furthermore, as briefly mentionned above and also in this paper, this theorem as already important applications to automata theory. This is why this theorem is worth being advertised outside the semigroup community as a major tool in automata theory.

The technical contribution of the paper is an investigation of the potential use of factorisation forests in broader contexts than finite words. An important objective is to be able to apply this theorem on infinite words, and on trees instead of words. Those attempts are incarnated by two new variants of the theorem. As a byproduct we improve the known bounds of the original result (in particular on the previous improvement [START_REF] Chalopin | On factorization forests of finite height[END_REF]).

We also provide some applications of those results. We give a new proof of the result of Carton and Rispal showing the closure under comlementation of rational languages of words with countable scattered linear domain [START_REF] Carton | Complementation of rational sets on countable scattered linear orderings[END_REF]. We use the other variant of the theorem for proving a decomposition result for monadic interpretations (in fact the application of a technique that we call compaction). This yields new caracterisations of prefix recognisable structures and of the Caucal hierarchy.

However, the applications of those results go beyond the one proposed here. In paricular, let us mention the work of Blumensath [START_REF] Blumensath | A short combinatorial proof of Rabin's theorem[END_REF] who applies the deterministic variant of the theorem presented here for giving a new proof of Rabin's theorem [START_REF] Rabin | Decidability of second-order theories and automata on infinite trees[END_REF]. The theorem of Rabin states that the monadic theory of the infinite binary tree is decidable. Different proofs have been proposed for this result so far, all relying on the use of automata theory, and most of them on the use of parity games (see [START_REF] Thomas | Languages, automata, and logic[END_REF] for a survey). For the simpler theory of the naturals with successororiginally proved by Buchi [START_REF] Bchi | On a decision method in restricted second order arithmetic[END_REF] -another proof technique is known: the compositional method of Shelah [START_REF] Shelah | The monadic theory of order[END_REF]. In this seminal paper, Shelah asks whether there exists a proof of Rabin's theorem along the same lines. Blumensath [START_REF] Blumensath | A short combinatorial proof of Rabin's theorem[END_REF] answers to this longstanding open question positively.

The content of the paper is organised as follows. Section 2 is dedicated to definitions. Section 3 present the original theorem of factorisation forests as well as two less standard presentations of it. We also introduce in this section the notion of a ramseyan split, which is central in the remainder of the paper. In Section 4 we provide the first extension of the theorem, the extension to all complete linear orderings. Section 5 is dedicated to the application of this extension to the complementation of automata over countable scattered linear orderings. In Section 6 we provide the second extension of the theorem, to ordinals only this time, but with an extra property of determinism. Finally, in Section 7, we develop the technique of compaction and use it for providing a new decomposition result for monadic interpretations applied to trees. We also show how this impacts on the theory of infinite structures.

Definitions

In this section, we successively present linear orderings, words indexed by them, semigroups and additive labellings.

Linear orderings

A linear ordering α = (L, <) is a set L equipped with a total ordering relation <; i.e. an irreflexive, antisymmetric and transitive relation such that for every distinct elements x, y in L, either x < y or y < x. A subordering β of α is a subset of L equipped with the same ordering relation; i.e. β = (L ′ , <) with L ′ ⊆ L. We write β ⊆ α. We omit the ordering relation < below unless necessary, and just say that L is a linear ordering. An convex subset of α is a subset S of α such that for all x, y ∈ S and x < z < y, z ∈ S. We use the notations [x, y], [x, y[, ]x, y], ]x, y[, ] -∞, y], ] -∞, y[, [x, +∞ [ and ]x, +∞[ for denoting the usual intervals.

Intervals are convex, but the converse does not hold in general. Given two subsets X, Y of a linear ordering, X < Y holds if for all x ∈ X and y ∈ Y , x < y.

The sum of two linear orderings α 1 = (L 1 , < 1 ) and α 2 = (L 2 , < 2 ) (up to renaming, assume L 1 and L 2 disjoint), denoted α 1 + α 2 , is the linear ordering (L 1 ∪ L 2 , <) with < coinciding to < 1 on L 1 , to < 2 on L 2 and such that L 1 < L 2 . More generally, given a linear ordering α = (L, <) and for each x ∈ L a linear ordering β x = (K x , < x ) (the K x are assumed disjoint), we denote by x∈α β x the linear (∪ x∈L K x , < ′ ) with x ′ < ′ y ′ if x < y or x = y and x ′ < x y ′ , where x ′ ∈ K x and y ′ ∈ K y .

A linear ordering α is well ordered if every nonempty subset has a minimal element. It is complete if every nonempty subset of α with an upper bound has a least upper bound in α, and every nonempty subset of α with a lower bound has a greatest lower bound in α.

A cut in a linear ordering α = (L, <) is a couple (E, F ) where {E, F } is a partition of L, and E < F . Cuts are totally ordered by (E, F ) < (E ′ , F ′ ) if E E ′ . This order has a minimal element ⊥ = (∅, L) and a maximal element ⊤ = (L, ∅). We denote by α the set of cuts over L and by α * the set α \ {⊥, ⊤}. An important remark is that α and α * are complete linear orderings.

Cuts can be thought as new elements located between the elements of L:

given x ∈ L, x -= (] -∞, x[, [x, +∞[) represents the cut placed just before x, while x + = (] -∞, x], ]x, +∞[)
is the cut placed just after x. We say in this case that x + is the successor of x -through x. But not all cuts are successors or predecessors of another cut. A cut c is a right limit (resp. a left limit) if it is not the minimal element and not of the form x + for some x in L (resp. not the maximal element and not of the form x -).

Two linear orderings α = (L, <) and β = (L ′ , < ′ ) are isomorphic if there exists a bijection f from L onto L ′ such that for every x, y in L, x < y iff f (x) < ′ f (y). In this case, we also say that (L, <) and (L ′ , < ′ ) have the same order type. This is an equivalence relation on the class of linear orderings. We denote by ω, ω * , ζ the order types of respectively (N, <) (the naturals), (-N, <) (the nonpositive integers) and (Z, <) (the integers). The order type of a well-ordering is called an ordinal. Below, we do often not distinguish between a linear ordering and its type. This is safe since all the construction we perform are isomorphism invariant.

The interested reader can find in [START_REF] Rosenstein | Linear Orderings[END_REF] additional material on linear orderings.

Words

We use a generalized version of words: words indexed by a linear ordering. Given a linear ordering α = (L, <) and a finite alphabet A, an α-word u over the alphabet A is a mapping from L to A. We also say that α is the domain of the word u, or that u is a word indexed by α.

Standard finite words are simply the words indexed by finite linear orderings. Given a word u of domain α and β ⊆ α, we denote by u| β the word u restricted to its positions in β.

Given an α-word u and a β-word v, uv represents the (α + β)-word defined by (uv)(x) is u(x) if x belongs to α and v(x) if x belongs to β. This construction is naturally generalized to the infinite product i∈α u i , where α is an order type and u i are linear β i -words; the resulting being a i∈α β i -word.

Semigroups and additive labellings

For a thorough introduction to semigroups, we refer the reader to [START_REF] Lallement | Semigroups and Combinatorial Applications[END_REF][START_REF] Pin | Variétés de langages formels[END_REF][START_REF] Pin | Varieties of formal languages[END_REF]. A semigroup (S, .) is a set S equipped with an associative binary operator written multiplicatively. Groups and monoids are particular instances of semigroups. The set of nonempty finite words A + over an alphabet A is a semigroup -it is the semigroup freely generated by A. A morphism of semigroups from a semigroup (S, .) to a semigroup (S ′ , . ′ ) is a mapping ϕ from S to S ′ such that for all x, y in S, ϕ(x.y) = ϕ(x). ′ ϕ(y). An idempotent in a semigroup is an element e such that e 2 = e.

Let α be a linear ordering and (S, .) be a semigroup. A mapping σ from couples (x, y) with x, y ∈ α and x < y to S is called an additive labelling if for every x < y < z in α, σ(x, y).σ(y, z) = σ(x, z).

Given a semigroup morphism ϕ from (A ⋄ , .) to some semigroup (S, .) and a word u in A ⋄ of domain α, there is a natural way to construct an additive labelling φ u from α to (S, .): for every two cuts x < y in α, set ϕ u (x, y) is ϕ(u| ]x,y[ ). I.e. ϕ u (x, y) is the image by ϕ of the factor of u located between x and y. We denote by ϕ * u the mapping ϕ u restricted to α * .

Structures, graphs, trees, logics

Relational structures Let us first remark that the definitions presented here are useless before Section 6, have marginal consequences in Section 6, and are of real interest only for Section 7.

A relational structure (U, R 1 , . . . , R n ) is a set U, called the universe, together with relations R 1 , . . . , R n of fixed finite arity over U. Each relation R has a name that we write R itself. The signature of a structure contains the names involved together their arity. A graph is a relational structure for which the relations have arity 1 and one relation of arity 2. The elements of the universe are called vertices, the unary relations are called label relations, and the binary relations is called the edge relation. A path is a finite sequence of vertices such that two successive vertices are in relation by the edge relation. The first vertex is called the origin of the path, and the last vertex the destination.

Linear orderings can be naturally represented as graphs: (L, <) can be seen as a graph of vertices L, with an edge between x and y iff x < y. For a linear ordering α = (L, <) and a finite alphabet A = {a 1 , . . . , a n }, an α-word u is the graph (L, <, a 1 , . . . , a n ) obtained from the graph of the linear ordering by setting a i to be interpreted as u -1 (a i ); the set of positions in the word corresponding to letter a i .

A tree t is a graph such that there is only one edge relation, called the ancestor relation and denoted ⊑, satisfying:

-the relation ⊑ is an order, -there is a minimal element for ⊑, called the root, -for every u, the set {v : v ⊑ u} is an ordinal of length at most ω.

The vertices of a tree are called nodes. Maximal chains of nodes in a tree are called branches.

Warning: The trees are not defined by a 'direct successor' relation, but rather by the ancestor relation. This has major impact on the logical side: all the logics we use below can refer to the ancestor relation, and it is well-known that first-order logic using this ancestor relation is significantly more expressive over trees than first-order logic with access to the successor of a node only. The results would fail if the ancestor relation was not used.

A particular tree will play a special role below. The complete binary tree has as universe {0, 1} * , as ancestor relation the prefix relation, and has two unary relations, 0 = {0, 1} * 0 and 1 = {0, 1} * 1. We call the relation 0 the left-child relation, while 1 is the right-child relation. We denote by ∆ 2 the complete binary tree.

One constructs a tree from a graph by unfolding. Given a graph G and one of its vertices v, the unfolding of G from v is the tree which has as nodes the all paths with origin v, as ancestor relation the prefix relation over paths, and such that a path π is labelled by a in the unfolding iff its destination is labelled by a in the graph.

Logics For defining first-order logic, we need to have at our disposal a countable set of first-order variables x, y, . . . to pick from. The atomic formulae are R(x 1 , . . . , x n ) for x 1 , . . . , x n first-order variables and R the name of relation of arity n; given two first-order variables x, y, x = y is also an atomic formula. First-order logic formulae are made out of these atomic formulae, combined with the boolean connectives ∨, ∧, ¬, and the first-order quantifiers ∃x and ∀x. For monadic logic, we need furthermore a countable set of monadic variables X, Y, . . . Monadic (second-order) formulae are defined as first-order formulae, but further allow the use of monadic quantifiers ∃X, ∀X, and of a membership atomic formula x ∈ X, where x is a first-order variable and X a monadic one. For first-order as well as monadic formulae we use the standard notion of free variables. A formula without free variables is called a closed formula.

We denote by S |= φ the fact, for a closed formula φ and a structure S, that the formula is true over the structure S. The formal definition uses the standard semantic, the value of firstorder variables ranging over elements of the universe of the structure, while monadic variables take as values subsets of the universe. We say that S is a model of φ, or that φ is satisfied over S. When the structure is obvious from the context, we simply state that φ is satisfied. We also allow ourselves to use formulae like φ(x 1 , . . . , x n ) to denote that the free-variables of φ are among {x 1 , . . . , x n }. Then given elements u 1 , . . . , u n in the universe of a structure S, we write S |= φ(u 1 , . . . , u n ) if the formula φ is true over the structure S, using the valuation which to each x i associates u i .

A relational structure S has a decidable L-theory (where L is either first-order or monadic), if there is an algorithm which, given a formula φ of the logic L, answers whether S |= φ or not.

Interpretations An interpretation is an operation defined by logic formulae that defines a structure inside another one. An interpretation is given as a tuple

I = (δ(x), φ 1 (x 1 , . . . , x |R 1 | ), . . . , φ k (x 1 , . . . , x |R K | ))
where δ(x), φ 1 (x 1 , . . . , x |R 1 | ), . . . , φ k (x 1 , . . . , x |R K | ) are formulae of corresponding free variables. The interpretation is first-order if the formulae are first-order and monadic if the formulae are monadic.

Given a structure S of universe U, I(S) is the structure of universe

U I(S) = {u ∈ U : S |= δ(u)} ,
and such that the interpretation of R i is

{(u 1 , . . . , u |R i | ) ∈ U |R i | I(S) : S |= φ i (u 1 , . . . , u |R i | )}.
A special case of interpretation is the marking. A marking replicates the structure, and adds some new unary relations on it.

Factorisation forest theorem: various presentations for the standard case

In this section, we present the theorem of factorisation forest. We first give the original statement in Section 3.1. The in Section 3.2, we provide another equivalent presentation in terms of regular expressions; possibly the most natural one. In Section 3.3, we introduce the notion of a split, and use it for a third formalisation of the result. This notion is the one used in the extensions of the factorisation forest theorem we provide below.

Factorisation forest theorem

Fix an alphabet A and a semigroup morphism ϕ from A + to a finite semigroup (S, .). A factorisation tree of a word u ∈ A + is an ordered unranked tree in which each node is either a leaf 2 1 0 2 3 2 3 0 0 3 2 2 0 0 0 2 Fig. 1. A factorisation tree labeled by a letter, or an internal node, and such that the word obtained by reading the leaves from left to right (the yield) is u. The height of the tree is defined as usual, with the convention that the height of a tree restricted to a single leaf is 0. A factorisation tree is ramseyan (for ϕ) if every node 1) is a leaf, or 2) has two children, or, 3) the values of its children are all mapped by ϕ to the same idempotent of S.

Example 1. Fix A = {0, 1, 2, 3, 4}, (S, .) = (Z/5Z, +) and ϕ to be the only semigroup morphism from A + to (S, .) mapping each letter to its value. Figure 1 presents a ramseyan factorisation tree for the word u = 210232300322002 (u is the yield of the tree). In this drawing, internal nodes appear as horizontal lines. Double line correspond to case 3 in the description of ramseyanity.

The theorem of factorisation forests is then the following.

Theorem 1 (factorisation forests). For every alphabet A, finite semigroup (S, .), semigroup morphism ϕ from A + to S and word u in A + , u has a ramseyan factorisation tree of height at most 3|S|.

The original theorem is due to Simon [START_REF] Simon | Factorization forests of finite height[END_REF], with a bound of 9|S|. An improved bound of 7|S| is provided by Chalopin and Leung [START_REF] Chalopin | On factorization forests of finite height[END_REF]. The value of 3|S| is a byproduct of the present work.

A variant via regular expressions

The use of factorisation trees gave the name of factorisation forests to the theorem. But it is sometime very convenient to use another formalisation in terms of regular expressions. This presentation is new (to the knowledge of the author), but its simplicity makes it worth to be advertised. Let A be an alphabet, ϕ a semigroup morphism from A + to some semigroup S, and E be a regular expression over the alphabet A. E is ϕ-ramseyan if for each occurence L * of the Kleene star in E, L is mapped to {e} by ϕ, for e an idempotent in S.

Example 2. Let S be Z/2Z with the addition, A be {0, 1} and ϕ be the morphism from A + to S sending each letter to its value modulo 2. The expression 0(0 + 10 * 1) * + 10 * 1(0 + 10 * 1) * is ϕ-ramseyan and evaluates to ϕ -1 (0).

Theorem 2 (variant of factorisation forests). For every alphabet A, finite semigroup (S, .), semigroup morphism ϕ from A + to S and x in S, there exists a ϕ-ramseyan regular expression E x evaluating to ϕ -1 (x).

Proof. By induction on k, for every x in S, let the ϕ-ramseyan regular expression E k x be:

E 0 x = ϕ -1 (x) ∩ A , E k+1 x = E k x + yz=x E k y E k z + e 2 =e=x (E k e ) * .
On can show by induction on k that for all x ∈ S, E k x evaluates to the set of words in ϕ -1 (x) possessing a factorisation tree of height k. This proof, for both directions of the inclusion, is a direct application of the definitions. Then, by Theorem 1,

E 3|S| x evaluates to ϕ -1 (x). ⊓ ⊔
The interest of Theorem 2 is that it allows to perform proofs by induction on the structure of ramseyan regular expressions. By the following refinement, we can derive complexities when using this technique.

Property 1 (refinement of Theorem 2). The height of the regular expression E x is at most 3|S| + 1, counting 0 for the operator +, and 1 for the concatenation, the Kleene star and constants. The regular expression E x contains at most 6|S| 2 distinct subexpressions, at most 3|S| 2 distinct subexpressions without the +-operator at the root.

Those bounds are obtained from the last variant, Theorem 3.

A variant via ramseyan splits

The third equivalent presentation to the theorem of factorisation forests uses the notion of ramseyan splits. One way to see a split is as a form of presentation of a tree. This formalisation naturally extends to infinite words, and is very natural to use in automata theoretic constructions. The extensions of the theorem proposed in the remaining of the paper use this definition.

A split of height N of a linear ordering α is a mapping s from α to [1, N ]. Given a split, two elements x and y in α such that s

(x) = s(y) = k are k-neighbours if s(z) ≥ k for all z ∈ [x, y].
k-neighbourhood is an equivalence relation over s -1 (k). Fix an additive labelling from α to some finite semigroup S. A split of α is ramseyan for σ -we also say a ramseyan split for (α, σ) -if for every k ∈ [1, N ], every x < y and x ′ < y ′ such that all the elements x, y, x ′ , y ′ are k-neighbours, then σ(x, y) = σ(x ′ , y ′ ) = (σ(x, y)) 2 ; Equivalently, for all k, every class of kneighbourhood is mapped by σ to a single idempotent of the semigroup.

Example 3. Let S be Z/5Z equipped with the addition +. Consider the linear ordering of 17 elements and the additive labelling σ defined by:

| 3 | 1 | 0 | 2 | 3 | 2 | 3 | 0 | 0 | 3 | 2 | 2 | 0 | 0 | 0 | 2 |
Each symbol '|' represents an element, the elements being ordered from left to right. Between two consecutive elements x and y is represented the value of σ(x, y) ∈ S. In this situation, the value of σ(x, y) for every x < y is uniquely defined according to the additivity of σ: it is obtained by summing all the values between x and y modulo 5.

A split s of height 3 is the following, where we have written above each element x the value of s(x):

1 3 2 2 1 2 1 2 2 2 3 2 1 1 1 1 2 | 2 | 1 | 0 | 2 | 3 | 2 | 3 | 0 | 0 | 3 | 2 | 2 | 0 | 0 | 0 | 2 |
In particular, if you choose x < y such that s(x) = s(y) = 1, then the sum of elements between them is 0 modulo 5. If you choose x < y such that s(x) = s(y) = 2 but there is no element z in between with s(z) = 1 -i.e. x and y are 2-neighbours -the sum of values separating them is also 0 modulo 5. Finally, it is impossible to find two distinct 3-neighbours in our example. Theorem 3. For every finite linear ordering α, every finite semigroup (S, .) and additive labelling σ from α to S, there exists a ramseyan split for α of height at most |S|.

The proof of this result is postponed to Section 4.2, as the proof is a simplification of the proof of its extension Theorem 4.

Let us state the link between ramseyan splits and factorisation trees. Fix an alphabet A, a semigroup S, a morphism ϕ from A + to S and a word u ∈ A + . The following is easy to establish:

-every ramseyan factorisation tree of height k of u can be turned into a ramseyan split of height at most k of ϕ * u , -every ramseyan split of height k of ϕ * u can be turned into a factorisation tree of height at most 3k of u.

Using this last argument and Theorem 3, we directly obtain a proof of Theorem 1 with the announced bound of 3|S|. Using similar arguments, one obtains the bounds of Property 1.

Extension of the factorisation forest theorem to infinite words

The contribution of this section is an extension of Theorem 3 to complete linear orderings.

Theorem 4. For every complete linear ordering α, every finite semigroup (S, .) and additive labelling σ from α to S, there exists a ramseyan split for (α, σ) of height at most 3|S| (|S| if α is an ordinal).

Compared to Theorem 3, we trade the finiteness -which is replaced by the completenessfor a bound of 3|S| -which replaces a bound of |S|. The special case of α being an ordinal, proves Theorem 3.

The remaining of the section is devoted to the proof of Theorem 4, as well as its ordinal version, Theorem 3. We start in Section 4.1 by establishing some elementary topological lemmas relative to complete linear orderings. Then, in Section 4.2, we give successively a proof of both Theorems 3 and 4.

On linear orderings

The subject of this section is to provide preparatory lemmas on linear orderings. Namely Lemmas 1 and 3. This Section is not relevant for the simpler proof of Theorem 3.

We consider here a binary relation R over a linear ordering α. The statement R(x, y) can be thought as meaningful only for x < y, in the sense that we do not take into account the value of R elsewhere. We say that a binary relation R over α is upward closed if for every x ≤ x ′ < y ′ ≤ y, R(x ′ , y ′ ) implies R(x, y).

Lemma 1. Let α be a complete linear ordering, and R be an upward closed relation over α. There exists γ ⊆ α such that for every x < y in α,

-if R(x, y) then [x, y] ∩ γ is nonempty, -if ]x, y[∩γ contains two distinct elements, then R(x, y).
Let us first remark that if Lemma 1 holds for some linear ordering α, then it is also true for every convex subset of α. For this reason, we can safely add a new minimal element ⊥ ′ and maximal element ⊤ ′ to α, such that for every x in α, R(⊥ ′ , x) and R(x, ⊤ ′ ). Define now for x ∈ α, l(x) = sup{y : ∀z > x. R(y, z)} , and r(x) = inf{z : ∀y < x. R(y, z)} .

Thanks to the adjunction of ⊥ ′ and ⊤ ′ , l and r are defined everywhere but for the minimal and maximal elements respectively. Fact 2. The following holds.

1. Both l and r are nondecreasing.

2. For every x, l(x) ≤ x ≤ r(x). 3. For every x, l(x) = x iff r(x) = x. 4. For every x, r ω (x) = sup{r n (x) : n ∈ N} and l ω (x) = inf{l n (x) : n ∈ N} are fixpoints of both l and r. 5. For every x, y, z, if x < z ≤ r(z) < y then R(x, y). 6. For every x, y, z, if z < x < y < r(z) then ¬R(x, y).

Proof. Items 1,2,5 and 6 follow from the definition.

For item 3. By upward closure of R, l(x) = x iff for every y < x and z > x, R(y, z), iff r(x) = x.

For item 4. Let y = r ω (x). By item 2, we have y ≤ r(y). We have to prove r(y) ≤ y. Let x n be r n (x). If

x n+1 = x n for some n, then y = x n = r(x n ) = r(y). Else x 0 < x 1 < • • • < y.
It follows by definition of r that for all n, R(x n , y). This implies r(y) = y.

⊓ ⊔

We can now prove Lemma 1.

Proof. Set Fix to be the set of fixpoints of r (equivalently, l). Define the equivalence relation ∼ by x ∼ y if x = y ∈ Fix or [x, y] ∩ Fix is empty. This relation induces two kind of equivalence classes: singletons consisting of a single fixpoint, or maximal intervals containing no fixpoint.

Let C be an equivalence class of ∼.

If C = {x} for x ∈ Fix, set γ(C) to be C. Else, C is an interval. Fix an element x C in C, set x n
C to be r n (x C ) for n ≥ 0 and x -n C be l n (x) for n ≥ 0 (both definitions coincide for n = 0 with x 0 C = x C ). By induction and using fact 2, one easily shows that for every n, both

x n C and x -n C belong to Fix ∪ C. Let γ(C) be {x n C : n ∈ Z, x n C ∈ Fix}. According to the previous remark γ(C) ⊆ C.
We now define γ to be the union of γ(C) for C ranging over equivalence classes of ∼. Let us prove that this γ satisfies the conclusion of the lemma.

Let x < y be in α such that ]x, y[∩γ contains two distinct elements. If ]x, y[ contains two elements x ′ < y ′ nonequivalent for ∼, there is a fixpoint in [x ′ , y ′ ] ⊆]x, y[. It follows by Fact 2 that R(x, y). Else ]x, y[ is included in some equivalence class C of ∼. Thus, the two elements in ]x, y[ are of the form x n C and x m C for n < m. Since

x n C < x n+1 C ≤ x m C , x n+1 C = r(x n C ) belongs to ]x, y[. By Fact 2, R(x, y).
Let x < y be in L such that R(x, y). If x ∼ y then by definition Fix ∩ [x, y] is nonempty. And since Fix ⊆ γ, [x, y] ∩ γ is nonempty. Else x ∼ y. Let C be the equivalence class containing both x and y. If x C ∈ [x, y], then x C witnesses the nonemptyness of γ ∩ [x, y]. Else either x > x C or y < x C . The two cases are symmetric. Let us treat the case x > x C . By Fact 2, r ω (x C ) ∈ Fix, and as x C ∼ x, x < r ω (x C ). Hence, there exists some n in N such that x n C = r n (X C ) ≥ x. Let n be the least such natural. We have x n-1 C < x, and by monotonicity (Fact 2)

x n C ≤ r(x). Overall x n C ∈ [x, r(x)]. Furthermore by Fact 2, r(x) ≤ y. This witnesses x n C ∈ γ ∩ [x, y]. ⊓ ⊔
We will also require the following lemma 1 . At this point, the easiest way to conclude the proof is to prove for every n in [k] and every scattered nonempty linear ordering β, that there exists a mapping c β,n satisfying the conclusion of the lemma, such that c -1 β,n (n) is nonempty. This can be easily done with the help of Hausdorff's theorem (see e.g. chapter 5 in [START_REF] Rosenstein | Linear Orderings[END_REF]). Then, one uses the fact that every linear ordering α is a dense sum of scattered linear orderings (Theorem 4.9 in [START_REF] Rosenstein | Linear Orderings[END_REF]), i.e: α = x∈γ β x with γ dense, and all the β x are scattered and pairwise disjoint.

(x) = c i (x) if there is some i such that c i (x) is defined, else b(x)
Then, using the case of a dense linear ordering above, we have a mapping d from γ to [k] satisfying the conclusion of the lemma. Define now c over α by c(x) = c β,d(β) (x) for β ∈ γ with x ∈ β. This mapping c fulfills the conclusion of the lemma. ⊓ ⊔

Proof of the statement

We assume here the reader used to standard semigroup theory, and in particular Green's relations. The reader can refer to [START_REF] Lallement | Semigroups and Combinatorial Applications[END_REF][START_REF] Pin | Variétés de langages formels[END_REF][START_REF] Pin | Varieties of formal languages[END_REF] for a presentation of the subject. Some definitions and facts are presented below. Below, σ denotes the additive labelling from the complete linear ordering α to the finite semigroup (S, .) of Theorem 4. We denote by β a subordering of α. We slightly abuse the notation, and write (β, σ) for (β, σ| β ) in which σ| β is the additive labelling obtained by restricting σ to β. We also denote by σ(β) the set {σ(x, y) : x < y, x, y ∈ β}.

Facts about finite semigroups and Green's relations

We recall some definitions here, and gather some standard facts concerning finite semigroups.

Given a semigroup S, S 1 denotes the monoid S itself if S is a monoid, or the monoid S augmented with a new neutral element 1 otherwise, thus making S a monoid. The Green's relation are defined by: As a consequence of the last equivalence, one defines the last of Green's relations:

a ≤ L b if a = cb for some c in S 1 a L b if a ≤ L b and b ≤ L a a ≤ R b if a = bc for some c in S 1 a R b if a ≤ R b and b ≤ R a a ≤ J b if a = cbc ′ for some c, c ′ in S 1 a J b if a ≤ J y and b ≤ J a a ≤ H b if a ≤ L b and a ≤ R b a H b if a L b and a R b
a D b if a L c R b for some c in S if a R c ′ L b for some c ′ in S
The key result being (here the hypothesis of finiteness of S is mandatory):

Fact 5. D=J .

For this reason, we refer from now on only to D and not J . However, we will use the preorder ≤ J (which is an order over the D-classes).

An elemement a in S is called regular if asa = a for some s in S. A D-class is regular if all its elements are regular.

Case of a group H-class.

Lemma 10. Let H be an H-class in S such that (H, .) is a group, and β be such that σ(β) ⊆ H. Then there exists a ramseyan split of height at most |H| of (β, σ).

Proof. Since (H, .) is a group, it is natural to extend the definition of σ over β in the following way. For every x, let σ(x, x) be 1 H , the neutral element of the group (H, .); for every y < x in β, let σ(x, y) be σ(y, x) -1 , the inverse of σ(x, y) in H. As expected, this extended version of σ satisfies for every x, y, z in β, σ(x, z) = σ(x, y)σ(y, z). Let n be a mapping numbering the elements of H from 1 to |H|. Fix an element x 0 in β. Let s be defined for all x by s(x) = n(σ(x 0 , x)).

Let us show that s defined this way is indeed a ramseyan split for σ. Let x < y be such that s(x) = s(y), then σ(x 0 , x) = σ(x 0 , y) since n is a bijection from

H onto [1, |H|]. Hence σ(x, y) = σ(x, x 0 )σ(x 0 , y) = σ(x 0 , x) -1 σ(x 0 , y) = 1 H . Hence, given x < y and x ′ < y ′ pairwise k-neighbours, then σ(x, y) = 1 H = σ(x ′ , y ′ ) = 1 2 H . ⊓ ⊔
Case of a regular D-class.

Lemma 11. Let D be a regular D-class in S, and β be such that σ(β) ⊆ D. Then there exists a ramseyan split of height at most |D| of (β, σ).

Proof. For every x ∈ β nonmaximal, set r(x) to be the R-class of σ(x, z) for some z > x; this value is independant of the choice of z according to Fact 7. Similarly, for every x in β nonminimal, set l(x) to be the L-class of σ(y, x) for some y < x. If β has a maximal element M , choose r(M ) to be such that l(M )∩r(M ) is a subgroup of S; this is possible according to Fact 6.

Similarly if β has a minimal element m, choose l(m) such that l(m) ∩ r(m) is a subgroup of S.

Set for all x in β, h(x) = l(x) ∩ r(x).

We claim that for every x in β, h(x) is a subgroup of S. Indeed, if x is either the minimal or the maximal element of β, this follows from the definition of r(M ) and l(m). Else, there exists y, z such that y < x < z. Let a be σ(y, x) ∈ l(x) and b be σ(x, z) ∈ r(x). By Fact 7, since ab = σ(y, z) ∈ D, there exists an idempotent e in D such that a L e and b R e; i.e. e ∈ h(x). And by Fact 9, h(x) is a subgroup of S. The claim holds.

According to Fact 8, there is a natural number N such that all H-classes included in D have cardinal N . Let H 1 , . . . , H d be the H-classes included in D which are subgroups of S. For k in {1, . . . , d}, set β k to be {x ∈ β : h(x) = H k }. By fact 7, σ(β k ) ⊆ H k . By Lemma 10, there exists a ramseyan split s k for (β k , σ) of height at most |H k | = N .

We set now for all x in β, s(x) to be kN

+ s k (x)
where k is such that x ∈ β k . Let us establish that s is a ramseyan split for (β, σ). Let x < y and x ′ < y ′ be such that s(x) = s(y) = s(x ′ ) = s(y ′ ). By definition of s, x, y, x ′ , y ′ belong to the same β k . Furthermore, since

s(x) = s(y) = s(x ′ ) = s(y ′ ), we have s k (x) = s k (y) = s k (x ′ ) = s k (y ′ ).
Hence, by ramseyanity of s k over (β k , σ), σ(x, y) = σ(x ′ , y ′ ) = σ(x, y) 2 . We conclude that the mapping s is a ramseyan split for (β, σ). Its height is bounded by dN ≤ |D|.

⊓ ⊔

The general case for ordinals: proof of Theorem 3.

For this last part of the proof, one has to provide factorisations on ordinals where the minimal value has ben removed. Without this, one does not obtain the bound of |S| announced. Hence, given a linear well-ordering β, one denotes by β the linear ordering β \ {0 β }.

Lemma 12. Let E ⊆ S be a D-closed subset of S and β ⊆ α be such that σ(β) ⊆ E. Then there exists a ramseyan split of height at most |E| of ( β, σ).

Proof. The proof is done by induction on the size of E. If E is empty, then β contains at most one element. Hence β is empty. We can give a split of height 0 over the empty linear ordering.

Else, let D be a minimal D-class in E (for the ≤ J -order). Let γ ⊆ β be the least set satisfying:

-0 β ∈ γ, where 0 β is the minimal element of β, -if x ∈ γ then min{y > x : σ(x, y) ∈ D} ∈ γ.

It is not difficult to check that the following fact holds.

Fact 13. For every x, y in β, if ]x, y] ∩ γ is empty, then σ(x, y) ∈ D. If [x, y] ∩ γ contains two elements, then σ(x, y) ∈ D.

Define the equivalence relation ∼ over β by x ∼ y, if ]x, y] ∩ γ = ∅ for x < y and closed under reflexivity and symmetry. Let η be an equivalence class for ∼. By Fact 13, σ(η) ∩ D = ∅. Hence, one can apply the induction hypothesis and obtain a ramseyan split s η for ( η, σ) of height at most |E| -|D|. Remark that η = η \ γ.

At this point, two cases may happen depending on the regularity of D. If D is not regular, then γ contains at most 2 elements, Indeed, assume x < y < z in γ, then σ(x, y), σ(y, z) and σ(x, y)σ(y, z) = σ(x, z) belong to D. By Fact 6, D would be regular. A contradiction. Define s β over β by s(x) = 1 for x ∈ γ, else s(x) = s η(x) + 1 for η the equivalence class of x. This split is ramseyan since the value 1 is used at most once (in γ), and the ramseyanity is inherited from the induction hypothesis elsewhere. By induction hypothesis, this split has height at most |E| -|D| + 1 ≤ |E|.

Finally, if D is regular. We have σ(γ) ⊆ D. By Lemma 11 we obtain ramseyan split s γ of height at most |D| for (γ, σ). Then define s over β by s(x) = s γ (x) for x ∈ γ, else s(x) = |D| + s η (x) for η the equivalence class of x. It follows from the definition that s is a ramseyan split of ( β, σ) of height at most |E| -|D| + |D| = |E|.

⊓ ⊔

We can now conclude the proof of Theorem 3.

Proof. Given an ordinal α, and an additive labelling σ from α to S. Fix a value a 0 in S, construct the linear ordering α ′ = 1 + α, where 1 is a linear ordering containing the single element 0. Set σ ′ (x, y) for x < y in α to be σ(x, y), and set σ ′ (0, y) to be a 0 .σ(0 α , y). Defined like this, σ ′ is an additive labelling from α ′ to S. By Lemma 12, there exists a ramseyan split s for ( α′ , σ ′ ) of height at most |S|. By construction of α ′ and σ ′ , s is also a ramseyan split for (α, σ).

⊓ ⊔

The general case for complete orderings: proof of Theorem 4. Theorem 4 follows directly from the following lemma, with E = S.

Lemma 14. Let E ⊆ S be a D-closed subset of S and β ⊆ α be complete and such that σ(β) ⊆ E. Then there exists a ramseyan split of height at most 3|E| of (β, σ).

Proof. We assume wlog that β is nonempty. The proof is done by induction on the size of E.

Let D be a minimal D-class in E (for the ≤ J -order). We define a binary relation R over β by: for every x < y in β, R(x, y) if σ(x, y) ∈ D. Since D is a minimal D-class, this relation is upward closed; we can apply Lemma 1 and obtain a set γ satisfying its conclusion. Define the equivalence relation ∼ over β \ γ by x ∼ y, if [x, y] ∩ γ = ∅ for x < y and closed under reflexivity and symmetry. Let η be an equivalence class for ∼. By Lemma 1 from which is obtained γ, σ(η)∩ D = ∅. Hence, one can apply the induction hypothesis and obtain a ramseyan split s η for (η, σ). At this point, two cases may happen depending on the regularity of D.

If D is not regular, then γ contains at most 2 elements (same argument as in the case of α being an ordinal. Let us treat the case of γ containing two elements x 0 < x 1 (the case of γ being empty or a singleton can be deduced from it). The equivalence ∼ has at most three equivalence classes, η = (-∞, x 0 [, η ′ =]x 0 , x 1 [, and η ′′ =]x 1 , +∞). We can apply the induction hypothesis with σ(η) ⊆ E \ D (resp. σ(η ′ ) ⊆ E \ D and σ(η ′′ ) ⊆ E \ D) and obtain a ramseyan split s η for (η, σ) (resp. s η ′ for (η ′ , σ) and s η ′′ for (η ′′ , σ)) of height at most 3(|E| -|D|). We construct s over β by s(x) = s η (x) + 2 if x ∈ η, s(x 0 ) = 1, s(x) = s η ′ (x) + 2 if x ∈ η ′ , s(x 1 ) = 2, and s(x) = s η ′′ (x)+2 for x ∈ η ′′ . It follows from the definition that s is a ramseyan split of (β, σ) of height at most 3(|E| -|D|) + 2 ≤ 3|E|.

Else, if D is regular, we apply Lemma 3 on γ with k = 3 and obtain a mapping c : γ → {0, 1, 2} satisfying the conclusions of Lemma 3. By Lemma 1, σ(c -1 (0)) ⊆ D. We can apply Lemma 11 to c -1 (0), obtaining a ramseyan split s ′ for (c -1 (0), σ) of height at most |D|. Let x be in β, we define We have to prove the ramseyanity of s. Let x < y and x ′ < y ′ be pairwise k-neighbours for some k. If k ∈ [1, |D|], we are in the first case of the definition of s, and σ(x, y) = σ(x ′ , y ′ ) = σ(x, y) 2 by ramseyanity of s ′ . If k ∈ [|D| + 1, |D| + 2], then c(x) = c(y) and by Lemma 3, there is some z in ]x, y[ with c(z) = 0. This implies s(z) ≤ |D|, contradicting the 'k-neighbourity' of x and y. Finally if k ≥ |D| + 3, since x, y, x ′ and y ′ are k-neighbours, they all lie in the same ∼-equivalence class η. And σ(x, y) = σ(x ′ , y ′ ) = σ(x, y) 2 by ramseyanity of s η .

s(x) =      s ′ (x) if x ∈ γ, and c(x) = 0 |D| + c(x) if x ∈ γ, c(x) ∈ {1, 2} s η (x) + |D| + 2 if x ∈ γ,
⊓ ⊔

Application to countable scattered linear orderings

In this section, we use Theorem 4 for giving a new simplified proof of Theorem 5 (known from [START_REF] Carton | Complementation of rational sets on countable scattered linear orderings[END_REF]). We first briefly recall some facts about scattered linear orderings in Section 5.1 and define the corresponding notions for words. Then we introduce automata on countable scattered words in Section 5.2 and the corresponding algebraic definition of a ⋄-semigroup in Section 5.3. In Section 5.4, we prove Theorem 5. This section is independant from the subsequent ones.

Scattered linear orderings

A linear ordering α is dense if for every x < y in α, there exists z in ]x, y[. A linear ordering is scattered if it is not dense on any subordering. For instance (Q, <) and (R, <) are dense, while (N, <) and (Z, <) are scattered. Being scattered is preserved under taking a subordering. A scattered sum of scattered linear orderings also yields a scattered linear ordering. Every ordinal is scattered. Furthermore, if α is scattered, then α is scattered. And if α is countable and scattered, then α is also countable and scattered. Given an alphabet A, we denote by A ⋄ the set of words indexed by a countable scattered linear ordering. Given a language L ⊆ A ⋄ , L ω represents the set of words of the form {u i : i ∈ ω} where all the u i 's belong to L. One defines similarly L -ω and L ζ .

A standard way for proving results on scattered linear orderings is to use the theorem of Hausdorff (chapter 5 of [START_REF] Rosenstein | Linear Orderings[END_REF] is dedicated to the subject). It establishes a general way of decomposing scattered linear orderings. Hausdorff's theorem is a key tool in the original proof of Theorem 5 [START_REF] Carton | Complementation of rational sets on countable scattered linear orderings[END_REF]. We avoid it below; instead, we use the following lemma which provides a kind of induction principle for scattered linear orderings. It essentially says that an equivalence relation such that any two sets of equivalent elements are contiguous (there is nothing in between) are equivalent, then the relation contains is trivial.

Lemma 15. Given a scattered linear ordering α and an equivalence relation R over α satisfying: for all X < Y, with X 2 ⊆ R, and

Y 2 ⊆ R, x∈X, y∈Y ]x, y[= ∅ implies (X ∪ Y ) 2 ⊆ R ; Then R = α 2 .
Proof. Consider the set S of equivalence relations included in R such that every equivalence class is convex. It is nonempty since the equality relation over α belongs to S. Order S by inclusion. Given a chain in S, the union of all relations in the chain is itself an element of S: the chain has an upper bound in S. Then, according to Zorn's lemma, there is a maximal element ∼ in S. Since α is scattered and ∼∈ S, α/ ∼ is itself a scattered linear ordering. Assume that it has two distinct equivalence classes. Since α/ ∼ is scattered, there are two equivalence classes X and Y -choose wlog X < Y -such that there is no other equivalence class Z with X < Z < Y . This follows that ∩ x∈X, y∈Y ]x, y[= ∅. Applying the hypothesis leads to (X ∪ Y ) 2 ⊆ R, and consequently (∼ ∪(X ∪ Y ) 2 ) ∈ S. It contradicts the maximality of ∼. ⊓ ⊔

Automata over countable scattered linear orderings

In this section, we define priority automata and show how they accept words indexed by countable scattered linear orderings. Those automaton were introduced in [START_REF] Bruyre | Automata on linear orderings[END_REF], but in their 'Muller' form, while here we adopt the 'parity-like' approach.

Definition 1. A priority automaton A = (Q, A, I, F, p, δ) consists of a finite set of states Q, a finite alphabet A, a set of initial states I, a set of final states F , a priority mapping p :

Q → [1, N ] (N being a natural) and a transition relation δ ⊆ (Q × A × Q) ⊎ ([1, N ] × Q) ⊎ (Q × [1, N ]).
A run of the automaton A over an α-word u is a mapping ρ from α to Q such that for all cuts c, c ′ :

-if c ′ is the successor of c through x, then (ρ(c), u(x), ρ(c ′ )) ∈ δ, -if c is a left limit, then (k, ρ(c)) ∈ δ where k = max c ′ <c p(ρ(]c ′ , c[)), -if c is a right limit, then (ρ(c), k) ∈ δ where k = max c ′ >c p(ρ(]c, c ′ [)).
The first case corresponds to standard automata on finite words: a transition links one state to another while reading a single letter in the word. The second case verifies that the highest priority appearing infinitely close to the left of c corresponds to a transition. The third case is symmetric. An α-word u is accepted by A if there is a run ρ of A over u such that ρ(⊥) ∈ I and ρ(⊤) ∈ F .

Example 4. Consider the automaton with states {q, r}, alphabet {a}, initial states {q, r}, final state q, priority mapping constant equal to 0 and transitions {(q, a, q), (q, a, r), (0, q), (r, 0)}). It accepts those words in {a} ⋄ which have a complete domain. For this, note that a linear ordering is complete iff no cut is simultaneously a left and a right limit.

Consider a word u ∈ {a} ⋄ which has a complete domain α. For c ∈ α, set ρ(c) to be q if c is ⊤ or if c has a successor, else ρ(c) is r. Under the hypothesis of completeness, it is simple to verify that ρ is a run witnessing the acceptance of the word. Conversely, assume that there is a run ρ over the α-word u with α not complete. There is a cut c ∈ α which is both a left and a right limit. If ρ(c) is r, then, as c is a left limit, there is no corresponding transition; else if ρ(c) is q the same argument apply to the right of c. In both cases there is a contradiction.

The languages accepted by priority automata are closed under union, intersection, concatenation, projection and exponentiation by ω and -ω [START_REF] Bruyre | Automata on linear orderings[END_REF]. They also admit an equivalent form of regular expressions [START_REF] Bruyre | Automata on linear orderings[END_REF] and their emptyness problem is decidable. A consequence of Theorem 5 below is their closure under complementation (originally proved in [START_REF] Carton | Complementation of rational sets on countable scattered linear orderings[END_REF], in [START_REF] Carton | Complementation of rational sets on scattered linear orderings of finite rank[END_REF] for a particular case).

On ⋄-semigroups

Finite semigroups are known to have the same 'expressive power' as finite state automata. This approach has been extended to languages of ω-words while introducing ω-semigroups in [START_REF] Perrin | Semigroups,Formal Languages and Groups, chapter Semigroups and automata on infinite words[END_REF]. Then Bedon and Carton generalized it to words indexed by countable ordinals in [START_REF] Bedon | An eilenberg theorem for words on countable ordinals[END_REF], the corresponding algebraic object being called an ω 1 -semigroup. Finally, Carton and Rispal have introduced ⋄-semigroups for describing languages of words indexed by scattered linear orderings.

Formally, a ⋄-semigroup (s, π) is a set equipped with an operator π mapping S ⋄ to S which satisfies:

-for all s ∈ S, π(s) = s, and, -for all countable scattered linear ordering α and families (u i ) i∈α of words in S ⋄ ,

π( {π(u i ) : i ∈ α}) = π( {u i : i ∈ α}) .
Those properties express the fact that π is a generalized product operator: more precisely, the rules correspond to a generalized form of associativity. For instance, for every u, v, w in S, π(uπ(vw)) = π(uvw) = π(π(uv)w). In this sense, every ⋄-semigroup can be seen as a semigroup with the product defined by u.v = π(uv). The free ⋄-semigroup generated by a finite alphabet A is (A ⋄ , ).

Given two ⋄-semigroups (S, π) and (S ′ , π ′ ), a mapping ϕ from S to S ′ is a morphism of ⋄semigroups if for every scattered linear ordering α, and every (x i ) i∈α in S, ϕ(π( {x l : l ∈ α})) = π ′ ( {ϕ(x l ) : l ∈ α}). A language K ⊆ A ⋄ is ⋄-recognizable if there exists a morphism of ⋄semigroups from A ⋄ to a finite ⋄-semigroup saturating K; i.e. such that ϕ -1 (ϕ(K)) = K. As usual with recognizability, ⋄-recognizable languages are closed under union, intersection and complementation.

From now, we denote π(uv) simply by uv. More generally, given a word u in S ⋄ , we do not distinguish between u and π(u). Similarly, we abbreviate π( {u : i ∈ (N, <)}) by u ω and π( {u : i ∈ (-N, <)}) by u -ω . We also denote by u ζ the value u -ω u ω .

Example 5. Consider the set S = ({0, 1} × {0, 1}) ⊎ {⊥}. Define the product . and the exponent mappings ω and -ω by, for every x in S and a, b, a ′ , b ′ in {0, 1},

⊥x = x⊥ = ⊥ (a, b)(a ′ , b ′ ) = ⊥ if b = a ′ = 1 (a, b ′ ) else ⊥ ω = (1, 1) ω = ⊥ (a, b) ω = ⊥ if a = b = 1 (a, 1) else ⊥ -ω = (1, 1) -ω = ⊥ (a, b) -ω = ⊥ if a = b = 1 (1, b) else.
Using Theorem 10 in [START_REF] Carton | Complementation of rational sets on countable scattered linear orderings[END_REF], this (S, .) together with the mappings ω and -ω defines uniquely a ⋄-semigroup (S, π).

Let u be in {a} ⋄ of domain α. Set ϕ(u) to be ⊥ if α is not complete. If α is complete, set ϕ(u) to be (a, b) where a = 0 if α has a minimal element, else a = 1, and b = 0 if α has a maximal element, else b = 1. This ϕ is a morphism from ({a} ⋄ , ) to (S, π). It follows that the set of words in {a} ⋄ of complete domain is ⋄-recognizable: it is equal to ϕ -1 ({0, 1} × {0, 1}).

Equivalence of representations

The following theorem was proved in [10]2 . A direct consequence of it is the closure under complementation of the languages of words indexed by scattered linear orderings accepted by priority automata.

Theorem 5 ([10]).

Let A be a finite alphabet. A language L ⊆ A ⋄ is accepted by a priority automaton if and only if it is ⋄-recognizable.

The left to right implication is standard: one constructs a ⋄-semigroup which captures all the possible behaviours of the automata over a word. Then there is no choice on the definition of the product and the morphism.

The difficult direction is, given a ⋄-recognizable language, to construct a priority automaton accepting it. The contribution here is to show that a natural way of constructing such an automaton is to follow the structure of a ramseyan split. Let us fix a ⋄-semigroup (S, π) and a morphism of ⋄-semigroups ϕ from (A ⋄ , ) to (S, π). By closure of priority automata under union, it is sufficient to show that for every c ∈ S the language ϕ -1 (c) is acepted by a priority automaton.

Let k be a natural number, set L k to be the set of words u such that ϕ u admits a ramseyan split of height at most k. We show by induction on k that for every c ∈ S, the language L c,k = L k ∩ ϕ -1 (c) is accepted by an automaton. According to Theorem 4 we have ϕ -1 (c) = L c,3|S| . We also use the intermediate language SD(e, k) for e an idempotent of S which is the set of words u of domain α admitting a ramseyan split s of height at most k, such that s(⊥ α ) = s(⊤ α ) = 1 and ϕ(u) = e (in particular, SD(e, k) ⊆ L e,k ).

The following lemma reduces the problem from describing the language L c,k to describing languages of the form SD(e, k). Lemma 16. Let u ∈ A ⋄ be a word of at least two letters. Then u belongs to L c,k+1 iff there exists a, b, e in S and γ ∈ {0, 1, ω, -ω, ζ } such that e 2 = e, c = ae γ b and u ∈ L a,k (SD(e, k + 1)) γ L b,k (with the convention that xy 0 z = xz).

Proof. From left to right. Let u be an α-word in A ⋄ of length at least 2, and let s be a ramseyan split of height at most k + 1 of (α, ϕ u ). We argue on the nature of s -1 (1).

If s -1 (1) is empty, then choose arbitrarily a cut c in α * , and set a new value of 1 to s(c). This modified s is still a ramseyan split of height k + 1 of (α, ϕ u ). And we can apply the next case for which s -1 (1) is a singleton.

If s -1 (1) is a singleton {c}, let v be u restricted to positions to the left of c, and w be u restricted to positions to the right of c. Obviously u = vw, and we have u ∈ L ϕ(v),k e 0 L ϕ(w),k for any idempotent e.

Else s -1 (1) contains at least two elements. There are four cases depending on the existence of a minimal (resp. a maximal) element in s -1 (1). First case. If s -1 (1) has both a minimal element c and a maximal element c ′ , then let a = ϕ u (⊥, c), e = ϕ u (c, c ′ ), and b = ϕ u (c ′ , ⊤). By definition of a ramseyan split, e is an idempotent of S; furthermore, ϕ(u) = aec. We obtain u ∈ L a,k SD(e, k + 1)L b,k . Second case. If s -1 (1) has neither a minimal element nor a maximal element. Let c be inf(s -1 (1)) and c ′ be sup(s

-1 (1)). Let a = ϕ u (⊥, c), b = ϕ u (c ′ , ⊤). Using the countability of α * , we have a ζ-indexed sequence • • • < x n < x n+1 < • • • in s -1 (1)
, such that inf{x i : i ∈ ζ} is c, and sup{x i : i ∈ ζ} is c ′ . Let e be ϕ u (x 1 , x 2 ). The sequence of x i 's shows that ϕ u (c, c ′ ) ∈ (SD (e, k + 1)) ζ . Furthermore e is an idempotent. We obtain u ∈ L a,k (SD(e, k + 1)) ζ L b,k . The two other cases are obtained as combinations of the two first one, using ω and -ω-indexed sequences.

⊓ ⊔

This lemma together with the closure properties of languages accepted by priority automata shows that it is sufficient to construct an automaton accepting SD(e, k + 1). For this, define the following languages:

M e,k = {u ∈ L k \ {ε} : ϕ(u) = e}, M ← e,k = {u ∈ L k : ϕ(u)e -ω = e}, M →← e,k = {u ∈ L k : e ω ϕ(u)e -ω = e}, M → e.k = {u ∈ L k : e ω ϕ(u) = e}.
Those languages can be obtained as unions of the L a,k together with languages consisting of a single letter word, or the empty word. Hence, by induction hypothesis there are automata accepting them. We identify below the automaton and the language.

In order to accept the language SD (e, k+1), we construct a corresponding automaton A(e, k+ 1). The definition of the automaton A(e, k + 1) is depicted in Figure 2. This is a disjoint union of the automata accepting M e,k , M ← e,k , M → e,k and M →← e,k and of a new state t of priority n; the state t being both initial and final. The value n is chosen to be the highest priority of the automaton. New ε-transitions3 are added to this construction as depicted in Figure 2: arrow arriving from the left have the initial states of the automaton as destination, while the arrows leaving to the

t : n M → e,k M ← e,k M e,k M →← e,k n ε ε n ε ε n n
Fig. 2. The automata A(e, k + 1)

right have the final states of the automaton as origin. Dashed arrows represent limit transitions.

For instance the leftmost one expresses the existence of a limit transition (n, q) for q an initial state of M → e,k : the automaton can go to state q if the maximal priority appearing infinitely often to its left is n. The following lemma concludes the proof.

Lemma 17. The automaton A(e, k + 1) accepts the language SD(e, k + 1).

Proof. From right to left. Let u be a word indexed by α. Let s be a ramseyan split of ϕ u corresponding to the membership of u in SD(e, k + 1), i.e. such that s(⊥) = s(⊤) = 1.

We construct a run ρ ∈ Q α in the following way (Q is the set of states of A e,k+1 ). Set ρ(x) = t whenever s(x) = 1. We define ρ elsewhere by copying runs of the automata E e,k , M ← e,k , M → If I = [x, y[, this means that s(x) > 1, but s(y) = 1. As a consequence, there is a sequence x 1 < x 2 < . . . in s -1 (1) indexed by ω such that sup{x i : i < ω} = x (this is possible because α is countable). It follows that σ(x 1 , x) = e ω . Furthermore (by ramseyanity), σ(x 1 , y) = e. We deduce e ω σ(x, y) = e. By induction hypothesis, we obtain that v is accepted by M → e,k . We define ρ to replicate the corresponding run over I using the instance of M → e,k it contains. We have to prove that this choice indeed produces a run. Over ]x, y[ this is a correct run since the original run was itself correct. It remains to show the correctness of the run to the left of x. But, we already know that the maximal priority reaching x from the left is n since the sequence of the x i 's tends to x and by construction correspond to a priority n which is maximal. We conclude that there is a corresponding transition in A e,k+1 .

From left ro right. Let ρ ∈ Q α be a run of A(e, k + 1) over u from t to t. We aim at constructing a ramseyan split s of ϕ u corresponding to the membership of u in SD (e, k + 1). Let J be ρ -1 (t). We set s(x) to be 1 over J. Let I be a maximal interval which does not intersect J. Once more there are four cases: I = [x, y], [x, y[, ]x, y] or ]x, y[. We treat the case of [x, y[. The others being similar.

If I = [x, y[, this means that s(x) > 1, but s(x) = 1. Let q be the state ρ(x). Since I is maximal, there exists an ω-sequence x 1 < x 2 < . . . in J of limit x. Since ρ(x i ) is n by definition, this means that the maximal priority appearing infinitely often to the left of x is n. Hence, there must be in A e,k+1 a limit transition from n to q. By inspecting the definition of A e,k+1 , this means that q is either the initial state of M → e,k or the initial state of M →← e,k . In y, the run assumes state n, but this state has been reached by an ε-transition either from the final state of M e,k , or by the final state of M → e,k . Let p ′ be this state. We know that there is a run of A e,k+1 from configuration (x, q) to (y, p ′ ) which does not visit state n (by definition of I). It follows that q is the initial state of M → e,k-1 , p ′ is its final state and that the run from (x, q) to (y, p ′ ) is an accepting run of M → e,k . By induction hypothesis, σ (u| I ) = (ϕ u )| I has factorisation height at most k. Let s ′ be this factorisation. For all x ∈ I, let s(x) be s ′ (x) + 1.

Let us show that this split is ramseyan. Let x < y be such that s(x) = s(y) = k. For k-neighours with k ≥ 2, this is inherited from the induction hypothesis. What remains to be shown is that for every x < y in J (i.e. x, y are 1-neighbours), σ(x, y) = e. To make this relation reflexive and symmetric, we consider the relation R defined by xRy if x = y or x < y and σ(x, y) = e or y < x and σ(y, x) = e. We want to apply Lemma 15 on (J, <) and the relation R. Let X, Y ⊆ J be such that X < Y , X 2 ⊆ R, Y 2 ⊆ R and ∩ x∈X,y∈Y ]x, y[∩X = ∅. Let I = ∩ x∈X,y∈Y ]x, y[, I is a maximal interval nonintersecting J.

Once more there are four cases: I = [x, y], [x, y[, ]x, y] or ]x, y[. We treat the case of I = [x, y[. Fix x 0 ∈ X and y 0 ∈ Y . We want to prove σ(x 0 , y 0 ) = e. As x ∈ J, there is an ω-sequence x 0 < x 1 < . . . of limit x with for all i, σ(x i , x i+1 ) = e. It follows that σ(x 0 , x) = e ω . By construction s corresponds to a run of M → e,k over I. It follows, by definition of M → e,k , that e ω σ(x, y) = e. We obtain σ(x 0 , y) = e. Since furthermore by hypothesis, σ(y, y 0 ) = e, we have σ(x 0 , y 0 ) = e.

Lemma 15 concludes that for every x < y in J, σ(x, y) = e. Hence, s is a ramseyan split for ϕ u .

⊓ ⊔

Deterministic extension to the factorisation forest theorem

We try in this section to construct the split from 'left to right' in a 'deterministic way'. The notion of ramseyanity is not suitable anymore in this context; the result would be false 4 . It is replaced by the notion of forward ramseyanity. The result, Theorem 6, only holds for ordinals.

The statement

A split s of height N is forward ramseyan if for every k = 1 . . . n and k-neighbours x < y and x ′ < y ′ , σ(x, y) = σ(x, y).σ(x ′ , y ′ ) .

So in particular, σ(x, y) is an idempotent, but σ(x, y) and σ(x ′ , y ′ ) may be different idempotents.

In the terminology of Green's relation, σ(x, y) and σ(x ′ , y ′ ) are L-equivalent idempotents. A ramseyan split is always forward ramseyan, but the converse does not hold in general. Below, we also identify the natural numbers with the corresponding ordinal. Furthermore, for σ an additive labelling over an ordinal α, and given β < α, we denote by σ| ≤β the labelling σ restricted to [0, β]. Theorem 6. Let (S, .) be a semigroup. To every additive labelling σ over an ordinal α, one can associate a forward ramseyan split s α,σ of (α, σ) of height at most |S|. Furthermore, for every additive labellings σ and σ ′ over the respective ordinals α and α ′ , and every ordinal β < min{α, α ′ },

if σ| ≤β = σ ′ | ≤β then s α,σ (β) = s α ′ ,σ ′ (β) (determinism property) .
Furthermore, under the same hypothesis, over finite linear orderings, the forward ramseyan split can be computed via monadic formulae.

Proposition 1 (definable variant of Theorem 6). Given a finite semigroup (S, .), there exist monadic closed formulae Θ 1 , . . . , Θ |S| such that for every ordinal α, and additive labelling σ from α to S, the split s defined for every β ∈ α by:

s(β) = n such that (β + 1, σ| ≤β ) |= Θ n , is forward ramseyan.
are idempotents of S. Since σ(x, y) L σ(x ′ , y ′ ), σ(x, y) = aσ(x ′ , y ′ ) for some a ∈ S. Hence, σ(x, y)σ(x ′ , y ′ ) = aσ(x ′ , y ′ ) 2 = aσ(x ′ , y ′ ) = σ(x, y).

Else, if there exists a non-regular H-class in L. This means that L contains at least two H-classes. Define s L β,σ (0 β ) = 1, and s L β,σ = s H β,σ ′ (x) + 1 elsewhere. The split s L defined this way is forward ramseyan for (β, σ) as above. It has height at most |H| + 1 ≤ 2|H| ≤ |L|.

And this construction satisfies the determinism property.

⊓ ⊔

Case of a single D-class.

Lemma 21. Let D be a regular D-class. For every ordinal β such that σ(β) ⊆ D, there exists a ramseyan split s D β,σ of height at most |D|. Furthermore s D satisfies the determinism property. Proof. We prove the property for every L-closed E ⊆ D. This is done by induction on the cardinal of E. If E is an L-class, Lemma 19 concludes.

Else, let L be an L-class in E. Let γ = {0 β } ∪ {x ∈ β : σ(0 β , x) ∈ E \ L}. By Fact 7, for every x < y in γ, σ(x, y) ∈ E \ L. On can apply the induction hypothesis, and obtain a split s E\L which is forward ramseyan for (γ, σ) and of height at most |E| -|L|. Similarly, for every x < y in β \γ, σ(x, y) ∈ L. By Lemma 19, one obtains a split s L which is forward ramseyan for (β \ γ, σ) of height at most |L|. Let us define the split s E by s

E (x) = s E\L (x) + |L| if x ∈ γ, else s E (x) = s L (x) if x ∈ β \γ.

Compaction of additive labellings

A labelling maps pairs of elements to a finite set (the semigroup): it is defined via a finite number of binary predicates. In this section we show that the use of (forward) ramseyan factorisations permits to encode all this information into a finite number of unary predicates. Furthermore, we show that the whole additive labelling can be reconstructed from those unary predicates via first-order formulae. We call this technique compaction.

As above, there are two variants to the technique. One which usable over complete linear orderings (Section 7.1), and one usable over ordinals, which satisfies furthermore the determinisism property (Section 7.2). In Section 7.3, we apply this technique for proving a new result on monadic interpretations applied to trees. And in Section 7.4 we briefly describe how this result impacts on the theory of finitely presentable infinite structures.

Compactions of additive labelling over complete linear orderings

We prove here the following statement.

Theorem 7. For every finite semigroup (S, .) and a in S, there exists a first-order formula labelling a (x, y) of free variables x, y, which uses the ordering relation < and unary predicates p 1 , . . . , p N with N = ⌈(6|S| + 2) log 2 (|S|)⌉ such that the following holds 5 .

For every complete linear ordering α and additive labelling σ from α to S, there exists subsets X 1 , . . . , X N of α such that for all a in S and x < y in α:

σ(x, y) = a iff (α, X 1 , . . . , X N ) |= labelling a (x, y) ,
in which for every i = 1 . . . N , p i is interpreted as X i .

Else, let n ≤ |S|. Assume the property true for n+1 and consider x ≤ y. Let E be [x, y[∩s -1 (n). If E is empty, this means that for all z in [x, y[, s(z) ≥ n + 1. And by induction hypothesis labelling n+1 (x, y) = σ(x, y). Hence, labelling n (x, y) = σ(x, y). If E is the singleton {z}. This means that l n (y) = σ(z, y). It follows that labelling n (x, y) = labelling n+1 (x, z)l n (y) = σ(x, z)σ(z, y) = σ(x, y). Finaly, if E = {z 0 < z 1 < . . . }. By definition of l n (z 1 ), l n (z 1 ) = σ(z 0 , z 1 ). By induction hypothesis, labelling n+1 (x, z 0 ) = σ(x, z 0 ). Furthermore, by definition of l n (y), there is some z > z 0 such that l n (y) = σ(z, y). Alltogether with the forward ramseyanity of s leads to:

labelling n (x, y) = labelling n+1 (x, z 0 )l n (z 1 )l n (y) = σ(x, z 0 )σ(z 0 , z 1 )σ(z, y) = σ(x, z 0 )σ(z 0 , z)σ(z, y) = σ(x, y) .

⊓ ⊔

As in the previous case, the construction is easily adaptable into a presentation by first-order formulae using the relation < together with N = ⌈(2|S| + 1) log 2 (|S|)⌉ unary predicates coding all the possible values of (s(x), l 1 (x), . . . , l |S| (x)). This concludes the proof of Theorem 8.

Application to interpretations

We prove in this section Theorem 9. Let us first give two lemmas which are consequences of standard techniques; either the compositional method, or tree automata.

Lemma 25. Every monadic formula Φ(x 1 , . . . , x n ) is equivalent on trees to a formula of the form ∃z 1 . . . ∃z k .Φ ′ where Φ ′ is a boolean combination of monadic formulae of the form x ⊏ y ∧ Ψ (x, y) (of free variables x, y), Ψ (x) (of free variable x) and x = y, for x, y ranging in {x 1 , . . . , x n , z 1 , . . . , z k }.

Lemma 26. For every monadic formula of the form x ⊏ y ∧ Φ(x, y) of free variables x, y, there exists a semigroup S Φ and A Φ ⊆ S Φ such that, for every tree t, there exists a mapping σ which to every nodes x ⊏ y associates σ(x, y) ∈ S Φ , such that -σ restricted to every branch is an additive mapping, and -for every nodes x ⊏ y, t |= Φ(x, y) iff σ(x, y) ∈ A Φ . Furthermore, σ is monadically definable: for every s ∈ S Φ , there exists a monadic formula Φ s (x, y) such that for every tree t and nodes x ⊏ y, t |= Φ s (x, y) iff σ(x, y) = s.

And the result is then the following. Theorem 9. For every monadic interpretation I MSO , there exists a monadic marking M MSO and a first-order interpretation I FO such that for every tree t, I MSO (t) = I FO (M MSO (t)).

Proof. Wlog, we prove the result for an interpretation I MSO with a single formula Φ(x 1 , . . . , x n ). Using Lemma 25, we just have to show how to obtain an equivalent to a formula of the form x ⊏ y ∧ Ψ (x, y) as the combination of a monadic marking and a first-order formula. For this, we use Lemma 26 which tells us that the value of Ψ (x, y) can be uncovered by projection of an additive labelling. And we use Theorem 8 for reducing the computation of the additive labelling to the combination of a monadic marking and a first-order formula.

Note that this argument heavily relies on the determinism of the construction of Theorem 8. Indeed, one has to mark every branch of a tree, a priori with a different marking. The determinism property allows to have a single marking for the whole tree. ⊓ ⊔

Consequences for infinite structures

The goal of this section is to show how the results given above, namely Theorem 9, have direct new consequences in the definition of some families of finitely presentable infinite structures.

There is no real technical contribution in this section but rather a presentation of those consequences to the theory of infinite structures. Let us warn the reader that we do not intend to provide a survey of this area, since this would require much more space and would be out of topic. We rather directly concentrate on providing Theorems 11 and 12. Essentially, those results show that for the standard caracterisation of the families of prefix-recognizable graphs, as well as for the Caucal hierarchy, one can replace the monadic interpretations by first-order ones.

The prefix-recognizable graphs were introduced by Caucal via an internal definition [START_REF] Caucal | On infinite transition graphs having a decidable monadic theory[END_REF]. Namely, fix a finite alphabet A. A prefix-recognizable graph is an infinite directed graph defined as follows. Its set of vertices is a regular language over the alphabet A. And each edge is a finite union of relations of the form (U × V ).W with (U × V ).W = {(uw, vw) : u ∈ U, v ∈ V, w ∈ W } , for U, V, W regular languages. By extension, a graph is prefix recognizable if it is isomorphic to such a graph. An important property of those graphs is that their monadic theory is decidable (this fact is due to Caucal [START_REF] Caucal | On infinite transition graphs having a decidable monadic theory[END_REF]; it can be easily seen as a direct consequence of Rabin Theorem [START_REF] Rabin | Decidability of second-order theories and automata on infinite trees[END_REF] stating that the complete binary tree has a decidable monadic theory, together with Theorem 10 below).

There exists different caracterisations for this class of graphs. We will use below the following one:

Theorem 10 (Blumensath [START_REF] Blumensath | Prefix-recognisable graphs and monadic second-order logic[END_REF]). A graph is prefix-recognizable iff it is isomorphic to a monadic interpretation of the complete binary tree.

Using this theorem as guide, one can extend the definition of prefix-recognisability to relational structures: we call a relational structure prefix-recognizable if it is monadically interpretable in the complete binary tree.

Theorem 9 provides another -new -caracterisation of prefix-recognizable structures, Theorem 11. Beforehand, we need the following lemma.

Lemma 27. Let t be a regular tree. Then there exists a first-order interpretation I FO such that t is isomorphic to I FO (∆ 2 ).

Proof. It is sufficient to consider that the regular tree is the complete binary tree together with a regular labelling in some finite alphabet A attached to every node. This means that there exists a deterministic and complete finite automata A of finite words over the alphabet {0, 1}, with each state labelled by a letter in A, such that the label of a node u is the letter attached to the sole state reached from the initial state while reading u. Let this automaton have states Q, initial state q 0 , and transition function δ from Q×{0, 1} to Q. As usual we extend this transition function into a mapping from Q × {0, 1} * to Q. Wlog we can assume that there exists also a mapping d from Q to {0, 1} such that for every state q in Q and letter a in {0, 1}, d(δ(q, a)) = a; i.e. the automaton remembers whether the current node is a left or a right child.

Let n be a mapping numbering the states of A from 1 to |Q|. Given a word u = a 1 a 2 . . . a n , the a i 's being letters in {0, 1}, define: f (u) = 10 n(q 0 ) 10 n(q 1 ) 1 . . . 10 n(qn) 1 in which q 0 , q 1 , . . . , q n are the n + 1 states successively assumed by the automaton while reading the word u. The proviso concerning the mapping d makes f an injective mapping.

The image of f is first-order definable (as a language of words). Indeed, in order to verify that a word belongs to the image of f , it is sufficient to check a) that 10 n(q 0 ) 1 is a prefix, b) that the last letter is 1, and c) that every factor of the form 10 n 10 m is such that n = n(p) and m = n(q) for some transition δ(p, a) = q. Those verifications are first-order definable. Furthermore, for every word u, the state δ(q 0 , u) is nothing but the sole state q such that 10 n(q) 1 is suffix of f (u). This is also first-order definable.

From those remarks, it is easy to give a first-order interpretation which, given the complete binary tree, selects the nodes belonging to the image of f , and labels every node f (u) by the state δ(q 0 , u). This interpretation provides a new tree t ′ . Since all the relevant informationthe label of the node, and its right-child/left-child nature -is encoded in each state, it is easy to first-order interpret t in t ′ .

⊓ ⊔ Theorem 11. A structure is prefix-recognizable iff it is isomorphic to the first-order interpretation (with ancestor relation) of the complete binary tree.

Proof. We have to show that given a monadic interpretation I MSO , there exists a first-order interpretation I FO such that I MSO (∆ 2 ) is isomorphic to I FO (∆ 2 ). Using Theorem 9, we have that I MSO (∆ 2 ) is equal to I ′ FO (L MSO (∆ 2 )) for some monadic labelling L MSO and first-order interpretation I ′ FO . Then using Lemma 27, we obtain an interpretation I ′′ FO such that I ′′ FO (∆ 2 ) is isomorphic to L MSO (∆ 2 ). By closure of first-order interpretation under composition, I FO = I ′ FO • I ′′ FO is a first-order interpretation such that I FO (∆ 2 ) is isomorphic to I MSO (∆ 2 ).

⊓ ⊔

A similar approach can be used for caracterising the Caucal hierarchy. The Caucal hierarchy [START_REF] Caucal | On infinite terms having a decidable monadic theory[END_REF] is an extension of prefix-recognizable graphs to 'higher-order'. We use here the caracterisation of Carayol and Wöhrle [START_REF] Carayol | The Caucal hierarchy of infinite graphs in terms of logic and higher-order pushdown automata[END_REF] as a definition:

-The structures in Struct 0 are the finite relational structures.

-The graphs in Graph n are the structures in Struct n having a graph signature.

-The trees in Tree n+1 are the unfolding of graphs in Graph n .

-The structures in Struct n+1 are the monadic interpretations of trees in Tree n+1 .

Since both the monadic interpretation and the unfolding preserve the decidability of the monadic theory, the trees, graphs and structures in the classes defined above have a decidable monadic theory.

The following interpretation shows that in the definition of this hierarchy, the monadic logic can be replaced by first-order logic.

Theorem 12. The structures in Struct n are, up to isomorphism, the first-order interpretation of trees in Tree n .

In fact, this is a direct consequence of Theorem 9 together with the following proposition (see [START_REF] Carayol | The Caucal hierarchy of infinite graphs in terms of logic and higher-order pushdown automata[END_REF], Proposition 1). Proposition 2. The class Tree n is closed under monadic markings.

Lemma 3 .

 3 For every linear ordering α and every natural k, there exists a mapping c : α → {0, . . . , k -1} such that for every x < y in α with c(x) = c(y), c([x, y]) = {0, . . . , k -1}. Proof. Let [k] denote {0, . . . , k -1} We first show the result for a dense linear ordering β. Consider the set M of partial mappings c from β to [k] such that for every x < y with c(x) = c(y) defined, either c is injective when restricted to [x, y[, or c([x, y]) = [k]. Those mappings are ordered by c ⊆ c ′ if the domain of c ′ contains the domain of c, and c coincides with c ′ over its domain. Consider now a chain (c i ) i∈I of elements in M . It has an upper bound b defined by b

Fact 4 .

 4 Let a, b, c be in S. If a L b then ac L bc. If a R b then ca R cb. For every a, b in S, a L c R b for some c iff a R c ′ L b for some c ′ .

Fact 6 .Fact 7 .

 67 A D-class D is regular, iff it contains an idempotent, iff every L-class in D contains an idempotent, iff every R-class in D contains an idempotent, iff there exists a, b in D such that ab ∈ D. For every a, b in D such that ab ∈ D, a R ab and b L ab. Furthermore, there is an idempotent e in D such that a L e and b R e.Fact 8 (from Green's lemma). All H-classes in a D-class have the same cardinality.

Fact 9 .

 9 Let H be an H-class in S. Either for all a, b in H, ab ∈ H; or for all a, b in H, ab ∈ H, and furthermore (H, .) is a group.

  and η is the ∼-equivalence class of x. Let us first remark that the values corresponding to the first case of the definition range in [1, |D|] (def. of s ′ ). The values of the second case lie in [|D| + 1, |D| + 2] by construction. Finally, the values provided by the last case lie all in [|D| + 3, |D| + 2 + 3(|E| -|D|)], which is included in [|D| + 3, 3|E|].

  e,k and M →← e,k . More precisely, consider a maximal interval I ⊆ α such that s(I) ≥ 2. Let us define ρ over I. Four cases happen depending on the nature of the interval: I = [x, y], [x, y[, ]x, y] or ]x, y[. We treat the case of [x, y[. The others are similar.

  The mapping s E is forward ramseyan for (β, E) as an inheritance of the forward ramseyanity of s L and s E\L . It has height at most|E| -|D| + |D| = |E|. ⊓ ⊔For the proof of Theorem 6, we use Lemma 21 with E = D, and the same trick as for ordinal ramseyan splits.

  is undefined. It is easy to check that b belongs also to M . By Zorn's lemma, there exists a maximal element m in M . Assume m is not defined in say, x. Let Y be the set of elements y such that m is not defined over [min(x, y), max(x, y)]. By definition, x ∈ Y . There are four cases depending on whether x is the minimal (resp. the maximal) element of Y . If x is neither the minimal nor the maximal element, this means there exists y < x < z in Y . By density, we can construct a ζ-indexed growing sequence (x i ) i∈Z included in Y . Define then m ′ to coincide everywhere with m, but over the x i 's, where m ′ (x i ) is set to be the remainder of i modulo k. By construction m ′ belongs to M , contradicting the maximality of m. If Y is [x], set m ′ to coincide everywhere with m but for x, where m ′ (x) = 0. Once more, m ′ belongs to M , this time by remarking that every value in [k] is mapped by m infinitely close to the left and to the right of x. This contradicts the maximality of m. The other possibilities for Y are just combinations of the two above. Hence m has to be defined everywhere, which means by density of β that the conclusion of the lemma holds for every dense linear ordering.

In fact, the weaker result needed is the existence of a mapping c : α → {0, . . . , k -1} such that for all x < y in α with c(x) = c(y) = 0, c([x, y]) = {0, . . . , k -1}. It happens to be much easier to establish than Lemma 3.

In fact, the present theorem differs in the use of priority automata in place of automata using Muller condition in limit transitions. For this reason the result here is new; but for a nonessential reason.

ε-transitions are just a commodity notation. And in particular there is no cycle of such transitions.

Consider the semigroup ({a, b}, .) defined by ab = aa = a and ba = bb = b.

We did not try to optimize the value of N .

Acknowledgement

I am deeply grateful to Achim Blumensath and Olivier Carton for their help in the production of this document.

Proof. (Idea) Implement the construction of the proof of Theorem 6 via monadic formulae. ⊓ ⊔ Note, that a consequence of Proposition 1, the mapping s satisfies the determinism property.

Proof of Theorem 6

Once more, we perform a case analysis.

Case of a single H-class. Lemma 18. Let H be an H-class in S such that (H, .) is a group. For β ⊆ α such that σ(β) ⊆ H, there exists a ramseyan split s H β,σ of height at most |H|. Furthermore s H satisfies the determinism property. This is exactly the proof of Lemma 10 in which one always chooses x 0 to be 0 β .

Case of a single L-class.

Lemma 19. Let L be an L-class in a regular D-class, for every ordinal β such that σ(β) ⊆ L, there exists a ramseyan split s L β,σ of height at most |L|. Furthermore s L satisfies the determinism property.

We require the following result.

Fact 20. There is an H-class H ⊆ L which is a group, and a mapping f : L → H such that:

Proof. Let H 1 , . . . , H n be the H-classes included in L. By Fact 9 we can assume that H 1 , . . . , H k are groups, while for every a, b in K i for i > k, ab ∈ L. By regularity hypothesis and Fact 6, Let H be H 1 . If k = 0, then for all a, b in L, ab ∈ L. One can construct the mapping arbitrarily using Fact 8. Else, let e i be the neutral element of H i for i ≤ k. Let i, j ≤ k. Since e i L e j , e i = xe j for some x. Hence e i e j = xe j e j = xe j = e i . For every a ∈ L, let f (a) = ae 1 . According to the claim above, f is a mapping from L to H 1 . Assume a, b in L such that ab ∈ L. According to the claim, above, b ∈ L ′ , i.e. b ∈ H i for i ≤ k. Also, as a L e i , a = xe i for some x. We have f (a)f (b) = ae 1 be 1 = xe i e 1 be 1 = xe i be 1 = abe 1 = f (ab).

The fact that f | H i is a bijection from H i to H 1 is known as Green's lemma.

⊓ ⊔

We can now prove Lemma 19.

Proof. Let H and f be obtained by Fact 20. For x < y in β, let σ ′ (x, y) be f (σ(x, y)). The first property of f makes σ ′ an additive labelling from β to H, such that σ(β) ⊆ H. Applying the case of a single H-class above we obtain a split s H β,σ ′ forward ramseyan for (β, σ ′ ). There are two different cases.

Either all the H-classes are groups. In this case, one sets s L β,σ to be s H β,σ ′ . Let us show that s L is forward ramseyan. Indeed, consider x < y and x ′ < y ′ to be k-neighbours for some k. This means that f (σ(x, y)) and f (σ(x ′ , y ′ )) are equal to the neutral element 1 of H. Since the Hclass of σ(x, y) (resp. of σ(x ′ , y ′ )) are groups isomorphic to H, we have that σ(x, y) and σ(x ′ , y ′ )

In this proof, we define first the value of X 1 , . . . , X N , before giving the formulae. Using Theorem 3, one obains a ramseyan split s for (α, σ) of height at most 3|S|. To every element x in α and k with 1 ≤ k ≤ 3|S|, we furthermore attach some pieces of information concerning the value of σ. For every k with 1 ≤ k ≤ 3|S|, there are two such informations, l k (x) and r k (c), taking value in S, and corresponding to a compaction of what is happening to the left of x, and to the right of x respectively. We give the definition of l k (x), the case of r k (x) being symmetric.

Note that a consequence of this definition is that, whenver x < y are k-neighbours, then σ(x, y) = l s(y) (y). Finally, it is simple to establish that N = ⌈(6|S| + 2) log 2 (|S|)⌉ bits are sufficient for coding (s(x), l 1 (x), . . . , l s(x) (x), r 1 (x), . . . , r s(x) (x)).

We have now to construct first-order formulae which reconstruct the value of σ(x, y) for every x < y in α. We do not provide the formulae explicitly, but instead describe functions which can be easily translated into first-order logic. Let us treat first the 'ascending case'; i.e. compute σ(x, y) for x < y, s(x) ≤ s(y), and s(z) ≥ s(x) for all z in [x, y].

Lemma 22. For every x < y in α, if s(x) ≤ s(y) and s(z) ≥ s(x) for all z in [x, y], then σ(x, y) = asc(x, y) with:

Proof. Two cases can happen. If for all z in ]x, y[, s(z) > s(x). This means that [x, y[∩s -1 (s(x)) = {x}. Hence, by definition, l s(x) (y) = σ(x, y).

Else, there exists x ′ be in ]x, y[∩s -1 (s(x)). By definition of l s(x) (y), there exists y ′ in [x ′ , y[∩s -1 (s(x)) such that l s(x) (y) = σ(y ′ , y). Let now z be the one used in the definition of asc(x, y). By definition of l s(x) (z), there exists z ′ in [x, z[∩s -1 (s(x)) such that σ(z ′ , z) = l s(x) (z). Finally using the ramseyanity of s, we deduce σ(x, y ′ ) = σ(z ′ , z) = l s(x) (z). Overall σ(x, y) = σ(x, y ′ )σ(y ′ , y) = l s(x) (z)l s(x) (y) = asc(x, y).

⊓ ⊔

Naturally, there is a corresponding definition for desc(x, y) satisfying σ(x, y) = desc(x, y) whenever s(x) ≥ s(y) and s(z) ≥ s(y) for all z in [x, y]. Combining asc and desc we obtain the following.

Lemma 23. For every x < y in α, σ(x, y) = labelling(x, y) with:

Proof. There are three cases, corresponding to the three items of the definition. The two first one are treated by Lemma 22 and its variant for desc(x, y). In the third case, one finds z in ]x, y[ such that s(z) is minimum. We use Lemma 22 between x and z, and its variant for desc between z and y, as well as the additivity of the labelling σ, for obtaining: σ(x, y) = σ(x, z)σ(z, y) = asc(x, z)desc(z, y) = labelling(x, y) .

⊓ ⊔

It is not difficult at this point to check that the definition of labelling can be translated for every a in S into a first-order formula labelling a using as predicate the ordering relation < as well as unary predicates p 1 , . . . , p N encoding the value of (s(x), l 1 (x), . . . , l s(x) (x), r 1 (x), . . . , r s(x) (x)), and satisfying the conclusion of Theorem 7.

Deterministic compaction of additive labellings over ordinals

We now state a result similar to Theorem 7 in the ordinal case, which satisfies a form of determinism property. The statement in itself is difficult to process; it is similar to the statement of Theorem 7, in which the determinism feature has been injected. Theorem 8. For every finite semigroup (S, .) and a in S, there exists a first-order formula labelling a (x, y) of free variables x, y, which uses the ordering relation < and unary predicates p 1 , . . . , p N with N = ⌈(2|S| + 1) log 2 (|S|)⌉ such that the following holds. For every ordinal α and additive labelling σ from α to S, there exists subsets X 1 (α, σ), . . . , X N (α, σ) of α such that for all a in S and x < y in α:

in which for every i = 1 . . . N , p i is interpreted as X i (α, σ). Furthermore, for every additive labellings σ and σ ′ over the respective ordinals α and α ′ , and every ordinal β < min(α, α ′ ),

Let s be the forward ramseyan split of (α, σ) of height |S| obtained by Theorem 6. Let us define l k (x) as in the previous section (this time only for every k = 1 . . . |S|). Without loss of generality, we assume that there exists a neutral element -denote it 1 -in S, and we set for every x, σ(x, x) = 1. Define: labelling(x, y) = labelling 1 (x, y) , with labelling n defined by induction for all n = 1, . . . , |S| + 1 by:

In this definition, we abbreviate by [x, y[∩s -1 (n) = {z 0 < z 1 < . . . } the fact that z 0 is the minimal element, and z 1 the minimal element different from z 0 in [x, y[∩s -1 (n). Those two elements exist since α is an ordinal and since the case of [x, y[∩s -1 (n) being the emptyset or a singleton is treated above.

The correctness is then stated by the following lemma.