Keywords: Transductions, minimisation, congruence syntaxique, aperiodicité, logique du second ordre monadique, logique du premier ordre, origine, vérification, synthèse, data Transductions, minimization, syntactic congruence, aperiodicity, monadic secondorder logic, first-order logic, origin, verification, synthesis, data words

Définissabilité et Synthèse de Transductions

Titre Définissabilité et Synthèse de Transductions

Résumé Dans la première partie de ce manuscrit nous étudions les fonctions rationnelles, c'est-à-dire définies par des transducteurs unidirectionnels. Notre objectif est d'étendre aux transductions les nombreuses correspondances logique-algèbre qui ont été établies concernant les langages, notamment le célèbre théorème de Schützenberger-McNaughton-Papert. Dans le cadre des fonctions rationnelles sur les mots finis, nous obtenons une caractérisation à la Myhill-Nerode en termes de congruences d'indice fini. Cette caractérisation nous permet d'obtenir un résultat de transfert, à partir d'équivalences logique-algèbre pour les langages vers des équivalences pour les transductions. En particulier nous montrons comment décider si une fonction rationnelle est définissable en logique du premier ordre. Sur les mots infinis, nous pouvons également décider la définissabilité en logique du premier ordre, mais avec des résultats moins généraux.

Dans la seconde partie nous introduisons une logique pour les transductions et nous résolvons le problème de synthèse régulière: étant donnée une formule de la logique, peut-on obtenir un transducteur bidirectionnel déterministe satisfaisant la formule ? Plus précisément nous fournissons un algorithme qui produit toujours une fonction régulière satisfaisant une spécification donnée en entrée. Nous exposons également un lien intéressant entre les transductions et les mots avec données. Par conséquent nous obtenons une logique expressive pour les mots avec données, pour laquelle le problème de satisfiabilité est décidable.

Résumé en français

Des langages aux transductions L'étude des langages formels est l'un des piliers de l'informatique théorique et a permis de développer de nombreux outils théoriques et pratiques dans différents domaines. Certaines classes de langages se démarquent des autres car elles bénéficient de plusieurs descriptions différentes, par exemple les langages récursivement énumérables peuvent être caractérisés en termes de machines de Turing ou en termes de grammaires de type 0 dans la hiérarchie de Chomsky. Un exemple qui nous intéresse particulièrement est celui de la classe des langages rationnels 1 qui se situe au plus bas niveau de la hiérarchie de Chomsky puisqu'elle est caractérisée par les grammaires régulières. Les langages rationnels sont également caractérisés par les expressions rationnelles, les formules de la logique monadique du second-ordre (MSO), les monoïdes finis (ou de manière équivalente les congruences d'indice fini), les automates finis (ainsi que toutes leurs variantes: déterministes, non-déterministes, alternants, unidirectionnels, bidirectionnels, etc), etc. Par exemple, le langage des mots de longueur paire sur l'alphabet {a}, est reconnu par l'automate donné en Fig. 1 La théorie de la calculabilité peut aussi être abordée du point de vue des fonctions et là encore des classes particulières bénéficient de plusieurs descriptions différentes, par exemple, les fonctions calculables peuvent être caractérisées en termes de machines de Turing, de fonctions µ-récursives, ou d'expressions du lambda calcul. Dans le modèle de Turing, une machine (nondéterministe) avec une bande d'entrée et une bande de sortie définit une relation sur les mots appelée une transduction.

Une question importante à nos yeux est la suivante: quelle est la classe de transductions homologue aux langages rationnels ? Il n'y a pas de réponse évidente à cette question puisque la classe de transductions que l'on obtient dépend du modèle de calcul que l'on choisit de généraliser. Par exemple, les transductions reconnaissables par monoïdes finis forment une des classes de transductions les moins expressives et une telle transduction peut être décrite comme une union finie de produits de langages rationnels (voir [START_REF] Berstel | Transductions and context-free languages[END_REF]).

Un automate peut être promu en transducteur, c'est-à-dire un automate avec des sorties, et il réalise ainsi une transduction. En Fig. 2 nous donnons deux exemples de transducteurs.

1 Souvent appelés langages réguliers.

v

Définissabilité et Synthèse de Transductions

Le premier copie la moitié des lettres de son entrée tandis que le second double chaque lettre. Tandis qu'un automate peut être vu comme une machine de Turing avec une bande de lecture seule, un transducteur est une machine de Turing avec une bande de lecture et une bande d'écriture. Les variantes d'automates finis reconnaissent toutes la même classe de langages, cependant ce n'est pas le cas pour les transductions. Premièrement, un transducteur déterministe doit réaliser une fonction puisqu'une certaine configuration de la bande d'entrée ne permet qu'un unique calcul. Un transducteur non-déterministe au contraire peut réaliser une relation non-fonctionnelle. Deuxièmement, les transducteurs unidirectionnels sont strictement moins expressifs que les transducteurs bidirectionnels, par exemple la fonction miroir, qui inverse l'ordre d'un mot, peut uniquement être réalisée par un transducteur bidirectionnel. Les transductions réalisées par des transducteurs unidirectionnels sont aussi définissables par des expressions rationnelles sur une produit de monoïdes libres (voir [START_REF] Berstel | Transductions and context-free languages[END_REF]) et ont donc été nommées transductions rationnelles. Les fonctions réalisées par des transducteurs bidirectionnels ont également été caractérisées par différents modèles, notamment les transductions MSO à la Courcelle ainsi que les streaming string transducers (SST), des transducteurs unidirectionnels augmentés de registres. Ces équivalences ont été montrées respectivement dans [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF][START_REF] Alur | Expressiveness of streaming string transducers[END_REF], et les fonctions de cette classe sont souvent appelées fonctions régulières. Pour une vue d'ensemble de ces différents modèles voir [START_REF] Filiot | Logic-automata connections for transformations[END_REF][START_REF] Filiot | Transducers, logic and algebra for functions of finite words[END_REF].

Les problèmes

Les problèmes classiques de la théorie des langages formels peuvent être formulés en termes de transductions. Nous considérons des questions de définissabilité et de minimisation, et nous exposons quels résultats ont déjà été obtenus pour les langages rationnels et leurs extensions vers les transductions. De plus de nouveaux types de problèmes se posent, en particulier les questions de synthèse pour les transductions ont beaucoup été étudiées.

En ce qui concerne les langages rationnels, la minimisation a été résolue pour différents modèles. Le monoïde syntaxique (de manière équivalente, la congruence syntaxique, voir [START_REF] Nerode | Linear automaton transformations[END_REF]) d'un langage rationnel est le plus petit monoïde reconnaissant le langage, et de plus ce monoïde est minimal au sens fort où il divise n'importe quel monoïde reconnaissant le langage. À partir de cela, on peut définir l'automate déterministe minimal d'un langage, qui est minimal en nombre d'états parmi les automates déterministes reconnaissant le même langage. Une fois encore, cette propriété de minimalité est en fait plus forte: l'automate minimal est un quotient de n'importe quel automate déterministe reconnaissant le même langage, et cette structure supplémentaire fournit des procédures de minimisation efficaces en PTime ( [START_REF] Moore | Gedanken-experiments on sequential machines[END_REF][START_REF] Hopcroft | An n log n algorithm for minimizing states in a finite automaton[END_REF]). Dans le cadre des transducteurs séquentiels (des transducteurs unidirectionnels avec un automate sous-jacent déterministe) un objet minimal similaire a été découvert par Choffrut avec la même propriété de minimalité forte que le transducteur séquentiel minimal est un quotient de n'importe quel transducteur séquentiel réalisant la même fonction. Cette caractérisation peut être trouvée dans [START_REF]Minimizing subsequential transducers: a survey[END_REF], où l'auteur fournit également plusieurs algorithmes de minimisation en PTime, similaires au cas des automates. L'existence de tels objets minimaux pour les automates et pour les transducteurs séquentiels a été traduite en termes de théorie des catégories par [START_REF] Colcombet | Automata minimization: a functorial approach[END_REF]. Par exemple le transducteur en Fig. 2(b) peut être minimisé en un transducteur avec un seul état.

Dans [BGMP16, BGMP17], les auteurs considèrent une approche différente de la minimisation: étant donné un transducteur bidirectionnel fonctionnel, ils montrent comment minimiser, uniformément sur toutes les entrées, le nombre de changements de direction de la tête de lecture. Une approche encore différente est étudiée dans [START_REF] Daviaud | A generalised twinning property for minimisation of cost register automata[END_REF][START_REF] Daviaud | Degree of sequentiality of weighted automata[END_REF] où les auteurs considèrent des SST avec des restrictions sur les opérations de registres et parviennent à minimiser le nombre de registres en utilisant des propriétés de jumelage à la Choffrut.

Problèmes de définissabilité Le problème de C 1 -definissabilité pour C 2 demande, pour un objet syntaxique M 2 (par exemple un automate, une formule, etc) dans une classe C 2 avec une interprétation sémantique M 2 , s'il existe un objet M 1 ∈ C 1 tel que M 1 = M 2 . Premièrement, remarquons qu'un problème de minimisation peut être vu comme un cas particulier de problème de définissabilité en prenant pour C 1 une classe de petits objets de C 2 . Des problèmes de définissabilité apparaissent dans de nombreux domaines de l'informatique lorsqu'on veut savoir si un objet peut être défini dans un certain modèle de calcul.

Un fragment logique de MSO est un sous-ensemble des formules MSO défini par une restriction syntaxique. Pour un tel fragment F, on a le problème de F-définissabilité pour les langages réguliers. Beaucoup de tels problèmes ont été résolus par la théorie des variétiés de monoïdes finis (parfois appelées pseudovariétés, voir [START_REF] Straubing | Finite automata, formal logic, and circuit complexity[END_REF]). En effet, les variétés de monoïdes sont closes par division ce qui implique qu'un langage est reconnaissable par un monoïde dans une variété V si et seulement si son monoïde syntaxique est dans V. De plus la théorie d'Eilenberg des variétés, initiée par [START_REF]Automata, languages, and machines[END_REF], fournit une description équationnelle des variétés de monoïde ce qui donne dans de nombreux cas une procédure pour décider si un langage est reconnaissable par un monoïde dans une variété donnée.

Le premier exemple d'une telle équivalence est le théorème de Schützenberger/McNaughton-Papert ( [START_REF]On finite monoids having only trivial subgroups[END_REF][START_REF] Mcnaughton | Counter-free automata[END_REF]) qui dit qu'un langage est définissable en logique du premier ordre si et seulement si il est reconnaissable par un monoïde apériodique. Ceci fournit une procédure pour décider la FO[≤]-définissabilité des langages rationnels: calculer le monoïde syntaxique (ou l'automate minimal) puis tester l'apériodicité. Depuis, d'autres équivalences ont été établies entre fragments logiques et variétés de monoïdes, voir [START_REF] Straubing | Finite automata, formal logic, and circuit complexity[END_REF][START_REF] Diekert | Fragments of first-order logic over infinite words[END_REF] (et aussi Fig. 1.2) pour plus de détails. La notion de variété de monoïde a aussi été généralisée aux variétés de monoïdes ordonnés [Pin95] et aux variétés de timbres [START_REF] Chaubard | Actions, wreath products of C-varieties and concatenation product[END_REF]. vii En ce qui concerne les transductions séquentielles on a, grâce à l'algorithme de minimisation de Choffrut, une façon de décider si une fonction séquentielle peut être réalisée par un transducteur séquentiel avec un monoïde de transition dans une variété donnée. Par exemple, les deux transducteurs de Fig. 2 ne sont pas apériodiques puisqu'ils comptent modulo deux. Cependant, bien que le premier est minimal le second ne l'est pas, et il se trouve que la fonction a n → a 2n est apériodique car elle peut être réalisée par un transducteur avec un unique état.

Pour la logique, une équivalence a été établie entre les transducteurs bidirectionnels fonctionnels avec monoïde de transition apériodique et les FO[≤]-transductions dans [START_REF] Carton | Aperiodic two-way transducers and fo-transductions[END_REF]. Un résultat similaire a été obtenu prouvant l'équivalence entre les SST avec monoïde de transition apériodique et les FO[≤]-transductions dans [START_REF] Filiot | First-order definable string transformations[END_REF]. Ces équivalences ne fournissent cependant pas de procédure pour décider si une transduction peut être réaliser par un FO[≤]-transducteur. En effet pour les fonctions régulières on ne connaît pas encore d'objet minimal avec de bonnes propriétés tel que l'automate minimal ou le monoïde syntaxique dans le cas des langages rationnels.

Un point de vue différent a été considéré dans [START_REF] Cadilhac | A circuit complexity approach to transductions[END_REF] où les auteurs fournissent une procédure pour décider si une transduction séquentielle peut être exprimée par un circuit dans AC 0 . Leur approche, qui utilise une notion de continuité des transduction par rapport à une variété de monoïde a été étendue dans [START_REF] Cadilhac | Continuity and rational functions, 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017[END_REF].

Problèmes de synthèse Le problème de C 1 , C 2 -synthèse demande, étant donné un transducteur T 2 dans une classe C 2 avec une interprétation sémantique T 2 et un domaine dom( T 2 ), s'il existe un transducteur T 1 ∈ C 1 uniformisant T 2 , c'est-à-dire tel que T 1 ⊆ T 2 et dom( T 1 ) = dom( T 2 ). En termes de vérification, le transducteur T 2 est nommé la spécification, qui est censée capturer les comportements entrée/sortie acceptables, et T 1 , normalement fonctionnel, peut être vu comme un programme qui satisfait la spécification. Les problèmes de synthèse sont centraux en informatique puisqu'il s'agit d'obtenir automatiquement à partir d'une spécification un programme qui la satisfait. Les problèmes de synthèse jouent également un rôle important en théorie des jeux, où l'on souhaite produire une stratégie (programme) qui assure (satisfait) une condition de victoire (spécification). Pour plus de détails sur l'histoire et les implications des problèmes de synthèse voir [Tho09].

Le problème de synthèse de Church, énoncé dans l'article fondateur [START_REF] Church | Application of recursive arithmetic to the problem of circuit synthesis[END_REF] demande, étant donné un circuit réalisant une transduction lettre-à-lettre si l'on peut synthétiser un transducteur séquentiel lettre-à-lettre l'uniformisant. Dans [START_REF] Büchi | Solving sequential conditions by finite-state strategies[END_REF] les auteurs montrèrent que si la spécification est donnée comme une formule MSO réalisant une transduction lettre-à-lettre, alors le problème est décidable. En utilisant comme spécifications des formules LTL, [START_REF] Pnueli | On the synthesis of a reactive module[END_REF] ont fourni une solution élémentaire au problème de synthèse ce qui insuffla beaucoup d'intérêt dans le domaine de la synthèse réactive, par exemple la compétition SYNTCOMP co-située avec la conférence CAV depuis 2014. Depuis, d'autres classes de transductions ont été considérées avec des résultats positifs et négatifs. Dans [START_REF] Carayol | Uniformization in automata theory[END_REF], les auteurs ont montré que lorsque la restriction lettre-à-lettre est retirée, le problème devient indécidable. Cependant, ils ont également montré que si seulement la spécification est lettre-à-lettre alors le problème reste décidable. Dans [START_REF] Filiot | On equivalence and uniformisation problems for finite transducers[END_REF] les auteurs montrent que le problème de synthèse séquentielle est décidable lorsque la spécification est une transduction finiment valuée (il existe une borne uniforme sur le nombre de sorties produites par une entrée). Ils prouvent également que le problème est décidable si la spécification est donnée par un transducteur déterministe (un automate déterministe à deux bandes). Ce problème a également été étendu aux structures arborescentes, par exemple dans [START_REF] Löding | Synthesis of deterministic top-down tree transducers from automatic tree relations[END_REF]. viii

Definability and Synthesis of Transductions

Contributions de la thèse

Ce manuscrit traite de certaines instances des questions mentionnées précédemment, minimisation, définissabilité et synthèse pour les transductions, et il est divisé en deux parties. Dans la première partie nous considérons les fonctions rationnelles sur les mots, c'est-à-dire les fonctions réalisées par des transducteurs unidirectionnels, sur des mots finis et infinis. Une restriction naturelle des transducteurs MSO, nommés transducteurs préservant l'ordre, capture exactement les fonctions rationnelles, voir [Boj14,[START_REF] Filiot | Logic-automata connections for transformations[END_REF]. Plusieurs questions de définissabilité peuvent donc découler de cette remarque: étant donné un fragment logique F de MSO, peut on décider la F-définissabilité des fonctions rationnelles ? Dans la première partie nous considérons de telles questions que nous résolvons pour certains fragments (en particulier FO[≤]) par des techniques de minimisation et de formes canoniques. Dans la seconde partie nous étudions des logiques expressives pour les transductions et nous résolvons le problème de synthèse régulière pour ces logiques. Nous établissons également un lien fort entre les transductions et les langages de mots avec données ordonnées.

Caractérisation des fonctions rationnelles L'objectif et la situation Dans ces travaux notre but a été d'étendre le succès de l'étude des équivalences logique-algèbre des langages vers les transductions, afin de résoudre des problèmes de définissabilité pour des fragments logiques de MSO. Pour les langages rationnels, la caractérisation effective de fragments de MSO repose souvent sur une équivalence avec une variété de monoïdes. Ce qui veut dire, d'après les bonnes propriétés des variétés, que calculer l'automate minimal est suffisant pour décider si un langage est reconnu par un monoïde dans la variété et donc par une formule du fragment. En ce qui concerne les transductions séquentielles, comme nous l'avons vu, un objet minimal existe également cependant toutes les fonctions rationnelles ne sont pas séquentielles.

Dans [START_REF] Reutenauer | Minimization of rational word functions[END_REF], les auteurs donnent une procédure pour calculer une machine canonique pour n'importe quelle fonction rationnelle. Les machines utilisées sont des bimachines, qui furent introduites par [START_REF] Schützenberger | A remark on finite transducers[END_REF] puis nommées et étudiées par [START_REF] Eilenberg | Automata, languages, and machines. A, Pure and applied mathematics[END_REF]. Une bimachine peut être vue comme un transducteur séquentiel avec "information en avant", c'est-à-dire avec une information rationnelle sur le suffixe du mot, où l'information en avant est donnée par un automate codéterministe. En particulier, la bimachine canonique de [START_REF] Reutenauer | Minimization of rational word functions[END_REF] a l'automate d'information en avant minimal parmi toutes les bimachines réalisant la fonction. Cependant cette bimachine n'est pas minimale en termes de monoïde de transition.

Les résultats Notre première contribution principale est de montrer que pour une transduction sur les mots finis donnée, il existe un nombre fini de bimachines minimales réalisant la fonction (minimales en termes de monoïde de transitions). Ainsi nous obtenons un algorithme pour décider si une transduction donnée en entrée peut être réalisée par un transducteur avec un monoïde de transitions dans une certaine variété (décidable).

De plus nous donnons un théorème de transfert d'équivalences logique-algèbre pour les langage vers des équivalences logique-algèbre pour les transductions. Ce qu'il faut retenir de ce résultat de transfert est que étant donné F un fragment logique de MSO équivalent à une variété de monoïdes, si F a accès au prédicat d'ordre alors l'équivalence peut être étendue aux transductions.

En particulier on peut décider si une transduction donnée peut être exprimée en FO[≤] logique du premier ordre, FO 2 [≤] logique du premier ordre avec deux variables, et BΣ 1 [≤] la clôture booléenne du fragment existentiel de FO[≤]. De plus, dans le cas des transductions apériodiques nous montrons que toutes les bimachines canoniques sont apériodiques, ce qui nous ix Définissabilité et Synthèse de Transductions permet de prouver que la décision de la FO[≤]-définissabilité des fonctions rationnelles est un problème PSpace-complet.

Sur les mots infinis, le tableau est moins complet. Premièrement nous étendons le résultat de minimisation de Choffrut aux fonctions séquentielles sur les mots infinis. La difficulté est que pour les langages de mots infinis, il n'y a pas de bonne définition d'automate minimal. Nous contournons ce problème en ignorant le domaine de la transduction, et nous obtenons un unique transducteur séquentiel minimal qui prolonge la fonction initiale sur la clôture de son domaine.

Nous définissons un automate canonique pour l'information en avant et nous obtenons une bimachine canonique pour les fonctions rationnelles sur les mots infinis. Cependant cette bimachine n'a pas les même bonnes propriétés que celle de [START_REF] Reutenauer | Minimization of rational word functions[END_REF]: l'automate d'information en avant n'a pas de propriété de minimalité. Néanmoins nous montrons que n'importe quelle transduction apériodique a une bimachine canonique apériodique et nous obtenons donc une procédure de décision de la FO[≤]-définissabilité pour les fonctions rationnelles sur les mots infinis.

Spécification et synthèse pour les transductions L'objectif Le but de ce travail était de définir un "bon" langage de spécification pour les transductions. Notre objectif était d'obtenir un formalisme de haut niveau pour spécifier des propriétés de transductions, pour lequel des problèmes classiques de vérification pourraient être résolus: l'équivalence, la vérification de modèle et la synthèse par exemple. Nos trois exigences principales étaient 1) ce formalisme devrait être de haut niveau, c'est-à-dire proche du langage humain, en d'autres termes une logique. 2) il devrait être suffisamment expressif et au moins pouvoir exprimer les fonctions régulières, qui jouissent de nombreuses caractérisations différentes notamment par des modèles d'automates déterministes ce qui semble pertinent pour la vérification de modèle et la synthèse. 3) certains des problèmes mentionnés plus haut devraient être décidables.

Un premier candidat évident serait le modèle de transducteurs NMSO de Courcelle. Ce modèle rempli les points 2) et 3) mais nous arguons qu'il ne satisfait pas le point 1), bien qu'étant basé sur MSO. Pour un transducteur NMSO on doit spécifier exactement comment l'entrée produit la sortie, on n'a pas la possibilité de sous-spécifier. Par exemple la spécification "L'entrée contient au moins une fois la lettre a et la sortie au plus deux fois la lettre b" ne peut être exprimée par une transduction NMSO. En effet pour un transducteur NMSO un mot d'entrée ne peut produire qu'un nombre fini de mots de sortie. Dans un certain sens, un transducteur NMSO est plus proche d'un modèle de machine où les déplacements de la tête de lecture sont définis par des formules MSO.

L'approche Notre approche est basée sur une remarque faite dans [Boj14], que la sémantique de presque n'importe quel modèle de transducteurs peut être enrichie en sémantique avec origines. Au lieu de paires de mots (u, v) où u est l'entrée et v la sortie, la sémantique avec origine considère des paires de la forme (u, (v, o)) où u est l'entrée, v la sortie et o : dom(v) → dom(u) est la fonction d'origine qui, intuitivement, envoie une position de la sortie sur la position de l'entrée qui était traitée lorsque la position de sortie a été produite.

On considère des graphes d'origine: des structures relationnelles à deux composantes, une structure d'entrée, une structure de sortie ainsi qu'une fonction d'origine des positions de sortie vers les positions d'entrée. Nous considérons principalement les graphes d'origine de mots vers mots, c'est-à-dire quand les deux sous-structures sont des mots. Nous donnons en Fig. 3(a Nous considérons MSO sur les graphes d'origine et nous montrons que cette logique est indécidable (même pour des fragments faibles). Il faut cependant noter que dans [START_REF] Miko Laj Bojańczyk | Which classes of origin graphs are generated by transducers[END_REF] les auteurs montrent que la vérification de modèle d'une fonction régulière contre une formule MSO est décidable. Une façon d'obtenir ce résultat est d'observer que les graphes d'origine produits par un transducteur bidirectionnel déterministe ont une largeur de chemin bornée. En utilisant le théorème de Courcelle [START_REF] Courcelle | The monadic second-order logic of graphs. i. recognizable sets of finite graphs[END_REF] on obtient donc la décidabilité.

La logique Puisque la logique MSO entière est indécidable, notre approche a été de chercher un fragment suffisamment faible pour être décidable mais suffisamment expressif pour capturer au moins les fonctions régulières. Nous sommes parvenus à trouver une logique adéquate, après plusieurs essais, appelée Lo. Puisque nous voulions avoir toute l'expressivité de MSO sur l'entrée afin de capturer les fonctions régulière, nous avons défini une logique "asymétrique" dans le sens où elle est restreinte dans son expressivité en ce qui concerne les positions de sortie. La logique que nous définissons est la logique du premier ordre avec deux variables, avec l'ordre sur l'entrée et sur la sortie et une fonction d'origine. En plus de cela nous ajoutons n'importe quel prédicat MSO-définissable qui ne peut quantifier que sur l'entrée. Nous dénotons cette logique par Lo := Les chevrons , sont seulement là pour séparer les prédicats MSO[≤ in ], dans un soucis de clarté. Le prédicat out(x) est ajouté comme sucre syntaxique et peut être exprimé par exemple par x ≤ out x. La formule dit que deux positions de sortie étiquetées par a et b respectivement doivent avoir des origines à distance paire.

Les résultats Nos techniques sont inspirées de [START_REF] Schwentick | Two-variable logic with two order relations[END_REF] où les auteurs obtiennent la décidabilité de la logique du premier ordre avec deux variables sur les mots avec données ordonnées, avec comme prédicats l'ordre sur les positions et l'ordre sur les données. Avant d'expliciter le lien entre graphes d'origine et mots avec données, discutons des résultats obtenus. Nous montrons tout d'abord que le problème de satisfiabilité de Lo sur les graphes d'origine est décidable. En fait notre résultat est plus fort que cela puisque nous fournissons un algorithme pour calculer un automate reconnaissant le domaine d'une transduction Lo. Puisque la logique est close par opérations booléennes, nous obtenons la décidabilité de l'équivalence de formules. En raffinant nos techniques, nous obtenons alors le résultat principal de cette partie: un algorithme de synthèse régulière, c'est-à-dire une algorithme qui prend en entrée une formule Lo et qui produit une fonction régulière l'uniformisant.

Nous donnons également deux extensions de la logique pour lesquelles notre algorithme d'uniformisation fonctionne également. La première est ∃Lo qui étend Lo en ajoutant un bloc de

Introduction

From languages to transductions

The study of formal languages is one of the cornerstones of theoretical computer science and has been very fruitful in developing theoretical as well as practical tools in many domains. Some language classes stand out from the crowd because they enjoy several different descriptions, for instance the recursively enumerable languages which can be characterized both in terms of Turing machines or in terms of type-0 grammars in the Chomsky hierarchy. An example of particular interest to us is the class of rational languages 2 which sits on the lowest level of the Chomsky hierarchy as they are recognized by the regular grammars. The rational languages are also characterized by rational expressions, monadic second-order logic (MSO) formulas, finite monoids (or equivalently congruences of finite index), finite state automata (and all their variants: deterministic, non-deterministic, alternating, one-way, two-way, etc), etc. For instance the language of words of even length over the alphabet {a} is recognized by the automaton of Fig. 4, and is defined by the rational expression (aa) * . The theory of computability can also be considered from the point of view of functions and there again particular classes enjoy many different descriptions, for instance the computable functions can be characterized in terms of Turing machines, µ-recursive functions or in the lambda calculus. In the model of Turing, a (non-deterministic) machine with an input tape and an output tape defines a relation on words over a finite alphabet, called a transduction.

An important question to us is: what is the class of transductions homologous to the rational languages? There is no straightforward answer to this question since the transduction classes we obtain depend on the computational model we choose to generalize. For instance the transductions recognizable by finite monoids are one of the lowest classes of transductions in terms of expressiveness and can be described as finite unions of products of rational languages (see e.g. [START_REF] Berstel | Transductions and context-free languages[END_REF]).

Automata can be promoted to transducers, i.e. automata with outputs, to realize transductions. In Fig. 5 on the next page we give two examples of transducers. The first one copies half of the letters of its input while the second one doubles it. While an automaton can be thought of as a Turing machine with a read-only tape, a transducer is a Turing machine with one readonly tape and one write-only tape. The different variants of automata all recognize the same class of languages, however this is not the case at all for transductions. Firstly, deterministic transducers can only realize (partial) functions since a particular configuration of the input tape only allows for one computation. Non-deterministic transducers on the other hand may realize non-functional relations. Secondly, one-way transducers are strictly less expressive than two-way transducers, for instance the mirror function, which reverses the order of a word, can be realized in the latter class but not in the former. The transductions realized by one-way transducers are also the transductions definable by rational expressions over a product of free monoids (see [START_REF] Berstel | Transductions and context-free languages[END_REF]) and have thus been coined rational transductions. The functions realized by two-way transducers have also been characterized by different models, namely the MSO-transductions à la Courcelle as well as the so-called streaming string transducers, i.e. one way transducers with registers. The equivalences have been shown in [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF][START_REF] Alur | Expressiveness of streaming string transducers[END_REF], respectively, and the functions of this class are often called the regular functions. For an overview of the different models of transducers, see the surveys [START_REF] Filiot | Logic-automata connections for transformations[END_REF][START_REF] Filiot | Transducers, logic and algebra for functions of finite words[END_REF].

0 1 a|a a| (a) a n → a n 2 0 1 a|aa a|aa (b) a n → a 2n

The problems

Classical problems in the theory of formal languages can be formulated in terms of transductions. We consider some minimization and definability questions and say what results have been obtained for rational languages and their extensions to transductions. Additionally new kinds of problems arise, and in particular synthesis questions for transductions have been extensively studied.

Minimization problems and canonical forms A minimization problem asks given a syntactic object M 2 (e.g. an automaton) in a class C, with a semantic interpretation M 2 , whether there exists an object M 1 ∈ C such that M 1 = M 2 and M 1 is "smaller" than M 2 , for some definition of smaller. Minimization problems are pervasive in computer science, for obvious efficiency reasons. Moreover, minimal objects are often linked to canonical forms which have additional algorithmic interest. A canonical form for objects in a given class C is a procedure which takes as input an object M ∈ C, and produces an object M which only depends on M and such that M = M . In particular, having a procedure to compute a canonical form gives a way to test equivalence of two objects. Moreover such a canonical form may allow one to test other semantic properties of an object. For rational languages, minimization has been solved for different models. The syntactic monoid (equivalently, syntactic congruence, see [START_REF] Nerode | Linear automaton transformations[END_REF]) of a rational language is the smallest monoid recognizing the language, and moreover this monoid is minimal in the strong sense that it divides any monoid recognizing the language. From this, one can define the minimal deterministic automaton of a language which is minimal in the number of states among other deterministic automata recognizing the same language. Again this minimality property is stronger than just having a minimal number of states: the minimal automaton is a quotient of any deterministic automaton recognizing the same language, and this extra structure yields efficient minimization procedures in PTime ( [START_REF] Moore | Gedanken-experiments on sequential machines[END_REF][START_REF] Hopcroft | An n log n algorithm for minimizing states in a finite automaton[END_REF]).

For sequential transducers (one-way transducers with a deterministic underlying automaton) a similar minimal object was discovered by Choffrut with the same strong minimality property that the minimal sequential transducer is a quotient of any sequential transducer realizing the function. Alternatively, one could say that the transition monoid of the minimal sequential transducer divides the transition monoid of any sequential transducer realizing the function. This can be found in the survey [START_REF]Minimizing subsequential transducers: a survey[END_REF] where the author also gives several PTime minimization procedures close to the automata case. The existence of such minimal objects for automata and sequential transducers has been translated in category theoretical terms in [START_REF] Colcombet | Automata minimization: a functorial approach[END_REF]. As an example, the transducer in Fig. 5(b) on the facing page can be minimized into a one state transducer.

A different take on minimization has been considered in [BGMP16, BGMP17] where the authors, given functional two-way transducer, are able to minimize the number of head reversals uniformly over all input words. Yet another approach in [DRT16, DJRV17] considers streaming string transducers, with some restrictions on the register operations, and is able to minimize the number of registers, using twinning properties à la Choffrut.

Definability problems

The C 1 -definability problem for C 2 asks, given a syntactic object M 2 (e.g. automaton, formula, etc) in a class C 2 , with a semantic interpretation M 2 , whether there exists an object M 1 ∈ C 1 such that M 1 = M 2 . Let us first remark that minimization problems can be thought of as particular cases of definability problems, by taking C 1 a class of small objects of C 2 . Definability problems occur in many areas of computer science when one wants to know if an object can be expressed in a given computational model.

A logical fragment of MSO is a subset of MSO-formulas defined by a syntactic restriction. For any such fragment F we have the associated F-definability problem for rational languages. Many of such problems have been solved through the theory of monoid varieties (sometimes called pseudovarieties, see [START_REF] Straubing | Finite automata, formal logic, and circuit complexity[END_REF]). Indeed many equivalences have been established between logical fragments and monoid varieties. Moreover, monoid varieties are crucially closed under division which means that a language is recognizable by a monoid in a pseudo-variety V if and only if its syntactic monoid is in V. Furthermore, the Eilenberg theory of varieties, started in [START_REF]Automata, languages, and machines[END_REF], provides an equational description of monoid varieties, which gives in many cases a decision procedure to know if a language is recognizable by a monoid in a given variety.

The first example of such an equivalence is the Schützenberger/McNaughton-Papert Theorem ([Sch65, MP71]) which states that languages definable in first-order logic, FO[≤], are exactly the languages recognized by aperiodic monoids. This provides a procedure to decide the FO[≤]definability problem for rational languages: computing the syntactic monoid (or the minimal automaton) and then checking for aperiodicity. Since then, other equivalences have been established between logical fragments and monoid varieties, see [START_REF] Straubing | Finite automata, formal logic, and circuit complexity[END_REF][START_REF] Diekert | Fragments of first-order logic over infinite words[END_REF] (and also Fig. 1.2 on page 17) for more on this. The notion of monoid varieties has also been generalized to varieties of ordered monoids [Pin95] and to stamp varieties [START_REF] Chaubard | Actions, wreath products of C-varieties and concatenation product[END_REF].

For sequential transductions, we also have, thanks to the Choffrut minimization algorithm, a way to decide if a given sequential function can be realized by a sequential transducer with a transition monoid in a given variety. For instance both transducers in Fig. 5 on the facing page are not aperiodic since they count modulo two. However, while the first one is minimal, the second one is not and in fact the function a n → a 2n is aperiodic because it can be realized by a one-state transducer (which is thus aperiodic).

Concerning logics, an equivalence has been established between functional two-way transducers with an aperiodic transition monoid and FO[≤]-transductions in [START_REF] Carton | Aperiodic two-way transducers and fo-transductions[END_REF]. A similar result was also obtained showing the equivalence between streaming string transducers with an aperiodic transition monoid and FO[≤]-transductions in [START_REF] Filiot | First-order definable string transformations[END_REF]. These equivalences however do not provide a procedure to decide if a given transduction can be realized by an FO[≤]-transducer. Indeed, regular functions lack a minimal object with good minimality properties such as the minimal automaton or the syntactic monoid for rational languages.

From another point of view, in [START_REF] Cadilhac | A circuit complexity approach to transductions[END_REF] the authors provided a procedure to decide if a sequential transduction can be expressed as a circuit in AC 0 . Their approach, which uses a notion of continuity of transductions with respect to a monoid variety, was extended in [START_REF] Cadilhac | Continuity and rational functions, 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017[END_REF].

Synthesis problems

The C 1 , C 2 -synthesis problem asks, given a transducer T 2 in a class C 2 with semantic interpretation T 2 and domain dom( T 2 ), if there exists a transducer T 1 ∈ C 1 uniformizing T 2 , i.e. such that T 1 ⊆ T 2 and dom( T 1 ) = dom( T 2 ). In verification terms, the transducer T 2 is called the specification, which is supposed to capture acceptable input/output behaviors, and T 1 , usually functional, can be thought of as a program that satisfies the specification. Synthesis problems are very central to computer science, since the goal is to obtain automatically from a specification, a program that satisfies it (or realizes it). Synthesis problems also play a huge role in game theory, where one often wants to produce a strategy (program) that ensures (satisfies) a winning condition (specification). For more on the history and implications of synthesis problems see [Tho09].

The Church synthesis problem, stated in the seminal article [START_REF] Church | Application of recursive arithmetic to the problem of circuit synthesis[END_REF], asks, given a circuit realizing a letter-to-letter transduction if one can synthesize a sequential letter-to-letter transducer uniformizing it. In [START_REF] Büchi | Solving sequential conditions by finite-state strategies[END_REF] the authors showed that when the specification is given as a MSO-formula realizing a rational letter-to-letter transduction, then the problem is decidable. Using specifications in LTL instead, [START_REF] Pnueli | On the synthesis of a reactive module[END_REF] provided an elementary solution to the synthesis problem which sparked a lot of interest in the domain of reactive synthesis, including the competition SYNTCOMP co-located with CAV since 2014. Since then many other classes have been considered with positive and negative results. In [START_REF] Carayol | Uniformization in automata theory[END_REF], the authors show that when the letter-to-letter restriction is removed, then the problem becomes undecidable. However they also show that if only the specification is required to be letter-to-letter, then the problem remains decidable. In [START_REF] Filiot | On equivalence and uniformisation problems for finite transducers[END_REF] the authors show that the sequential synthesis problem is also decidable when the specification is a finite-valued rational transduction (there is a uniform bound on the number of different outputs an input word may produce). They also solve the problem when the specification is a given by a deterministic transducer (a deterministic two-tape automaton). This problem has also been extended to tree structures for instance in [START_REF] Löding | Synthesis of deterministic top-down tree transducers from automatic tree relations[END_REF].

Contributions of the thesis

This manuscript deals with some instances of the questions mentioned above, minimization, definability and synthesis for transduction, and is divided into two main parts. In the first part we focus on rational word functions, that is functions realized by one-way transducers over words, finite and infinite. A natural restriction on MSO-transducers, called order-preserving MSO-transducers was shown to capture exactly the rational functions in [Boj14,[START_REF] Filiot | Logic-automata connections for transformations[END_REF]. From this fact many definability questions arise: for a logical fragment F of MSO, can one decide F-definability of rational functions? In the first part we consider such questions which we solve (for some fragments, including FO[≤]) using minimization and canonical forms for transducers.

In the second part we study expressive logics for transductions and solve the regular synthesis problem for them. We also establish a strong link between transductions and languages of data words with an ordered data domain.

Characterizations of rational functions

The goal and the setting In this work, our goal was to extend the successful study of logicalgebra equivalences from languages to transductions, to solve definability problems in logical fragments of MSO. For rational languages, the effective characterizations of logical fragments of MSO usually rely on an equivalence with a monoid variety. Then, by the good properties of varieties, computing the minimal automaton is enough to decide if a language is recognized by a monoid in the variety and thus by a formula in the fragment. For sequential transductions, as we have seen, a similar minimal device exists, but not all rational functions are sequential.

In [START_REF] Reutenauer | Minimization of rational word functions[END_REF], the authors give a procedure to compute a canonical machine for any rational function. The machines used in [START_REF] Reutenauer | Minimization of rational word functions[END_REF] are bimachines, which were introduced in [START_REF] Schützenberger | A remark on finite transducers[END_REF], and named and further studied in [START_REF] Eilenberg | Automata, languages, and machines. A, Pure and applied mathematics[END_REF]. Bimachines can be thought of as sequential transducers with look-ahead, where the look-ahead is given as a co-deterministic automaton. In particular, the canonical bimachine of [START_REF] Reutenauer | Minimization of rational word functions[END_REF] has the minimal look-ahead automaton among all bimachines realizing the function. However, this bimachine is not minimal in terms of transition monoid.

The results

Our first main contribution is to show that for any given transduction over finite words, there exists a finite number of minimal bimachines realizing the function (minimal in terms of transition monoid). Thus we obtain an algorithm to decide if a given transduction can be expressed by a transducer with a transition monoid in a given (decidable) variety.

Furthermore we obtain a transfer theorem from logic-algebra equivalences over languages to logic-algebra equivalences over transductions. The main takeaway of this transfer theorem is that given F a logical fragment of MSO equivalent to some monoid variety3 , if F has access to the linear order predicate then the equivalence transfers to transductions.

In particular we are able to decide if a given transduction can be expressed in FO[≤] firstorder logic, FO 2 [≤] first-order logic with two variables, and BΣ 1 [≤] the boolean closure of the existential fragment of FO[≤]. Moreover, in the case of an aperiodic transduction, we are able to show that all its minimal bimachines are aperiodic, which allows us to show that deciding FO[≤]-definability of rational functions is PSpace-complete.

Over infinite words the picture is less complete. First we extend the minimization result of Choffrut to sequential functions over infinite words. The difficulty here is that for rational languages over infinite words, there is no known meaningful way to define a minimal automaton. We circumvent this issue by ignoring the domain of the transduction, and what we obtain is a unique minimal sequential transducer that extends the original one over the topological closure of its domain.

We define a canonical look-ahead automaton and from that we obtain a canonical bimachine for any rational function over infinite words. However this bimachine does not have the same nice property as the one in [START_REF] Reutenauer | Minimization of rational word functions[END_REF] over finite words: its look-ahead automaton has no minimality property. We nonetheless show that any aperiodic transduction has an aperiodic canonical bimachine and thus we obtain a decision procedure of FO[≤]-definability for rational functions over infinite words.

Specification and synthesis for transductions

The goal The goal of this work was to define a "good" specification language for transductions. Our objective was to obtain a high-level formalism to specify properties of transductions, for which classical verification problems could be solved: equivalence, model-checking and synthesis for instance. Our three major requirements were 1) this formalism should be high-level, i.e. close to a human language, in other words a logic. 2) it should be expressive enough, and our yardstick for expressiveness was the class of regular functions, which enjoy many different characterizations including deterministic automata models which seem relevant for model-checking and synthesis.

3) some of the aforementioned problems should be decidable.

A first obvious candidate for this are the NMSO-transducers of Courcelle. This model definitely fulfills requirements 2) and 3), but let us argue why, even though it is based on MSO it does not fit the bill for 1), in our view. In an NMSO-transducer you have to specify exactly how the input produces the output, you do not have the possibility to underspecify. For instance for the specification "The input contains at least once the letter a and the output at most twice the letter b", there are no NMSO-transducer realizing all pairs of input/output words that satisfy this specification. Indeed, in an NMSO-transducer each input word can only produce a finite number of output words. In some sense an NMSO-transducer is closer to a machine model where the moves are defined by MSO-formulas.

The approach Our approach is based on a remark made in [Boj14], that the semantics of almost any reasonable transducer model can be extended to a richer origin semantics. Instead of relating pairs of words (or other structures) (u, v) where u is the input structure and v the output structure, the origin semantics considers pairs of the form (u, (v, o)) where u is the input structure, v is the output structure and o : dom(v) → dom(u) is the origin function which intuitively maps an output position to the input position that was being processed when the output position was produced.

We consider origin-graphs: two-sorted relational structures with an input structure, an output structure and an additional origin function from output positions to input positions. We mainly focus on word-to-word origin-graphs: origin-graphs where the two substructures are words. We give in Fig. 6 We consider MSO over origin-graphs and we show that the logic is undecidable (even for weak fragments). Note however that in [START_REF] Miko Laj Bojańczyk | Which classes of origin graphs are generated by transducers[END_REF] the authors show that the model-checking of regular functions against MSO-formulas is decidable. One way to obtain the result is to see that the origin-graphs produced by a two-way deterministic transducer have bounded path-width, and thus, using Courcelle's theorem [START_REF] Courcelle | The monadic second-order logic of graphs. i. recognizable sets of finite graphs[END_REF] we obtain the decidability.

The logic Since the full MSO logic is undecidable, our approach was to find a fragment of MSO weak enough to be decidable, but still expressive enough to capture at least the regular functions. We managed to find a suitable logic, after some trial and error, called Lo. Since we wanted the full power of MSO over the input, in order to capture the regular function, we defined an "asymmetric" logic in the sense that it is restricted in the way it can talk about output positions. The logic we came up with is first-order logic with two-variables, with the linear order predicate over the input and the output, and with an origin function symbol. To this we added arbitrary MSO-definable predicates that can only quantify over input positions. We denote the logic by

Lo := FO 2 [≤ out , o, MSO[≤ in ]],
where ≤ in and ≤ out are the linear orders over the input and output, respectively and o is the origin function symbol. Let even(x, y) be the binary MSO[≤ in ]-predicate stating that the distance between positions x and y is even. Let us consider the following Lo formula.

∀x, y out(x) ∧ out(y) ∧ a(x) ∧ b(y) → even(o(x), o(y))
The brackets , are just here to separate the MSO[≤ in ]-predicates, for readability. The predicate out(x) is added as syntactic sugar and can be expressed for instance by x ≤ out x. The formula states that two output positions labeled by a and b respectively must have origins at even distance.

The results Our techniques are inspired by [START_REF] Schwentick | Two-variable logic with two order relations[END_REF], where the authors obtain decidability for first-order logic with two variables over words with linearly ordered data, with the linear order over positions and the order over data. Before explaining the link between origin-graphs and data words, let us talk about our results.

We first show that the satisfiablility of Lo over origin-graphs is decidable. Actually our result is stronger than that since we show a way to compute, for any Lo-transduction, an automaton recognizing its domain. Since the logic is syntactically closed under boolean operations, we obtain that the equivalence of formulas is also decidable. By refining our techniques, we are even able to obtain the main result of this part: a regular synthesis algorithm, i.e. an algorithm that takes as input an Lo formula and produces a regular function uniformizing it.

We also give two extensions of the logic for which our uniformization algorithm still works. The first one is ∃Lo which extends Lo by adding a block of existential monadic quantifiers. The second one is Lo so which add new unary predicates that can talk about the output produced by a single input position. While Lo is incomparable in expressiveness with both NMSO-transductions and one-way transductions, ∃Lo and Lo so subsume these two classes, respectively. We give the relations between known classes of transductions in Fig. 4.2 on page 99 and Fig. 4.10 on page 119.

Finally we discovered a very tight connection between transductions and languages over data words. This link helped us during our search of a suitable decidable logic for transductions: undecidability results of logics for words with ordered data can be translated into undecidability results in the context of logics over origin-graphs. Conversely, from the decidability of Lo, we obtain the decidability of Ld := FO 2 [≤, MSO[ ]] over data words where ≤ is the linear order over positions, is the order over data and MSO[ ] denotes any MSO-definable predicate that can only quantify over data and sets of data. For instance one could express that the number of data values between the data of two positions is even.

Part I Computational, Logical and Algebraic Characterizations of Rational Word Functions

Chapter 1

Rational languages and rational functions "In the beginning there was nothing, which exploded."

-Terry Pratchett, Lords and ladies

Rational languages enjoy many different characterizations including finite automata, rational expressions, monadic second-order logic and recognizability by congruences of finite index. In this chapter we present important results concerning some of these characterizations and the links between them, however we assume some knowledge of these notions and refer the reader to the textbooks [Str94, Sak09, Pin18] for a good overview of the subject. More precisely, we mention the tight connections existing between logical fragments of monadic second-order logic and varieties of congruences which are, basically, sets of congruences with good closure properties. These links, together with the existence of a syntactic congruence characterizing the algebraic properties of a language, have yielded many definability results. A paramount example is the Schützenberger/McNaughton-Papert theorem which gives a procedure to decide if a given language is definable in first-order logic.

Rational functions also enjoy different characterizations such as finite transducers, logical transducers à la Courcelle and rational expressions. In the case of functions however, much less is known of the links between logics and algebra. Our main goal, throughout Chap. 2 and 3 will be trying to establish such links.

Words and languages 1.Words

An alphabet is a finite set of symbols called letters. Let N denote the set of natural numbers and N * denote the set of positive integers. Let n ∈ N * and let n denote the set {1, . . . , n} of positive integers less than or equal to n. A finite word w of length n over an alphabet A is a sequence of n letters of A. Formally, it is a function w : n → A. The length of w is denoted by |w| and the set of words of length n is denoted by A n . Furthermore we represent the word w by the sequence of its letters w = w(1) • • • w(n), and w(i) is called the ith position of w. As a convention, the empty word is the unique word of length 0 and is written . An ω-word (or infinite word) is an Chapter 1. Rational languages and rational functions infinite sequence of letters, i.e. a function x : N * → A, and as for finite words we often write x = x(1)x(2) • • • and we set |x| := ∞. Given an infinite word x, we denote by Inf(x) the set of letters which appear infinitely often in x.

Concatenation

The concatenation of a finite word u and a finite (or infinite word) w, is the word u•w (or simply uw) of length |u|+|w| (with the convention that ∀x ∈ N {∞} x+∞ = ∞) defined by uw(i)

:= u(i) if 1 ≤ i ≤ |u|, uw(i) := w(i -|u|) if |u| < i ≤ |u| + |w|.
Note that the concatenation of two words u, v when u is infinite is undefined. The set of all finite words A * = n∈N A n together with the concatenation of words is a monoid whose identity element is the empty word . The set of non-empty words1 is denoted by A + , the set of infinite words is denoted by A ω and the set of all words, finite or not, is denoted by A ∞ . Given a finite word u ∈ A * , we define the ω-power of u by u ω = uuu • • • , with the convention that ω := . Given a sequence of finite words u 1 , . . . , u n (u n may even be infinite), we denote the concatenation (in the obvious order) of these words by i∈n u i . Similarly, given an infinite sequence of finite words u 1 , u 2 , . . . we write 1≤i u i to denote the infinite concatenation of these words.

Rational words

We say that a word w is rational if there exist finite words u, v ∈ A * such that w = uv ω . In particular any finite word u is rational since u = u ω . Note that a given infinite word may have different decompositions, such as (ba) ω = b(abab) ω . We say that a word uv ω is in normal form -with respect to some alphabetic order -if either v = , which means that the word is finite, or v is minimal in the lexicographic order, among possible decompositions of the word, and v is not a suffix of u. For instance, the normal form of (ba) ω is b(ab) ω .

Factors of a word Given two words

u ∈ A ∞ , v ∈ A ∞ , u is a strict prefix of v if
there exists a non-empty word w ∈ A ∞ such that uw = v which we denote by u < v, and we let u -1 v denote this word w. Given two words u, v ∈ A ∞ , we say that u is a prefix of v, denoted by u ≤ v, if either u = v or u < v, and in the first case we set u -1 v := . We extend this notation: for K, L ⊆ A ∞ we set K -1 L := w | ∃(u, v) ∈ K × L, w = u -1 v . Given a non-empty word w ∈ A ∞ , and integers 1 ≤ i ≤ j ≤ |w| the prefix of w of length i is denoted by w(:i), the suffix of w from position i is the word w(i:) := i≤k≤|w| w(k) and the infix (or factor ) of w from position i to position j is the word w(i:j) := w(i) • • • w(j). As a convention, for any word w ∈ A ∞ , w(:0) := and w(|w| + 1:) := . Two infinite words are called ultimately equal if they have a common infinite suffix.

Languages

A language (resp. ω-language, ∞-language) is a set of finite words (resp. infinite words, words) and for L ⊆ A ∞ a non-empty language, L denotes the longest common prefix (i.e. the infimum with respect to ≤) of L. We denote by u ∧ v the longest common prefix of {u, v}, and the delay between u and v is the pair del(u, v) = (u ∧ v) -1 u, (u ∧ v) -1 v . For instance aba ∧ abb = ab and del(aba, abb) = (a, b). We define the prefix language of a language L ⊆ A ∞ , by ↓L := {u | ∃v ∈ L, u ≤ v}.

Metrics We define two different metrics over words, the delay distance which varies as the size of the delay, and the prefix distance which varies as the inverse of the size of the longest common prefix. We will mostly use the delay distance in Chap. 2 and the prefix distance in Chap. 3. The delay distance between two words u, v ∈ A ∞ is defined by u, v del := |del(u, v)| (where |(x, y)| = |x| + |y|). The prefix distance between two words u, v ∈ A ∞ is defined by u, v ∧ := 0 if u = v, and u, v ∧ := 2 -|u∧v| otherwise. The topological closure of a language L ⊆ A ω with respect to the prefix distance can be alternatively defined as: L := {u | ∀v < u, ∃x vx ∈ L}.

Finite automata

Finite automata 1.2.1 Automata

Pre-automata A pre-automaton, over an alphabet A is a tuple A = (Q, ∆, I) where Q is the finite set of states, ∆ ⊆ Q × A × Q is the transition relation and I ⊆ Q is the set of initial states. A run of A over a word w ∈ A ∞ is itself a word r ∈ Q ∞ such that |r| = |w| + 1 and for all 1 ≤ i < |r| we have (r(i), w(i), r(i + 1)) ∈ ∆. A run r is initial if r(1) ∈ I. We use the notation p u -→ A q (or just p u -→ q) to denote that there is a finite run r of A over u such that r(1) = p and r(|r|) = q. We write p x -→ A P to denote that there is an infinite run r of A over x such that r(1) = p and Inf(r) = P .

Word automata

We define three different models of automata: one over finite words, just called automata, and two over infinite words, namely Büchi automata and Muller automata. We use the generic term of word automata to refer to all three types at once, and ω-automata to refer to Büchi or Muller automata. An automaton (of finite words) over an alphabet A is a tuple A = (Q, ∆, I, F ) such that (Q, ∆, I) is a pre-automaton, and F ⊆ Q. A run r of an automaton is final if it is finite and r(|r|) ∈ F . A Büchi automaton is a tuple A = (Q, ∆, I, F ) such that (Q, ∆, I) is a pre-automaton, and F ⊆ Q. A run r of a Büchi automaton is final if it is infinite and Inf(r) ∩ F = ∅. A Muller automaton is a tuple A = (Q, ∆, I, F ) such that (Q, ∆, I) is a pre-automaton, and F ⊆ 2 Q (the powerset of Q). A run r of a Muller automaton is final if it is infinite and Inf(r) ∈ F . We will sometimes need a notion of word automata without initial states, which we will call final automata. A run of a word automaton is accepting if it is both initial and final and we denote by A the language recognized by A, i.e. the set of words over which A has an accepting run. A language (resp. ω-language) is rational if it is recognized by some automaton (resp. ω-automaton).

Example 1.2.1. The automaton A of Fig. 1.1 recognizes the language L of words which start with the letter a and end with b, i.e. L = aA * b, and we have L = a. The initial state 0 is denoted by an ingoing arrow and the final state 2 by an outgoing arrow. A is trim and deterministic but is not co-deterministic since, for instance, the word b has two distinct final runs.

The same automaton seen as a Büchi automaton, recognizes the language K = a(a * b) ω of words which start with an a and have an infinite number of bs.

Chapter 1. Rational languages and rational functions

Subclasses of automata

A state q of a word automaton is accessible (resp. co-accessible) if there exists an initial (resp. final) run ending (resp. starting) in q. By extension, a word automaton is called accessible (resp. coaccessible) if all of its states are. A trim automaton is an automaton which is both accessible and co-accessible. An automaton is deterministic2 (resp. co-deterministic) if it has at most one initial (resp. final) run per word. An automaton is unambiguous if it has at most one accepting run per word. An automaton over finite words (resp. infinite words) is complete if it has an initial run over any finite word (resp. infinite word). Symmetrically we define co-completeness by considering final runs instead. An automaton over finite words is called left automaton (resp. right automaton) if it is accessible (resp. co-accessible) and deterministic (resp. co-deterministic).

Determinization The famous powerset construction, due to [START_REF] Michael | Finite automata and their decision problems[END_REF], takes as input an automaton (over finite words) and produces a deterministic automaton recognizing the same language, at the cost of an exponential blow-up.

Theorem 1.2.2. From an automaton recognizing a language L of finite words, one can obtain a deterministic automaton recognizing L.

Büchi automata cannot be determinized in general since some rational languages can only be recognized but non-deterministic Büchi automata. However, one can transform any ω-automaton into a deterministic Muller automaton [START_REF] Mcnaughton | Testing and generating infinite sequences by a finite automaton[END_REF].

Theorem 1.2.3. From an ω-automaton recognizing a language L, one can obtain a deterministic Muller automaton recognizing L.

Although deterministic Büchi automata do not capture the whole class of rational languages over infinite words, it was shown in [START_REF] Carton | Unambiguous Büchi automata[END_REF] that any rational ω-language can be recognized by a co-deterministic co-complete Büchi automaton, sometimes called prophetic or backward deterministic automata.

Theorem 1.2.4. From an ω-automaton recognizing a language L, one can obtain a co-complete co-deterministic Büchi automaton recognizing L.

Algebraic characterization of rational languages

In this section we present the algebraic aspect of rational languages. The syntactic congruence associated with a language characterizes it and, as its name suggests, it is not dependent on a particular description of the language. This yields an object which allows one to decide intrinsic properties of language, such as definability in a given logic (see Sec. 1.4).

Congruences

Let ∼ be an equivalence relation over a set S. Given s ∈ S, we denote by [s] ∼ (or just [s] when it is clear from context) the equivalence class of s, i.e. the set {t | t ∼ s}. The index of a relation is the number of its equivalence classes. Given two equivalence relations ∼ 1 and ∼ 2 over S, we say that ∼ 1 is finer than ∼ 2 (or that ∼ 2 is coarser than ∼ 1 ), if any equivalence class of ∼ 2 is a union of equivalence classes of ∼ 1 . In other words ∼ 1 is included in ∼ 2 , seen as subsets of 1.3. Algebraic characterization of rational languages S × S, which we denote by ∼ 1 ∼ 2 . An equivalence relation ∼ over A * is a right congruence if for any words u, v ∈ A * and any letter a ∈ A, u ∼ v ⇒ ua ∼ va. An equivalence relation ≈ over A * (resp. A ω ) is a left congruence if for any words u, v ∈ A * (resp. A ω ) and any letter a ∈ A, u ≈ v ⇒ au ≈ av. A congruence over A * is an equivalence relation which is both a left and a right congruence. The intersection of two right (resp. left) congruences ∼ 1 , ∼ 2 is also a right (resp. left) congruence which we denote by ∼ 1 ∼ 2 . Let ≡ be a congruence over A * , the quotient A * / ≡ = {[u] | u ∈ A * } is naturally endowed with a monoid structure with a product defined by [u] • [v] = [uv] and identity element [ ]. A congruence ≡ of finite index over A * can be seen as a surjective monoid morphism3 from A * to the finite monoid A * / ≡ . Hence a finite index congruence can be finitely described by a finite monoid M and a function A → M . In the following we assume that finite index congruences are given that way.

Recognizability We say that a language over finite words L ⊆ A * is recognized by a right (resp. left) congruence ∼ if L = u∈L [u], i.e. it is a union of equivalence classes of ∼.

The algebraic notion of recognizability for ω-languages is more intricate than in the finite case. There were several attempts, such as weak recognizability which lacked good properties (e.g. the existence of a minimal syntactic object), and strong recognizability, before reaching the more rewarding notions of ω-semigroups and Wilke algebras. In this manuscript we will only talk about strong recognizability (called simply recognizability), but we refer the interested reader to [START_REF] Olivier Carton | Automata and semigroups recognizing infinite words, Logic and Automata: History and Perspectives[END_REF] for more details concerning all these different notions. A language of infinite words L ⊆ A ω is recognized by a congruence ≡ if we have:

L = uv ω ∈L [u] [v] ω . Notice that if we have [u] [v] ω ∩L = ∅ then we must have [u] [v] ω ⊆ L which is exactly the characterization of saturation given in [Arn85, Lemma 1.1].
Syntactic congruences Let L be a language of finite words over A, we define the syntactic right congruence ∼ L , the syntactic left congruence ≈ L and the syntactic congruence ≡ L of L:

• u ∼ L v if ∀x ∈ A * , ux ∈ L ⇔ vx ∈ L • u ≈ L v if ∀x ∈ A * , xu ∈ L ⇔ xv ∈ L • u ≡ L v if ∀x, y ∈ A * , xuy ∈ L ⇔ xvy ∈ L
One can easily show that each of these relations recognizes L and that they are the coarsest to do so among right congruences, left congruences and congruences, respectively.

Given a right congruence ∼, one can obtain the associated (complete deterministic accessible) pre-automaton defined by

A ∼ := (A * / ∼ , {([u] , a, [ua]) | a ∈ A, u ∈ A * } , {[ ]}).
Given a language L recognized by ∼, then the automaton (A ∼ , {[u] | u ∈ L}) recognizes L. Symmetrically, given a left congruence ≈, one can obtain the associated (co-complete co-deterministic co-accessible) final automaton defined by

A ≈ := (A * / ≈ , {([au] , a, [u]) | a ∈ A, u ∈ A * } , {[ ]}) (note that here {[ ]} is the set of final states).
The well-known Myhill-Nerode theorem [START_REF] Nerode | Linear automaton transformations[END_REF] states that a language L is rational if and only if its syntactic right congruence has finite index. Furthermore ∼ L gives a description of the minimal automaton of a language L by A

L = (A ∼ L , {[u] | u ∈ L}).
Theorem 1.3.1. Given a language of finite words L ⊆ A * , ∼ L has finite index if and only if L is rational. Furthermore, the automaton A L has the least possible number of states among complete deterministic automata recognizing L.

Chapter 1. Rational languages and rational functions

Of course the same result holds if we consider the syntactic left congruence and co-complete co-deterministic automata instead.

Remark 1.3.2. Given a left automaton L with state space Q, there is a bijection (up to adding a sink state) between Q and the equivalence classes of ∼ L . For this reason we will often identify states of L with the equivalence classes of ∼ L . Symmetrically we will identify the states of a right automaton R with the equivalence classes of ≈ R . Abusing notations we will often write L 1 L 2 to denote that ∼ L1 ∼ L2 . Symmetrically, we will write R 1 R 2 instead of ≈ R1 ≈ R2 .

The minimal automaton of a language is actually minimal in a stronger sense than just having the least number of states among the deterministic complete automata recognizing it. Given a complete deterministic automaton recognizing a language, it (seen as a right congruence) refines the minimal automaton. Using this, a deterministic automaton can be minimized, in PTime, to obtain the minimal automaton (up to isomorphism) of the language [START_REF] Moore | Gedanken-experiments on sequential machines[END_REF][START_REF] Hopcroft | An n log n algorithm for minimizing states in a finite automaton[END_REF].

Theorem 1.3.3. Given a deterministic automaton recognizing a language of finite words L, one can obtain the minimal automaton (up to isomorphism) of L in PTime.

The correspondence between automata and congruences over infinite words is less simple than in the case of finite words. Let L ⊆ A ω be an ω-language, we define ≈ L the syntactic left congruence of L, just like in the case of finite words, by x ≈ L y if ∀u ∈ A * , ux ∈ L ⇔ uy ∈ L. The definition of syntactic congruence of an ω-language is due to [START_REF] Arnold | A syntactic congruence for rational omega-language[END_REF] and is a bit more involved, but intuitive in the sense that for two words to be equivalent, they must behave the same whatever the context, and also when raised to the ω power.

u ≡ L v if ∀x, y, z x(uy) ω ∈ L ⇔ x(vy) ω ∈ L and xuyz ω ∈ L ⇔ xvyz ω ∈ L
Again one can easily see that ≡ L is the coarsest congruence recognizing L.

Transition congruences Let A be a word automaton with state space Q, we define the right transition congruence ∼ A , the left transition congruence ≈ A and the transition congruence ≡ A of A:

• u ∼ A v if ∀q ∈ Q there exists an initial run over u ending in q ⇔ there is an initial run over v ending in q

• u ≈ A v if ∀q ∈ Q there exists a final run over u beginning in q ⇔ there is a final run over v beginning in q

• u ≡ A v if ∀p, q ∈ Q there exists a run over u from p to q ⇔ there is one over v

The following proposition states that the transition congruences of an automaton recognize the language of the automaton.

Proposition 1.3.4. Let L be a language of finite words recognized by A, then ∼ A , ≈ A , ≡ A all recognize L and are thus finer than their respective syntactic relations ∼ L , ≈ L and ≡ L . Seen as a Büchi automaton A recognizes K = a(a * b) ω . The syntactic congruence of K is given by A * / ≡ K := { , a + , bA * , aA * bA * }. Notice that ≡ K = ≡ A and furthermore, ≡ A does not even recognize4 K. For instance the word a • (aba

Algebraic characterization of rational languages

Languages Logic Variety Equation Rational MSO[≤] All - Star-free FO[≤] A x π = x π+1 Unambiguous polynomials FO 2 [≤] DA (xy) π x(xy) π = (xy) π Piecewise testable BΣ 1 [≤] J y(xy) π = (xy) π = (xy) π x Idempotent I x = x 2
) ω ∈ K, however [aba] A = aA * a = [aa] A but [a] A ([aa] A ) ω ⊆ K.

Classes of congruences

A class of congruences (class for short) C associates with any finite alphabet A a set of congruences of finite index C(A) which is 1) closed under intersection of congruences 2) closed under taking coarser congruences5 . Note that we will often abuse notations and write C instead of C(A). A class C is decidable if given a finite index congruence one can decide if it belongs to C. In that case given a language, one can decide if it is a C-language

Let A be an alphabet and let ≡ be a congruence of finite index over A * . We define π the idempotent power of ≡ as the smallest positive integer such that for any word u ∈ A * , u π ≡ u 2π . The study of varieties of finite monoids (which can be seen as a particular case of classes of congruences, with more closure properties, and are sometimes called pseudovarieties), see e.g. [START_REF] Straubing | Finite automata, formal logic, and circuit complexity[END_REF], has been very successful in the algebraic characterization of rational languages and has yielded many links between logics and algebra. These varieties enjoy an equational characterization through Eilenberg variety theory [START_REF]Automata, languages, and machines[END_REF]. The point of such equations is that varieties for which the explicit equations are known are decidable since one only has to check a finite number of equalities. For instance the variety of idempotent congruences is characterized by the equation x = x 2 meaning that a congruence ≡ is idempotent if it satisfies u ≡ u 2 for any word u. We give in the table of Fig. 1.2 some well-known congruence classes with their corresponding equations, and logics and we refer the reader to [START_REF] Volker Diekert | A survey on small fragments of first-order logic over finite words[END_REF] for a more precise description of these classes of languages. Actually the symbol π in the equations represents something more subtle than the idempotent power of a finite monoid in the theory of profinite topology, but this first approximation is good enough for our purposes and we refer the reader to [Pin18] for details. This table is not supposed to be exhaustive and just presents the main classes we will encounter in the next chapter. The definitions of the logics as well as the references for the results are given in Sec. 1.4. A class of particular interest to us is the class A of aperiodic congruences.

A language is called a C-language (sometimes we abuse definitions and say that the language is in C) if it is recognized by a C-congruence. If C is a decidable class, since the syntactic congruence of a rational language L is computable and is coarser than all congruences recognizing L, and since classes are closed under taking coarser congruences, then one can decide if a language is in C.

Chapter 1. Rational languages and rational functions Theorem 1.3.6. Let C be a decidable class of congruences. Given a word automaton, one can decide if the language it recognizes is a C-language.

An automaton whose transition congruence is a C-congruence is called a C-automaton. Note that according to Prop. 1.3.4 and since classes of congruences are closed under coarser congruences, a language of finite words is a C-language if and only if it is recognized by a C-automaton. Concerning languages of infinite words, as we have seen in Ex. 1.3.5 the transition congruence of an automaton is not necessarily finer than the syntactic congruence of the language recognized by the automaton.

Example 1.3.7. Let us consider ≡, the syntactic congruence of L = aA * b given in Ex. 1.3.5, and let us determine to which of the congruence varieties given above it belongs. First it is idempotent, we have indeed, a ≡ aa, b ≡ bb, ab ≡ abab, ba ≡ baba and of course ≡ • = . From this we have for any word u, that u π = u, hence we can show that ≡ is in DA and A (indeed we have I ⊆ DA ⊆ A). However ≡ is not in J, since b(ab) π = bab ≡ (ab) π = ab.

If we now consider the syntactic congruence of K = a(a * b) ω given in Ex. 1.3.5, we can show that it is also in I, DA and thus A but again not in J.

Aperiodicity

Aperiodic and counter-free automata In the particular case of A we do have that considering the transition congruence of an ω-automaton is enough to decide if a language is aperiodic:

Theorem 1.3.8 ([DG08]
). A language of infinite words is aperiodic if and only it is recognized by an aperiodic Büchi automaton.

A different characterization of aperiodic languages relies on the notion of counter-free automata. A word automaton A is counter-free if for any state p, any finite word u, and any positive integer n we have p

u n --→ p ⇒ p u -→ p.
There is a close relationship between aperiodic automata and counter-free automata. First, one can easily show that a counter-free automaton is necessarily aperiodic. The converse does not hold in general, unless the automaton is not too ambiguous. An automaton is polynomially ambiguous if the number of runs of the automaton over a finite word is bounded by a polynomial in the size of the word.

Proposition 1.3.9. If an automaton is aperiodic and polynomially ambiguous then it is counterfree.

Proof. Let A be an aperiodic and polynomially ambiguous automaton with state space Q. Let p be a state of A, and let n be a positive integer larger than π, the idempotent power of ≡ A . Let us assume that p ---→ p over u n(n+1) and assume that they are different then we have a contradiction with the polynomial ambiguity of A. Indeed, the word u (n(n+1))k has at least 2 k different runs from p to p. This means that the two previous runs are identical and we have in particular that p u n --→ p u -→ p, which concludes the proof.

Co-example 1.3.10. The automaton of Fig. 1.3 on the facing page has counters yet it is aperiodic. However, it is exponentially ambiguous.

The following theorem characterizing languages recognized by counter-free automata is due to [START_REF] Mcnaughton | Counter-free automata[END_REF] for finite words and to [START_REF] Diekert | First-order definable languages, Logic and Automata: History and Perspectives[END_REF] for infinite words: Theorem 1.3.11. A language of finite (resp. infinite) words is aperiodic if and only if it is recognized by a counter-free automaton (resp. Büchi automaton).

Aperiodic deterministic Muller automata also characterize aperiodic languages. In fact in [Tho81] the author shows that counter-free deterministic Rabin automata exactly characterize aperiodic languages. A proof of this result can also be found in [START_REF] Vrunda Dave | Fo-definable transformations of infinite strings[END_REF].

Theorem 1.3.12. A language over infinite words is aperiodic if and only if it is recognized by an aperiodic Muller automaton.

Similarly, we can show that the construction from [START_REF] Carton | Unambiguous Büchi automata[END_REF] preserves aperiodicity.

Theorem 1.3.13. Given an aperiodic congruence recognizing a language over infinite words L, one can obtain an aperiodic right Büchi automaton recognizing L in ExpTime.

Proof. Let us consider ≡ an aperiodic congruence over A * , and let S := {[u] | u ∈ A + } be the associated aperiodic semigroup. The construction from [CM03, Section 6.3.3] takes as input a semigroup and outputs a Büchi automaton. Our goal is to argue why this construction gives an aperiodic automaton, given an aperiodic semigroup. We use the same notations as in [CM03, Section 6.3], we only give the main arguments and we refer the reader to the original paper for more details on the construction. The states of the constructed automaton are of the form ([s, e] , (s 1 , . . . , s n )) where [s, e] denotes a conjugacy class of linked pairs and (s 1 , . . . , s n ) is a chain of R-classes. Since S is aperiodic, the left action on conjugacy classes is obviously aperiodic. More precisely, if we have [u n ] = u n+1 , then in particular [[u n ] s, e] = u n+1 s, e . Similarly, one can see that there is an integer n large enough such that for any word u, ρ(u n+1 ) = ρ(u n ), and thus ϕ(u n+1 w) = ϕ(u n w).

Finally, the construction gives a Büchi automaton with a set of final transitions instead of final states. However one can easily go from a transition Büchi automaton to a Büchi automaton, while preserving aperiodicity, just by remembering in the states if the last transition seen is final or not.

It was shown in [START_REF] Cho | Finite-automaton aperiodicity is PSpace-complete[END_REF] that deciding aperiodicity of language given as a deterministic automaton is PSpace-hard. Since it is known that one can decide aperiodicity of a language in PSpace, then the problem is PSpace-complete, whether the input is a deterministic or nondeterministic automaton (see [START_REF] Diekert | First-order definable languages, Logic and Automata: History and Perspectives[END_REF]).

Theorem 1.3.14. The problem of deciding if a word automaton recognizes an aperiodic language is PSpace-complete.

Chapter 1. Rational languages and rational functions

Logics over words

In this section we present Monadic Second-Order (MSO) logic over words, a high-level formalism which is closer to natural language than say automata or congruences, and thus makes for a good specification language.

Monadic second-order logic

We give generic, although succinct, definitions of signatures, MSO-formulas, logical structures, etc and refer the reader to [START_REF] Ebbinghaus | Finite model theory[END_REF] for more details.

Signatures and logical structures A signature is a triple S = (P, F, ar) with P being the set of predicate symbols, F the set of function symbols and ar : P F → N the arity function.

A nullary function symbol is called a constant symbol. A structure M over S is given as a set dom(M ) called the domain of M , an interpretation for each predicate symbol p given by p M ⊆ dom(M ) ar(p) and for each function symbol f given by a total function f M : dom(M ) ar(f ) → dom(M ).

Monadic second-order formulas Monadic Second-Order formulas over a signature S, denoted by MSO[S], is the set of formulas given by the following grammar:

φ ::= ∃X φ | ∃x φ | (φ ∧ φ) | ¬φ | X(t) | p(t 1 , . . . , t n ) |
where X ranges over a countable set of second-order variables (often denoted by X, Y, Z . . .), x ranges over a countable set of first-order variables (often denoted by x, y, z . . .), p is a predicate of S of arity n, t 1 , . . . , t n are terms build from function symbols and first-order variables and is the true formula. We define universal quantifications and other boolean connectives as usual, ∀X φ := ¬∃X ¬φ, ∀x φ := ¬∃x ¬φ, (φ 1 ∨φ 2 ) := ¬(¬φ 1 ∧¬φ 2 ), (φ 1 → φ 2 ) := (¬φ 1 ∨φ 2 ), ⊥ := ¬ . Instead of ∃x 1 . . . ∃x n , we write ∃x 1 , . . . , x n , and we do the same for universal quantification and second-order quantification.

Models A free variable is defined as usual as not being in the scope of a quantifier, and given a formula φ, we will often write φ(x 1 , . . . , x m , X 1 , . . . , X n ) to denote that all free firstorder variables of φ belong to {x 1 , . . . , x m } and free second-order variables to {X 1 , . . . , X m }. A sentence is a formula without free variables. Let S be a signature, M be a structure over S, let φ(x 1 , . . . , x m , X 1 , . . . , X n ) be an MSO[S]-formula and let s 1 , . . . , s m ∈ dom(M ) and S 1 , . . . , S n ⊆ dom(M ). In the following we write x := x 1 , . . . , x m and X := X 1 , . . . , X n and similarly for s and S. We define a new signature S x,X where each variable of x is a new constant symbols and each variable of X is a new unary predicate symbol. We can thus define a structure over S x,X , denoted by M, s, S with the interpretation x M i := s i and X M i := S i for each free occurrence of the variables x i of x and X i of X. We define by induction on formulas what it means for M, s, S to satisfy φ (or to be a model of φ), which we denote by M, s, S |= φ. If φ is equal to the true formula then any structure is a model of φ, and M, s, S |= φ. If φ = p(t 1 , . . . , t k ) with first-order variables of the terms of t all belonging to variables of x, then the interpretations of the variables and the function symbols extend to the terms of t, and we set that M, s, S |= φ if and only if t

M,s ∈ p M . If φ = X i (t),

MSO for words

We now focus on MSO restricted to structures which are words.

Words as logical structures A word w over an alphabet A is seen as a logical structure w over the signature S A with unary predicates a for each a ∈ A, a binary predicate ≤, and no functions. The domain of w is the set of its positions, the unary predicate a is interpreted as the set of positions labeled by a and the binary predicate ≤ is interpreted as the linear order over positions of w. For the sake of simplicity we will often write w instead of w. We rather write MSO[≤] to denote formulas over S A , the alphabet often being implicit.

Formulas over finite and infinite words Let φ be an MSO[≤]-sentence, we define the finite words semantics of φ by φ * := {u ∈ A * | u |= φ}. Similarly, the infinite words semantics of φ is defined by

φ ω := {x ∈ A ω | x |= φ}.
Note that we will often write φ , relying on the context, and we say that φ defines, or recognizes the language φ . We have the seminal theorem(s) characterizing MSO[≤]-definable languages, due to [START_REF] Richard | Weak second-order arithmetic and finite automata[END_REF][START_REF] Elgot | Decision problems of finite automata design and related arithmetics[END_REF][START_REF] Trakhtenbrot | Finite automata and the logic of monadic predicates[END_REF] for the finite case and [START_REF]On a decision method in restricted second order arithmetic[END_REF][START_REF] Mcnaughton | Testing and generating infinite sequences by a finite automaton[END_REF] for the infinite case:

Theorem 1.4.1. A language (resp. ω-language) L is rational if and only if it is defined by some

MSO[≤]-formula. Fragments of MSO A fragment F of MSO[S] is a subset of MSO[S]-formulas.
Given a fragment F and a language L, of finite or infinite words, we say that L is F-definable (or is an F-language) if there exists an F-formula defining it. We say that F characterizes (or is equivalent to) a congruence class C, if any language is an F-language if and only if it is a C-language.

The fragment of first-order logic FO[S] is the set of formulas which do not use second-order variables. A famous theorem linking algebra and logics is due, in the finite case, to [START_REF]On finite monoids having only trivial subgroups[END_REF] for the algebraic part and to [START_REF] Mcnaughton | Counter-free automata[END_REF] on the logic side. The result was extended to infinite words by [START_REF] Perrin | Recent results on automata and infinite words[END_REF] on the algebraic side and by [START_REF] Ladner | Application of model theoretic games to discrete linear orders and finite automata[END_REF] and [START_REF] Thomas | Star-free regular sets of omega-sequences[END_REF] on the logic side. As a corollary, FO[≤]-definability of rational languages is decidable.

Theorem 1.4.2. A language (resp. ω-language) L is aperiodic if and only if it is FO[≤]-definable. Furthermore, one can decide in PSpace if a language given as a word automaton is FO[≤]definable.

First-order logic with two variables, FO 2 [S], is the set of first-order formulas which only use (and possibly reuse) two first-order variables. The following theorem is due to [START_REF]Sur le produit de concatenation non ambigu[END_REF], [START_REF] Pin | Polynomial closure and unambiguous product, Automata[END_REF] and [START_REF] Thérien | Over words, two variables are as powerful as one quantifier alternation[END_REF] in the case of finite words. It was extended to infinite words by [START_REF] Diekert | Fragments of first-order logic over infinite words[END_REF].

Theorem 1.4.3. A language (resp. ω-language) L is in DA if and only if it is FO 2 [≤]-definable.
As a consequence, one can decide if a language given as a word automaton is

FO 2 [≤]-definable.
The existential fragment of first-order logic, denoted by Σ 1 [S], is the set of formulas of the form ∃x 1 , . . . , x n φ, for some positive integer n and φ a quantifier-free formula. The boolean closure of a fragment F is denoted BF. The following theorem is mainly due to a result of [START_REF] Simon | Piecewise testable events[END_REF] (see [START_REF] Volker Diekert | A survey on small fragments of first-order logic over finite words[END_REF]).

1.4.4. A language L is in J if and only if it is BΣ 1 [≤]-definable.
As a consequence, one can decide if a language given as an automaton is BΣ 1 [≤]-definable.

Remark 1.4.5. The equivalence between BΣ 1 [≤] and J does not transfer to infinite words. An ω-language which is BΣ 1 [≤]-definable is in particular in J, however the converse is not true. There is an equational characterization of BΣ 1 [≤]-languages of infinite words but it relies on the notion of ω-semigroup which we choose not to introduce in this work. We refer the interested reader to [START_REF] Perrin | Infinite Words, Automata, Semigroups, Logic and Games[END_REF].

Example 1.4.6. We define the minimum and maximum predicate by min(x) := ∀y x ≤ y and max(x) := ∀y y ≤ x which are definable in FO 2 [≤] (and thus in

FO[≤]). The language L = aA * b is thus definable by the FO 2 [≤]-formula: ∀x (min(x) → a(x)) ∧ (max(x) → b(x)). The language K = a(a * b) ω is definable by the FO 2 [≤]-formula: ∀x (min(x) → a(x)) ∧ (∃y x < y ∧ b(y)
). Since we have seen in Ex. 1.3.7 that the syntactic congruence of L is not in J, we know from Th. 1.4.4 that L cannot be defined by a BΣ 1 [≤]-formula.

Onward to transductions

Rational transductions have also been characterized by different models: functional transducers, (order-preserving) logical transducers and rational expressions, for instance. What is lacking is a good understanding of the links between these characterizations, and in particular a syntactic object which fully characterizes transducers. Such a syntactic object has been defined in the particular case of sequential transducers (see [START_REF]Minimizing subsequential transducers: a survey[END_REF]), and a first attempt for the general case of rational functions is given in [START_REF] Reutenauer | Minimization of rational word functions[END_REF]. In Chap. 2 and 3 we heavily rely on these two papers in our attempt to algebraically characterize rational functions.

Onward to transductions

Transductions and transducers

Transducers are automata which read pairs of words and thus recognize relations instead of languages. We refer the reader to [START_REF] Berstel | Transductions and context-free languages[END_REF] for a detailed study of rational transductions. 1)) • α otherwise, then we say that the pair (u, β) is realized by T and we let T denote the transduction realized by T , that is the set of pairs realized by T . We use the term ω-transducer to refer to a Büchi or Muller transducer. A transduction (resp. ω-transduction) is called rational if it is realized by a transducer (resp. ω-transducer).

Transducers A transduction (resp. ω-transduction) over alphabets A, B is a relation R ⊆ A * × B * (resp. R ⊆ A ω × B ∞ ). A transducer 6 (resp Büchi, Muller transducer) over alphabets A, B is a tuple T = (A, i , o, t) (resp. T = (A, i , o)), with A = (Q, ∆, I, F )
--→ T Inf(|r|) otherwise. Furthermore, if r is accepting, let β := i (r(1)) • α • t(r(|r|)) if r is finite and β := i (r(
Subclasses of transducers A transducer is letter-to-letter if for any transition t ∈ ∆, its output o(t) is a single letter of A, and the initial and final output functions are constant equal to . By extension a transduction realized by a letter-to-letter transducer is called letter-toletter. A transduction f which is a partial function is called functional and we rather denote (u, α) ∈ f by f (u) = α. All the transductions we consider in Chap. 2 and 3 are functional. It was shown in [START_REF]Sur les relations rationnelles entre monoides libres[END_REF] that functionality of transducers over finite words is decidable. The result has been improved, both in the case of finite words (see [START_REF] Eitan | A note on finitely-valued and finitely ambiguous transducers[END_REF][START_REF] Béal | Squaring transducers: An efficient procedure for deciding functionality and sequentiality of transducers[END_REF]) and infinite words (see [START_REF] Gire | Two decidability problems for infinite words[END_REF][START_REF] Prieur | How to decide continuity of rational functions on infinite words[END_REF]), and functionality of transducers is actually decidable in PTime.

Theorem 1.5.1. Functionality of transducers, over finite or infinite words, can be decided in PTime.

A transducer is called unambiguous when its underlying automaton is unambiguous and in that case the transduction it realizes is necessarily functional. Moreover it has been shown in [START_REF] Eilenberg | Automata, languages, and machines. A, Pure and applied mathematics[END_REF] that any functional transduction over finite words can be realized by some unambiguous transducer. It is also the case over infinite words and this can be seen as a consequence of [Car10, Theorem 1]. A transducer is called sequential7 if its underlying automaton is deterministic and we extend the terminology to the function it realizes. Sequentiality of a transduction is decidable, as it was shown in [START_REF] Choffrut | Une caracterisation des fonctions sequentielles et des fonctions sous-sequentielles en tant que relations rationnelles[END_REF] for finite words, and even in PTime, whether on finite words [START_REF] Weber | Economy of description for single-valued transducers[END_REF][START_REF] Béal | Squaring transducers: An efficient procedure for deciding functionality and sequentiality of transducers[END_REF] or on infinite words [BC04].

Theorem 1.5.2. Sequentiality of rational transductions, over finite or infinite words, can be decided in PTime.

A right-sequential transducer over finite words is a transducer with a co-deterministic underlying automaton. For infinite words [START_REF] Carton | Right-sequential functions on infinite words[END_REF] proposed a definition of right-sequential transducers over infinite words based on so-called prophetic automata, i.e. co-deterministic and co-complete automata (see [START_REF] Carton | Unambiguous Büchi automata[END_REF]). Intuitively a right-sequential transducer is deterministic but reads its input from right to left. We mentioned above than any rational function can be realized by an Chapter 1. Rational languages and rational functions unambiguous transducer, but a stronger result from [START_REF] Elgot | On relations defined by generalized finite automata[END_REF] states that any rational function can be obtained as the composition (in both ways) of a sequential transducer with a right-sequential transducer. In [START_REF] Carton | Right-sequential functions on infinite words[END_REF] a similar result (but only in one way) was obtained for transducers over infinite words.

Theorem 1.5.3. Let f be a rational function over finite words, then there exist g sequential (resp. right-sequential) and h letter-to-letter and right-sequential (resp. sequential) such that f = g • h.

Let f be a rational function over infinite words, then there exist g sequential and h letter-toletter and right-sequential such that f = g • h.

C-transducers

The transition congruence of a transducer is the transition congruence of its underlying automaton. A transducer over finite words with a transition congruence in C is called a C-transducer8 . A transduction over finite words is C-rational (resp. C-sequential ) if is is realized by some functional (resp. sequential) C-transducer. Note that C-rational transductions are sometimes called C-transductions for short. Over infinite words, as we have seen in Ex. 1.3.7, considering only the transition congruence of an automaton is not justified in general to algebraically characterize a language. However according to Th. 1.3.8 it is justified for A, and we will see in Chap. 3 that it is also justified in the case of transducers. A transducer over infinite words is called aperiodic if its underlying automaton is aperiodic. An ω-transduction is called aperiodic (resp. aperiodic-sequential ) if it is realized by an aperiodic transducer (resp. aperiodic and sequential transducer).

Example 1.5.4. Let A := {a, b}, we define the (partial) function We can compute ≡ the transition congruence of T and we obtain the following equivalence classes: A * / ≡ = { , a, b, aA * a, aA * b, bA * a, bA * b}. One can show that ≡ is in DA (and hence A) but not in I nor J. Hence we can conclude that f swap is a DA-transduction, however we cannot say if it is an I (resp. J) transduction, because there might exist some I (resp. J) transducer realizing it. Actually, the domain of f swap is not an I-language since a is not in it whereas aa is. Because any transducer realizing f swap must recognize its domain we can conclude that f swap is not an I-transduction. In order to decide if f swap is a J-transduction, we will need some algebraic characterization of transductions, which we provide in Sec. 2.2.

f swap : A * → A * , for any α, β ∈ A, u ∈ A * by f (αuβ) := βuα.

Logical transducers

MSO-transducers are a formalism of graph transformations introduced by Courcelle (see [START_REF]Monadic second-order definable graph transductions: A survey[END_REF]). In [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF] the authors have shown that word-to-word MSO-transducers exactly capture functional two-way transducers. Our definition of logical transducers is equivalent to the notion of orderpreserving MSO-transducers from [START_REF] Filiot | Logic-automata connections for transformations[END_REF], a restriction which coincides with one-way transducers, i.e. rational functions [Fil15, Theorem 4].

Pointed structures Let S be a signature and let F be a logical fragment. As we have seen before, a formula with a free variable can actually be seen as a sentence over an extended signature. We define the pointed version of S by S c , which is S with an additional constant symbol c. From this we can easily define the fragment F c by all the F-formulas where 1.5. Onward to transductions c is substituted for arbitrary occurrences of first-order variables. The finite (resp. infinite) pointed word semantics of an F c -formula is given by φ

* := {(u, i) ∈ A * × {1, . . . , |u|} | u, i |= φ} (resp. φ ω := {(x, i) ∈ A ω × |x| | x, i |= φ}).
Again we will often rely on the context and simply write φ .

Remark 1.5.5. Pointed formulas can be intuitively seen as formulas with an extra variable which cannot be quantified upon. We could have chosen a different definition of F c , namely substitute c for free occurrences of first-order variables. In fragments where the number of variables is not bounded, these two definitions are equivalent. However in the case of FO 2 c [≤], this alternative definition is strictly less expressive than the one we chose, as it was noticed by [Boj15]. As an example, the

FO 2 c [≤]-sentence ∃x a(x) ∧ (x < c) ∧ ∀y (x < y) → (c ≤ y)
which states that the position just before the pointed position is labeled by a cannot be expressed in the formalism where only free occurrences of variables are replaced by c.

Example 1.5.6. Let us define the pointed FO 2 c [≤]-sentence: φ a,middle := a(c) ∧ ¬ min(c) ∧ ¬ max(c), which states that the pointed position is labeled by a and is neither minimal nor maximal.

Logical transducers Let F be a fragment of MSO[≤], an F-transducer over an alphabet A is a tuple T = K, φ dom , (φ α ) α∈K where K is a finite subset of A * , φ dom is an F-sentence, called the domain formula, and for each α ∈ K, φ α is an F c -sentence. Let u be a word, finite or infinite, satisfying φ dom , and for each integer 1 ≤ i ≤ |u| let α i be such that (u, i) |= φ αi , if it exists. In that case we set α := i α i , and we say that T realizes the pair (u, α). The finite words (resp. infinite words) semantics of T is denoted by

T * := {(u, α) | u ∈ A * , T realizes (u, α)} (resp. T ω := {(x, α) | x ∈ A ω , T realizes (x, α)}).
Just as before we will rely on the context and often write T . Note that this relation is not necessarily functional but in the following, we always assume that it is and that its domain is equal to φ dom . • φ dom := ∃x, y x < y

• φ a := (min(c) ∧ ∃x max(x) ∧ a(x)) ∨ (max(c) ∧ ∃x min(x) ∧ a(x)) ∨ φ a,middle • φ b := (min(c) ∧ ∃x max(x) ∧ b(x)) ∨ (max(c) ∧ ∃x min(x) ∧ b(x)) ∨ φ b,middle
where φ a,middle is the formula given in Ex. 1.5.6

As mentioned above, the following result extends [Fil15, Theorem 4], where the author uses a slightly different but equivalent formalism for logical transducers. This result easily transfers to ω-transducers. It also generalizes to the equivalence between aperiodic transducers and FO[≤]transducers, both over finite and infinite words. It is the natural extension of the result of Büchi from rational languages to rational functions.

Theorem 1.5.8. A functional transduction (resp. ω-transduction) is realizable by an unambiguous transducer if and only if it is realizable by an MSO[≤]-transducer.

Proof. We give the proof of the equivalence between ω-transducers and MSO[≤]-transducers over infinite words.

Let T = (A, i , o) be an unambiguous transducer realizing a function f : A ω → B ∞ , with underlying automaton A = (Q, ∆, I, F ). Let p, q be states of A, let L p,q ⊆ A * be the set of Chapter 1. Rational languages and rational functions finite words which can go from p to q and let L q ⊆ A ω denote the set of infinite words having a final run from q. Since L p,q , L q are rational, there are MSO[≤]-formulas φ p,q , L q recognizing them, respectively. Given an MSO[≤]-formula φ we define inductively the MSO c [≤]-formula φ <c by restricting the quantifications to the positions before c. Formally, if φ = ∃y ψ(y) then we set φ <c := ∃y (y < c) ∧ ψ <c (y). Atomic formulas and boolean connectives are left unchanged.

Let us define T = K, φ dom , (φ v ) v∈K by:

• K := ({ } ∪ i (I)) • o(∆) • φ dom := p,q∈I×F φ p,q • φ v (x) := i(p0)o(p0,a,q)=v min(c) ∧ a(c) ∧ φ >c q o(p,a,q)=v,p0∈I ¬ min(c) ∧ φ <c p0,p ∧ a(c) ∧ φ >c q
By construction, and since A is unambiguous, we have that T realizes f . Conversely, let T = K, φ dom , (φ v ) v∈K be a logical transducer realizing a function f : A ω → B ∞ . From T , we define an ω-language over the alphabet A × K. Let φ be an MSO c [≤]-formula, we syntactically define φ (c) an MSO[≤]-formula with one free variable. Each label predicate a(x) is replaced syntactically by v∈K (a, v)(x). Then each occurrence of the constant symbol c is replaced by a fresh free variable symbol c. For v ∈ K, we define a predicate v(x) := a∈A (a, v)(x). We define the formula:

φ T := φ dom ∧ ∀c v∈K v(c) ∧ φ v (c)
The formula φ T recognizes words such that the projection over A ω is in dom(f ). Furthermore each position is labeled by its output. We define a trim automaton A T = (Q T , ∆ T , I, F ) recognizing the same language as φ T . From this we naturally define a transducer T := (A, i , o) with A := (Q T , ∆, I, F ) by:

• ∆ := {(p, a, q) | (p, (a, v), q) ∈ ∆ T } • i : p → • o(p, a, q) := v such that (p, (a, v), q) ∈ ∆ T Note that o is well-defined since f is a function. By construction T realizes f .
Chapter 2

Characterizations of rational functions over finite words "I love deadlines. I love the whooshing noise they make as they go by."

-Douglas Adams, The Salmon of Doubt

The existence of a syntactic object capturing all the algebraic properties of a language is a cornerstone of the study of rational languages. The many correspondences between algebraic varieties and logical fragments, together with the effective computation of the syntactic congruence, has yielded a generic tool to effectively decide if a language is expressible in some logical fragment.

The goal of this chapter is to try to obtain such an object for rational functions and see which logic-algebra correspondences can be carried over to functions. In the case of sequential functions, this has already been achieved: for any sequential function, one can compute a sequential transducer which is minimal in the strong sense that its right transition congruence is the coarsest among those of sequential transducers realizing the function (see [START_REF]Minimizing subsequential transducers: a survey[END_REF]). In the case of rational functions the result from [START_REF] Reutenauer | Minimization of rational word functions[END_REF] gives the construction of a canonical, i.e. not machine dependent, transducer realizing a function. However this canonical machine does not have the nice minimality properties which provide an algebraic characterization in the case of languages.

Refining the techniques of [START_REF] Reutenauer | Minimization of rational word functions[END_REF], we are able to show the existence, and give the constructions, of a finite number of minimal machines for any rational function. These machines are minimal in the sense that the transition congruence of any transducer realizing the function has to be finer than the transition congruence of one of the minimal machines. This gives us a procedure, for any decidable class of congruences C, to decide if a transduction is in C. On the logical side, we provide a transfer result which gives sufficient conditions on a logical fragment so that an equivalence with a class of congruences can be carried over to transductions. These conditions basically amount to having access to the linear order predicate. In these conditions we are thus able to decide if a transduction is definable in a given logical fragment.

We start this chapter by studying the case of sequential functions, reformulating the results of [START_REF]Minimizing subsequential transducers: a survey[END_REF] in our framework. We also show that the class of aperiodic transducers is robust to determinization, which means that a transduction is A-sequential if and only if it is sequential and in A, which is not true for an arbitrary class of congruences C. Then we define bimachines, Chapter 2. Characterizations of rational functions over finite words a model of computation for rational functions introduced in [Sch61], and named as such and further studied by [START_REF] Eilenberg | Automata, languages, and machines. A, Pure and applied mathematics[END_REF]. A bimachine, as its name suggests, is given by two automata, one deterministic and one co-deterministic. Intuitively it can be seen as a sequential transducer with look-ahead where the look-ahead is given by a co-deterministic automaton. Of course the model is completely symmetrical and could be seen as a right-sequential transducer with a lookbehind. We are able to minimize bimachines using a two-sided version of minimization à la Choffrut, and then we show that the number of minimal bimachines is always finite. In the particular case of aperiodic transductions, we show that the robustness of the class means that if a transduction is aperiodic then all its minimal bimachines are. This property provides a PSpace algorithm to decide aperiodicity of a transduction. Finally we consider the logical side of rational transductions and establish some logic-algebra correspondences.

The results of this chapter can be found in [START_REF] Filiot | First-order definability of rational transductions: An algebraic approach[END_REF][START_REF]Aperiodicity of rational functions is PSpace-complete[END_REF]. Throughout this chapter, we only consider finite words.

Sequential functions

Sequential transductions can be characterized by a right syntactic congruence which yields, as for automata, a unique (up to shifting outputs) minimal machine realizing the function (see [START_REF]Minimizing subsequential transducers: a survey[END_REF]). By the closure properties of classes of congruences, deciding C-sequentiality thus amounts to computing the minimal sequential transducer and deciding if its transition congruence is in C. In the case of a decidable class, this gives a decision procedure for C-sequentiality.

We describe this right syntactic congruence as well as a minimization procedure in PTime, which can both be found in [START_REF]Minimizing subsequential transducers: a survey[END_REF] but which we will generalize later in the case of rational functions. We then describe the determinization procedure of [BC02], which terminates for sequential functions, and show that it preserves aperiodicity of transducers. This means that deciding aperiodicity of a sequential function can be reduced to deciding A-sequentiality. In particular, as we will see in Sec. 2.3 this gives a procedure to decide if a sequential function is FO[≤]-definable.

Algebraic characterization of sequential functions

Here we describe the right syntactic congruence of a function and the minimal sequential transducer associated with it. This is very analogous to the Myhill-Nerode congruence of a language and the corresponding minimal deterministic automaton.

Infimum of a function Let A, B be alphabets and let

f : A * → B * be a (partial) function. We define the infimum of f , f : A * → B * by f (u) := {f (v) | u ≤ v, v ∈ dom(f )},
which is defined over ↓dom(f ). In other words f (u) outputs the longest possible word that f can produce by reading a word starting with u. * . Let us also consider the function f idem given by the transducer of Fig. 2.1 on the next page. We have that

f idem (u) = if u ∈ { , a} and f idem (u) = a if u ∈ aa + . One can easily see that f idem = f idem . Right syntactic congruence Definition 2.1.2. The right syntactic congruence of a function f : A * → B * is defined by u ∼ f v if: 2.1. Sequential functions 0 1 2 a| a|a a| a| Figure 2.1: A transducer realizing f idem . • u -1 dom(f ) = v -1 dom(f ) • for any w ∈ u -1 dom(f ), f (u) -1 f (uw) = f (v) -1 f (vw) Proposition 2.1.3. Let f be a function, then ∼ f is a right congruence. Proof. Let f : A → B be a function, let u ∼ f v and let a ∈ A. We want to show that ua ∼ f va. First (ua) -1 dom(f ) = a -1 (u -1 dom(f )) = (va) -1 dom(f ). We know that for any word w ∈ u -1 dom(f ), f (u) -1 f (uw) = f (v) -1 f (vw)
, and we let g(w) denote this word. Let aw ∈ u -1 dom(f ).

f (ua) -1 f (uaw) = ( z f (uaz)) -1 f (uaw) = z f (u)g(az) -1 f (u)g(aw) = f (u) z g(az) -1 f (u)g(aw) = ( z g(az)) -1 g(aw) = f (va) -1 f (vaw)
Hence ua ∼ f va which concludes the proof.

Minimal sequential transducer

The minimal sequential transducer of a transduction f : A * → B * is defined, using the right syntactic congruence, by

T f = (A f , i f , o f , t f ), with A f = (Q f , ∆ f , I f , F f ) where: • Q f := {[u] | u ∈ ↓dom(f )} • ∆ f := {([u] , a, [ua]) | a ∈ A} • I f := {[ ]} • F f := {[u] | u ∈ dom(f )} • i f ([ ]) := f ( ) • o f ([u] , a, [ua]) := f (u) -1 f (ua) • t f ([u]) := f (u) -1 f (u)
Intuitively, the minimal sequential transducer outputs over a word u the longest possible word, knowing that the input begins with u. Remark 2.1.4. Note that we have defined a transducer which has an infinite number of states, in general. Of course this definition applies to arbitrary functions, but will yield a finite machine when the function considered is a sequential function.

Notice that ∼ A f = ∼ f , by definition, and that the number of states of A f is the number of equivalence classes of ∼ f (up to adding a sink state).

Proposition 2.1.5. The outputs of the minimal sequential transducer of a function are welldefined.

Proof. We show that the output functions are well-defined. Let f : A * → B * . The initial output function is obviously well-defined. Let u ∼ f v and let a ∈ A such that ua ∈ ↓dom(f ). We want to show that the output function o is well-defined, meaning that f (u

) -1 f (ua) = f (v) -1 f (va).
As before we have that f (u) -1 f (uw) = f (v) -1 f (vw), for any w ∈ u -1 dom(f ), and we denote this word by g(w).

f (u) -1 f (ua) = ( z f (uz)) -1 z f (uaz) = z f (u)g(z) -1 z f (u)g(az) = ( z g(z)) -1 z g(az) = f (v) -1 f (va)
The final output function is well-defined, since f (u

) -1 f (u) = f (v) -1 f (v) for u, v ∈ dom(f ), by definition of ∼ f .
Example 2.1.6. Let us consider again the functions f swap and f idem , given by their respective transducers of Fig. 1.4 on page 22 and 2.1. As we have seen f swap is the constant function equal to . Hence, one can show that the right syntactic congruence of f swap is the finest congruence, separating all words. The minimal sequential transducer of f swap has an infinite number of states, and the final output function outputs f swap (u) for u ∈ dom(f ) since f swap is constant, equal to . This simply means that the function is not sequential. The syntactic congruence of f idem has three classes, namely , a and aa + , and the minimal sequential transducer is given in Fig. 2.2.

Theorem 2.1.7. The transducer T f realizes f . Proof. Let f : A * → B * be a function, and let u ∈ dom(f ). By definition of the outputs of T f ,

T f (u) = f ( ) • 0≤i<|u| f (u(:i)) -1 f (u(:i + 1)) • f (u) -1 f (u) = f (u).
We now give the theorem which justifies the name of minimal sequential transducer.

Theorem 2.1.8. Let f be a sequential function realized by a sequential transducer with underlying automaton A, then ∼ A ∼ f .

Sequential functions

Proof. Let T = (A, i , o, t) be a sequential transducer with A = (Q, ∆, {q 0 } , F ) realizing f , let u ∼ A v and let p be the state of A reached from the initial state by u and v. Let T p := (A p , p → , o, t) with A p := (Q, ∆, {p} , F ), and let f p := T p . We have u -1 dom(f ) = v -1 dom(f ) since this set is the language of words which have a final run from p. Let w ∈ u -1 dom(f ), we want to show that f (u) -1 f (uw) = f (v) -1 f (vw). Let us denote the initial runs of T over u and v by q 0 u|α --→ p and q 0 v|β --→ p, respectively. Let γ := {f p (x) | x ∈ dom(f p )}, and let p w|δ --→ q f . Thus we have f (u) = i (q 0 )αγ, f (v) = i (q 0 )βγ, f (uw) = i (q 0 )αδt(q f ) and f (vw) = i (q 0 )βδt(q f ). Hence we obtain that f (u

) -1 f (uw) = γ -1 δt(q f ) = f (v) -1 f (vw).
Corollary 2.1.9. For any class of congruences C, a transduction is C-sequential if and only if its minimal sequential transducer is in C.

Proof. Let T be a sequential transducer with underlying automaton A realizing a function f , such that ≡ A ∈ C. Let ≡ be the transition congruence of A f , the underlying automaton of the minimal sequential transducer of f . According to Th. 2.1.8, we have that

∼ A ∼ f . Let u ≡ A v, let [w] f be a state of A f , and let [w] f u -→ A f [wu] f denote the run of A f over u from [w] f . Since u ≡ A v,
we have in particular that wu ∼ A wv, and thus wu ∼ f wv. Hence we have a run

[w] f v -→ A f [wu] f ,
and we obtain ≡ A ≡.

Minimization of sequential transducers

The minimization of sequential transducers is very similar to the minimization of deterministic automata. Here we describe a Moore-like minimization algorithm, which works by partitioning the states too coarsely and then refining the partition until a fixpoint is reached, which we show gives the syntactic congruence. The algorithm also relies on a preprocessing step to output words as early as possible [START_REF]Minimizing subsequential transducers: a survey[END_REF].

Let T = (A, i , o, t) be a transducer, let p be a state and let the longest common prefix of outputs from p be α p := α | p u|β --→ q, α = βt(q) . Then T is called in earliest form if for any state p, α p = .

Proposition 2.1.10. Given a transducer T , one can obtain in PTime a new transducer T in earliest form realizing the same function.

Proof. We give the definition of T , show that it realizes the same function and is indeed in earliest form, and finally we give a procedure to compute it. Let T = (A, i , o, t) be a transducer realizing a function f , let p be a state of A and let α p denote the longest common prefix of outputs from p. We define T = A, i , o, t by:

• i (p) := i (p)α p • o(p, a, q) := α -1 p o(p, a, q)α q • t(p) := α -1 p t(p)
One can easily see that all the α p s cancel out, and thus T realizes f as well.

Let p u|β --→ T q and p u|β --→ T q, we have that β t(q) = α -1 p βt(q), which means that the longest common prefix of outputs from p for T is equal to α -1 p α p = .

Chapter 2. Characterizations of rational functions over finite words

To show that computing the α p s can be done in PTime, we refer the reader to [Cho03, Section 5] which surveys different approaches as well as their precise complexities.

We now give the minimization theorem, which can be found in [START_REF]Minimizing subsequential transducers: a survey[END_REF].

Theorem 2.1.11. Given a sequential transducer, one can compute (up to renaming states) the associated minimal sequential transducer in PTime.

Proof. Let T = (A, i , o, t), with A = (Q, ∆, I, F ) be a sequential transducer realizing a function f . According to Prop. 2.1.10 we can assume without loss of generality that T is in earliest form. Now the idea is to compute an equivalence relation by successive refinements. The idea is very similar to Moore's deterministic automata minimization algorithm [START_REF] Moore | Gedanken-experiments on sequential machines[END_REF], except that the initial relation also has to be compatible with the output functions.

In the following we identify the states of A with the equivalence classes of ∼ A . The initial partition is given for all words u, v by u

∼ 0 v if: 1) [u] A ∈ F ⇔ [v] A ∈ F and t([u] A ) = t([v] A ) and 2) ∀a ∈ A, o([u] A , a, [ua] A ) = o([v] A , a, [va] A ).
Let i ∈ N, we define inductively for all words u, v, u ∼ i+1 v by: u ∼ i v and ∀a ∈ A, ua ∼ i va. Of course we have ∀i ∈ N that ∼ A ∼ i+1 ∼ i , which means that we reach a fixpoint relation for some i, which we denote by ∼ * .

Let us first show that ∼ * is fine enough to realize f , which means that ∼ * ∼ f according to Th. 2.1.8. The relation ∼ * is a right congruence since it is a fixpoint for right multiplication. Let T * = (A * , i * , o * , t * ) with A * = (Q * , ∆ * , I * , F * ) be defined as:

• Q * := {[u] * | u ∈ ↓dom(f )} • ∆ * := {([u] * , a, [ua] * ) | a ∈ A} • I * := {[ ] * } • F * := {[u] * | [u] A ∈ F } • i * ([ ] * ) := i ([ ] A ) • o * ([u] * , a, [ua] * ) := o([u] A , a, [ua] A ) • t * ([u] * ) := t([u] A )
The final states and the final outputs are well defined according to point 1) in the definition of ∼ 0 given above. The output function is well-defined according to point 2). Given a word in the domain of f , its outputs for T * will be exactly the same as for T which means that T * realizes f and hence ∼ * ∼ f . We only have left to show that ∼ f ∼ * , which we do by showing by induction on i ≥ 0 that ∼ f ∼ i . First, let us remark that since T is in earliest form and is sequential, the function computed by T without final outputs is exactly

f . Let u ∼ f v we have 1) u ∈ dom(f ) ⇔ v ∈ dom(f ), which means that [u] A ∈ F ⇔ [v] A ∈ F . According to the previous remark, f (u) -1 f (u) = t([u] A ) and since f (u) -1 f (u) = f (v) -1 f (v) we have t([u] A ) = t([v] A ).
Similarly, according to the proof of Prop. 2.1.5, we have for any letter a that f (u

) -1 f (ua) = f (v) -1 f (va). Again according to the remark above, we obtain 2) o([u] A , a, [ua] A ) = o([v] A , a, [va] A ). Hence ∼ f ∼ 0 . Now let us assume that for some i ∈ N we have ∼ f ∼ i . Let u ∼ f v,
we have by hypothesis that u ∼ i v. Since ∼ f is a right congruence we also have for any a ∈ A that ua ∼ f va which means that ua ∼ i va, and hence u ∼ i+1 v, which concludes the proof of correctness.

The fact that this procedure takes polynomial time can be argued just like for Moore's algorithm: each refinement step takes polynomial time and since each step merges at least two states, the number of steps is linear in the number of states of the transducer.

Sequential functions

Corollary 2.1.12. Let C be a decidable class of congruence, then C-sequentiality of sequential transductions is decidable.

Proof. Let T be a sequential transducer realizing f , according to Th. 2.1.11 we can compute the minimal sequential transducer of f . According to Cor. 2.1.9, f is C-sequential if and only if T f is a C-transducer, which we can decide since C is decidable by assumption.

Determinization preserves aperiodicity

Here we study the determinization of transducers. Determinization is not always possible since not all rational functions are sequential, such as f swap of Ex. 1.4. There is however an algorithm which terminates in the case of sequential functions which we call powerset construction with delays. This algorithm is similar to the usual powerset construction, and the idea is to output on a transition the longest common prefix of all possible outputs. In order to obtain the original function, the macro-states of the construction thus have to contain not only states but pairs composed of a state and a remaining output (called a delay). Like for automata this construction, when it terminates, yields a deterministic machine at the cost of an exponential blow-up.

We describe the algorithm given in [BC02] and show that if the initial transducer is aperiodic then the resulting one also is. As a corollary this gives us, as we will see in Sec. 2.3, a procedure to decide if a sequential transduction is FO[≤]-definable.

C-sequentiality vs C-rationality Let C be a class of congruences. We start by stating that, in the case of sequential functions, C-sequentiality and C-rationality are not equivalent.

Theorem 2.1.13. There exists a class of congruences C, and a sequential C-transduction which is not C-sequential.

Proof. Let C = I, the class of idempotent congruences. Let f idem be the function given by the transducers T 1 and T 2 of Fig. 2.1 on page 29 and 2.2, respectively. The transducer T 1 is idempotent and non-sequential whereas T 2 is sequential and not in I. Furthermore T 2 is actually the minimal sequential transducer of f idem which means, according to Cor. 2.1.9, that f idem is not I-sequential.

Determinization algorithm

We describe the powerset construction with delays which builds a sequential transducer realizing the same function as the input transducer. Since not all functions are sequential, the algorithm may not terminate in general. When it does terminate, one can show that the lengths of the delays are polynomial in the input transducer, which means that the overall worst-case complexity is, as for automata determinization, exponential.

Let T = (A, i , o, t) be a transducer, with underlying automaton A = (Q, ∆, I, F ), realizing a function f . We describe S := (D, i , o , t ), with D := (Q , ∆ , S 0 , F ), which also realizes f . Note that S is sequential by definition but may have an infinite number of states when f is not sequential. We assume that T is trim and in earliest form, without loss of generality.

Let α := q∈I i (q) and let S 0 := (q, α -1 i (q)) | q ∈ I , with i (S 0 ) := α. We build Q and ∆ up from S 0 using the following steps. Let P be a state already constructed in Q and let a ∈ A.

We define R := (q, βγ) | (p, β) ∈ P, and p a|γ --→ q . Let α := (q,β)∈R β, then we add the state S := (q, α -1 β) | (q, β) ∈ R to Q and the transition P a|α --→ S to ∆ . We only have left to define F and t . F := {P | ∃(p, α) ∈ P, p ∈ F } and t (P ) := αt(p) such that (p, α) ∈ P and p ∈ F . Note that the definition of t may seem ambiguous but it is not due to the functionality of f (T is assumed trim).

Chapter 2. Characterizations of rational functions over finite words

The previous construction as well as the following theorem are taken from [BC02].

Theorem 2.1.14. Let T be a transducer realizing a sequential function f and let S be the transducer obtained by powerset construction with delays. Then S is finite and realizes f . Aperiodicity As we have seen determinization does not preserve transition congruence of a machine. However determinization of an aperiodic transducer always produces an aperiodic transducer.

Lemma 2.1.15. Let T be an aperiodic transducer realizing a sequential function f and let S be the transducer obtained by powerset construction with delays. Then S is aperiodic.

Proof. Let T = (A, i , o, t), with A = (Q, ∆, I, F ), be an A-transducer realizing a sequential function f : A * → B * . Let S = (D, i , o , t ), with D = (Q , ∆ , S 0 , F ), be the sequential transducer obtained from T by powerset construction with delays. We want to show that S is aperiodic and actually we will show that D is counter-free, which is equivalent according to Prop. 1.3.9 since S is sequential. A is aperiodic so there is an integer n such that ∀u ∈ A * , u n ≡ A u n+1 . Let u ∈ A + be a word, let k be a positive integer and let R 0

u|α0 ---→ S R 1 . . . R k-1 u|α k-1 ----→ S R 0 denote a counter in S.
Let us assume that k is the size of the smallest such counter, which means that all R j s are pairwise distinct, we want to show k = 1.

Let Γ 0 := α 0 • • • α k-1 , for 1 ≤ j < k let Γ j := α j • • • α k-1 α 0 • • • α j-1 and let us note that Γ j α j = α j Γ j+1 mod k . Let R = {q 1 , . . . , q m }
denote the states appearing in R 0 . For 0 ≤ j < k, the states of R j are exactly the states which can be reached in A from some state of R 0 by reading u kn+j ≡ A u kn . This means that the states of R j are the same as the states of R 0 , namely q 1 , . . . , q m . Thus let R j = {(q 1 , β 1,j ), . . . , (q m , β m,j )}.

Let i, i ∈ m, and let q i u|α i,i ----→ T q i denote a run in T when it exists. By definition of S, we have for any 0 ≤ j < k:

β i,j α i,i = α j β i ,j+1 mod k Let q i0 u -→ A . . . q it-1 u -→ A q it such
that t is a multiple of k. Thus we obtain for any 0 ≤ j, j < k:

β i0,j α i0,i1 • • • α it-1,it = α j • • • α j-1 β it,j β i0,j α i0,i1 • • • α it-1,it = α j • • • α j -1 β it,j
Since Q is finite there must be a state q l ∈ R, such that q l loops by reading a power of u, meaning that there is an integer t such that q l u t -→ q l . For a large enough t we can assume by aperiodicity that t is of the form t = ks + 1. Let l, i 1 , . . . , i t-1 , l denote the state indices of the previous run from q l to q l over u t . Let Φ := α l,i1 • • • α it-1,l . We have:

β l,j Φ = Γ s j α j β l,j+1 (1) β l,j Φ k = Γ ks+1 j β l,j (2) β l,j+1 Φ k = Γ ks+1 j+1 β l,j+1 (3)
From (2) we have |Φ| = (ks + 1) |Γ0| k . From (1) we thus obtain:

|β l,j+1 | -|β l,j | = |Γ0| k -|α j |.
Notice that this holds for any looping state q l but the difference does not depend on the state itself.

Let us now consider q i , a state which is not necessarily a looping state. Any state must be reachable from some looping state, since all states in R can be reached from some state of R by an 2.2. Algebraic characterization of rational functions arbitrarily large power of u. Let q l be a looping state which can reach q i by a run over u ks . Again let l, i 1 , . . . , i ks-1 , i denote the sequence of indices of such a run and let Ψ := α l,i 1 • • • α i ks-1 ,i . We have: β l,j Ψ = Γ ks j β i,j (4) β l,j+1 Ψ = Γ ks j+1 β i,j+1 (5) Taking the lengths of words of (4) and (5), and taking the difference between the two equalities we obtain:

|β i,j+1 | -|β i,j | = |β l,j+1 | -|β l,j | = |Γ0|
k -|α j | which again does not depend on i. Thus we obtain that for any state q i ∈ R, looping or otherwise,

|β i,j+1 | -|β i,j | = |Γ0| k -|α j |.
If we assume that Γ 0 = , then in particular |β i,j+1 | = |β i,j | for any state q i . From (1), we have that β l,j = β l,j+1 for any looping state q l . Then combining (4) and ( 5) we obtain β i,j = β i,j+1 for any state q i . Hence all R j s are identical which means that k = 1.

Let us now assume that Γ 0 = . Since equations ( 4) and ( 5) can have an arbitrarily large common suffix, we know that for any state q i , either β i,j is a suffix of β i,j+1 or vice versa. Let {x, y} = {j, j + 1} such that β i,x = γ i β i,y . Note that x, y do not depend on i since

|β i,j+1 | - |β i,j | = |Γ0|
k -|α j |, and furthermore the size of γ i does not depend on i either. If x = j, since (4) and (5) can have an arbitrarily large common suffix, we have that γ i is a suffix of Γ ks j+1 which does not depend on i. Hence γ i is a common prefix of β i ,j for all i ∈ m, which means that γ i = by definition of S. Thus all R j s are equal which means that k = 1. Similarly, if x = j + 1, then γ i is a suffix of Γ ks j , and with the same reasoning, we conclude that k = 1.

Theorem 2.1.16. A sequential function is A-rational if and only if it is A-sequential.

Proof. Let f be sequential function. If f is A-sequential then in particular it is A-rational. If f is A-rational, then there exists an aperiodic transducer realizing it. According to Lem. 2.1.15, the sequential transducer obtained by powerset construction with delays is also aperiodic which means that f is A-sequential.

Remark 2.1.17. Note that all the results of this section can easily be extended symmetrically to right sequential function.

Algebraic characterization of rational functions

The goal of this section is to obtain an algorithm to decide C-rationality of transductions, for a decidable class of congruences C. The algebraic characterization in the case of rational languages is tied to the existence of a deterministic model, deterministic automata. This is the main reason why sequential functions can be characterized by a syntactic object. We thus consider a deterministic model of transductions called bimachines. A bimachine is a model of computation introduced in [START_REF] Schützenberger | A remark on finite transducers[END_REF] and named as such by [START_REF] Eilenberg | Automata, languages, and machines. A, Pure and applied mathematics[END_REF]. Bimachines are equivalent in expressive power to functional transducers and one of their main features is that they work in a deterministic fashion. As the name suggests, bimachines are made up of two automata: one deterministic, called the left automaton, and one co-deterministic, called the right automaton. Intuitively, a bimachine can be seen as a sequential transducer with look-ahead, where the lookahead information is given by the right automaton. However we also use the fact that the roles of the two automata are completely symmetrical. We define bimachines and show how one can go from a bimachine to an unambiguous transducer while preserving the transition congruence, which was already known [RS95]. This allows us to reduce the study of C-transductions to the study of C-bimachines, for any class C. Then we introduce the syntactic congruence of a function with respect to a fixed look-ahead, an object Chapter 2. Characterizations of rational functions over finite words

l 0 la 1 la 2 lb 1 lb 2 a a, b a, b b a, b ra 2 rb 2 ra 1 rb 1 r 0 a a, b a, b b a, b l α r o(l, α, r) l 0 α rγ j γ lβ i α r 0 β lβ i α rγ j α Figure 2
.3: Left and right automata and output table of a bimachine realizing f swap .

introduced in [RS91] and we use it to minimize bimachines through a two-sided Choffrut-like minimization. Finally we introduce the delay congruence, a syntactic object (also taken from [START_REF] Reutenauer | Minimization of rational word functions[END_REF]) which yields a minimal look-ahead, and thus a canonical bimachine. As it was noticed in [START_REF] Reutenauer | Minimization of rational word functions[END_REF] however, this canonical bimachine does not necessarily capture all the algebraic properties of a transduction. Refining the techniques of [START_REF] Reutenauer | Minimization of rational word functions[END_REF] we are able to show that any rational function has a finite number of minimal bimachines, which was conjectured in [START_REF] Reutenauer | Minimization of rational word functions[END_REF]. It turns out that we can bound the size of minimal bimachines, using the canonical bimachine, and thus we obtain the main result of this section: an algorithm to decide C-definability of rational functions, for any decidable class of congruences C.

Bimachines and transductions

We define bimachines, and the related notions. We also show how to go from a bimachine to a transducer while preserving transition congruences.

Bimachines A bimachine over alphabets A, B is given as a tuple B = (L, R, i , o, t) where

L = (Q L , ∆ L a, {l 0 } , F L ) is a deterministic accessible automaton, called the left automaton of B, R = (Q R , ∆ R , I R , {r 0 }
) is a co-deterministic co-accessible and co-complete automaton, called the right automaton of B, i

: Q R → B * is the initial function, o : Q L × A × Q R → B *
is the output function and t : Q L → B * is the final function. We also add the semantic restriction that L and R must recognize the same language1 . Let u be a word and let l and r be runs of L and R, respectively, over u. We extend o to Q L × A * × Q R by setting o(l(1), u, r(|r|)) := 1≤j≤|u| o(l(j), u(j), r(j + 1)). Furthermore if l and r are accepting, let α := i (r(|r|)) • o(l(1), u, r(|r|)) • t(l(|l|)). We say that the pair (u, α) is realized by B and we denote by B the set of pairs realized by B.

Example 2.2.1. Let us consider the bimachine B swap = (L, R, i , o, t) with L and R the automata of Fig. 2.3. We set i : r → , t : l → . Let α, β, γ ∈ {a, b} and i, j ∈ 2, we define o(l 0 , α, rγ j ) := γ, o(lβ i , α, r 0 ) := β and in all other cases, o(l, α, r) := α. The function realized by B is f swap (cf. Ex. 1.5.4), and in Fig. 2.4 on the facing page we give an example of a run of B swap over the word aabb. Proof. Let us consider f idem the function given by the sequential transducer of Fig. 2.2 on page 30. Any sequential transducer realizing a total function can be seen as a bimachine with a trivial right automaton. Let B be such a bimachine with the underlying automaton of the minimal sequential transducer as left automaton and the trivial automaton as right automaton.

C-bimachines

There cannot be a bimachine realizing f idem with coarser automata otherwise we would obtain a sequential transducer smaller than the minimal one. Hence B is a minimal bimachine. However, one can easily see that f idem is also a right sequential function, and can be realized by a bimachine with a trivial left automaton. Hence f idem has at least two incomparable minimal bimachines.

From bimachines to transducers It is quite easy to show that from a C-bimachine one can obtain an unambiguous C-transducer realizing the same function, and this was already noticed in [RS95].

Proposition 2.2.3. Let B be a bimachine realizing a function f with left and right automata L and R, respectively. Then one can construct in PTime an unambiguous transducer realizing f with underlying automaton L × R.

Proof. Let B = (L, R, i , o, t) be a bimachine realizing a function f with left automaton L = (Q L , ∆ L a, {l 0 } , F L ) and right automaton R = (Q R , ∆ R , I R , {r 0 }).
The main idea is to consider the product of the two automata. The transducer will guess the run of the right automaton, and co-determinism ensures that there is only one possible run. We define a transducer T := (A, i , o , t ) with A := (Q, ∆, I, F ) by:

• Q := Q L × Q R • ∆ := {((l, r ), a, (l , r)) | a ∈ A, (l, a, l ) ∈ ∆ L , (r , a, r) ∈ ∆ R }
Chapter 2. Characterizations of rational functions over finite words

• I := {l 0 } × I R • F := F L × {r 0 } • i (l 0 , r) := i (r)
• o ((l, r ), a, (l , r)) := o(l, a, r)

• t (l, r 0 ) := t(l)
By construction T realizes f and its underlying automaton is indeed L × R.

≡ L×R is in C, hence T is a C-transducer and f is a C-transduction.
In [RS95] it was noticed that one can easily go from an unambiguous transducer to a bimachine while preserving the transition congruence. We show later in this section a stronger result, namely that the transducer needs not be unambiguous for the proposition to hold. The result however is not trivial and relies on the notions of canonical bimachine, and bimachine minimization.

Bimachines and minimization

Just like for sequential functions, the minimization of bimachines relies on a syntactic congruence. We define two different minimizations which are completely symmetrical: left minimization and right minimization. Left minimization consists in fixing the right automaton and then computing the minimal left automaton possible given the look-ahead information provided by the right automaton. Our main conceptual tool is the syntactic congruence of a function with respect to a fixed right automaton, taken from [START_REF] Reutenauer | Minimization of rational word functions[END_REF]. From this we are able to compute, just like for sequential functions, a minimal left automaton in PTime. We also show that composing left and right minimization (either way) always produces a minimal bimachine. Finally we obtain that one can go from a (possibly ambiguous) transducer to a bimachine while preserving the transition congruence. R-syntactic congruence Let f : A * → B * be a function and let R be a right automaton recognizing dom(f ). We define for each state of R, i.e. each equivalence class

[v] R of ≈ R , a function f [v] R : u → {f (uw) | w ≈ R v}, which is defined over dom(f )v -1
. Note that the right automaton will often be implicit and we will rather write f v . Intuitively, this function outputs over a word u the longest possible word, with the look-ahead information that the suffix is in

[v] R .
Definition 2.2.5. Let f : A * → B * be a function and let R be a right automaton recognizing dom(f ). The R-syntactic congruence of f is defined for u, v ∈ A * by: u

∼ R f v if • u -1 dom(f ) = v -1 dom(f ) and • ∀w ∈ A * , f w (u) -1 f (uw) = f w (v) -1 f (vw)
Intuitively, u and v are equivalent if when we remove the contributions of u and v from f (uw) and f (vw), respectively, we obtain the same word left to write. Note here that the contributions of u and v are computed with the knowledge that the suffix is equivalent to w, with respect to R.

Proposition 2.2.6. Let f be a function and let R be a right automaton recognizing dom(f ), then ∼ R f is a right congruence.

Proof. Let f : A * → B * be a function, let R be a right automaton recognizing dom(f ), let u ∼ R f v and let a ∈ A. We want to show that ua ∼ R f va. First (ua) -1 dom(f ) = a -1 (u -1 dom(f )) = (va) -1 dom(f ). We know that for any word

w ∈ u -1 dom(f ), f w (u) -1 f (uw) = f w (v) -1 f (vw),
and we let g(w) denote this word. Let aw ∈ u -1 dom(f ).

f w (ua) -1 f (uaw) = z≈ R w f (uaz) -1 f (uaw) = z≈ R w f aw (u)g(az) -1 f aw (u)g(aw) = f aw (u) z≈ R w g(az) -1 f aw (u)g(aw) = z≈ R w g(az) -1 g(aw) = f w (va) -1 f (vaw)
Hence ua ∼ R f va which concludes the proof. Example 2.2.7. Let us consider again the function f swap and R the right automaton of B swap given in Ex. 2.2.1. We give the classes of the congruence ∼ R fswap : { , a, b, aA + , bA + } which exactly coincides with the states of the left automaton of Fig. 2.3 on page 36.

Left minimal bimachine Let f : A * → B * be a function and let R := (Q R , ∆ R , I R , {r 0 }) be a right automaton recognizing dom(f ). Using the R-syntactic congruence of f we define the left minimal bimachine of f with respect to R. We set B f (R) := (L f (R), R, i , o, t) with L f (R) := (Q L , ∆ L , l 0 , F L ) defined by:

• Q L := [u] R f | u ∈ ↓dom(f ) • ∆ L := ([u] R f , a, [ua] R f ) • l 0 := [ ] R f • F L := [u] R f | u ∈ dom(f ) • i ([u] R ) := f u ( ) • o([u] R f , a, [v] R ) := f av (u) -1 f v (ua) • t([u] R f ) := f (u) -1 f (u)
The definition of the left minimal bimachine of a function f with respect to a right automaton R is very similar to the definition of the minimal sequential transducer of a function. Intuitively, it outputs over a word u, and given a class [w] R , the longest possible word knowing that the input begins with u and ends with a word equivalent to w. Again this bimachine may have an infinite number of states, in general.

Remark 2.2.8. When f is a total function, and R is the trivial right automaton with only one state, then ∼ R f = ∼ f and since B f (R) does not make use of R, it is basically the same as T f . Note that, as for sequential functions, ∼ L f (R) = ∼ R f . In particular, when ∼ R f has infinite index then the "bimachine" B f (R) is actually infinite.

We show, as for the minimal sequential transducer of Section 2.1, that the outputs of the machine we obtain from ∼ R f are well-defined. Proposition 2.2.9. Let f be a function and let R be a right automaton recognizing dom(f ). The outputs of B f (R) are R is well-defined.

Proof. Let f be a function and let R be a right automaton recognizing dom(f ). We show that the output functions of B f (R) are well-defined. The initial output function is obviously well-defined. Let u ∼ R f v and let a ∈ A such that ua ∈ ↓dom(f ). We want to show that the output function o is well-defined, meaning that ∀w, f aw (u) -1 f w (ua) = f aw (v) -1 f w (va). As before we have that f aw (u) -1 f (uaw) = f aw (v) -1 f (vaw), for any a ∈ A, aw ∈ u -1 dom(f ), and we denote this word by g(aw).

f aw (u) -1 f w (ua) = z≈ R aw f (uz) -1 z≈ R w f (uaz) = z≈ R aw f aw (u)g(z) -1 z≈ R w f aw (u)g(az) = z≈ R aw g(z) -1 z≈ R w g(az) = f aw (v) -1 f w (va)
The final output function is well-defined, since f (u

) -1 f (u) = f (v) -1 f (v) for u, v ∈ dom(f ), by definition of ∼ R f .
We now can show that B f (R) realizes f . However, B f (R) may be infinite if R does not give enough look-ahead information to realize f sequentially.

Theorem 2.2.10. Let f be a function and let R be a right automaton recognizing dom(f ). The bimachine B f (R) realizes f . Proof. Let f : A * → B * be a function, let R be a right automaton recognizing dom(f ) and let u ∈ dom(f ). By definition of the outputs of the left minimal bimachine

B f (R), B f (R) (u) = f u ( ) • 0≤i<|u| f u(i+1:) (u(:i)) -1 f u(i+2:) (u(:i + 1)) • f (u) -1 f (u) = f (u).
We now show that the left minimal bimachine with respect to some right automaton is indeed minimal among bimachines realizing the same function with the same right automaton. This was already shown in [START_REF] Reutenauer | Minimization of rational word functions[END_REF], but only in the case of total functions. Theorem 2.2.11. Let f be a transduction realized by a bimachine with left and right automata L and R, respectively. Then

∼ L ∼ R f . Proof. Let B = (L, R, i , o, t) be a bimachine with automata L = (Q L , ∆ L , {l 0 } , F L ) and R = (Q R , ∆ R , I R , {r 0 }) realizing f and let u ∼ L v. We have u -1 dom(f ) = v -1 dom(f ) since L recognizes dom(f ). Let w ∈ u -1 dom(f ), we want to show that f w (u) -1 f (uw) = f w (v) -1 f (vw). Let α := i ([uw] R )o(l 0 , u, [w] R ) and β := i ([vw] R )o(l 0 , v, [w] R )

Algebraic characterization of rational functions

Then we have f w

(u) = αγ, f w (v) = βγ, f (uw) = αo([u] L , w, r 0 )t([uw] L ) and also f (vw) = βo([u] L , w, r 0 )t([uw] L ). Finally we obtain that f w (u) -1 f (uw) = γ -1 o([u] L , w, r 0 )t([uw] L ) = f w (v) -1 f (vw).
Corollary 2.2.12. Let f be a function and let R be a right automaton recognizing dom(f ). Then there exists a bimachine realizing f with right automaton R if and only if ∼ R f has finite index.

Proof. If B is a bimachine realizing f with left and right automata L and R, respectively, then according to Th. 2.2.11, ∼ L ∼ R f which means that ∼ R f has finite index. Conversely, let us assume that ∼ R f has finite index, then B f (R) is finite and realizes f , from Prop. 2.2.10.

Left minimization algorithm Just like for sequential transducers, we show how to minimize the left automaton of a bimachine by successive refinements. In this context we require a notion of earliest bimachine to apply the refinement technique.

Let B = (L, R, i , o, t) be a bimachine, let u, v ∈ A * such that uv ∈ dom(f ). Let α u,v := {o([u] L , w, r 0 )t([uw] L ) | w ≈ R v} be the longest common prefix of outputs from [u] L with look-ahead [v] R . Then B is called in earliest form if for any u, v ∈ A * , we have α u,v = (note that we safely write α u,v instead of α [u] L ,[v] R to simplify the notations).
Proposition 2.2.13. Given a bimachine B, one can obtain in PTime a new bimachine B in earliest form realizing the same function.

Proof. We give the definition of B, show that it realizes the same function and is indeed in earliest form, and finally we give a procedure to compute it. Let B = (L, R, i , o, t) be a bimachine realizing a function f and let u, v ∈ A * . Let α u,v denote the longest common prefix of outputs from [u] L with look-ahead [v] R . We define B = L, R, i , o, t by:

• i ([v] R ) := i ([v] R )α ,[v] R • o([u] L , a, [v] R ) := α -1 u,av o([u] L , a, [v] R )α ua,v • t([u] L ) := α -1 u, t([u] L )
One can easily see that all the α u,v s cancel out, and thus B realizes f as well. By construction, B is in earliest form.

To show that computing the α u,v s can be done in PTime, one can consider the transducer obtained from Prop. 2.2.3 and put it in earliest form, which can be done using the result from [BC00] for instance.

We now give the minimization theorem: Theorem 2.2.14. Given a bimachine with right automaton R realizing a function f , one can compute in PTime B f (R), the left minimal bimachine with respect to R.

Proof. Let B = (L, R, i , o, t) be a bimachine realizing a function f with left and right automata L = (Q L , ∆ L , {l 0 } , F L ) and R = (Q R , ∆ R , I R , {r 0 }), respectively. According to Prop. 2.2.13 we can assume without loss of generality that B is in earliest form.

We use the same ideas as in the sequential case, but the original partition depends on the outputs for all letters and all states of R.

As usual, we identify the states of L with the classes of ∼ L . The initial partition is given for all words u, v by u

∼ 0 v if: 1) [u] L ∈ F L ⇔ [v] L ∈ F L and t([u] L ) = t([v] L ) and 2) ∀a ∈ A, w ∈ A * , o([u] L , a, [w] R ) = o([v] L , a, [w] R ).
Let i ∈ N, we define inductively for all words u, v, u ∼ i+1 v by: u ∼ i v and ∀a ∈ A, ua ∼ i va. Of course we have ∀i ∈ N that ∼ L ∼ i+1 ∼ i , which means that we reach a fixpoint relation for some i, which we denote by ∼ * .

Let us first show that ∼ * is fine enough to realize f with R as right automaton, which means that ∼ * ∼ R f according to Th. 2.2.11. The relation ∼ * is a right congruence since it is a fixpoint for right multiplication. Let B * = (L * , R, i * , o * , t * ) with L * = (Q * , ∆ * , I * , F * ) be defined as:

• Q * := {[u] * | u ∈ ↓dom(f )} • ∆ * := {([u] * , a, [ua] * ) | a ∈ A} • I * := {[ ] * } • F * := {[u] * | [u] L ∈ F L } • i * ([u] R ) := i [u] R • o * ([u] * , a, [v] R ) := o([u] L , a, [v] R ) • t * ([u] * ) := t([u] L )
The final states and the final outputs are well defined according to point 1) in the definition of ∼ 0 given above. The output function is well-defined according to point 2). Given a word in the domain of f , its outputs for B * will be exactly the same as for B which means that B * realizes f and hence ∼ * ∼ R f , according to Th. 2.2.11. We only have left to show that ∼ R f ∼ * , which we do by showing by induction on i ≥ 0 that ∼ R f ∼ i . First, let us remark that since B is in earliest form, the function computed by B without final outputs and with [v] R as final state is exactly

f v . Let u ∼ R f v we have 1) u ∈ dom(f ) ⇔ v ∈ dom(f ), which means that [u] L ∈ F ⇔ [v] L ∈ F . According to the previous remark, f (u) -1 f (u) = t([u] L ) and since f (u) -1 f (u) = f (v) -1 f (v) we have t([u] L ) = t([v] L ).
Similarly, according to the proof of Prop. 2.2.9, we have for any letter a and for any word w that f aw (u) -1 f w (ua) = f aw (v) -1 f w (va). Again according to the remark above, we obtain 2)

o([u] L , a, [w] R ) = o([v] L , a, [w] R ). Hence ∼ R f ∼ 0 . Now let us assume that for some i ∈ N we have ∼ R f ∼ i . Let u ∼ f v, we have by hypothesis that u ∼ i v. Since ∼ R
f is a right congruence we also have for any a ∈ A that ua ∼ R f va which means that ua ∼ i va, and hence u ∼ i+1 v, which concludes the proof.

From transducers to bimachines In [RS95] the authors observe that one can go from bimachines to unambiguous transducers and back while preserving the transition congruence. We now have the tools to extend this result to arbitrary transducers, and show that one can go from a (possibly ambiguous) transducer to a bimachine while preserving the transition congruence. Unsurprisingly this construction causes an exponential blow-up of size.

Theorem 2.2.15. Let T be a transducer with underlying automaton A realizing a function f . One can obtain a bimachine realizing f with left and right automata coarser than ∼ A and ≈ A , respectively. Proof. Let T = (A, i , o, t) be a transducer with underlying automaton A = (Q, ∆, I, F ) realizing f . Let R be the right automaton associated with ≈ A recognizing dom(f ). We want to show that ∼ A ∼ R f which will conclude the proof, since B f (R) realizes f according to Th. 2.2.10. Let u ∼ A v, our goal is to show that u ∼ R f v. We have of course that u -1 dom(f ) = v -1 dom(f ). Let w ∈ u -1 dom(f ), and let r 1 , . . . , r n ∈ Q denote the states of A which can be reached from I by reading u (or v) and from which there is a final run by reading w. Let i ∈ n, let p i u|αi ---→ r i and q i v|βi --→ r i denote initial runs over u and v respectively to r i . Let r i w|γi ---→ s i denote a final run over w from r i , and let

Algebraic characterization of rational functions

δ i := δt(s) | r i z|δ --→ s, z ≈ A w .
Then for any i ∈ n we have

f w (u) = i (p i )α i δ i , f (uw) = i (p i )α i γ i t(s i ), f w (v) = i (q i )β i δ i and f (vw) = i (q i )β i γ i t(s i ). Taking for instance i = 1, we obtain f w (u) -1 f (uw) = δ -1 1 γ 1 t(s 1 ) = f w (v) -1 f (vw), hence u ∼ R f v which concludes the proof.
As an important corollary, we obtain for any class of congruences C that one only needs to study C-bimachines in order to study C-rationality.

Corollary 2.2.16. Let C be a class of congruences and let f be a function. The function f is C-rational if and only if it is realized by a C-bimachine.

Proof. This is a simple consequence of both Cor. 2.2.4 and Th. 2.2.15.

Example 2.2.17. We give in Fig. 2.5 the automata of the bimachine obtained from the transducer of Fig. 2.1 on page 29 using the construction of Th. 2.2.15. The outputs of the bimachine are defined by o(l , a, r a ) := a and all other outputs are set to . Notice that this bimachine is in I while the minimal sequential transducer of the function f idem , given in Fig. 2.2 on page 30 is not. We can observe that f idem has three different minimal bimachines: one where all the information is given by the left automaton (see Fig. 2.2 on page 30), i.e. the right automaton is trivial, one where the left automaton is trivial and one where the information is split between the two, as in Fig. 2.5.

Remark 2.2.18. Symmetrically, we define ≈ L f , the L-syntactic congruence of a function f , by considering the longest common suffix instead of the longest common prefix. Our minimization results and algorithm obviously extend to the symmetric case, and we naturally define B f (L) and R f (L), the minimal bimachine with left automaton L and its right automaton. We continue to only state our results in one direction, for readability.

Left-right minimization

We show that composing left and right minimization yields a minimal bimachine but before we show two useful lemmas.

The intuition behind this first lemma is very simple: if an automaton is fine enough to realize a function, then a finer automaton will also do, a fortiori.

Chapter 2. Characterizations of rational functions over finite words Lemma 2.2.19. Let L 1 L 2 be two left automata and let R 1 R 2 be two right automata all recognizing the same language. Let B 2 be a bimachine realizing a function f with left and right automata L 2 and R 2 , respectively. One can obtain a bimachine B 1 realizing f with left and right automata L 1 and R 1 , respectively. Proof. Intuitively, since L 1 and R 1 keep more information than L 2 and R 2 respectively, B 1 can simulate the behavior of

B 2 . Let B 2 = (L 2 , R 2 , i , o, t). We define B 1 := (L 1 , R 1 , i 1 , o 1 , t 1 ) by: i 1 ([v] R1 ) := i ([v] R2 ), o 1 ([u] L1 , a, [v] R1 ) := o 2 ([u] L2 , a, [v] R2 ) and t 1 ([u] L1 ) := t([u] L2
). Since the automata of B 1 are finer than those of B 2 , then B 1 is well defined and simulates B 2 , hence they realize the same function.

The following lemmas explicits a trade-off between the two automata of a bimachine: the finer an automaton is, the coarser the other automaton can be.

Lemma 2.2.20. Let B 1 and B 2 be bimachines realizing f with their respective right automata verifying

R 1 R 2 . Then L f (R 1 ) L f (R 2 ).
Proof. Let B 1 and B 2 be bimachines realizing f with their respective right automata verifying R 1 R 2 . Let us consider B f (R 2 ) which has automata L f (R 2 ) and R 2 . Since R 1 R 2 , according to Lem. 2.2.19, we can obtain a bimachine realizing f with automata L f (R 2 ) and R 1 . By minimality of L f (R 1 ), we have according to Th. 2.2.11 that

L f (R 2 ) L f (R 1 ).
Remark 2.2.21. The previous lemma explicitly tells us that for a given function, there is a trade-off between the coarseness of the left and the right automata. The finer the left automaton is, the coarser the right automaton can be, and vice versa. Intuitively this means that the more information the one automaton gives the less the other is required to give. In fancy terms we have, for any given function, a Galois connection between the set of minimal left automata and the set of minimal right automata (with partial orders ).

Theorem 2.2.22. Let B be a bimachine with right automaton R realizing a function f . Then

B f (L f (R)) is minimal.
Proof. Let us first remark that minimal bimachines are exactly the bimachines whose automata are unchanged (up to isomorphism) by both left minimization and right minimization. Since left and right minimization are idempotent operators, we only have to show that

B f (L f (R)) is a fixpoint for left minimization. Let L = L f (R f (L f (R))), we want to show that L = L f (R). By Th. 2.2.11 we have L f (R) L. Considering B and B f (L f (R)), with R R f (L f (R)) we obtain from Lem. 2.2.20 that L L f (R).

Look-ahead versus labeling

Here we link the notion of bimachines with Th. 1.5.3 (from [START_REF] Elgot | On relations defined by generalized finite automata[END_REF]), which says that any rational function is the composition of a left and a right sequential function.

Labeling Let f : A * → B * be a function and let R be a right automaton recognizing dom(f ). We define the labeling function associated with R by the right sequential transducer

(R) := (R, i , o, t) with i : r → , t : [ ] R → and o([au] R , a, [u] R ) := (a, [u] R ). We define the transduction f R := f • (R) -1 . Note that f R is a function, since (R) is injective (by unambiguity of R).
Intuitively, f R produces the same output as f over an input annotated by the look-ahead information given by R.

Our goal is to link the sequentiality of f R with the fact that R gives enough look-ahead to have a bimachine with R as a right automaton. We begin with the easy direction. Proposition 2.2.23. Let f be a transduction and let R be a right automaton recognizing dom(f ).

Algebraic characterization of rational functions

q 0 q 1 q 2 (α, r β )|βα (α, r β )|α (α, r )| (α, r )|α α, β ∈ {a, b}
If ∼ R f has finite index then f R is sequential.
Proof. Let f be such that ∼ R f has finite index. Then according to Cor. 2.2.12 there exists a bimachine B = (L, R, i , o, t) with L = (Q L , ∆ L , l 0 , F L ) realizing f . Let us consider the sequential transducer T := (A, i , o , t ) with A := (Q, ∆, I, F ) defined by:

• Q := {q 0 } Q L × Q R • ∆ := {((l, r ), (a, r), (l , r)) | (l, a, l ) ∈ ∆ L , (r , a, r) ∈ ∆ R } ∪ {(q 0 , (a, [u] R ), (l , [u] R )) | (l 0 , a, l ) ∈ ∆ L , au ∈ dom(f )} • I := {q 0 } • F := F L × {r 0 } (or F L × {r 0 } ∪ {q 0 } if ∈ dom(f ))
• i (q 0 ) =

• o ((l, r ), (a, r), (l , r)) := o(l, a, r) and o (q 0 , (a, [u] R ), (l

, [u] R )) := i ([au] R )o(l 0 , a, [u] R ) • t (l) := t(l) (and t (q 0 ) := i (r 0 )t(l 0 ) if ∈ dom(f ))
Example 2.2.24. Let f last be the function defined by f (uα) = αu, for α ∈ A = {a, b} and u ∈ A * . We consider the right automaton R given in Fig. 2.6 and give a transducer realizing f last,R in the same figure. Notice that f last is not sequential while f last,R is.

We can now consider the converse result, which is harder to show. We give a constructive proof of the result by exhibiting when possible a bimachine with R as a right automaton. As a side result, we show that this construction preserves aperiodicity.

Lemma 2.2.25. Let T be a transducer realizing a function f and let R be a right automaton recognizing dom(f ). If f R is sequential then ∼ R f has finite index. In that case one can compute B f (R) in 2 ExpTime. Furthermore if T and R are aperiodic then B f (R) also is.

Chapter 2. Characterizations of rational functions over finite words

Proof. Let T = (A, i , o, t) with A = (Q, ∆, I, F ) be a transducer realizing a function f , let R = (Q R , ∆ R , I R , {r 0 }) be a right automaton recognizing dom(f ) and let us assume that f R is sequential. Let us describe the steps of the proof.

Step 1) we construct a transducer realizing f R by taking the product of T and R.

Step 2) we determinize this transducer using the powerset construction with delays of [BC02], in ExpTime. We thus obtain S a sequential transducer realizing f R , of exponential size with respect to T .

Step 3) we project the input alphabet of S, which is A × Q R , to A, to obtain a transducer realizing f . Step 4) we consider the product automaton of the underlying automaton of this transducer with R, and determinize it, using the usual powerset construction, again with an ExpTime complexity to obtain a deterministic automaton D. We are then able to exhibit a bimachine with D and R as automata realizing f . Finally we left minimize this bimachine to obtain

B f (R) (recall that ∼ R f = ∼ L f ).
We also show that each of the four steps preserves aperiodicity.

1) From T and R we can obtain a transducer realizing f R , by just taking T and using the states of R to label the input. Let T := (A , i , o , t ) with A := (Q , ∆ , I , F ) be defined by:

• Q := Q × Q R • ∆ := {((p, s), (a, r), (q, r)) | (p, a, q) ∈ ∆, (s, a, r) ∈ ∆ R } • I := I × I R • F := F × {r 0 } • i (q, r) := i (q)
• o ((p, s), (a, r), (q, r)) := o(p, a, q)

• t (q, r) := t(q) By construction T realizes f R . Let us assume that A and R are aperiodic, and let us show that A then must be aperiodic also. Let u ∈ (A × Q R ) * be a word and let u denote the projection of u onto the alphabet A. Let p, q be states of A and let v ∈ A * . We assume that we have for some integer n, (p, [

u n v] R ) u n --→ (q, [v] R )
. By construction of A , we know that the last letter of u is (a, [v] R ) for some a ∈ A. If n > 1, then from the definition of A , we know that we must have [ux] = [x]. By aperiodicity of A we know that p = p 0 u -→ p 1 . . . p n u -→ p n+1 = q, for n large enough. We have for any 0

≤ k ≤ n that (p k , [v] R ) u -→ (p k+1 , [v] R ). Hence we can conclude that (p, [v] R ) u n+1 ---→ (q, [v] R ) which means that A is aperiodic.
2) We use the powerset construction of [BC02] on T , presented in Sec. 2.1, to obtain a sequential transducer S realizing f R in ExpTime, since f R is sequential by assumption. According to Lem. 2.1.15, this procedure preserves aperiodicity.

3) We project away the labels of the input letters of S to obtain a transducer realizing f . Furthermore this transducer is unambiguous, otherwise some word would have two distinct labelings. Let us show that this procedure preserves aperiodicity. Let A S be the deterministic underlying automaton of S , which we assume to be aperiodic. We consider A S , the same automaton but with the input labels projected onto A. Let u ∈ A * , let p, q be states of A S , let n be a positive integer such that p u n --→ A S q. Let v ∈ A * be a word such that there is a final run of A S over v from q. This means that there is a labeling z of u n , i.e. z = u n , ending in (a, [v] R )

Algebraic characterization of rational functions

for some a ∈ A, such that: p z -→ A S q. Since R is aperiodic, we know that for m large enough, u m v ≈ R u m+1 v. Let y be the labeling of u with last letter (a, [u m v] R ), then z = y k z with z a labeling of u m . By aperiodicity of A S , if k is large enough we have a run p y k+1 z ----→ A S q. Since y k+1 z = u n+1 , we finally have p u n+1 ---→ A S q, which concludes the proof.

4)

Let us consider the product of automata A S and R, and let D be the automaton obtained by the usual powerset construction of automata. This construction preserves aperiodicity, and is in ExpTime. We only have left to show that we can obtain a bimachine realizing f with D and R as automata. Indeed, if it is the case and D is aperiodic, we have according to Th. 2.2.11 that D L f (R) which means that B is aperiodic a fortiori.

Let S = (A S , i S , o S , t S ) with A S = (Q S , ∆ S , {q 0 } , F S ). Let us define the output functions of

B := (D, R, i B , o B , t B ). Let i ([u] R ) := i S (q 0 ). Let P := {(p 1 , [v 1 ] R ), . . . , (p n , [v n ] R )} be a state of D, let a ∈ A and let v ∈ A * , we define o B (P, a, [v] R ) := o S (p i , (a, [v]), q) such that v i ≈ R av and (p i , (a, [v] R ), q) ∈ δ S . Let us show that o B is well-defined. Let i, j ∈ n, such that v i = v j = av.
This means that there exists a word which can reach both p i and p j in A S and that there is a final run over v from both p i and p j . Since A S is unambiguous, we have p i = p j . Furthermore, since A S is deterministic, the state q is uniquely defined. Let t(P ) := t S (p i ) such that p i is final. Again, by the unambiguous nature of A S , this state is uniquely defined. One can easily see that the outputs of B exactly match those of S, which means that B realizes f . We now obtain the result linking the existence of a bimachine realizing a function f with right automaton R, with the sequentiality of f R .

Theorem 2.2.26. Let f be a transduction and let R be a right automaton recognizing dom(f ). There exists a bimachine realizing f with right automaton R if and only if f R is sequential.

Proof. This is a consequence of Prop. 2.2.23 and Lem. 2.2.25.

Canonical bimachine and characterization

Here we define the second key notion from [START_REF] Reutenauer | Minimization of rational word functions[END_REF], the delay congruence of a function. This congruence yields the coarsest look-ahead possible to realize the function sequentially. Combining this with the previously introduced minimization, the authors of [RS91] obtained a canonical bimachine for rational functions. Refining their method, we show that the number of minimal bimachines of a rational function is finite, which was conjectured in [START_REF] Reutenauer | Minimization of rational word functions[END_REF]. Since we bound the size of all minimal bimachines, we obtain an algorithm to decide C-rationality (for a decidable C).

Delay congruence

Definition 2.2.27. Let f : A * → B * be a function, the left delay congruence of f is defined for

u, v ∈ A * by u ∆ ≈f v if: • dom(f )u -1 = dom(f )v -1 • sup { f (wu), f (wv) del | wu ∈ dom(f )} < ∞ (recall that x, y del = |x| + |y| -2|x ∧ y|)
Furthermore, let R f denote the right automaton with left transition congruence ∆ ≈f and recognizing dom(f ).

First we show that this left congruence is coarser than any left transition congruence of a machine realizing a given function.

Theorem 2.2.28. Let T (resp. B) be a transducer (resp. bimachine) with underlying automaton A (resp. right automaton R) realizing a function f . Then

≈ A ∆ ≈f (resp. ≈ R ∆ ≈f ).
Proof. We give the proof for a bimachine, the proof for a transducer can be obtained as a consequence of Th. 2.2.15. Let B = (L, R, i , o, t) be a bimachine and let u ≈ R v, we want to show that u

∆ ≈f v. Since ≈ R recognizes dom(f ) we have dom(f )u -1 = dom(f )v -1 . Let w ∈ dom(f )u -1 ,
let us bound the size of del(f (wu), f (wv)). We have that f (wu

) = i ([wu] R )o([ ] L , w, [u] R )o([w] L , u, [ ] R )t([wu] L ) and since u ≈ R v we also have that f (wv) = i ([wu] R )o([ ] L , w, [u] R )o([w] L , v, [ ] R )t([wv] L ). If we remove the longest common prefix, we ob- tain that del(f (wu), f (wv)) ≤ |o([w] L , u, [ ] R )t([wu] L )| + |o([w] L , v, [ ] R )t([wv] L )| ≤ k(|u| + |v| + 2)
where k is the maximum size of words in the range of i , o, t. Finally we obtain sup w∈A * f (wu), f (wv

) del ≤ k(|u| + |v| + 2) < ∞ which means that u ∆ ≈f v.
We now show how to compute the right automaton R f . Theorem 2.2.29. Let B be a bimachine realizing a function f . One can compute R f in PTime.

Proof. Let B = be a bimachine with left and right automata L and R, respectively. According to Th. 2.2.28, we know that R R

f . Let [u 1 ] R , [u 2 ] R be two states of R, we can choose u 1 , u 2 of size linear in Q R . Thus we only have to show how to decide if u 1 ∆ ≈f u 2 in PTime. First we can easily check that dom(f )u -1 1 = dom(f )u -1
2 . Now we want to check whether we have sup w∈A * f (wu 1 ), f (wu 2 ) del < ∞. From B, for any word x ∈ A * we can easily construct a transducer T x which realizes the function f x : w → f (wx). We can take the transducer T obtained from B by the construction of Prop. 2.2.3, we set as final states the states from which T has a final run over x, and we define the final output function to recover the missing output of x. Thus deciding whether u 1 ∆ ≈f u 2 amounts to deciding if f u1 , f u2 del := sup w∈A * f u1 (w), f u2 (w) del < ∞.

We define a twinning-like property which will be equivalent to f u1 , f u2 del < ∞. This notion is equivalent to that of adjacent functions defined in [START_REF] Reutenauer | Minimization of rational word functions[END_REF]. Let T 1 and T 2 be two transducers with the same domain. We say that T 1 and T 2 satisfy the adjacency twinning property if for any pair of initial runs p 1 x|α1 ---→ T1 q 1 y|β1 ---→ T1 q 1 and p 2 x|α2 ---→ T2 q 2 y|β2 ---→ T2 q 2 such that there is a word z with a final run from both q 1 and q 2 we have: ---→ T1 q 1 y|β1 ---→ T1 q 1 and p 2 x|α2 ---→ T2 q 2 y|β2 ---→ T2 q 2 be two initial runs such that there is a word z with a final run from both q 1 and q 2 and:

del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ) Claim: T 1 , T 2 del < ∞ if
del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ).
Then we obtain that for any integer n, f u1 (xy n z), f u2 (xy n z) del < f u1 (xy n+1 z), f u2 (xy n+1 z) del and hence f u1 , f u2 del = ∞. Conversely, let us assume that T 1 and T 2 satisfy the adjacency twinning property. This basically means that over synchronized loops, the delay between T 1 and T 2 cannot increase. For any word, one can decompose its runs over T 1 and T 2 into small parts of bounded size and a bounded number of synchronized loops. Overall, the delay must stay bounded. Now we only have left to show that one can decide the adjacency twinning property in PTime. To do this we use the result of [START_REF] Filiot | A pattern logic for automata with outputs[END_REF] which allows to state properties of transducer and check them in PTime (actually NLogSpace), for a fixed property. The formalism used is called pattern logic and allows to quantify over runs of a machine and express constraints on these runs, their input and their output. Using the syntax of the article and considering the union of the two transducers, the adjacency twinning property is expressed by (the negation of):

∃π 1 : p 1 x|α1 ---→ q 1 , ∃π 1 : q 1 y|β1 ---→ q 1 , ∃π 1 : q 1 z|γ1 --→ r 1 , ∃π 2 : p 1 x|α2 ---→ q 2 , ∃π 2 : q 2 y|β2 ---→ q 2 , ∃π 1 : q 1 z|γ2 --→ r 2 , init(p 1 ) ∧ init(p 2 ) ∧ final(r 1 ) ∧ final(r 1 ) ∧ SDel = (α 1 , β 1 , α 2 , β 2 )
Note that the only difference with the twinning property is that the word z has to be the same for the two runs. Thus we have a PTime algorithm, which concludes the proof.

Canonical bimachine

We now show that R f always gives a sufficient look-ahead to realize the function f , by exhibiting the canonical bimachine of [START_REF] Reutenauer | Minimization of rational word functions[END_REF]. The bimachine B f (R f ) is called the canonical bimachine of f . Theorem 2.2.30. Let f be a rational transduction, then B f (R f ) is finite.

Proof. Using Lem. 2.2.25, we only have to show that f R f is sequential. For this we use the twinning property of [START_REF] Choffrut | Une caracterisation des fonctions sequentielles et des fonctions sous-sequentielles en tant que relations rationnelles[END_REF]. A transducer T (assumed trim) is said to satisfy the twinning property if for any words u, v ∈ A * , for any initial runs

p 1 u|α1 ---→ q 1 v|β1 ---→ q 1 and p 2 u|α2 ---→ q 2 v|β2 ---→ q 2 , we have del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ).
According to [Cho77, Proposition 3.4], a transducer realizes a sequential sequential function if and only if it satisfies the twinning property. Let T be a trim transducer realizing f R f , and let us assume that T does not satisfy the twinning property. Let u, v ∈ (A × Q R ) * be annotated words and let p 1 u|α1 ---→ q 1 v|β1 ---→ q 1 and p 2 u|α2 ---→ q 2 v|β2 ---→ q 2 be initial runs such that we have

del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ). Let (a, [w] R f ) ∈ A × Q R f be the last let- ter of v. Let x 1 ,
x 2 be two words over which there is a final run from q 1 and q 2 , respectively. Then, since uvx 1 , uvx 2 ∈ dom(f R f ) we must have

x 1 ≈ R f w ≈ R f x 2 . Hence we obtain that for any n, f R f (uv n x 1 ), f R f (uv n x 2 ) del < f R f (uv n+1 x 1 ), f R f (uv n+1 x 2 ) del . Finally we have sup n∈N f (uv n x 1 ), f (uv n x 2 ) del = ∞ which is in contradiction with x 1 ≈ R f x 2 , and f R f is sequential.
From this theorem we are now able to show that R f is the minimal look-ahead automaton needed to realize the function f . Theorem 2.2.31. Let f be a function and let R be a right automaton recognizing dom(f ). There exists a bimachine with R as right automaton if and only if R R f . Proof. Let f be a transduction realized by a bimachine with right automaton R. According to Th. 2.2.28, we have R R f . Let R be a right automaton recognizing dom(f ) such that R R f . Then since B f (R f ) is a bimachine realizing f , we can obtain from Lem. 2.2.19 a bimachine realizing f with R as right automaton.

However the canonical bimachine does not capture all the algebraic properties of a transduction in general.

Proposition 2.2.32. There exists a class of congruences C and a function f such that f is a C-transduction and the canonical bimachine of f is not a C-bimachine.

Proof. Let C = I. The function f idem is sequential and has a total domain, thus its minimal right automaton is trivial. This means that the left automaton of its canonical bimachine is simply the underlying automaton of its minimal sequential transducer, given in Fig. 2.2 on page 30. This automaton is not idempotent, however the bimachine of Fig. 2.5 on page 43 is idempotent and realizes f idem .

Example 2.2.33. If we consider the function f swap , then its canonical bimachine is actually the bimachine given in Ex. 2.2.1. One can also show that it is the only minimal bimachine of the function since L fswap = L fswap (R fswap ). Since this bimachine is not a J-bimachine, this means that f swap is not in J.

Bounding minimal bimachines As we have seen, looking at the canonical bimachine is not enough to decide C-rationality in general, and we might need to consider all minimal bimachines.

Here we show that we can bound the size of all minimal bimachines realizing a given function f . We start by comparing the size of a minimal bimachine with respect to the canonical bimachine.

Theorem 2.2.34. Let B be a minimal bimachine with left automaton L realizing a function f . Then L f (R f ) L.

Proof. Intuitively, since R f is coarser than any right automaton of a bimachine realizing f , then L f (R f ) is the finest minimal left automaton on could need to realize f . Let B be a minimal bimachine with automata L and R realizing a function f . By minimality of B, we know that L f (R) = L. According to Th. 2.2.28, we have R R f and from Lem. 2.2.20 we thus obtain that

L = L f (R) L f (R f ).
In particular, we obtain a bound on the size of the minimal bimachines.

Theorem 2.2.35. Let B be a bimachine realizing a function f . Then any minimal bimachine realizing f has size at most 2-exponential in the size of B.

Proof. Let B be a bimachine realizing a function f . From Th. 2.2.28, we know that R f is smaller than B's right automaton. From Lem. 2.2.25 we know that the size of L f (R f ) is at most 2exponential in the size of B. Symmetrically we can bound the size of R f (L f ) in the same way. Overall, from Th. 2.2.34, we know that the size of a minimal bimachine is at most 2-exponential in the size of B.

Example 2.2.36. We give an example of a minimal bimachine which is exponentially larger than an equivalent bimachine. Let A = {a, b}, let n ∈ N and let f n (uv) := v for u ∈ A * and v ∈ A n and f n (v) = v if |v| < n. The function f n is both sequential and right-sequential. However, while a right sequential transducer only needs n + 1 states to realize f n , a sequential transducer needs 2 n+1 -1 states since it needs to remember the last n letters read.

Remark 2.2.37. We have shown in Ex. 2.2.36 that a minimal bimachine may be exponentially bigger than another bimachine. However, Th. 2.2.35 gives a doubly exponential upper bound. Up until now we still don't know if this upper bound is met or not.

Deciding C-rationality We now state our main result of this section, the decision of Crationality for rational functions.

Theorem 2.2.38. Let C be a decidable class of congruences such that one can decide if an automaton A is in C in space K(|A|). Then one can decide if a bimachine B realizes a C-rational function with space K(2 2 P (|B|) ) for some polynomial P .

Logical transducers

Proof. Let C be a decidable class, and let f be a transduction given as a bimachine B. Since the size of any minimal bimachine of f is at most 2-exponential in the size of B (Th. 2.2.35), one can enumerate all the minimal bimachines of f with 2-exponential space and test whether one of them is in C or not. By property of minimality, and since C is closed under coarser congruences, there exists a C-bimachine realizing f if and only if there exists a minimal bimachine of f in C. Furthermore according to Cor. 2.2.16, a transduction is a C-transduction if and only if it is realized by a C-bimachine, which concludes the proof.

Deciding aperiodicity According to [START_REF] Cho | Finite-automaton aperiodicity is PSpace-complete[END_REF], testing aperiodicity of an automaton, and hence a bimachine is PSpace-complete. Hence with the algorithm presented in Th. 2.2.38 we can decide A-rationality in 2ExpSpace. However, by the robustness of A to determinization, we are able to improve this complexity.

Theorem 2.2.39. A rational transduction is aperiodic if and only if its canonical bimachine is.

Proof. If f 's canonical bimachine is aperiodic then f is aperiodic. Let us assume that f is realized by an aperiodic transducer T . Then according to Th. 2.2.28, R f is aperiodic as well. Thus from Lem. 2.2.25, we obtain that the canonical bimachine of f is aperiodic. This tells us that instead of computing all minimal bimachines of f and test them for aperiodicity, one only needs to compute the canonical bimachine. However, since deciding aperiodicity of a bimachine is PSpace-complete, this stills yields a 2ExpSpace complexity.

Theorem 2.2.40. A rational transduction is aperiodic if and only if all its minimal bimachines are aperiodic.

Proof. Let us show the one non-trivial direction. Let f be an aperiodic transduction, and let B be a minimal bimachine of f . According to Th. 2.2.39, we know that B f (R f ) is aperiodic, and hence L f (R f ) is aperiodic. Symmetrically, we have that R f (L f ) is aperiodic. From Th. 2.2.34, we obtain that the left and right automata of B are coarser than L f (R f ) and R f (L f ), respectively, and are thus aperiodic.

We obtain our second main result of this section: Theorem 2.2.41. Deciding if a bimachine realizes an aperiodic function is PSpace-complete.

Proof. From [START_REF] Cho | Finite-automaton aperiodicity is PSpace-complete[END_REF] we know that the problem is PSpace-hard. Let B be a bimachine with right automaton R, then from Th. 2.2.14 one can obtain the bimachine B := R f (L f (R)) in PTime. Furthermore from Th. 2.2.22, B is a minimal bimachine for f . Finally from Th. 2.2.40, we know that f is aperiodic if and only if B is, which we can check in PSpace ([CH91]).

Remark 2.2.42. We leave open the question whether one can decide the same problem in PSpace when the input is given as a transducer. Deciding whether an automaton recognizes an aperiodic language can be done in PSpace (see [START_REF] Diekert | First-order definable languages, Logic and Automata: History and Perspectives[END_REF]), however the proof does not seem to transfer straightforwardly to transducers.

Logical transducers

The goal of this section is to establish a transfer theorem of logic-algebra equivalences from languages to functions. We start by defining, for a logical fragment F, 2-F transducers, an ad hoc model of logical transducers which exactly coincides with bimachines. Then we give sufficient conditions under which 2-F transducers and F are equivalent. Under some conditions on a logical fragment F equivalent to some decidable class of congruences C, we thus obtain an algorithm to decide F-definability of rational functions, using the result of Section 2.2. In particular we show the decidability of FO-definability of rational functions.

2-F transducers

We define 2-F transducers, a different formalism from F-transducers defined in Section 1.5.2, and show their equivalence with C-transducers, under the equivalence of F-languages and Clanguages.

Pairs of formulas

We define pairs of formulas, a logical formalism for pointed languages, where the first component talks about the prefix of the word up to the pointed position and the second component talks about the suffix from the pointed position. Let F be a logical fragment of MSO[≤], we define 2-F-sentences over an alphabet A by the following grammar, where φ denotes an F-sentence and a ∈ A:

F ::= F ∨ F | (φ, φ) a

Let us define by induction on 2-MSO[≤]

sentences what it means for a pointed word to satisfy a 2-MSO[≤] sentence. Let (u, i) be a pointed word over A and let F = (φ 1 , φ 2 ) a be a 2-MSO[≤] atomic sentence. Then we say that (u, i) |= F if the following three conditions are satisfied: 1)

u(i) = a 2) u(:i -1) |= φ 1 and 3) u(i + 1:) |= φ 2 . Let F := F 1 ∨ F 2 , then (u, i) |= F if either (u, i) |= F 1 or (u, i) |= F 2 .
Example 2.3.1. We define the same pointed language as in Ex. 1.5.6, F a,middle := (∃x , ∃x ) a . This 2-formula states that the pointed position is labeled by a and that the prefix and suffix are not empty.

2-transducers

We define an alternative formalism of logical transducers from the one defined in Section 1.5.2. Let F be a fragment of MSO[≤], a 2-F transducer over an alphabet A is a tuple T = K, φ dom , (φ α ) α∈K where K is a finite subset of A * , φ dom is an F-sentence, called the domain formula, and for each α ∈ K, φ α is a 2-F sentence. The semantics is defined exactly as for F-transducers.

2-F transducers and C-bimachines

Pure machines A transducer or a bimachine is called pure if its initial and final outputs are all equal to . A class of congruences C is called pure if for any alphabet A, { } is a C(A)-language. In other words a class C is pure if for any alphabet A, the congruence

≡ := {(u, v) | u, v = } ∪ {( , )} is in C(A).
Proposition 2.3.2. Let C be a pure class of congruences, then any C-transduction can be realized by a pure C-bimachine.

Proof. Let C be a pure class. Let B = (L, R, i , o, t) be a bimachine realizing a function f , with C-automata L := (Q L , ∆ L , {l 0 } , F L ) and R := (Q R , ∆ R , I R , {r 0 }). We define L by taking ∼ L := ∼ L ≡ and we define R the same way. Since C is pure, and is closed under intersection, we have that L and R are still C-automata. We define a new C-bimachine B := (L , R , i , o , t ) by i : r → , t : l → . Let u, v ∈ A + be non-empty words and let a ∈ A be a letter, we define the new output function by:

• o ([ ] L , a, [ ] R ) := i ([a] R )o([ ] L , a, [ ] R )t([a] L ) • o ([ ] L , a, [v] R ) := i ([av] R )o([ ] L , a, [v] R ) • o ([u] L , a, [ ] R ) := o([u] L , a, [ ] R )t([ua] L ) • o ([u] L , a, [v] R ) := o([u] L , a, [v] R )
By construction the pure C-bimachine B realizes f , which concludes the proof.

Theorem 2.3.3. Let C be a pure class of congruences equivalent to some logical fragment F. Then C-transductions are exactly the 2-F transductions.

Proof. Let B = (L, R, i , o, t), be a C-bimachine realizing a function f . Since C is pure, we can assume from Prop. 2.3.2 that B is pure. Since L and R are C-automata, we have for any word w ∈ A * that [w] L and [w] R are C-languages. From the equivalence between C and F, there exist F-formulas φ [w] L and φ [w] R recognizing these languages, respectively. We define the 2-F transducer T := K, φ dom , (φ α ) α∈K by:

• K := {o([u] L , a, [v] R ) | a ∈ A, u ∈ A * , v ∈ A * } • φ dom := u∈dom(f ) φ [u] L • φ α := o([u] L ,a,[v] R )=α (φ [u] L , φ [v] R ) a
We thus obtain a 2-F transducer realizing f . Let T = K, φ dom , (φ α ) α∈K be a 2-F transducer. Let α ∈ K and let us write the 2-F formula φ α = i∈nα (φ α,i , ψ α,i ) aα,i . For a formula φ, we define ≡ φ the syntactic congruence of φ . By equivalence between C and F, the congruences ≡ φα,i and ≡ ψα,i are in C. Let L be the left automaton recognizing dom(f ) with right transition congruence ≡ φ dom α,i∈nα ≡ φα,i . Symmetrically we define R as the right automaton recognizing dom(f ) with right transition congruence ≡ φ dom α,i∈nα ≡ ψα,i . We define the pure C-bimachine B := (L, R, i , o, t), with o([u] L , a, [v] R ) := α if there is i ∈ n α such that (uav, |u| + 1) |= (φ α,i , ψ α,i ) aα,i . By construction B realizes f which concludes the proof.

Logic-algebra transfer result

Here we give sufficient conditions on a fragment F so that 2-F and F c (the pointed version of F, see Section 1.5.2) recognize the same pointed languages. This means, according to Th. 2.3.3, that these conditions are sufficient to transfer a logic algebra equivalence from languages to functions.

Languages over a pointed alphabet A pointed word over an alphabet A can alternatively be seen as a words over an extended alphabet A Ȧ. Of course not all words over this extended alphabet are pointed words, but in most logics one can define a formula to enforce the existence of a unique pointed position. A language L over the extended alphabet A Ȧ is called pointed if any word of L has exactly one position with a pointed letter, i.e. L ⊆ A * ȦA * .

Example 2.3.4. Let A = {a, b} be an alphabet, we define a formula φ pointed := ∃x Ȧ(x)∧∀y y = x ∨ A(y), where A(x) is a macro defined as a∈A a(x). We define the same language as in Ex. 1.5.6, but seen as a language over a pointed alphabet: φ a,middle := φ pointed ∧ ∃x ȧ(x) ∧ ¬ min(x) ∧ ¬ max(x).

Chapter 2. Characterizations of rational functions over finite words

Property (4) is satisfied since φ empty := ∀x ⊥ defines the language { }. The same arguments work for FO[≤], and adapting them slightly gives a proof for BΣ 1 [≤]. Now we have all the ingredients to state the main result of this section.

Theorem 2.3.12. Given a bimachine realizing a function f , one can decide if f is:

• FO[≤]-definable (in PSpace) • FO 2 [≤]-definable • BΣ 1 [≤]-definable
Proof. The equivalence between FO[≤] and A is due to [START_REF]On finite monoids having only trivial subgroups[END_REF][START_REF] Mcnaughton | Counter-free automata[END_REF]. In [START_REF] Thérien | Over words, two variables are as powerful as one quantifier alternation[END_REF], the authors show the equivalence between FO 2 [≤] and DA. The equivalence between BΣ 1 [≤] and J is partly due to [START_REF] Simon | Piecewise testable events[END_REF] and can be found in [START_REF] Volker Diekert | A survey on small fragments of first-order logic over finite words[END_REF]. From Prop. 2.3.11 and Th. 2.3.10 we have that these equivalences transfer to transductions. Furthermore the equivalences described above are effective, meaning that classes of congruences A, DA and J are decidable. Hence from Th. 2.2.38, we obtain our result. In the particular case of FO[≤], Th. 2.2.41 says that one can decide FO[≤]definability in PSpace.

Chapter 3

Characterizations of rational functions over infinite words "Le café est un breuvage qui fait dormir quand on n'en prend pas."

-Alphonse Allais

Rational ω-languages inherit many of the good properties of rational languages over finite words. Most of the celebrated results for rational languages over finite words have been successfully transferred to infinite words, often at some cost, if not conceptual then at least technical. Our goal is to apply the same program as for rational functions over finite words. With this plan in mind, new difficulties arise (we count four main ones) which can be classified into three categories: those that we overcome with a satisfying solution, those that are overcome but at some cost of elegance or importance and those which we have not been able to overcome yet.

Our first obstacle manifests itself already for sequential ω-functions, and even for rational ω-languages. As we mentioned in Chap. 1, the link between right congruences and deterministic automata is not as tight for ω-languages as it is in the finite case. Concretely, there is no canonical (nor indeed minimal) deterministic automaton recognizing a given ω-language. Somewhat surprisingly we are however able to circumvent this issue for sequential ω-functions. We show, in some precise way, that the problem of realizing a sequential transduction with a minimal device and the problem of recognizing the domain of the function can be considered independently, and we are thus able to minimize sequential ω-transducers.

Although finding a suitable notion of right-sequential transducer is not straightforward, Carton proposed in [START_REF] Carton | Right-sequential functions on infinite words[END_REF] a solution based on prophetic automata (see [START_REF] Carton | Unambiguous Büchi automata[END_REF]). This solution seems natural and in [START_REF] Carton | Right-sequential functions on infinite words[END_REF] the author even obtained an Elgot-Mezei theorem for rational functions over infinite words.

Perhaps the biggest issue in the case of ω-functions, is the breaking of the symmetry between sequential and right sequential ω-functions. However, we have not been able to obtain a canonical way to realize a right sequential function. This problem transfers to bimachines where we are able to minimize left automata with respect to a fixed right automaton, but not the other way around. This problem does not seem easy to overcome, which gives little hope of characterizing all minimal bimachines for rational ω-functions.

Our third issue is the definition of the delay congruence which does not make sense when applied directly to infinite words. Using a slight variation, originating from [BLN12], we are however able to recover this congruence which has the same minimality property as in the finite case. However, this congruence just falls short of giving enough information to realize a function sequentially, in the general case, which brings us to the fourth issue.

In order to compensate for the lack of information given by the delay congruence, we define a second canonical look-ahead congruence, which we call the ultimate congruence, and which does give enough information to realize any function sequentially. We thus regain a canonical bimachine for rational ω-functions. This ultimate congruence comes at some cost however, since we have not been able to show any minimality property. Obtaining a minimal look-ahead automaton would be much more satisfying (especially since we have not been able to characterize the minimal bimachines) and we are still working towards this goal.

Let us now describe the results of this section. The first is the extension of the minimization results of sequential functions (from [START_REF]Minimizing subsequential transducers: a survey[END_REF]) to sequential ω-functions. The second result is an Elgot-Mezei theorem for rational ω-functions, which was already half-obtained in [START_REF] Carton | Right-sequential functions on infinite words[END_REF]. Our third result is the definition of a canonical look-ahead which gives, together with a left minimization procedure, a canonical bimachine to realize a rational ω-transduction. Finally we show that this canonical bimachine is aperiodic for any aperiodic transduction which gives, as a corollary, a procedure to decide FO-definability of rational ω-transductions.

Sequential and quasi-sequential functions

Here we extend the results from [START_REF]Minimizing subsequential transducers: a survey[END_REF] to sequential ω-functions. Given a sequential ω-function f we define the minimal sequential transducer realizing an extension of f . We show that this minimal transducer is coarser than any transducer realizing f , and we show how to obtain this minimal transducer in PTime, from a sequential transducer realizing f . The main difference with the finite case is that one cannot define a minimal automaton recognizing a given rational ω-language. To circumvent this issue we extend any sequential function over the topological closure (for the prefix distance) of its domain, in a canonical way.

Another difference with the finite case is that having a syntactic right congruence of finite index is no longer sufficient for a function to be sequential, but rather characterizes a larger class of functions that we call quasi-sequential. Quasi-sequential functions can be thought of as the generalization of sub-sequential transductions from finite words to infinite words. A function is quasi-sequential if it can be realized by a sequential transducer extended with the possibility to append a (possibly infinite) word at the "end" of the computation. It turns out that quasi-sequential functions are exactly the functions for which the determinization procedure from [BC04] terminates. However the procedure is not always correct when the function is not sequential. We also show, just like for the finite case, that determinization preserves aperiodicity of ω-transducers.

Algebraic characterization of sequential functions

We define the right syntactic congruence of an ω-function. For that we need the notions of infimum and liminf of a function. As we show below, the liminf of a sequential function extends it over the topological closure of its domain. The minimality result we obtain holds for liminfs but we also show that the minimal sequential transducer for a liminf is coarser than any sequential transducer realizing the original function.

Inf and liminf Let A, B be alphabets. Let f : A ω → B ∞ be a partial function. We define

f : A * → B ∞ the infimum of f over ↓dom(f ) ∩ A * by f (u) := {f (ux) | ux ∈ dom(f )}.
Intuitively, f outputs over a word u the longest possible word, knowing that the input begins with u. We also define f : A ω → B ∞ the limit infimum of f over dom(f ) by f (x) := lim u<x f (u).

Example 3.1.1. Let f erase : (a * (b + c)) ω → (b + c) ω be the function which erases as of infinite words with an infinite number of non a letters over A = {a, b, c} (given in Fig. 3.1 on the preceding page). f erase : A * → (b + c) * is simply the morphism which erases as and leaves b and c unchanged. Thus f erase is defined over dom(f ) = A ω and erases as and leaves bs and cs unchanged. The function f erase can be given by the transducer of Fig. 3.1 on the facing page, by making all states final. We can see that the sequential function f erase extends the sequential function f erase .

Let f #a : (a + b) ω → (a + b) ω be defined by f #a (x) = a ω if a ∈ Inf(x) and f #a (x) = b ω otherwise. Here for any finite word u, we have f #a (u) = , and hence for any infinite word x we have f #a (x) = , thus f #a does not extend f #a .

Let A = {a, b}, let u n ∈ AA + for any n ∈ N and let x = n∈N (u n #), we define f blocks :

(AA + #) ω → (a + b + #) ω by f blocks (x) = n∈N (f swap (u n )#). Then we obtain the infi- mum function f blocks (u 1 # • • • #u n ) = f swap (u 1 )# • • • #f swap (u n-1 )#. Let x ∈ A ω ,
then the liminf extends f blocks over words with a finite number of #s, by

f blocks (u 1 # • • • #u n #x) = f swap (u 1 )# • • • #f swap (u n-1 )#.
Here we show that the liminf of a sequential function is an extension of it.

Proposition 3.1.2. Let f be a sequential ω-function, then f |dom(f ) = f . Proof. Let T = (A, i , o) be a sequential transducer realizing a function f : A ω → B ∞ , and let x ∈ dom(f ). Let us first remark that f (x) ≤ f (x). If f (x) is a finite word then we have the initial run q 0 u|α --→ p, with i (q 0 )α = f (x) for some u < x. Thus we have f

(x) ≤ f (u) ≤ f (x) ≤ f (x).
Let us now assume that f (x) is infinite and let q 0 x(:n)|αn -----→ p n denote the initial run of the prefix of x of size n ∈ N. We have that i (q 0 )α n ≤ f (x(:n)) for any n ∈ N, and by taking the limit we obtain: f (x) ≤ f (x) and thus f (x) = f (x).

Remark 3.1.3. From this we deduce that the function f #a given in Ex. 3.1.1 is not sequential. Since the function f blocks is not sequential, we also deduce that the above condition is necessary but not sufficient to be sequential.

Syntactic congruence Definition 3.1.4. The syntactic congruence of a function

f : A ω → B ∞ is defined by u ∼ f v if: • u -1 dom(f ) = v -1 dom(f ).
• either f (u) and f (v) are both infinite and ultimately equal, or ∀x ∈ A ω , such that ux, vx ∈ dom(f ) we have f

(u) -1 f (ux) = f (v) -1 f (vx).
Proposition 3.1.5. Let f : A ω → B ∞ be a rational ω-function, then ∼ f is a right congruence.

Proof. The proof goes almost like in the finite case. Let f : A ω → B ∞ be a rational ω-function, let u ∼ f v and let a ∈ A. We want to show that ua ∼ f va. First (ua) -1 dom(f ) = (va) -1 dom(f ). Let x ∈ A ω such that uax, vax ∈ dom(f ). If f (u) and f (v) are ultimately equal, then it is also the case for f (ua) and f (va). If f (u) and f (v) are finite then let g(y)

:= f (u) -1 f (uy) = f (v) -1 f (vy).
If y g(ay) is infinite then it is an infinite suffix of f (ua) and f (va) which are thus ultimately equal. Let us assume y g(ay) is finite:

f (ua) -1 f (uax) = y f (uay) -1 f (uax) = y f (u)g(ay) -1 f (u)g(ax) = f (u) y g(ay) -1 f (u)g(ax) = y g(ay) -1 g(ax) = f (va) -1 f (vaw)
Hence ua ∼ f va which concludes the proof.

Example 3.1.6. We compute for the three functions of Ex. 3.1.1 the right syntactic congruence.

We have for any word ux ∈ A ω that f erase (u) -1 f erase (ux) = f erase (x), and thus for any finite words u, v we have u ∼ ferase v. Hence ∼ ferase is just the trivial congruence.

Similarly we have f #a (u) -1 f #a (ux) = f #a (x), and thus ∼ f #a is also trivial. Let u ∈ (a+b) * , α ∈ (a+b), and let x := (#aa) ω then we have f blocks (αuα) -1 f blocks (αuαx) = f blocks (αuαx) = αuαx, which means that the right syntactic congruence of f blocks has an infinite index.

Lemma 3.1.7. Let f : A ω → B ∞ be a rational ω-function, then for any finite word u ∈ A * , f (u) is a rational word.

Proof. Let T be an ω-transducer realizing the function f . Let u ∈ A * be a finite word, we can define an automaton recognizing L(u), the words in B ∞ which can be output by reading a word beginning with u. Thus L(u) is a rational subset of B ∞ , and thus f (u) = L(u) is a rational word.

In the following, when a Büchi automaton has only final states, we will rather write it as a triple (Q, ∆, I) instead of a quadruple (Q, ∆, I, Q), for simplicity. We call this class of deterministic automata left automata. Note that a left automaton recognizes a closed language. A sequential transducer whose underlying automaton is a left automaton is called left-sequential.

Let f be a rational ω-function. Based on the right syntactic congruence ∼ f , we define

T f := (A f , i , o) with A f := (Q f , ∆ f , I f , F f ) the minimal sequential transducer of f by: • Q f := {[u] | u ∈ ↓dom(f ) ∩ A * } • ∆ f := {([u] , a, [ua]) | a ∈ A} • I f := {[ ]} • F f := Q f • i ([ ]) := f ( ) if f ( ) is finite α if f ( ) = αβ ω (in normal form) and β = • o([u] , a, [ua]) :=    f (u) -1 f (ua) if f (ua) is finite β if f (u) = αβ ω (in n.f.) and β = α if f (u) finite, f (u) -1 f (ua) = αβ ω (in n.f.
) and β = Remark 3.1.8. Just like for the case of finite words, notice that ∼ A f = ∼ f , by definition, and that the number of states of A f is the number of equivalence classes of ∼ f (up to adding a sink state). In particular if ∼ f has infinite index then A f actually has an infinite number of states.

Proposition 3.1.9. The outputs of the minimal sequential transducer of a rational ω-function are well-defined.

Proof. Let f : A ω → B ∞ be a rational ω-function. We show that the output functions are well-defined, i.e. do not depend on the choice of representative. According to Lem. 3.1.7, for any finite word u ∈ A * , f (u) is rational, and in particular f ( ), hence i is well-defined. Let u ∼ f v and let a ∈ A such that ua ∈ ↓dom(f ). We want to show that the output function o is well-defined. Let us assume that f (u) is infinite, then according to Lem. 3.1.7, there exists α ∈ A * , β ∈ A + such that f (u) = αβ ω (in normal form). Since u ∼ f v, we know that f (u) and f (v) are ultimately equal and in particular,

f (v) = γβ ω for some γ ∈ B * . Let us now assume that f (u) is finite, in that case, so is f (v). Since u ∼ f v we have f (u) -1 f (ux) = f (v) -1 f (vx),
for any x ∈ A ω such that ux, vx ∈ dom(f ), and we denote this word by g(x).

f (u) -1 f (ua) = ( x f (ux)) -1 x f (uax) = x f (u)g(x) -1 x f (u)g(ax) = ( x g(x)) -1 x g(ax) = f (v) -1 f (va)
Hence we obtain that o([u] , a, [ua]) is well-defined.

Theorem 3.1.10. The transducer T f realizes f . Proof. Let f : A ω → B ∞ be a rational ω-function and let g denote the function realized by T f . Let us first remark that dom(g) = dom(f ) = dom(f ). Let x ∈ dom(f ). Let us assume that f ( ) = αβ ω is infinite. Then we have i ([ ]) = α and the output of any transition in T f is equal to β. This means that f and g are both the constant function equal to αβ ω over dom(f ).

We now assume that there exists a letter a and a prefix of x, u < ua < x such that f (u) is finite and f (ua) is infinite (and thus equal to

f (x)). Let [ ] ua|γ ---→ T f [ua] denote the initial run of T f over ua. Let f (u) -1 f (ua) = αβ ω ,
with β = by assumption. By definition of T f we have that i ([ ])γ = f (u)α, and we also know that all the transitions after [ua] will output β. Hence

g(x) = f (u)αβ ω = f (ua) = f (x).
Let us finally assume that for all prefixes u < x we have f (u) finite. By definition of the

outputs of T f , g(x) = f ( ) • i∈N f (x(:i)) -1 f (x(:i + 1)) = lim i∈N f (x(:i)) = f (x).
In contrast with the case of finite words, the minimal sequential transducer of a function f is actually the minimal sequential transducer of f . We still show that this minimal sequential transducer is coarser than any sequential transducer realizing f . Theorem 3.1.11. Let f be a sequential ω-function realized by a sequential ω-transducer with underlying automaton A, then ∼ A ∼ f . Proof. Let T = (A, i , o) be a sequential ω-transducer realizing f with A = (Q, ∆, {q 0 } , F ) deterministic. Let u ∼ A v and let p be the state of A reached from the initial state by u and v. Let T p := (A p , p → , o) with A p := (Q, ∆, {p} , F ), and let f p := T p . We have x ∈ u -1 dom(f ), if and only if the run of A from p over x always stays in the co-accessible part of A, and thus in particular u -1 dom(f ) = v -1 dom(f ).

Let x ∈ A ω such that ux, vx ∈ dom(f ). Let us denote the initial runs of T over u and v by q 0 u|γ --→ p and q 0 v|γ --→ p, respectively. Let αβ ω := {f p (y) | y ∈ dom(f p )}, and let

p x|δ --→ F . If β = then f (u) = i (q 0 )γαβ ω and f (v) = i (q 0 )γ αβ ω are ultimately equal. If β = , we have f (u) = i (q 0 )γα, f (v) = i (q 0 )γ α, f (ux) = i (q 0 )γδ and f (vx) = i (q 0 )γ δ. Hence we obtain that f (u) -1 f (ux) = α -1 δ = f (v) -1 f (vx), and thus u ∼ f v.
We obtain a Myhill-Nerode-like characterization for sequential functions. As we will see later, this characterization is closely related to the characterization given in [BC04] in terms of weak twinning property and continuity.

Theorem 3.1.12. A rational ω-function f is sequential if and only if the two following conditions hold:

• ∼ f has finite index • f extends f
Proof. If f is sequential then from Th. 3.1.11, we know that ∼ f has finite index. Furthermore, according to Prop. 3.1.2, f extends f . Conversely, If ∼ f has finite index, then T f is a finite transducer realizing f , according to Th. 3.1.10. Since f is rational, then so is its domain, thus by taking the product of T f with a deterministic (Muller) automaton recognizing dom(f ), we obtain a sequential transducer realizing f |dom(f ) , which is equal to f by assumption.

Remark 3.1.13. The characterization of Th. 3.1.12 is tightly linked to the one from [BC04] which is expressed in terms of the weak twinning property (defined below) and continuity of the function for the prefix distance. As we will see below, the finite index of the syntactic congruence is actually equivalent to being realized by a transducer satisfying the weak twinning property. Over functions which only produce infinite words then we also have an equivalence between continuity and the liminf extending the function. In the general case however, the liminf extending the function does not mean continuity for the prefix distance topology but for the topology induced by the prefix partial-order (both topologies coincide over infinite words).

Example 3.1.14. As we have seen in Ex 3.1.1, the function f blocks extends f blocks . However, from in Ex. 3.1.6 we have that the right syntactic congruence of f blocks is infinite, and thus the function is not sequential.

From Ex. 3.1.6 we know that ∼ f #a has index 1. However, in Ex. 3.1.1 we have seen that f #a does not extend f #a . Hence ∼ f #a is not sequential either.

Proof. Let f : A ω → B ∞ be a function, and let u ∼ f v. Of course we have dom(f ) = dom(f ).

Let us notice that we have f = f . Let x be such that ux, vx ∈ dom(f ). Let us assume that f (u) is infinite, then since u ∼ f v, we know that f (v) is also infinite and they are ultimately equal. If we assume that f (u) is finite then f (u) -1 f (ux) = f (u) -1 lim n∈N f (ux(:n)) = lim n∈N f (u) -1 f (ux(:n)). However, according to the proof of Prop. 3.1.9 we have for any word w that f (u) -1 f (uw) = f (v) -1 f (vw), and thus we obtain that f (u) -1 f (ux) = f (v) -1 f (vx) which concludes the proof.

Lemma 3.1.17. Let f : A ω → B ∞ be a function such that f extends f . Then ∼ f ∼ f . Proof. Let f : A ω → B ∞ be such that f extends f . Again we have dom(f ) = dom(f ), and f = f . Let u ∼ f v, and let x be such that ux, vx ∈ dom(f ), then in particular, ux, vx ∈

dom(f ),f (ux) = f (ux) and f (vx) = f (vx). If f (u) is infinite then f (v) is also infinite and they are ultimately equal since u ∼ f v. If f (u) is finite then f (u) -1 f (ux) = f (u) -1 f (ux) = f (v) -1 f (vx) = f (v) -1 f (vx).
Corollary 3.1.18. Let f be a sequential ω-function, then ∼ f = ∼ f . Proof. We conclude using Lem. 3.1.16 on one hand, and Prop. 3.1.2 and Lem. 3.1.17 on the other hand.

We can now state and prove our minimization result.

Theorem 3.1.19. Given a sequential ω-transducer, one can compute the associated minimal sequential transducer (up to renaming states) in PTime.

Proof. Let T = (A, i , o), with A = (Q, ∆, I, F ) be a sequential transducer realizing a function f . According to Prop. 3.1.15 we can assume without loss of generality that T is in earliest normal form.

The algorithm is almost the same as in the finite case.

In the following we identify the states of A with the equivalence classes of ∼ A . The initial partition is given for all words u, v by u

∼ 0 v if: 1) u -1 dom(f ) = v -1 dom(f ) and 2) ∀a ∈ A, o([u] A , a, [ua] A ) = o([v] A , a, [va] A ).
Let i ∈ N, we define inductively for all words u, v, u ∼ i+1 v by: u ∼ i v and ∀a ∈ A, ua ∼ i va. Of course we have ∀i ∈ N that ∼ A ∼ i+1 ∼ i , which means that we reach a fixpoint relation for some i, which we denote by ∼ * .

Let us first show that ∼ * is finer than ∼ f . We will actually show that ∼ * ∼ f , since we have ∼ f = ∼ f from Cor. 3.1.18. For this we construct a sequential transducer with right transition congruence ∼ * and which realizes f . Then according to Th. 3.1.11, we do obtain ∼ * ∼ f . The relation ∼ * is a right congruence since it is a fixpoint for right multiplication. Let T * = (A * , i * , o * , t * ) with A * = (Q * , ∆ * , I * ) be defined as:

• Q * := {[u] * | u ∈ ↓dom(f ) ∩ A * } • ∆ * := {([u] * , a, [ua] * ) | a ∈ A} • I * := {[ ] * } • i * ([ ] * ) := i ([ ] A ) • o * ([u] * , a, [ua] * ) := o([u] A , a, [ua] A )
The output function is well-defined according to point 2). Given a word in the closure of the domain of f , its outputs for T * will be exactly the same as for T . Since T is in earliest normal form, we can see that T * thus realizes f . We only have left to show that ∼ f ∼ * , which we do by showing by induction on i ≥ 0

that ∼ f ∼ i . Let u ∼ f v we have 1) u -1 dom(f ) = v -1 dom(f ).
Let us assume first f (u) is infinite equal to αβ ω . This means that f (v) is ultimately equal to f (u) and thus of the form α β ω . Since T is in earliest normal, we know that all the transitions after [u] A or [v] A have to produce β, which proves 2). If we now assume that f (u) is finite, then so is f (v), and let us consider the initial runs q 0 u|γ --→ T p and q 0 v|γ --→ T p . Since T is in earliest normal form, we have that the longest common prefix of outputs from both p and p is , and thus f (u) = i (q 0 )γ and f (v) = i (q 0 )γ . Let a ∈ A, let f (ua) = αβ ω and let f (va) = α β ω (with possibly β = ). Since T is in earliest form, we have that p a|α --→ q and p a|α --→ q . However, we know from the proof of Prop. 3.1.9 that α = α . Thus we obtain o(p, a, q) = o(p , a, q ) which proves 2), and thus u ∼ 0 v. Now let us assume that for some i ∈ N we have ∼ f ∼ i . Let u ∼ f v, we have by hypothesis that u ∼ i v. Since ∼ f is a right congruence we also have for any a ∈ A that ua ∼ f va which means that ua ∼ i va, and hence u ∼ i+1 v, which concludes the proof of correctness.

Like in the finite case, this algorithm runs in PTime.

Quasi-sequential transductions

Sequential functions over infinite words are characterized by the conditions given in Th. 3.1.12, namely the finiteness of the index of the syntactic right congruence and the fact that the liminf extends the function. If we remove the constraint on the liminf, we obtain a class of functions that we call quasi-sequential functions, and which has already been (implicitly) studied in [BC04]. Intuitively, quasi-sequential functions can be thought of as the generalization of subsequential functions from finite to infinite words, in the following way: they can be realized by sequential transducers extended with the possibility to append a (possibly infinite) word at the "end" of the run (if it produces a finite word) depending on some regular property of the input. A typical example of quasi-sequential function which is not sequential is the function f #a from Ex. 3.1.1 defined over the alphabet {a, b} by f #a (x) = a ω if the number of as in x is infinite and f #a (x) = b ω otherwise. We also show below that quasi-sequential functions can be characterized by the weak twinning property, a machine characterization from [BC04] generalizing the one for finite words introduced by Choffrut. Finally we show that quasi-sequential functions are exactly the functions for which determinization terminates (although it is not always correct when the function is not sequential).

Determinization algorithm

We define the determinization procedure from [BC04], which we call (as in the finite case) powerset construction with delays, and we state some of its properties. The construction is very similar to the case of finite words.

Let T = (A, i , o) be a transducer, with underlying automaton A = (Q, ∆, I, F ), realizing a function f . We describe S := (D, i , o ), with D := (Q , ∆ , S 0 ). Note that S is sequential by definition but may have an infinite number of states in general, but the authors of [BC04] show that S is finite and realizes f when f is sequential. Actually we show slightly more general results, which are present in [BC04], but not explicitly. We assume that T is trim and in earliest normal form, without loss of generality. Let C ⊆ Q be the set of constant states of T , and let β ω p denote the longest common prefix of outputs from state p of T .

Proof. The authors of [BC04] have a very slightly different model of transducers where a run has to produce an infinite word in order to be final. However this does not change the proofs here and in particular, they show that the sizes of the delays are polynomial with respect to the original transducer. Thus the construction causes, as for the finite case, an exponential blow-up of the state space.

Characterizations of quasi-sequential transductions We need two lemmas before giving the theorem characterizing quasi-sequential transductions. --→ S denote the initial runs of S over u and v, respectively. Our goal is to show that u ∼ f v. First since S realizes f and dom(f ) = dom(f ), we have u -1 dom(f ) = v -1 dom(f ). If S is constant and produces an infinite word γ, then f (u) = i (S 0 )αγ and f (v) = i (S 0 )α γ which are ultimately equal. Otherwise, there must exist pairs (p 1 , γ 1 ), (p 2 , γ 2 ) ∈ S such that γ 1 ∧ γ 2 = . Since T is in normal form, we obtain f (u) = i (S 0 )α and f (v) = i (S 0 )α . Let x ∈ A ω and let (p, γ) ∈ S such that x has a final run from p producing δ. If γ is infinite, we have f (ux) = i (S 0 )αγ and f (vx) = i (S 0 )α γ, and if γ is finite we have f (ux) = i (S 0 )αγδ and f (vx) = i (S 0 )α γδ. Either way we obtain f (u) -1 f (ux) = f (u) -1 f (ux), and thus u ∼ f v.

Lemma 3.1.24. Let T be an ω-transducer realizing f such that ∼ f has finite index. Then T satisfies the WTP.

Proof. Let T be an ω-transducer realizing f such that ∼ f has finite index. Let us assume towards a contradiction that T does not satisfy the WTP. Let p 1 u|α1 ---→ q 1 v|β1 ---→ q 1 and p 2 u|α2 ---→ q 2 v|β2 ---→ q 2 denote two initial runs.

We first consider the case where q 1 , q 2 are not constant states and del(i

(p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ). If we have |β 1 | = |β 2 |
this means that there exists a mismatch, i.e. a position k such that i (p 1 )α 1 β 1 (k) = i (p 2 )α 2 β 2 (k). Hence we obtain that f (uv n ) < i (p 2 )α 2 β 2 for any positive integer n, which means that there exists an integer N such that f (uv n ) = f (uv N ), for n ≥ N . Since q 2 is non-constant, and T is in earliest normal form, there is a word x over which there is an accepting run from q 2 producing γ such that γ ∧ β 2 = . Thus we have that f

(uv n ) -1 f (uv n x) = f (uv N ) -1 i (p 2 )α 2 β n
2 γ which takes an infinite number of different values, contradicting the fact that ∼ f has finite index. If

|β 1 | = |β 2 |, we assume without loss of generality that |β 1 | < |β 2 |. Since q 1 is non constant and T is in earliest normal form, we have for any n ∈ N that f (uv n ) ≤ i (p 1 )α 1 β n 1 . Hence we have that f (uv n ) -1 i (p 2 )α 2 β n
2 takes an infinite number of values. As above, using the fact that q 2 is constant, we can obtain a word x producing γ over a final run from q 2 such that γ ∧ β 2 = . Thus we obtain again that

f (uv n ) -1 f (uv n x) = f (uv n ) -1 i (p 2 )α 2 β n
2 γ takes an infinite number of values, contradicting that ∼ f has finite index.

Let us assume that q 1 is non-constant and q 2 is constant and produces γ (with T in earliest normal form). We also assume that β 1 = and i (p 1 )α 1 β ω 1 = i (p 2 )α 2 γ. This means in particular that there is an integer N such that for all n ≥ N , we have f (uv n ) = f (uv N ). Since q 1 is not constant, let x be a word producing δ over a final run from q 1 , such that β 1 ∧ δ = . Then

Canonical models for rational functions over infinite words

As a corollary, we obtain a way to decide if a sequential ω-transduction is aperiodic.

Theorem 3.1.27. A sequential ω-transduction is A-rational if and only if its domain is aperiodic and its minimal sequential transducer is aperiodic.

Proof. If f is sequential and in A, then there exists an aperiodic transducer realizing it. From Lem. 3.1.26, we know that the determinization of the transducer produces an aperiodic transducer, which is finite (Th. 3.1.25) and realizes f (Th. 3.1.10). Furthermore, we have that the minimal sequential transducer of f is the minimal sequential transducer of f , from Cor. 3.1.18. Finally, if f is aperiodic, then in particular dom(f ) is aperiodic.

Conversely, if dom(f ) is aperiodic, then from Th. 1.3.12, there is an aperiodic deterministic Muller automaton recognizing it. Thus by taking the product of the minimal sequential transducer and the deterministic automaton, we obtain an aperiodic sequential Muller transducer realizing f .

Canonical models for rational functions over infinite words

In this section we extend some of our results for transductions over finite words to transductions over infinite words. We are not able to describe all the minimal bimachines of a transduction like in the finite case, however we can at least exhibit a canonical way to compute a transduction.

In particular, we show that this canonical bimachine is always aperiodic for an aperiodic transduction, which is the main result of the section. Unlike for the finite case, the delay look-ahead does not always give enough information to realize the function sequentially. Indeed, when we annotate the input with the delay look-ahead information, what we obtain is a quasi-sequential transduction. For this reason we introduce a second look-ahead which is sufficient to make any quasi-sequential transduction sequential. However this second look-ahead, called the ultimate look-ahead, does not share the same minimality properties as the delay look-ahead. Composing the two look-aheads, we obtain nonetheless a canonical look-ahead fine enough to realize any rational transduction sequentially.

Bimachines and transductions

We define bimachines over infinite words and show that one can go from a bimachine to a transducer while preserving the transition congruence, just like in the finite case.

Bimachines An ω-bimachine over alphabets A, B is given as a tuple B = (L, R, i , o) where L = (Q L , ∆ L , {l 0 }) is a deterministic accessible (Büchi) automaton with only accepting states, called the left automaton of

B, R = (Q R , ∆ R , I R , F R ) is a co-deterministic co-accessible automaton, called the right automaton of B, i : Q R → B * is the initial function, o : Q L × A × Q R → B * is the output function.
We also add the semantic restriction that L = R . Let u ∈ A * be a finite word and let l and r be runs of L and R, respectively, over u. We extend o to Q L × A * × Q R by setting o(l(1), u, r(|r|)) := 1≤j≤|u| o(l(j), u(j), r(j + 1)). Let x ∈ A ω be an infinite word and let l and r be final runs of L and R, respectively, over x. We extend o to Q L × A ω by setting o(l(1), x) := lim n∈N o(l(1), x(:n), r(n + 1)). Furthermore if l and r are accepting let α := i (r(1))o(l(1), x), then we say that (x, α) is realized by B and we denote by B the set of pairs realized by B. From bimachines to transducers As in the finite case, it is easy to show that from a bimachine one can obtain an unambiguous transducer realizing the same function just by taking the product of the two automata.

Proposition 3.2.2. Let B be a bimachine realizing a rational ω-function f with left and right automata L and R, respectively. Then one can construct in PTime an unambiguous transducer realizing f with underlying automaton L × R.

Proof. Let B = (L, R, i , o) be a bimachine realizing a function f with left automaton L = (Q L , ∆ L a, {l 0 }) and right automaton R = (Q R , ∆ R , I R , F R ).
The main idea is to consider the product of the two automata. The transducer will guess the run of the right automaton, and codeterminism ensures that there is only one possible run. We define a transducer T := (A, i , o ) with A := (Q, ∆, I, F ) by:

• Q := Q L × Q R • ∆ := {((l, r ), a, (l , r)) | a ∈ A, (l, a, l ) ∈ ∆ L , (r , a, r) ∈ ∆ R } • I := {l 0 } × I R • F := Q L × F R if R is a Büchi automaton, and
F := {P L × P R | P L ⊆ Q L , P R ∈ F R } if R is a Muller automaton.
• i (l 0 , r) := i (r)

• o ((l, r ), a, (l , r)) := o(l, a, r)

By construction T realizes f and its underlying automaton is indeed L × R.

Like in the case of transductions over finite words, we are able to show conversely that from a transducer, one can obtain a bimachine with the same transition congruence. Again, we first need the notion of bimachine left minimization before showing this result.

Left minimization of bimachines

We are able to minimize the left automaton of bimachines, but not the right one. We define the syntactic right congruence of a function with respect to a fixed right automaton. This subsection very closely follows the corresponding Subsec. 2.2.2 over finite words. All the main ideas needed here are obtained by combining those of Subsec. 2.2.2 or Sec. 3.1.

Canonical models for rational functions over infinite words

R-syntactic congruence Let f : A ω → B ∞ be a function and let R be a right automaton recognizing dom(f ). We define for each state of R, i.e. each equivalence class

[x] R of ≈ R , a function f [x] R : u → {f (uy) | y ≈ R x}.
Note that the right automaton will often be implicit and we will rather write f x . Intuitively, this function outputs over a word u the longest possible word, with the look-ahead information that the suffix is in

[x] R . We define f R : A ω → B ∞ by f R (x) = lim uy=x f y (u) for any x ∈ dom(f ). Definition 3.2.3. The R-syntactic congruence of f : A ω → B ∞ is defined for u, v ∈ A * by u ∼ R f v if: • u -1 dom(f ) = v -1 dom(f ) and
• ∀x such that ux, vx ∈ dom(f ), either f x (u) and f x (v) are ultimately equal or

f x (u) -1 f (ux) = f x (v) -1 f (vx)
Intuitively, u and v are equivalent if when we remove the contributions of u and v from f (ux) and f (vx), respectively, we obtain the same word left to write. Note here that the contributions of u and v are computed with the knowledge that the suffix is equivalent to x, with respect to R. Proposition 3.2.4. Let f be a function and let R be a right automaton recognizing dom(f ), then ∼ R f is a right congruence. Proof. Let f : A ω → B ∞ be a function and let R be a right automaton recognizing dom(f ), let u ∼ R f v and let a ∈ A. We want to show that ua ∼ R f va. First (ua

) -1 dom(f ) = a -1 (u -1 dom(f )) = (va) -1 dom(f ). Let x ∈ A ω such that ux, vx ∈ dom(f ). If f ax (u) is in- finite then it is ultimately equal to f ax (v). We have f x (ua) = f ax (u) and f x (va) = f ax (v)
and thus f x (ua) and f x (va) are ultimately equal. If f ax (u) and f ax (v) are finite then we have f ax (u) -1 f (uax) = f ax (v) -1 f (vax), and we let g(x) denote this word. If y≈ R x g(y) is infinite then f x (ua) and f x (va) are ultimately equal to this word. Otherwise, we have:

f x (ua) -1 f (uax) = y≈ R x f (uay) -1 f (uax) = y≈ R x f ax (u)g(y) -1 f ax (u)g(x) = f ax (u) y≈ R x g(y) -1 f ax (u)g(x) = y≈ R x g(y) -1 g(x) = f x (va) -1 f (vax)
Hence ua ∼ R f va which concludes the proof. Example 3.2.5. Let R be the right automaton of Fig. 3.2 on the facing page. Then for any finite word u ∈ A * , we have

f a ω (u) = f ba ω (u) = a ω and f b ω (u) = f ab ω (u) = b ω . This means that ∼ R
f is the trivial congruence, which is consistent with the fact that the left automaton of the bimachine in Fig. 3.2 on the preceding page is trivial.

Left minimal bimachine Let f : A ω → B ∞ be a rational function over infinite words and let R := (Q R , ∆ R , I R , F R ) be a right automaton recognizing dom(f ). Using the R-syntactic congruence of f we define the left minimal bimachine of f with respect to R. We set

B f (R) := (L f (R), R, i , o) with L f (R) := (Q L , ∆ L ,
l 0 ) defined by: Chapter 3. Characterizations of rational functions over infinite words

• Q L := [u] R f | u ∈ ↓dom(f ) ∩ A * • ∆ L := ([u] R f , a, [ua] R f ) • l 0 := [ ] R f • i ([x] R ) := f x ( ) if f x ( ) is finite α if f x ( ) = αβ ω and β = • o([u] R f , a, [x] R ) :=    f ax (u) -1 f x (ua) if f x (ua) is finite β if f ax (u) = αβ ω and β = α if f ax (u) is finite, f ax (u) -1 f x (ua) = αβ ω , β =
Like in the finite case, the left minimal bimachine outputs the longest possible word (except if it is infinite), given the look-ahead information. Again this bimachine may have an infinite number of states, in general, when the look-ahead is not fine enough. We show that the outputs of the left minimal bimachine are well-defined.

Proposition 3.2.6. Let f be a rational ω-function and let R be a right automaton recognizing dom(f ). The outputs of B f (R) are well-defined.

Proof. Let f : A ω → B ∞ be a rational ω-function and let R be a right automaton recognizing dom(f ). We show that the output functions of B f (R) are well-defined. Using Lem. 3.1.7, we know that for any word x ∈ dom(f ), we have that

f x ( ) = f |[x] R ( ) is rational and thus the initial outputs of B f (R) are well-defined. Let u ∼ R f v, let a ∈ A and let x ∈ A ω such that uax, vax ∈ dom(f ). If f ax (u)
is infinite then so is f ax (v) and since they are ultimately equal (and rational from Lem. 3.1.7) we know that they have the same ultimate period. If f ax (u) is finite then we have for any y ≈ R ax that f ax (u) -1 f (uy) = f ax (v) -1 f (vy), and we denote this word by g(y).

f ax (u) -1 f x (ua) = y≈ R ax f (uy) -1 y≈ R x f (uay) = y≈ R ax f ax (u)g(y) -1 y≈ R x f ax (u)g(ay) = y≈ R ax g(y) -1 y≈ R x g(ay) = f ax (v) -1 f x (va)
We now can show that B f (R) realizes f . However, B f (R) may be infinite if R does not give enough look-ahead information to realize f sequentially. Theorem 3.2.7. Let f be a rational ω-function and let R be a right automaton recognizing dom(f ). The bimachine B f (R) realizes f R .

Proof. Let f : A ω → B ∞ be a rational ω-function, let R be a right automaton recognizing dom(f ) and let x ∈ dom(f ). Let us first assume that for all uy = x, f y (u) is finite, then by definition of the outputs of the left minimal bimachine

B f (R), B f (R) (x) = f u ( ) •
3.2. Canonical models for rational functions over infinite words

i ([x] R ) = α and ∀uay = x, we have o([u] R f , a, [y] R ) = β and thus we obtain B f (R) (x) = f R (x).
Similarly let us assume that uay = x, with a ∈ A such that f ay (u) is finite and

f y (ua) = f (uay) is infinite. By definition of B f (R), we have i ([x] R )o([ ] R f , u, [ay] R ) = f (u). Let f ay (u) -1 f y (ua) = αβ ω in normal form. Then we have i ([x] R )o([ ] R f , ua, [y] R ) = f (u)α and for any n ∈ N we have i ([x] R )o([ ] R f , uay(:n), [y(n + 1:)] R ) = f (u)αβ n . Finally, we obtain that B f (R) (x) = f R (x).
We show that when a right automaton gives enough look-ahead information, then the associated left minimal bimachine realizes the function.

Theorem 3.2.8. Let B be a bimachine with right automaton R realizing a function f . Then

f R = f . Proof. Let B = (L, R, o) be a bimachine realizing f . We know that f R ≤ f . Let ux ∈ dom(f ),
and let

α = i ([ux] R )o([ ] L , u, [x] R ).
We must have that α ≤ f x (u) and thus by taking the limit we have that f (ux) ≤ f R (x), which concludes the proof.

As in the finite case, the left minimal bimachine, with respect to a right automaton R, has a coarser left automaton than any bimachine realizing f with R as right automaton.

Theorem 3.2.9. Let f be a transduction realized by a bimachine with left and right automata L and R, respectively. Then ∼ L ∼ R f .

Proof. Let B = (L, R, i , o) be a bimachine with left and right automata

L = (Q L , ∆ L , {l 0 }) and R = (Q R , ∆ R , I R , F R ) realizing f and let u ∼ L v. We have u -1 dom(f ) = v -1 dom(f ) since L recognizes dom(f ). Let x ∈ A ω be such that ux, vx ∈ dom(f ), let α = i ([ux] R )o([ ] L , u, [x] R ), let β = i ([vx] R )o([ ] L , v, [x] R ), let γ = o([u] L , x) and let δ = y≈ R x o([u] L , y). We have f (ux) = αγ, f x (u) = αδ, f (vx) = βγ and f x (v) = βδ. If f x (u)
is infinite, then it is ultimately equal to δ, and so is f x (v). Otherwise, we have that

f x (u) -1 f (ux) = δ -1 γ = f x (v) -1 f (vx). Hence we have shown that u ∼ f v.
Left minimization algorithm In order to define the minimization algorithm, we need a notion of earliest normal form for ω-bimachines.

Let B = (L, R, i , o) be a bimachine, and let ux ∈ dom(f ). Let us denote by α u,x β ω u,x := {o([u] L , y) | y ≈ R x} the longest common prefix of outputs from [u] L with look-ahead [x] R (in normal form). Then B is called in earliest normal form if for any ux ∈ dom(f ), we have 1)

α u,x = and 2) if β u,ax = then o([u] L , a, [x] R ) = β u,ax .
Proposition 3.2.10. Given a bimachine B, one can obtain in PTime a new bimachine B in earliest form realizing the same function.

Proof. We give the definition of B, show that it realizes the same function and is indeed in earliest form, and finally we give a procedure to compute it. Let B = (L, R, i , o) be a bimachine realizing a function f and let ux ∈ dom(f ). Let α u,x β ω u,x denote the longest common prefix of outputs from [u] L with look-ahead [x] R . We define B = L, R, i , o by:

• i ([x] R ) := i ([x] R )α ,[x] R • o([u] L , a, [v] R ) := α -1 u,ax o([u] L , a, [x] R )α ua,x if β u,ax = β u,ax if β u,ax =
Let x be a word such that for all uy = x, f y (u) is finite. In that case, one can easily see that all the α u,x s cancel out, and thus B realizes f as well. If f x ( ) = αβ ω is infinite, then we have β ,x = β, and i ([x] R )α ,x β ω = f (x). For any uy = x, we have by definition that o([ ] L , u, [y] R ) = β |u| , and thus we obtain B (x) = f (x). Similarly, if we have some uay = x such that f ay (u) is finite and f y (ua) is infinite, then we have i

([uay] R ) o([ ] L , u, [ay] R ) = f ay (u). Let f ay (u) -1 f y (ua) = αβ ω , then we have i ([uay] R ) o([ ] L , ua, [y] R ) = f ay (u)α and also i ([uay] R ) o([ ] L , uay(:n), [y(n + 1:)] R ) = f ay (u)αβ n for any n ∈ N.
Thus we obtain that B realizes f and by construction, B is in earliest normal form. Let u ∈ A * , x ∈ A ω , we only have left to show that computing α u,x and β u,x can be done in PTime. We consider the transducer T obtained from B by Prop. 3.2.2. The state space of T is L × R and we have that the longest common prefix of outputs from state (

[u] L , [x] R ) is α ([u] L ,[x] R ) β ω ([u] L ,[x] R ) = α u,x β ω u,x .
Thus using the same procedure as in the proof of Prop. 3.1.15 we can compute α u,x and β u,x in PTime.

We now give the minimization theorem: Theorem 3.2.11. Given a bimachine with right automaton R realizing a rational ω-function, one can compute in PTime B f (R), the left minimal bimachine with respect to R.

Proof. Let B = (L, R, i , o) be a bimachine realizing a function f with left and right automata

L = (Q L , ∆ L , {l 0 }) and R = (Q R , ∆ R , I R , F R )
, respectively. According to Prop. 3.2.10 we can assume without loss of generality that B is in earliest form.

We use exactly the same ideas as in the finite case.

As usual, we identify the states of L with the classes of ∼ L . The initial partition is given for all words u, v by u

∼ 0 v if: 1) u ∈ ↓dom(f ) ⇔ v ∈ ↓dom(f ) and 2) ∀x with uax, vax ∈ dom(f ), we have o([u] L , a, [x] R ) = o([v] L , a, [x] R ).
Let i ∈ N, for all finite words u, v we define inductively u ∼ i+1 v by: u ∼ i v and ∀a ∈ A, ua ∼ i va. Of course we have ∀i ∈ N that ∼ L ∼ i+1 ∼ i , which means that we reach a fixpoint relation for some i, which we denote by ∼ * .

Let us first show that ∼ * is fine enough to realize f with R as right automaton, which means that ∼ * ∼ R f according to Th. 3.2.9. The relation ∼ * is a right congruence since it is a fixpoint for right multiplication. Let B * = (L * , R, i * , o * ) with L * = (Q * , ∆ * , I * ) be defined as:

• Q * := {[u] * | u ∈ ↓dom(f )} • ∆ * := {([u] * , a, [ua] * ) | a ∈ A} • I * := {[ ] * } • i * ([u] R ) := i ([u] R ) • o * ([u] * , a, [x] R ) := o([u] L , a, [x] R )
The output function is well-defined according to point 2). Given a word in the domain of f , its outputs for B * will be exactly the same as for B which means that B * realizes f and hence ∼ * ∼ R f , according to Th. 3.2.9. We only have left to show that ∼ R f ∼ * , which we do by showing by induction on i ≥ 0 that ∼ R f ∼ i .

Canonical models for rational functions over infinite words

Let u ∼ R f v, we have 1) u ∈ ↓dom(f ) ⇔ v ∈ ↓dom(f ). Let x be a word such that uax, vax ∈ dom(f ). If we assume that f ax (u) is finite, then so is f ax (v). Since B is in normal form, we have that i ([uax] R )o([ ] L , u, ax) = f ax (u) and i ([vax] R )o([ ] L , v, ax) = f ax (v). Since u ∼ R f v, we have f ax (u) -1 f (uax) = f ax (v)f (vax) = αβ ω which means that o([u] L , a, [x] R ) = o([v] L , a, [x] R ) = α. Similarly, if f ax (u) is infinite, then so is f ax (v)
, and let β their ultimate period. In that case we have o(

[u] L , a, [x] R ) = o([v] L , a, [x] R ) = β. Hence ∼ R f ∼ 0 . Now let us assume that for some i ∈ N we have ∼ R f ∼ i . Let u ∼ f v, we have by hypothesis that u ∼ i v. Since ∼ R
f is a right congruence we also have for any a ∈ A that ua ∼ R f va which means that ua ∼ i va, and hence u ∼ i+1 v, which concludes the proof.

From transducers to bimachines We show how one can go from a transducer to a bimachine while preserving the transition congruence.

Theorem 3.2.12. Let T be an ω-transducer with underlying automaton A realizing a function f . Let R be a right automaton recognizing dom(f ) such that ≈ R ≈ A , then one can obtain a bimachine with automata L and R such that ∼ A ∼ L .

Proof. Let T = (A, i , o) be a transducer with underlying automaton A = (Q, ∆, I, F ) realizing f . Let R be a right automaton, such that ≈ R ≈ A and recognizing dom(f ). We want to show that ∼ A ∼ R f which will conclude the proof, since B f (R) realizes f according to Th. 3.2.7 and 3.2.8. Let u ∼ A v, our goal is to show that u ∼ R f v. We have of course that u -1 dom(f ) = v -1 dom(f ). Let x be such that ux, vx ∈ dom(f ), and let r 1 , . . . , r n ∈ Q denote the states of A which can be reached from I by reading u (or v) and from which there is a final run by reading x. Let j ∈ n, let p j u|αj ---→ r j and q j v|βj ---→ r j denote initial runs over u and v respectively to r j . Let r j x|γj ---→ S i denote a final run over x from r j , and let δ j := δ | r j y|δ --→ S final , y ≈ A x . Then for any j ∈ n we have f x (u) = i (p j )α j δ j , f (ux) = i (p j )α j γ j , f x (v) = i (q j )β j δ j and f (vx) = i (q j )β j γ j . Taking for instance j = 1, we obtain that either f x (u) and f x (v) are infinite and ultimately equal to

δ 1 or f w (u) -1 f (uw) = δ -1 1 γ 1 = f w (v) -1 f (vw), hence u ∼ R f v which concludes the proof.
A first corollary is that ω-bimachines realize all the rational ω-transductions.

Corollary 3.2.13. An ω-function is rational if and only if it is realized by some ω-bimachine.

In particular this transfers to aperiodic transductions.

Corollary 3.2.14. An ω-transduction is aperiodic if and only if it is realized by an aperiodic bimachine.

Proof. Let B be an aperiodic bimachine. According to Prop. 3.2.2, we can obtain an aperiodic transducer realizing the same function.

Let T be an ω-transducer, with underlying aperiodic automaton A = (Q, ∆, I, F ), realizing a function f . Let us show that for any x ∈ A ω , {y | y ≈ R x} is aperiodic. Given a state p, the automaton A p := (Q, ∆, {p} , F ) is aperiodic since its transition congruence is that of A.

Let P := p ∈ Q | ∃ a final run p x -→ A S . Thus we have {y | y ≈ R x} = p∈P A p ,
which is aperiodic since aperiodic languages are closed under intersection. According to Th 1.3.13, we can thus obtain an aperiodic right automaton R such that ≈ R ≈ A . Finally, from Th. 3.2.12 we obtain our result.

Chapter 3. Characterizations of rational functions over infinite words

Another consequence is an Elgot-Mezei theorem for rational functions over infinite words, which generalizes the result of [START_REF] Carton | Right-sequential functions on infinite words[END_REF]. Indeed a bimachine can be seen as realizing the composition of a left and a right sequential function (in both ways). Furthermore, we can always assume that one of them is letter-to-letter. Theorem 3.2.15. Let f be a rational ω-function over infinite words, then there exist g sequential (resp. right-sequential) and h letter-to-letter and right-sequential (resp. sequential) such that f = g • h.

Look-ahead versus labeling

We introduce the notion of labeling, like in the finite case, and show the relationship between labelings and look-aheads.

Labeling Let f : A ω → B ∞ be an ω-function and let R be a right automaton recognizing dom(f ). We define the labeling function associated with R by the right sequential transducer

(R) := (R, i , o) with i : r → and o([ax] R , a, [x] R ) := (a, [x] R ). We define the transduction f R := f • (R) -1 . Note that f R is a function, since (R) is injective (by unambiguity of R).
Intuitively, f R produces the same output as f over an input annotated by the look-ahead information given by R.

Our goal is to link the sequentiality of f R with the fact that R gives enough look-ahead to have a bimachine with R as a right automaton. We start with the easy direction. Proposition 3.2.16. Let f be a rational ω-transduction realized by a bimachine with right automaton R. Then f R is sequential.

Proof. Let B = (L, R, i , o) with L = (Q L , ∆ L ,
{l 0 }) be a bimachine realizing f . Let us consider the sequential transducer T := (A, i , o ) with A := (Q, ∆, I, F ) defined by:

• Q := {q 0 } Q L × Q R • ∆ := {((l, r ), (a, r), (l , r)) | (l, a, l ) ∈ ∆ L , (r , a, r) ∈ ∆ R } ∪ {(q 0 , (a, [x] R ), (l , [x] R )) | (l 0 , a, l ) ∈ ∆ L , ax ∈ dom(f )} • I := {q 0 } • F := Q L × F R if R is a Büchi automaton and F := {P L × P R | P L ⊆ Q L , P R ∈ F R } if R is a Muller automaton • i (q 0 ) = • o ((l, r ), (a, r), (l , r)) := o(l, a, r) and o (q 0 , (a, [x] R ), (l , [x] R )) := i ([ax] R )o(l 0 , a, [x] R )
The transducer T is sequential and realizes f R .

Example 3.2.17. We consider the right automaton R given in Fig. 3.2 on page 70 and give a transducer realizing f #a,R in Fig. 3.3 on the facing page. Notice that f #a is not sequential while f #a,R is.

We can now consider the converse result, which is harder to show but works exactly as in the finite case. We give a constructive proof of the result by exhibiting when possible a bimachine with R as a right automaton. As a side result, we show that this construction preserves aperiodicity. Lemma 3.2.18. Let T be an ω-transducer realizing a function f and let R be a right automaton recognizing dom(f ). If f R is sequential then there is a bimachine realizing f with right automaton R. In that case one can compute B f (R) in 2 ExpTime. Furthermore if T and R are aperiodic then B f (R) also is.

Canonical models for rational functions over infinite words

q 0 ba ω a ω ab ω b ω (α, ba ω )|a ( α , a ω ) | a (α, ab ω )|b ( α , b ω ) | b (b, ba ω )|a (b, a ω )|a (a, ba ω )|a (a, a ω )|a (α, ab ω )|b (a, b ω )|b (b, b ω )|b
Proof. Let T = (A, i , o) with A = (Q, ∆, I, F ) be a transducer realizing a function f , let R = (Q R , ∆ R , I R , F R
) be a right automaton recognizing dom(f ) and let us assume that f R is sequential. Let us describe the steps of the proof.

Step 1) we construct a transducer realizing f R by taking the product of T and R.

Step 2) we determinize this transducer using the powerset construction with delays of [BC04], in ExpTime. We thus obtain S a sequential transducer realizing f R , of exponential size with respect to T .

Step 3) we project the input alphabet of S, which is A × Q R , to A, to obtain a transducer realizing f . Step 4) we consider the product automaton of the underlying automaton of this transducer with R, and determinize it, using the usual powerset construction for automata on finite words, again with an ExpTime complexity to obtain a deterministic automaton D. We are then able to exhibit a bimachine with D and R as automata realizing f . Finally we left minimize this bimachine to obtain

B f (R) (recall that ∼ R f = ∼ L f ).
We also show that each of the four steps preserves aperiodicity.

1) From T and R we can obtain a transducer realizing f R , by just taking T and using the states of R to label the input. Let T := (A , i , o ) with A := (Q , ∆ , I , F ) be defined by:

• Q := Q × Q R • ∆ := {((p, s), (a, r), (q, r)) | (p, a, q) ∈ ∆, (s, a, r) ∈ ∆ R } • I := I × I R • F := F × F R if A and
R are Büchi automata. If one of the two is a Muller automaton, we can assume that both are Muller automata by changing the final set. In that case we define F := {P × P R | P ∈ F, P R ∈ F R }.

• i (q, r) := i (q)

Canonical models for rational functions over infinite words

Proof. If R is aperiodic, then (R) is also aperiodic. Let us show that (R) -1 is aperiodic, this will conclude the proof since aperiodic functions are closed under composition (see Sec. 3.3). Let (R) be the transducer realizing (R) -1 , obtained by exchanging the input and output labels of transitions of R. Let R denote its transitions, such that we have

∆ R = {([ax] R , (a, [x] R ), [x] R ) | a, ∈ A, x ∈ A ω }. Let n ∈ N such that ∀u ∈ A * , u n+1 ≡ R u n . Let u ∈ (A × Q R ) * , and let π : (A × Q R ) * → A * denote the natural projection. Let k ≥ n and let π(u) k x R u k -→ [x] R denote a run of R over u k . Since we have π(u) k x = [π(u) n x], we know that [π(u) n x] R u -→ [π(u) n x] R , and thus π(u) k x R u k+1
---→ [x] R , which concludes the proof.

We now obtain the result linking the existence of a bimachine realizing a function f with right automaton R, with the sequentiality of f R .

Theorem 3.2.20. Let f be a rational ω-transduction and let R be a right automaton recognizing dom(f ). There exists a bimachine B realizing f with right automaton R if and only

if f R is sequential. Furthermore, if R is aperiodic, then f is aperiodic if and only if f R is.
Proof. This is a consequence of Prop. 3.2.16 and Lem. 3.2.18. The aperiodicty of f R follows from Prop. 3.2.19.

Delay look-ahead

The delay congruence of a function over finite words was introduced in [RS91] and yields, as we have seen in Chap. 2, the coarsest right automaton possible among all bimachines realizing the function. However the definition of delay congruence does not apply to functions producing infinite words. We rather use the alternative definition from [START_REF] Boiret | Learning rational functions[END_REF], which is equivalent to the one from [START_REF] Reutenauer | Minimization of rational word functions[END_REF] in the finite case but also applies to the infinite case. We show that this delay congruence has the same minimality property as in the finite case, but is only fine enough to make the function quasi -sequential and not sequential, in general.

Delay congruence

Definition 3.2.21. Let f : A ω → B ∞ be a function, the left delay congruence of f is defined for x, y ∈ A ω by x ∆ ≈f y if:

• ∀u ∈ A * , ux ∈ dom(f ) ⇔ uy ∈ dom(f ) • |{del(f (ux), f (uy)) | ux ∈ dom(f )}| < ∞
First we show that this left congruence is coarser than any left transition congruence of a machine realizing a given function.

Theorem 3.2.22. Let T (resp. B) be a transducer (resp. bimachine) with underlying automaton A (resp. right automaton R) realizing a rational ω-function f . Then

≈ A ∆ ≈f (resp. ≈ R ∆ ≈f ).
Proof. We give the proof for a bimachine, the proof for a transducer can be obtained in the same way. Let B = (L, R, i , o) be a bimachine and let x ≈ R y, we want to show that x

∆ ≈f y. Since ≈ R recognizes dom(f ) we have ∀u ∈ A * , ux ∈ dom(f ) ⇔ uy ∈ dom(f ).
Let u ∈ A * and let l 0 u -→ L l denote the initial run of L over u. Since x ≈ R y we have that del(f (ux), f (uy)) = del(o(l, x), o(l, y)), which only depends on the state l. Thus we obtain |{del(f (ux), f (uy)) | ux ∈ dom(f )}| ≤ |L|, and hence x ∆ ≈f y. Proposition 3.2.23. Let B be a bimachine realizing a rational ω-function f . Then one can compute ∆ ≈f in PTime.

Proof. Let B = (L, R, i , o) be a bimachine with left and right automata L and R, respectively. According to Th. 3.2.22, we know that ≈ R

∆ ≈f . Let [u 1 v ω 1 ] R , [u 2 v ω 2 ]
R be two states of R, we can choose u 1 , v 1 , u 2 , v 2 of size linear in Q R , and we write x i = u i v ω i , i ∈ 2. Thus we only have to show how to decide if x 1 ∆ ≈f x 2 in PTime. First we can easily check that ∀u, ux 1 ∈ dom(f ) ⇔ ux 2 ∈ dom(f ). Now we want to check whether the set {del(f (ux 1 ), f (ux 2 )) | ux 1 ∈ dom(f )} is finite. For any word x ∈ A ω we define the function f x : u → f (ux). From the bimachine B, we define for any x ∈ A ω , a transducer T x = (A x , i , o, t) over finite words. The underlying automaton A x is obtained by taking the product of L and R and setting as final states the states (l, r) such that r is the state from which R has a final run over x. The initial output function and the output function are obtained naturally as in Th. 3.2.12, whereas the final function always outputs . Let g x denote the function realized by T x . We have that f

x (u) = g x (u) • o([u] L , x). Thus deciding whether x 1 ∆ ≈f x 2 amounts to deciding if {del(g x1 (u) • o([u] L , x 1 ), g x2 (u) • o([u] L , x 2 )) | u ∈ A * } is finite.
We define a twinning-like property which will be equivalent to having a finite set of delays

{del(g x1 (u) • o([u] L , x 1 ), g x2 (u) • o([u] L , x 2 )) | u ∈ A * }.
We say that a state p of a transducer T is γ-constant if there exists a word δ such that for any final run outputting α from p we have αγ = δ. Let T 1 and T 2 be two transducers with the same domain and let γ 1 , γ 2 be two rational words. We say that (T 1 , γ 1 ) and (T 2 , γ 2 ) satisfy the weak adjacency twinning property if for any

pair of initial runs p 1 u|α1 ---→ T1 q 1 v|β1 ---→ T1 q 1 and p 2 u|α2 ---→ T2 q 2 v|β2 ---→ T2 q 2 such
that there is a word w with a final run from both q 1 and q 2 the following hold:

• if q 1 , q 2 are not γ 1 , γ 2 -constant, respectively, then we have that del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 )
• if q i is not γ i -constant and p j is γ j -constant, then we have del(i (p i )α i , i (p j )α j γ j ) = del(i (p i )α i β i , i (p j )α j γ j ) for {i, j} = 2 Claim: {del( T 1 (u) γ 1 , T 2 (u) γ 2 )} is finite if and only if (T 1 , γ 1 ) and (T 2 , γ 2 ) satisfy the weak adjacency twinning property.

Let us show this claim. Assume that T 1 and T 2 do not satisfy the weak adjacency twinning property. Then let p 1 u|α1 ---→ T1 q 1 v|β1 ---→ T1 q 1 and p 2 u|α2 ---→ T2 q 2 v|β2 ---→ T2 q 2 be two initial runs such that there is a word w with a final run from both q 1 and q 2 and let us assume that p i is not γ i -constant for all i ∈ 2. Then we have del(i

(p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ). Since p 2 is not γ 2 -constant ,
this means that we can choose two final runs from p 2 producing µ, ν such that µγ 2 ∧ νγ 2 is a finite word. This means that either γ 2 is finite or there is a mismatch between µγ 2 and νγ 2 . Either way we obtain

del(i (p 1 )α 1 β n 1 δ 1 γ 1 , i (p 2 )α 2 β n 2 δ 2 γ 2 ) | n ∈ N, q i w|δi ---→ Ti s i final = ∞
Let us now assume that p 1 is not γ 1 -constant and p 2 is γ 2 -constant, and del(i

(p 1 )α 1 , i (p 2 )α 2 γ 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 γ 2 ).
Using the same reasoning, we also obtain that either γ 1 is finite or we can find two final runs which yield a mismatch, and thus we obtain an infinite set of delays. Conversely, let us assume that T 1 and T 2 satisfy the weak adjacency twinning property. This basically means that over synchronized loops, the delay between T 1 and T 2 cannot increase. For any word, one can decompose its runs over T 1 and T 2 into small parts of bounded size and a bounded number of synchronized loops. Overall, the number of delays must stay bounded.

Canonical models for rational functions over infinite words

Now we only have left to show that one can decide the weak adjacency twinning property in PTime. Let T 1 and T 2 be two transducers and let γ 1 and γ 2 be two output words. This is done again using the pattern logic of [START_REF] Filiot | A pattern logic for automata with outputs[END_REF]. For each pair of states q 1 of T 1 and q 2 of T 2 , such that q i is not γ i constant for all i ∈ 2 and both states are co-reachable by some common word, we consider the transducer obtained by union of the two transducer T 1 , T 2 and with final states q 1 and q 2 . The we check in PTime if this transducer satisfies the twinning property. If it does then it means in particular that there are no pairs of runs p 1 u|α1 ---→ T1 q 1 v|β1 ---→ T1 q 1 and p 2 u|α2 ---→ T2 q 2 v|β2 ---→ T2 q 2 with del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ) which concludes the proof. Conversely, if the transducer does not satisfy the twinning property, then there are two runs

p 1 u|α1 ---→ T1 q 1 v|β1 ---→ T1 q 1 and p 2 u|α2 ---→ T2 q 2 v|β2 ---→ T2 q 2 with del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2
). Since q i can reach q i , this means that q i is not γ i constant for all i ∈ 2 and thus (T 1 , γ 1 ) and (T 2 , γ 2 ) do not satisfy the WATP.

Let q 1 be a non γ 1 -constant state of T 1 and let q 2 be a γ 2 -constant state of T 2 , such that both states are co-reachable for some common word. Again we consider the union of T 1 and T 2 with final states q 1 q 2 . We also modify the outputs from q 2 such that it produces γ 2 which does not change the final value since q 2 is γ 2 constant. This time we do not check for the twinning property but only for absence of a mismatch. Again if we do not find a mismatch then it means that there are no pairs of runs p

1 u|α1 ---→ T1 q 1 v|β1 ---→ T1 q 1 and p 2 u|α2 ---→ T2 q 2 v|β2 ---→ T2 q 2 such that del(i (p 1 )α 1 , i (p 2 )α 2 γ 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 γ 2 ).
Conversely, if there exists a mismatch for a different pair of states, then a fortiori (T 1 , γ 1 ) and (T 2 , γ 2 ) do not satisfy the WATP.

Thus by checking properties for each pair of states of T 1 , T 2 we can decide if (T 1 , γ 1 ) and (T 2 , γ 2 ) satisfy the WATP in PTime.

Example 3.2.24. We consider the functions defined in Ex. 3.1.1.

Since del(f erase (ux), f erase (uy)) = del(f erase (x), f erase (y)) then we have that ∆ ≈f erase is trivial, and the same goes for f #a .

The equivalence classes of the delay congruence of f blocks depend on the first letter of the words. Indeed, let x = (#aa) ω , then del(f (a n ax), f (a n bx)) = (aa n x, ba n x) for any positive integer n which means that ax ∆ ≈f blocks bx .

We show in the two following lemmas that the right automata R fine enough to have f R quasi-sequential are exactly those finer than ∆ ≈f .

Lemma 3.2.25. Let f be a rational ω-function and let R be a right automaton recognizing dom(f ).

If ≈ R ∆ ≈f then f R is quasi-sequential.
Proof. Let f : A ω → B ∞ be a rational ω-function and let R be a right automaton recognizing dom(f ), such that ≈ R ∆ ≈f . Let T be a transducer realizing f . Let us consider two initial runs

p 1 u|α1 ---→ q 1 v|β1 ---→ q 1 and p 2 u|α2 ---→ q 2 v|β2
---→ q 2 . Up to taking u = uv, we can assume that u and v have the same last letter (a, r), without loss of generality. Let π :

(A × S R ) ∞ → A ∞ denote the natural projection, such that π • (R) = Id. Let q 1 x1|γ1
---→ P 1 and q 2 x2|γ2 ---→ P 2 denote final runs, we must have that π(x 1 ) ≈ R π(x 2 ) since the two words have a final run from r. Let us first consider the case where p 1 , p 2 are non-constant, and we assume towards a contradiction that we have del(i (p 1 )α 1 , i (p 2 )α 2 ) = del(i (p 1 )α 1 β 1 , i (p 2 )α 2 β 2 ). Since p 1 , p 2 are non constant, we can choose x i such that β ω i = γ i , for i ∈ 2. This means that the set {del(i

(p 1 )α 1 β n 1 γ 1 , i (p 2 )α 2 β n 2 γ 2 )
| n ∈ N} is infinite and thus π(x 1 ) ≈ R π(x 2 ), which yields a contradiction. Let us now assume that p 1 is non constant and p 2 is constant. We assume that β 1 = , and i (p 1 )α

1 β ω 1 = i (p 2 )α 2 γ 2 .
Chapter 3. Characterizations of rational functions over infinite words

Since q 1 is non-constant, we can choose x 1 such that β ω 1 = γ 1 , and thus we obtain that the set {del(i (p 1 )α 1 β n 1 γ 1 , i (p 2 )α 2 γ 2 ) | n ∈ N} is infinite. Finally we conclude that π(x 1 ) ≈ R π(x 2 ), which yields a contradiction, thus T does satisfy the WTP. Lemma 3.2.26. Let f be a rational ω-function and let R be a right automaton recognizing dom(f ).

If f R is quasi-sequential then ≈ R ∆ ≈f .
Proof. Let f : A ω → B ∞ be a rational ω-function and let R be a right automaton recognizing dom(f ). Let T be a transducer realizing f R , and let us assume that T satisfies the WTP. Let x 1 , x 2 ∈ A ω such that x 1 ≈ R x 2 , our goal is to show that x 1 ∆ ≈f x 2 . Since R recognizes dom(f ), we have ∀u, ux 1 ∈ dom(f ) ⇔ ux 2 ∈ dom(f ). Let us consider two initial runs of T over

u = u 1 u 2 u 3 with a simultaneous loop, p 1 u1|α1 ---→ q 1 u2|β1 ---→ q 1 u3|γ1 ---→ r 1 and p 2 u1|α2 ---→ q 2 u2|β2 ---→ q 2 u3|γ2
---→ r 2 , such that there is a final run from r 1 over x 1 producing δ 1 and a final run from r 2 over x 2 producing δ 2 .

If q 1 and q 2 are constant, then we have del(f (ux 1 ), f (ux 2 )) = del(α 1 δ 1 , α 2 δ 2 ). If q 1 and q 2 are non-constant, then by WTP, we have del(f (ux 1 ), f (ux 2 )) = del(α 1 γ 1 δ 1 , α 2 γ 2 δ 2 ). If q 1 is nonconstant and q 2 is constant then del(f (ux 1 ), f (ux 2 )) = del(α 1 γ 1 δ 1 , α 2 δ 2 ). In all cases, we see that we can remove the simultaneous loops of u without changing the delays, and thus we obtain that |{del(f

(ux 1 ), f (ux 2 )) | u ∈ A * }| ≤ |A| (k+1)|Q| 2
where k is the size of the longest output of T .

Theorem 3.2.27. Let f be a rational ω-function and let R be a right automaton recognizing dom(f ).

Then f R is quasi-sequential if and only if ≈ R ∆ ≈f .
Proof. This is a consequence of the two previous results, Lem. 3.2.25 and 3.2.26.

The ultimate look-ahead and a canonical bimachine for quasisequential functions

The look-ahead given by the delay congruence is only fine enough to make a function quasisequential. We define a second canonical left congruence, the ultimate left congruence, which will be fine enough to make any quasi-sequential function sequential. Although it is defined in a machine independent way, this congruence does not share the same minimality property as the delay congruence. Nevertheless, combining the two look-aheads we are able to define a canonical bimachine for any rational ω-transduction.

Ultimate left congruence

Definition 3.2.28. The ultimate left congruence of a function f :

A ω → B ∞ is defined by setting x ∪ ≈f y if ∀u ∈ A * : • ux ∈ dom(f ) ⇔ uy ∈ dom(f ) • if ux ∈ dom(f ) then 1) f (u) = f (ux) ⇔ f (u) = f (uy) and 2) if f (ux) = f (ux) then f (ux) = f (vx)
Observe that f (u) ≤ f (ux), so the intuition for f (u) = f (ux) is that nothing more can be output sequentially after reading u over ux. The idea behind point 2) is that the missing outputs f (ux) -1 f (ux) and f (uy) -1 f (uy) should be equal, which means that f (ux) = f (uy) from point 1). Intuitively, a sequential transducer with the look-ahead given by ∪ ≈f would have enough information to produce the missing output, and know when to start producing it.

Canonical models for rational functions over infinite words

Proposition 3.2.29. Let f : A ω → B ∞ be a function, ∪ ≈f is a left congruence.

Proof. Let f : A ω → B ∞ be a function, let x ∪ ≈f y and let a ∈ A, our goal is to show that ax ∪ ≈f ay. Let u ∈ A * , of course we have that uax ∈ dom(f ) ⇔ uay ∈ dom(f ). Let us assume that uax ∈ dom(f ), we know that f (ua) = f (uax) ⇔ f (ua) = f (uay). If f (u) = f (ua) then we have 1) f (u) = f (uax) ⇔ f (u) = f (uay). In the case where f (u) = f (uax), then we have f (ua) = f (uax) and thus f (uax) = f (uay) which proves 2). If f (u) < f (ua), then we know that f (u) = f (uax) and f (u) = f (uay), and thus we trivially obtain 1) and 2). Hence we have ax Proof. Let B be a bimachine with automata L and R realizing a quasi-sequential function f : A ω → B ∞ . Let S be the sequential transducer obtained by powerset construction from the transducer with underlying automaton L × R (Prop. 3.2.2). Since f is quasi-sequential we know that S is finite (Th. 3.1.25), furthermore S realizes f (Prop. 3.1.21), and has exponential size with respect to B. Our approach here is to define a left congruence ≈ such that ≈ ∪ ≈f , show that ≈ has a doubly exponential size with respect to B and show that if B is aperiodic then so is ≈. Finally, we show how to obtain ∪ ≈f from ≈. Let x, y ∈ A ω , we set x ≈ y if for any state (r, P ) of R × S the two following conditions hold:

• the final runs over x and y from (r, P ) visit the same states infinitely often

• the run of S from P produces over x if and only if it produces over y Let us show that ≈ is a left congruence. Let x ≈ y, let a ∈ A and let (r, P ) be a state of R × S. If there exists a state r of R such that (r, a, r ) is a transition of R, and x, y both have final runs from r , then let P be the successor state of P by reading a in S, and we have that the final runs from (r, P ) over ax, ay visit infinitely often the same states as the final runs from (r , P ) over x, y, and hence we obtain 1). Now let us assume that the runs from P over x, y don't produce . Then the runs from P over ax, ay don't produce either. If the runs from P do produce , then the runs from P over ax, ay produce if and only if the output of the transition (P, a, P ) is equal to , which proves 2).

Let x ≈ y, we want to show that x ∪ ≈f y. Since x, y are equivalent with respect to R, we know that ∀u, ux ∈ dom(f )

⇔ uy ∈ dom(f ). Let u ∈ A * such that ux ∈ dom(f ). If f (u) is infinite then f (u) = f (ux) = f (ux) = f (uy) = f (uy) = f (u). Let us assume that f (ux) is
finite, then by definition of S, we have i S (S 0 )α = f (u), where S 0 u|α --→ S P denotes the initial run of S over u. If f (u) < f (ux), then the run from P over x has to produce something, and thus the run from P over y also produces something and we have f (u) < f (uy). Let us assume f (u) = f (ux) = f (uy) and let (r, S) be a state appearing infinitely often in the final runs from ([x] R , P ) over x, y. By determinism of L, there must be one state l such that ((l, r), β) ∈ S. Thus we obtain that f (ux) = i S (S 0 )αβ = f (uy), which means that x ∪ ≈f y.

One can see that the index of ≈ is exponential in the size of S and thus doubly exponential in B. Now that we have ≈ ∪ ≈f we show how to decide given x, y (rational) whether x ∪ ≈f y. Let P be a state of S, and let rest(x, R) denote the word w if x produces from R and the missing output is w, and ⊥ otherwise. Then one can see that x ∪ ≈f y if and only if ∀R, rest(x, R) = rest(y, R). In order to show that ∪ ≈f is aperiodic, we only have to show that ≈ is aperiodic, given that B is aperiodic. By assumption, R is aperiodic, and from Th. 3.1.26, we know that S is also aperiodic. Let P, R be states of S, let L P,R denote the language of finite words that have a run from P to R, and let L R denote the language of infinite words that have a final run (i.e. a run since all states of S are accepting) from R. Since S is aperiodic, these languages are aperiodic.

Let R a|α --→ S S be a producing transition such that α = . Then the language L P • (L P,R • a • L S ) c of words which have a final run from P and never use this producing transition is aperiodic. Since aperiodic languages are closed under concatenation and complement, this language is aperiodic. Furthermore, since aperiodic languages are closed under intersection, then the language of words which produce from P is aperiodic. Furthermore, let us consider R × S, we can fix any set of set of states as Muller acceptance condition, the obtained automaton is still aperiodic. Thus we have that any congruence class of ≈ is aperiodic, which concludes the proof.

Canonical bimachine for quasi-sequential functions Let f : A ω → B ∞ be a quasisequential function, and let R be a right automaton recognizing dom(f ) such that ≈ R ∪ ≈f . We define the bimachine U f (R) := (A f , R, i f , o R ), with A f and i f defined as in Sec. 3.1, by:

o R ([u] f , a, [x] R ) =    f (u) -1 f (ua) if f (ua) < f (uax) α if f (u) < f (ua) = f (uax) and f (u) -1 f (uax) = αβ ω β if f (u) = f (uax) and f (uax) = αβ ω
Remark 3.2.32. Let us note that given f quasi-sequential we have that A f is finite from Th. 3.1.25, and thus U f (R) is also finite.

Let us first show that the outputs of the above bimachine are well-defined.

o R ([u] f , a, [x] R ) = o R ([v] f , a, [x] R ). If f (u) is infinite, then f (v)
is also infinite and they have the same ultimate period. If f (u) is finite, then we know that f (v) is also finite and f (u) -1 f (uax) = f (v) -1 f (vax) by definition of ∼ f . We also have by the proof of Prop. 3.1.9 that f (u

) -1 f (ua) = f (v) -1 f (va). In all cases we obtain o R ([u] f , a, [x] R ) = o R ([v] f , a, [x] R ). Let us now show o R ([u] f , a, [x] R ) = o R ([u] f , a, [y] R ). If f (ua) < f (uax), then we have that f (ua) < f (uay) since x ∪ ≈f y. If f (u) < f (ua) = f (uax), then we have f (ua) = f (uay) since x ∪ ≈f y. This means that f (uax) = f (uay) and thus in particular f (u) -1 f (uax) = f (u) -1 f (uay). Finally, if f (u) = f (uax), then f (u) = f (uay) since ax ∪ ≈f ay. Thus we have f (uax) = f (uay) which proves o R ([u] f , a, [x] R ) = o R ([u] f , a, [y] R ).

Canonical models for rational functions over infinite words

Theorem 3.2.34. Let f : A ω → B ∞ be a quasi-sequential function, and let R be a right automaton recognizing dom(f ) such that ≈ R ∪ ≈f . Then the bimachine U f (R) is finite and realizes f . Proof. The fact that U f (R) is finite comes from Th. 3.1.25 which says that ∼ f is finite. We only have to show that U f (R) realizes f . Let g be the function realized by U f (R), and let x ∈ dom(f ). One can see that f (x) ≤ g(x) ≤ f (x). If f (x) is infinite, then of course g(x) = f (x). If f (x) is finite, let u < ua < x such that f (u) < f (ua) = f (x). Let f (x) = f (u)αβ ω , then the transition after reading u produces α and all other subsequent transitions produce β, by definition, and thus g(x) = f (x).

Remark 3.2.35. If we consider as right automaton R the automaton obtained by the construction of [START_REF] Carton | Unambiguous Büchi automata[END_REF], we obtain U f (R), a completely canonical bimachine for f quasi-sequential. However we can always left minimize this bimachine and thus a "more canonical" bimachine would be B f (R). Note here that unlike in the finite case, our notion of canonicity depends on a particular construction to obtain a right automaton.

Composing look-aheads and a canonical bimachine

We defined one canonical look-ahead which makes any rational ω-function quasi-sequential, and one which makes any quasi-sequential function sequential. Here we show how to compose these look-aheads to obtain a canonical bimachine for any transduction. We also show that an aperiodic function has an aperiodic canonical bimachine.

Composing look-aheads Let us first make clear what we mean by composition of look-aheads. Let R 1 = (Q 1 , ∆ 1 , I 1 , F 1 ) be a right automaton over an alphabet A. Let R 2 = (Q 2 , ∆ 2 , I 2 , F 2 ) be a right automaton over the alphabet A × Q 1 . We define the Muller automaton R 1 R 2 := (Q 1 × Q 2 , ∆ 1,2 , I 1 × I 2 , F 1,2 ) by:

• ∆ 1,2 := {(s 1 , s 2 ), a, (r 1 , r 2 ) | (s 1 , a, r 1 ) ∈ ∆ 1 and (s 2 , (a, r 1 ),

r 2 ) ∈ ∆ 2 } • F 1,2 := {S | {p | (p, q) ∈ S} ∈ F 1 , {q | (p, q) ∈ S} ∈ F 2 }
Lemma 3.2.36. Let R 1 be an automaton with state space Q 1 over A and let Q 2 be an automaton over

A × Q 1 . Then (R 2 ) • (R 1 ) = (R 1 R 2 ) (up to the isomorphism between (A × Q 1 ) × Q 2 and A × (Q 1 × Q 2 )).
Proof. Let x ∈ A ω , let r be the run of R 1 R 2 over x. By definition of R 1 R 2 , the first component of r depends only on the run of R 1 over x. Then we have that the second component of r is exactly the run of R 2 over (R 1 ) (x), which concludes the proof.

Canonical bimachine

We now have all the tools to show the main theorem of this chapter. In particular, this theorem shows that one can decide whether a given rational function over infinite words is aperiodic. Theorem 3.2.37. Let f be a rational ω-transduction given by a bimachine B. Let R 1 be the right automaton associated with ∆ ≈f and let R 2 be the right automaton associated with

∪ ≈f R1 . Then the bimachine B f (R 1 R 2 ) realizes f . Furthermore, if f is aperiodic, then B f (R 1 R 2 ) is aperiodic.
Proof. Let f be a rational ω-transduction given by a bimachine B. Let R 1 be the right automaton obtained by the construction from [START_REF] Carton | Unambiguous Büchi automata[END_REF], recognizing the delay congruence ∆ ≈f . Let R 2 be the right automaton recognizing the ultimate congruence ∪ ≈f R1 . Since ≈ R1 ∆ ≈f , we have according to Lem. 3.2.25 f R1 is quasi-sequential. Hence since R 2 is finer than ∪ ≈f R1 , we know from Th. 3.2.34 that U f R1 (R 2 ) realizes f R1 . From Th. 3.2.20 we thus have that the function (f R1 ) R2 , obtained by composing the labelings of (R 2 ) and (R 1 ), is sequential. Using Lem. 3.1.17, we obtain that f R1 R2 is sequential, and from Th. 3.2.20 we know that there exists a bimachine realizing f with R 1 R 2 as right automaton. In particular we have that B f (R 1 R 2 ) realizes f . If f is aperiodic, we have from Th. 3.2.22 that ∆ ≈f is aperiodic, and from Th. 1.3.13 R 1 is thus aperiodic, and from Th. 3.2.20 we have that f R1 is aperiodic. From Th. 3.2.31, we have that ∪ ≈f R1 is aperiodic and thus R 2 is aperiodic (Th. 1.3.13). Again from Th. 3.2.20, (f R1 ) R2 = f R1 R2 is aperiodic. A third time from Th. 3.2.20, we have that B f (R 1 R 2 ) is aperiodic, which concludes the proof.

Remark 3.2.38. The complexity of the above construction is several folds exponential (a simple analysis gives 7ExpTime!). We strongly suspect that the complexity can be lowered quite a bit.

Also note that the automata of the canonical bimachine are Büchi automata.

First-order definability of transductions over infinite words

This section is less general than in the finite case. Indeed here we only focus on first-orderdefinable ω-transductions. We show the equivalence with the aperiodic ω-transductions, and thus from Th. 3.2.37 we can decide FO-definability of rational ω-functions. For completeness we also show that FO[≤]-transductions are closed under composition, which is unsurprising for transductions à la Courcelle.

Aperiocity and first-order definability

Theorem 3.3.1. An ω-transduction is aperiodic if and only if it is realizable by an FO[≤]transducer.

Proof. We take the proof of Th. 1.5.8, and adapt it to the aperiodic case. Let T = (A, i , o) be an aperiodic transducer realizing a function f : A ω → B ∞ , with underlying automaton A = (Q, ∆, I, F ). According to Th. 3.2.37 there is an aperiodic bimachine realizing f and from Prop. 3.2.2T can be assumed unambiguous. Let p, q be states of A, let L p,q ⊆ A * be the set of finite words which can go from p to q and let L q ⊆ A ω denote the set of infinite words having a final run from q. Since L p,q , L q are aperiodic, there are FO[≤]formulas φ p,q , L q recognizing them respectively. Given an FO[≤]-formula φ we define inductively the FO c [≤]-formula φ <c by restricting the quantifications to the positions before c. Formally, if φ = ∃y ψ(y) then we set φ <c := ∃y (y < c) ∧ ψ <c (y). Atomic formulas and boolean connectives are left unchanged.

Let us define the FO[≤]-transducer T = K, φ dom , (φ v ) v∈K by:

• K := ({ } ∪ i (I)) • o(∆)
• φ dom := p,q∈I×F φ p,q

Chapter 4 Logics for transductions with origins "I pressed down the mental accelerator. The old lemon throbbed fiercely. I got an idea."

-P.G. Wodehouse

Transductions with origins were introduced in [Boj14], as a richer semantics for transducer models. A classical transduction (or transduction without origins) is a set of pairs of words, whereas a transduction with origins adds for each position of the output word the information of which input position "produced it". It was remarked in [Boj14] that most known models of transducers can be naturally extended with an origin semantics. This includes in particular models of finite state transducers, where the origin of an output position is naturally given by the position of the input head when the letter was produced, as well as logical transducers à la Courcelle. Furthermore the known transformations from one model to another preserve origins, so that inclusions of transduction classes are preserved when going to transductions with origins. Of course, transductions with origins can be considered over other structures such as infinite words, trees, graphs etc; however in this chapter we choose to focus on word-to-word transductions. One particular class of interest is the so-called regular transductions which enjoys several different characterizations. In [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF] it was shown that MSO-transducers and deterministic two-way transducers both characterize the class of functional regular transductions. A result not presented in this manuscript is that functional regular transductions are also captured by reversible (i.e. deterministic and co-deterministic) two-way transducers [START_REF] Dartois | On reversible transducers[END_REF], whereas reversible one-way transducers do not capture all the rational functions. A model of one-way deterministic transducers with registers (called streaming string transducers) was introduced in [START_REF] Alur | Expressiveness of streaming string transducers[END_REF] where the authors showed that this model also captures regular transductions. Finally, regular expressions for transducers were shown in [START_REF] Alur | Regular combinators for string transformations[END_REF] to also capture the regular functions and have since been a topic of interest (see e.g. [ADR15, BR18, DGK18]). All of these equivalences carry over to the origin semantics.

The main model of transducers we study is MSO logic over origin-graphs, i.e. two-sorted graphs composed of an input structure, an output structure (words here) and an origin function from output positions to input positions. The main problems we consider are emptiness, modelchecking and synthesis problems. Let C be a class of transducers, the C-emptiness problem asks, given a transducer T in C whether T = ∅ (or equivalently T o = ∅). We first notice that the satisfiability (emptiness) problem for MSO over word-to-word origin graphs is (unsurprisingly) undecidable.

A transduction R 1 (with or without origins) is said to uniformize1 a transduction R 2 if we have R 1 ⊆ R 2 and dom(R 1 ) = dom(R 2 ). Let C 1 , C 2 be classes of transducers, the model-checking problem of C 1 against C 2 asks given transducers T 1 ∈ C 1 , T 2 ∈ C 2 if the transduction realized by T 1 uniformizes the transduction realized by T 2 , called the specification. The model-checking of regular transductions against MSO-formulas was shown to be decidable in [START_REF] Miko Laj Bojańczyk | Which classes of origin graphs are generated by transducers[END_REF], in the origin semantics. This is not the proof used in the article, but one way to obtain this result is to observe that the origin-graphs recognized by a deterministic two-way transducer have bounded tree-width (even path-width) hence, according to Courcelle's theorem ( [START_REF] Courcelle | The monadic second-order logic of graphs. i. recognizable sets of finite graphs[END_REF]), we obtain the decidability result.

The C 1 , C 2 -synthesis problem asks given a transducer T 2 in C 2 if one can effectively construct a transducer T 1 in C 1 such that the transduction realized by T 1 uniformizes the specification given by T 2 . The Church synthesis problem, introduced in the seminal article [START_REF] Church | Application of recursive arithmetic to the problem of circuit synthesis[END_REF], considers letter-to-letter transductions over infinite words and asks whether one can synthesize a sequential letter-to-letter transducer uniformizing the input relation. It was shown in [START_REF] Büchi | Solving sequential conditions by finite-state strategies[END_REF] that when the specification is a rational letter-to-letter relation over infinite words, then the problem is decidable. When removing the letter-to-letter restriction, the problem (without origins) becomes undecidable (see [START_REF] Carayol | Uniformization in automata theory[END_REF]) because of the asynchronicity between the input and the output. We consider the origin semantics and we show that the synthesis problem is undecidable when one wants to synthesize a regular function from an MSO-formula over origin-graphs. Our main contribution is to exhibit a fragment of MSO, called Lo, for which synthesis of a regular function is always possible, by providing a uniformization algorithm.

The logic Lo has many interesting properties. First, the satisfiability problem is decidable and the domain of an Lo-transduction is always effectively rational, meaning that one can compute an automaton recognizing it from any Lo-formula. Actually, our synthesis result is even stronger than that since we have a uniformization algorithm which takes as input an Lo-formula and outputs a regular function uniformizing it (given for instance as an MSO-transducer). Furthermore, since Lo is closed under boolean operations, one can decide equivalence of Lo-transductions with origins. The fragment Lo is expressive enough to capture all the regular functions. Moreover, we define two extensions of the logic for which we can extend our uniformization algorithm. The first extension, called ∃Lo, adds a block of existential monadic second-order quantifications in front of the formula, and just by considering a larger alphabet our synthesis result transfers to ∃Lo. The fragment ∃Lo subsumes in expressiveness the non-deterministic MSO-transducers, while the latter class is incomparable with Lo. A second extension adds new unary predicates, called single-origin predicates, which allow one to speak about rational properties of the subword of all output positions which originate from a single input position. This second extension subsumes the class of one-way non-deterministic transducers, which is again incomparable with Lo-transductions.

We start the chapter by introducing transductions with origins and the known models of transductions, and in particular MSO-transductions à la Courcelle. Then we study the frontier of decidability of fragments of MSO over origin graphs, and we compare Lo-transductions to the known classes of transductions. In the third section, we show our main result which is the regular uniformization algorithm for Lo-transductions. The fourth section deals with the two extensions of Lo mentioned above. Finally we introduce data words, i.e. words over an infinite alphabet, which have been a recent focus of study (see [BDM + 11, SZ12] for instance). We exhibit a very tight connection between origin-graphs and data words with linearly ordered data. As a consequence, we obtain a decidable logic for data words strictly more expressive than the one from [START_REF] Schwentick | Two-variable logic with two order relations[END_REF], which is shown to be decidable in the article.

The results in this chapter can be found in the article [START_REF] Dartois | Logics for word transductions with synthesis[END_REF].

Transductions with origin

We define origin-graphs, transductions with or without origins and known models of transductions.

Origin graphs

Let S 1 , S2 be two signatures without function symbols, called the input and output signature, respectively. Let u be a (non-empty) S 1 -structure called the input structure, let v be a S 2structure called the output structure and let o : dom(v) → dom(u) be a total function which we call origin function from v to u. We define a new signature S 1,2 o which contains the disjoint union of the predicate symbols of S 1 and S 2 , plus a new unary function symbol o, called the origin symbol. We define the origin-graph (u, (v, o)) as a S 1,2 o -structure of domain dom(u) dom(v). Predicates symbols are interpreted naturally in the structure (u, (v, o)) by either restricting to u or v. The origin symbol o is interpreted as o over dom(v) and as the identity function 2 over dom(u). An origin-graph is called non-erasing if any input position is the origin of at least one output position. Given alphabets A, B an origin-graph over S A , S B is called a word-to-word origin-graph over A, B if its input and output structures are words. In the following, the origingraphs we consider will mostly be word-to-word. Note that we exclude the empty word as a possible input word but this does not weaken the models we consider, up to adding a special symbol at the beginning of words, for instance.

Transductions

Let S 1 , S 2 be two signatures, an origin-free transduction (or just transduction) over S 1 , S 2 is a set of pairs (u, v) such that u is a (non-empty) S 1 -structure and v is a S 2 -structure. The domain of a transduction R is the set dom(R) := {u | (u, v) ∈ R}. A transduction with origin (or origin-transduction) over S 1 , S 2 is a set τ of origin-graphs (u, (v, o)) such that u is a S 1structure, v is a S 2 -structure and o : dom(v) → dom(u) is the origin function. Given an origin-transduction τ , we define its origin-free projection p(τ

) := {(u, v) | ∃(u, (v, o)) ∈ τ }.
The domain of an origin-transduction τ is the set dom(τ ) := dom(p(τ )). An origin-transduction τ is called functional if for any structure u ∈ dom(τ ) there exists a unique pair (v, o) such that (u, (v, o)) ∈ τ . The composition of origin-transductions τ 1 over S 1 , S 2 and τ 2 over S 2 , S 3 is defined by τ

2 • τ 1 := {(u 1 , (v 2 , o 1 • o 2 ) | (u i , (v i , o i )) ∈ τ i , i ∈ 2, v 1 = u 2 }. Note that we have p(τ 2 •τ 1 ) = p(τ 2 )•p(τ 1
), which justifies the notation. An origin-transduction is called non-erasing if all its origin-graphs are non-erasing. Given alphabets A, B a transduction over S A , S B is called a word-to-word transduction over A, B if all its origin-graphs are word-to-word. We tend to write origin-transductions with Greek letters and origin-free transductions with capital Latin letters.

MSO-transducers

Courcelle MSO-transducers (see [START_REF]Monadic second-order definable graph transductions: A survey[END_REF]), generalize the order-preserving definition we gave in Ch. 1. In general they define transductions from relational structures over one signature to structures over a second signature, but we will mostly focus on word-to-word transductions. Let S 1 , S 2 be two signatures without function symbols. We start by defining non-deterministic MSO-transducers and then we define the deterministic version, MSO-transducers, as a particular restriction. An NMSO-transducer over signatures S 1 and S 2 is a tuple

T =   k, l, φ dom , φ i pos (x, X 1 , . . . , X l ) i∈k , φ i1,...,im R (x 1 , . . . , x m , X 1 , . . . , X l ) i1,...,im∈k ar 2 (R)=m   
where k is a positive integer (called the number of copies), l is an integer (called the number of parameters), φ dom is an MSO[S 1 ]-sentence, for i ∈ k, φ i pos is an MSO[S 1 ]-formula, for R a relation symbol of S 2 of arity m and for i 1 , . . . , i m ∈ k, φ i1,...,im R is an MSO[S 1 ]-formula. From u a S 1 -structure, and for P 1 , . . . , P l ⊆ dom(u) we define a S 2 structure v by:

• dom(v) := (i, j) | i ∈ dom(u), j ∈ k, u |= φ j pos (i, P 1 , . . . , P l ) • R v := ((i 1 , j 1 ), . . . , (i m , j m )) ∈ dom(v) m | u |= φ j1,...,jm R (i 1 , . . . , i m , P 1 , . . . , P l )
where R is a S 2 relation symbol of arity m

We now define naturally an origin function o : dom(v) → dom(u) by o(i, j) = i. We say that the origin-graph (u, (v, o)) is realized by T . We define two semantics for transductions: the origintransduction realized by T is the set T o of origin-graphs realized by it, while the origin-free transduction realized by T is defined by T := p( T o ). An MSO-transduction is a particular case of NMSO-transduction with no parameters, i.e. l = 0. In that case, we will simply omit l in the tuple. Note that MSO-transductions (with or without origins) are functional by definition. A regular word-to-word transduction over alphabets A, B is an NMSO-transduction over signatures S A , S B with the semantic restriction to word-to-word origin graphs (note that this restriction can be enforced in MSO[≤]). A word-to-word MSO-transduction is called a regular function.

Example 4.1.1. We give an example of an NMSO-transducer over words with alphabets A, A.

We define an NMSO-transducer which copies some subword of the input twice. We define a transducer with one parameter variable X which will denote the positions of the copied subword.

Let

T d := 2, 1, , φ i pos (x, X) i∈2 , (a(x)) a∈A , φ i,j ≤ (x, y, X) i,j∈2 with ∀i ∈ 2, φ i pos (x, X) := x ∈ X, φ i,i ≤ (x, y, X) := x ≤ y, φ 1,2 ≤ (x, y, X) := and φ 2,1 ≤ (x, y, X) := ⊥. The transduction we obtain is T d = {(u, vv) | v subword of u}.
Similarly, we define a NMSO-transducer which does the same but only when the subword has even length. Let even(X) be formula saying that X contains an even number of positions, then T d,e := 2, 1, even(X), φ i pos (x, X) i∈2 , (a(x)) a∈A , φ i,j ≤ (x, y, X) The equivalence between MSO-transducers and deterministic two-way transducers is due to [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF]. The equivalence between SSTs and MSO-transducers is due to [START_REF] Alur | Expressiveness of streaming string transducers[END_REF]. As it was remarked in [Boj14], the equivalences carry over to origin semantics. Theorem 4.1.2. The following models characterize the regular word-to-word functions (with or without origins):

• deterministic two-way transducers

• MSO-transducers

• streaming string transducers

It was also shown in [START_REF] Alur | Nondeterministic streaming string transducers[END_REF] that one of the above equivalences generalizes to the nondeterministic case.

Theorem 4.1.3. The following models characterize the regular word-to-word relations (with or without origins):

• NMSO-transducers

• non-deterministic streaming string transducers However, non-deterministic two-way (and even one-way) transducers are incomparable in expressiveness with NMSO-transducers.

Logics with origins

A logic over origin-graphs defines a class of transductions. We consider several fragments of MSO over word-to-word origin graphs, and study their respective expressiveness and the decidability of the problems mentioned above: emptiness, model-checking and synthesis of regular functions.

MSO over word-to-word origin graphs

We denote by MSO o = MSO[A, B, ≤ out , ≤ in , o] the logic over word-to-word origin-graphs with ≤ in , ≤ out the input and output linear orders and A, B the input and output alphabets, respectively and o the origin function. Note that, unless specified, the alphabets are implicitly known and we write MSO[≤ out , ≤ in , o], instead. Given an MSO o -formula φ, we define by φ o the set of origin-graphs satisfying φ and by φ := p( φ o ) the origin-free semantics of φ.

Example 4.2.1. We define several macros for MSO o , which will make notations easier. We define in(x) := x ≤ in x and out(x) := x ≤ out x, the input and output predicates, respectively. We naturally define the predicates =, < in , < out . We also define quantifiers restricted to either input or output positions: let α ∈ {in, out} then ∃ α x φ := ∃x α(x) ∧ φ, ∀ α x φ := ∀x α(x) → φ. Note that ∀ α x φ = ¬∃ α x ¬φ.

We define several formulas with (hopefully) transparent names:

• φ inj := ∀ out x, y o(x) = o(y) → x = y, states that o is injective • φ surj := ∀ in x ∃ out y o(y) = x, states that o is surjective • φ lab := ∀ out x a∈A a(o(x)) → a(x)
, states that labels are preserved

• φ shuffle := φ inj ∧ φ surj ∧ φ lab

A new fragment

As we have just seen, even very weak fragments of MSO o still have an undecidable satisfiability problem. Our objective is to find a fragment of MSO o which is weak enough to be decidable, but still as expressive as possible. Our initial objective was to find a fragment expressive enough to capture at least the regular functions. We define Lo, a fragment of MSO o which does capture regular functions (and much more). We show in Sec. 4.4 that the satisfiability problem is decidable for Lo, and we even show a stronger result: an algorithm that takes an Lo-formulas as an input and outputs a regular function uniformizing it. Intuitively, Lo is an extension of FO 2 [A, B, ≤ in , ≤ out , o], with additional binary predicates. These predicates are arbitrary predicates definable in MSO[A, ≤ in ], i.e. regular predicates which can only talk about the input. Definition 4.2.5. We define over alphabets A, B the logic

Lo := FO 2 [B, ≤ out , o, MSO[A, ≤ in ]]
In order to make formulas more readable we write MSO[A, ≤ in ] predicates, called input predicates, in between chevrons , . Note that from now on, the input predicates are viewed as atomic formulas. Furthermore, since we only have two first-order variables, we can assume without loss of generality that the input predicates have at most two free first-order variables.

Example 4.2.6. All the transductions given in Ex. 4.2.1 are actually definable in Lo. For instance we define equivalently φ inj := ∀ out x, y z = in t (o(x), o(y)) → x = y. To simplify notations, we will often substitute the terms for the variables in the predicates φ . For instance we write φ inj := ∀ out x, y o(x) = in o(y) → x = y. Let us give the other previous examples in this formalism.

• φ surj := ∀ in x ∃ out y o(y) = in x , states that o is surjective • φ lab := ∀ out x a∈A a(o(x)) → a(x), states that labels are preserved • φ shuffle := φ inj ∧ φ surj ∧ φ lab • φ id := φ shuffle ∧ ∀ out x, y o(x) ≤ in o(y) → x ≤ out y • φ mirror := φ shuffle ∧ ∀ out x, y o(x) ≤ in o(y) → x ≥ out y
Let us now give another example which actually makes use of a third variable. Note that the use of the third variable is made inside an MSO predicate and so is allowed in Lo: ∃ out x, y a(x) ∧ a(y) ∧ o(x) < in o(y) ∧ ∀ in z z ≤ in o(x) ∨ o(y) ≤ in z . This formula recognizes origin-graphs such that there are two output positions labeled by a whose respective origins are adjacent.

Expressing regular transductions

Regular functions We show how to express regular functions in Lo.

Theorem 4.2.7. Any regular function can be expressed in Lo.

Proof. We consider T := k, φ dom , φ i pos (x) i∈k , φ i a (x) i∈k,a∈B , φ i,j ≤ (x, y)

i,j∈k a word-toword MSO-transducer over A, B. Given an MSO[A, ≤]-formula φ of T , we will abuse notations and write φ to denote the predicate where ≤ in and ∃ in have been substituted for ≤ and ∃, respectively.

Chapter 4. Logics for transductions with origins

Let us start by defining formulas which talk about the output produced by some input position x. Let P ⊆ k. We define the formula saying which copies of x are used.

φ P (x) := i∈P φ i pos (x) i / ∈P ¬φ i pos (x)
Let i 1 , . . . , i l be a non-repeating sequence of integers in k, we define a formula specifying the order of the copies of x. φ i1,...,i l (x) := φ {i1,...,i l } (x)

1≤m<n≤l φ im,in ≤ (x, x)
Let v ∈ B l , we define a formula saying that x produces v.

φ i1,...,i l ,v (x) := φ i1,...,i l (x) j∈l φ ij v(j) (x)
Now we define inductively formulas to state that an output position has at least i positions to its left with the same origin for i ≥ 0.

D 0 (x) := out(x) D i+1 (x) := ∃ out y y ≤ out x ∧ o(y) = in o(x) ∧ D i (y)
From this we define C i+1 (x) := D i (x) ∧ ¬D i+1 (x) which states that x is exactly the i + 1st position with origin x.

We are now able to define the final formula defining the same origin-transduction as T .

φ dom ∧ ∀ in x φ ∅ (x) ↔ ∀ out y o(y) = in x ∧∀ out x l,i1,...,i l ,∈k,a∈B,p∈l C p (x) ∧ φ i1,...,i l (o(x)) ∧ φ ip a (o(x)) ∧ a(x) ∧∀ out x, y
l,m,i1,...,i l ,j1,...,jm∈k,a,b∈B,p∈l,q∈m

C p (x) ∧ C q (y) ∧ φ i1,...,i l (o(x)) ∧ φ j1,...,jm (o(y)) ∧ φ ip a (o(x)) ∧ φ jq b (o(y)) ∧ φ ip,jq ≤ (o(x), o(y)) → a(x) ∧ b(y) ∧ (x ≤ out y)
The formula can seem scary but it can be decomposed into three main parts: in the first line we state that the input satisfies the domain formula and that an input position which does not produce anything must satisfy φ ∅ . The big disjunction states that any output position must correspond to some copy of its origin. The big conjunction makes sure that the output positions do satisfy the properties enforced by T .

Existential logic

We define a new logic over origin-graphs ∃Lo, which consists in formulas of the form ∃X 1 . . . ∃X n φ where φ is an Lo-formula with additional unary predicates X 1 , . . . , X n available both for input and output positions. We show that this extension captures NMSOtransductions.

Theorem 4.2.8. Any regular transduction can be expressed in ∃Lo.

Proof. The proof is very similar to the one for regular origin-functions. Indeed, an NMSOtransducer can be thought of as an MSO-transducer but over a larger alphabet. If T is an NMSO-transducer with parameters X 1 , . . . , X n , then we define an ∃Lo formula ∃X 1 , . . . , X n φ where φ is an Lo-formula over a signature extended with new unary predicates. The Lo formula φ is defined exactly as in the proof of Th. 4.2.7. Example 4.2.9. We give examples of transductions which belong to some classes of Fig. 4.2 but not others. A transduction which is not a function but in all other classes could be {(a, a), (a, b)}.

Reduction of the regular synthesis problem

A typical example of a transduction which cannot be done by a one-way transducer (1NFT) is the mirror function given by φ mirror from Ex. 4.2.6. An example which is definable by an NMSOtransduction or in Lo but cannot be done by a two-way transducer (2NFT) is given by T d from Ex. 4.1.1 which intuitively needs to make twice the same non-deterministic choice on each position. An origin-transduction which can be done by a 1NFT, or an NMSO-transducer but not in Lo is keeping an even number of positions and erasing the others. The intuition behind this is that parity cannot be expressed in FO 2 [≤]. Finally an example which cannot be realized by an NMSO-transduction is {a} × A * since NMSO-transductions can only have a linear size increase, meaning that for any regular transduction there is a uniform constant k such that the output is at most k times the size of the input.

Combining these we can obtain a transduction in any part of the diagram of Fig. 4.2. Let us give an example of MSO o -transduction that does not belong to the other classes. Let φ cfl := φ shuffle ∧ φ in a * b * ∧ φ out (ab) * , where φ shuffle is the formula from Ex. 4.2.1 which says that the output is a permutation of the input. The formula φ in a * b * states that the input belongs to a * b * which can be expressed in first-order logic with two variables with either S in or ≤ in . On the other hand φ out (ab) * states that the output belongs to (ab) * , which is famously not expressible in in first-order logic with two variables and ≤ out but is of course expressible with S out . This means that the domain of the transduction defined by φ cfl is the language {a n b n | n ≥ 1} which is famously not rational. However as we will see in the next sections, Lo-transductions always have a rational domain.

Reduction of the regular synthesis problem

The Lo regular synthesis problem asks, for an origin transduction given as an Lo-formula if one can obtain a regular function (given as an MSO-transducer for instance) uniformizing it. Before tackling the regular synthesis problem for Lo-formulas, we start by reducing the problem several times to simpler problems. First we show how to restrict the problem to non-erasing transductions. This can easily be done by adding a copy of the input at the beginning of the output word. Second, we put formulas in Scott Normal Form (SNF), which is a classical method when dealing with first-order logic with two variables, allowing one to reduce the quantification rank of a formula to two (see [START_REF] Grädel | On logics with two variables[END_REF]). Third, we show that over non-erasing origin-graphs, we can restrict quantifications to output positions since any input position is the origin of some output position. Finally we replace these simple low quantifier rank formulas by sets of simple constraints called MSO constraints. From these reductions we can describe the uniformization algorithm. First we start by transforming the input formula following the previous steps. Then we describe a uniformization algorithm for MSO constraints. Finally we work backwards to retrieve a uniformization of the initial transduction.

Non-erasing transductions

Let g = (u, (v, o)) be an origin-graph over alphabets A, B, we define a non-erasing origin-graph over A, B { } A by g ne := (u, (u v, o )) such that for i ∈ {1, . . . , |u|}, o (i) := i, o (|u| + 1) := 1 and for i > |u| + 1, o (i) := o(i -|u| -1). Intuitively, we add on the left of v a copy of the input and separate the two by a symbol. This is illustrated in Fig. 4.3. We now show that we only have to find a uniformization algorithm for non-erasing formulas.

Theorem 4.3.1. Let φ be an Lo-formula. We can define a non-erasing Lo-formula φ ne such that for any origin-graph g, g |= φ ⇔ g ne |= φ ne .

Proof. Let φ be an Lo-formula over alphabets A, B. The main idea of the proof is to restrict quantifications to either positions before or after a special symbol . Then, we say that the output restricted to positions before the satisfies the identity formula and the output restricted to positions after the satisfies φ.

We start by defining ψ := ∃ out x (x) ∧ ∀ out x, y ( (x) ∧ (y)) → x = y, stating that there exists exactly one output position labeled by . Then, we can define the predicates < (x) := ∃ out y x < out y∧ (y) and > (x) := ∃ out y y < out x∧ (y). We also define ψ A B := ψ ∧∀ out x < (x) ↔ ( a∈A a(x)) to ensure that the alphabets are respected. Given an Lo-formula ψ, we define inductively ψ < , by restricting the output quantifications to positions before the . If ψ = ∃ out x θ(x) then we define ψ < := ∃ out x < (x) ∧ θ < (x). Predicates and boolean connectives are not affected by this. Similarly we define ψ > . We can define the final formula:

φ ne := ψ A B ∧ φ < id ∧ φ >
where φ id is the formula defining the identity origin-transduction given in Ex. 4.2.1.

A consequence of the previous result is that a uniformization algorithm for non-erasing Loformulas yields an algorithm for general Lo-formulas.

Scott Normal Form

We now describe the classical method (see [START_REF] Grädel | On logics with two variables[END_REF]) used for two-variable logic, the Scott Normal Form (SNF). The main idea is to reduce the quantification rank by augmenting the signature with new unary predicates. The number of additional unary predicates is linear in the size of the original formula. Let φ be an Lo-formula, and let ψ(x) be a subformula of φ with one quantifier. Let φ be the formula φ where the predicate P (x) has been substituted for every occurrence of ψ(x). Then the formula φ ∧ ∀x ψ(x) ↔ P (x) has the same models as φ, up to projecting away the predicate P . Hence we obtain a new formula with a shallower syntactic tree, and by repeating the process we obtain a formula of quantifier rank two. • ψ is of the form ∀x, y χ(x, y) ∧ i∈n ∀x ∃y β i (x, y), where ∀i ∈ n χ, β i are quantifier-free.

Proof. First, we assume without loss of generality that negations only occur at the level of atomic formulas. Let k denote the number of quantifiers in φ. We construct ψ iteratively, by defining for i ≤ k formulas θ i and ψ i such that φ is equivalent to θ i ∧ ψ i (up to projecting over B), and ψ i has i less quantifiers than φ. We initialize by θ 0 := and ψ 0 := φ. Let i > 0 and consider ξ i (x) a subformula of ψ i-1 with one quantifier. Then ξ i (x) is either of the form ∃y ρ(x, y) or ∀y ρ(x, y), where ρ(x, y) is a quantifier-free formula. Either way let θ i := θ i-1 ∧ ∀x P i (x) ↔ ξ i (x), where P i is a fresh unary predicate. The formula ψ i is obtained by substituting P i (x) for ξ i (x) in ψ i-1 .

Since φ has k quantifiers, we know that ψ k is quantifier-free. Furthermore, θ has two types of conjuncts, ∀∀ or ∀∃. All ∀∀ conjuncts can be regrouped in one formula χ, and we obtain a formula in the advertised form.

Let us now argue that φ and ψ are equivalent, up to projection over B. Let i ≤ k, we show by induction on i that θ i ∧ ψ i is equivalent to φ. Let i < k and let us assume that the property holds for i. Let g i be a model for θ i ∧ ψ i , we define g i+1 by adding the predicate P i+1 interpreted by {p ∈ dom(g i ) | g i , p |= ξ i+1 (x)}. Of course g i+1 |= θ i+1 since P i+1 is interpreted exactly as the positions in which ξ i+1 (x) holds. Similarly, since the positions satisfying ξ i+1 (x) are exactly the ones satisfying P i+1 (x) we have that g i+1 |= ψ i+1 .

Conversely, let g i+1 |= θ i+1 ∧ ψ i+1 . We define g i by projecting away the predicate P i+1 . We have a fortiori that g i |= θ i . Furthermore, all positions of g i+1 satisfying P i+1 (x) are exactly the positions satisfying ξ i+1 (x). However the positions of g i which satisfy ξ i+1 (x) are exactly the same as for g i+1 , which means that g i |= ψ i , and concludes the proof. Remark 4.3.4. Note that the number of new predicates is linear in the size of the formula. However, the number of new letters is exponential. Indeed the new predicates are not exclusive, so we obtain 2 k new letters.

Given a uniformization algorithm for Lo-formulas in SNF, we are thus able to retrieve an algorithm for general Lo-formulas by projecting the output labels over the original alphabet.

Uniformization algorithm

A universal constraint is a tuple (b, c, d, φ ) with b, c ∈ B, d ∈ {< out , = out , > out } and φ is an input predicate. We say that a non-erasing origin-graph g and two output positions p, q do not satisfy the constraint if p, q are labeled b, c, respectively, ordered by d and their origins satisfy φ . Intuitively, a universal constraint can be thought of as a forbidden pattern. Formally, a graph g and two output positions p, q satisfy the constraint if we have g, p, q |= ¬ (b(x) ∧ c(y) ∧ (x d y) ∧ φ (o(x), o(y))). The graph g satisfies the universal constraint if for all output positions p, q then g, p, q satisfy it.

An instance of the MSO Constraint Problem (MCP) is a pair C = (C ∃ , C ∀ ) of finite sets of existential and universal constraints, respectively. A non-erasing origin-graph g is said to satisfy (or model) C if it satisfies each of its constraints, and we denote it by g |= C. We write C o to denote the set of non-erasing origin graphs satisfying C. Theorem 4.3.9. Let φ be an output Lo-formula in SNF. We can construct C an MCP equivalent to φ over non-erasing origin-graphs.

Proof. Let φ = ∀ out x, y χ(x, y) ∧ i∈n ∀ out x ∃ out y β i (x, y) be an output Lo-formula in SNF. A atomic binary type for x, y is a truth value for all unary predicates P (x), P (y) and binary predicates Q(x, y). Hence the formula χ(x, y) can be seen as a disjunction of all the allowed atomic binary types. Thus we can define C ∀ as the set of all forbidden atomic binary types. Thus satisfying ∀ out x, yχ(x, y) is equivalent to satisfying all the constraints of C ∀ .

By a case study analysis, we can rewrite the rest of the formula i∈n ∀ out x ∃ out y β i (x, y) as:

∀ out x i∈m b i (x) → ∃ out y j∈n i c i,j (y) ∧ (x d i,j y) ∧ φ i,j (o(x), o(y))
where m ∈ N, for all i ∈ m, n i ∈ N and for all j ∈ n i , c i,j ∈ B, d i,j ∈ {< out , = out , > out }, and φ i,j is an input predicate. For each i ∈ m we define an existential constraint (b i , E i ) with

E i := {(c i,j , d i,j , φ i,j ) | j ∈ n i }.
We define C ∃ as the set of all such constraints and thus, satisfying the original formula is equivalent to satisfying C ∃ .

Corollary 4.3.10. Let φ be an output Lo-formula in SNF, let C be the obtained equivalent MCP, and let T be an MSO-transducer uniformizing C o .Then T uniformizes φ ne o .

Proof. This is a direct consequence of Th. 4.3.9.

In the following lemma we sum up the reduction results of the section.

Lemma 4.3.11. Given a regular uniformization algorithm for the MCP, we have a regular uniformization algorithm for Lo.

Proof. This is obtained by combining the reductions of the previous subsections, Lem. 4.3.2, Lem. 4.3.5, Cor. 4.3.8 and Cor. 4.3.10.

Uniformization algorithm

We have reduced the initial synthesis problem to the regular synthesis problem of MCPs. Indeed, according to Lem. 4.3.11, it suffices to exhibit a regular uniformization algorithm for MCPs in order to obtain a regular uniformization algorithm for Lo. The main ideas used to solve this problem are inspired from [START_REF] Schwentick | Two-variable logic with two order relations[END_REF] where the authors showed the decidability of first-order logic with two variables over data words with the linear order and the data order. We extend these ideas to our setting, and refine them to obtain not only decidable satisfiability but also effective

q i q x q y q f α α α α α q 0 q 1 α α Figure 4
.5: Two predicate automata. The left one recognizes the successor predicate with selecting pair (q x , q y ). The right one recognizes the even distance predicate with selecting pairs (q 0 , q 0 ) and (q 1 , q 1 ).

regular synthesis for Lo. MSO binary predicates are replaced by binary predicate automata recognizing words with two distinguished positions x, y. We enrich origin-graphs with extra information, and we call these new objects full profile graphs. A full profile graph contains for each input position a copy of the output, with additional information about the binary predicates.

From a full profile graph we define its reduced profile graph, which only keeps a bounded number of output positions for each input position. We show however that if a full graph satisfies an existential or universal constraint, then its reduced graph also does. Finally we show that if a reduced graph is valid (with respect to an MCP) and locally consistent (defined later) then one can construct an associated full graph. Since these properties are regular, we can recognize the set of valid and consistent reduced graphs, and by constructing the associated origin-graph, we obtain a uniformization of the original transduction.

A very useful tool will be to visualize an origin graph as a two dimensional structure with the input in the abscissa and the output in the ordinate, just as seen in Fig. 4.4.

Predicate automata

Before starting solving the problem, we replace MSO-formulas by automata, which are easier to deal with. We define the notion of predicate automata, a common tool to study MSO queries (see e.g. [START_REF] Niehren | N-ary queries by tree automata[END_REF]).

A (binary) predicate automaton over an alphabet A is a pair (A, SP ) where A is an automaton and SP ⊆ Q × Q is the set of selecting pairs, with Q the set of states of A. Given a word u and a b b a a d,→,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d, • ,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d,→,(q 0 ,q 0 ) d,→,(q 0 ,q 0 ) d,→,(q 0 ,q 0 ) d,→,(q 1 ,q 0 ) c, • ,(q 1 ,q 1 ) d,←,(q 1 ,q 0 ) c,→,(q 1 ,q 1 ) d,→,(q 1 ,q 0 ) d,→,(q 1 ,q 0 ) d,→,(q 1 ,q 0 ) d, • ,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) d,←,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d, • ,(q 0 ,q 0 ) d,→,(q 0 ,q 0 ) d, • ,(q 0 ,q 0 ) d,←,(q 1 ,q 0 ) c,←,(q 1 ,q 1 ) d,←,(q 1 ,q 0 ) c, • ,(q 1 ,q 1 ) d,←,(q 1 ,q 0 ) d,→,(q 1 ,q 0 ) d,←,(q 1 ,q 0 ) d,←,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) d,←,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) d,←,(q 0 ,q 0 ) d, • ,(q 0 ,q 0 ) d,←,(q 0 ,q 0 ) in out two positions i, j ≤ |u|, we say that the triple u, i, j is recognized by (A, SP ) if there exists an accepting run r of A over u such that (r(i), r(j)) ∈ SP . Given φ(x, y) a binary MSO[≤]-definable predicate over an alphabet A, we can define an equivalent predicate automaton (A φ , S φ ) over A. Given Φ = {φ 1 , . . . , φ n } a set of binary MSO[≤] predicates, we can take the union of all the predicate automata of each φ i , i ∈ n, and thus we obtain a unique automaton A Φ and one set of selecting pairs for each predicate, {SP φ1 , . . . , SP φn }.

Example 4.4.1. We give in Fig. 4.5 on the preceding page a predicate automaton for the successor predicate, where the only selecting pair is {(q x , q y )}. We also give an automaton for the even distance predicate.

Profiles

The notion of profile is a bit intricate but it is crucial to our approach. The profile of an input position in an origin-graph keeps information about the output positions it produces and also about other output positions.

Clauses Let A, B be alphabets, let C be an MCP instance, let A Φ be the automaton of the MSO input predicates appearing in C, let Q Φ be the state space of A Φ and let d,→,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d, • ,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d,→,(q 0 ,q 0 ) d,→,(q 1 ,q 0 ) c, • ,(q 1 ,q 1 ) d,←,(q 1 ,q 0 ) c,→,(q 1 ,q 1 ) d,→,(q 1 ,q 0 ) d, • ,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) d,←,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d,→,(q 0 ,q 0 ) d, • ,(q 0 ,q 0 ) d,←,(q 1 ,q 0 ) c,←,(q 1 ,q 1 ) c, • ,(q 1 ,q 1 ) d,→,(q 1 ,q 0 ) d,←,(q 1 ,q 0 ) d,←,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) c,←,(q 0 ,q 1 ) d, • ,(q 0 ,q 0 ) d,←,(q 0 ,q 0 ) in out Profile A C-profile (or just profile for short) is a sequence of the form λ = (a, S, A 1 , . . . , A k ) where a ∈ A, S ⊆ Q Φ is a subset of states of the predicate automaton, and A j is a clause for any j ∈ k. A clause occurrence A j in such a profile λ is called extremal if either for all clauses A j = A j we have j ≤ j (A j is maximal) or for all clauses A j = A j we have j ≥ j (A j is minimal). In the following, for j ∈ k we will often say the clause A j to refer to the occurrence of the clause corresponding to the jth clause of λ.

A profile is called reduced if any type of clause occurs at most two times. The reduction of a profile λ is the reduced profile ρ(λ) obtained by removing all non extremal clauses, i.e. for each type of clause only the two outermost occurrences are kept.

The input of a profile sequence s = λ 1 , . . . , λ n , with λ i = a i , S i , A i 1 , . . . , A i ki is the word in(s) = a 1 • • • a n . Note that the number of reduced profiles is less than

|A| • 2 |QΦ| • N 2N C +1 C .
Let g = (u, (v, o)) be an origin-graph. The full profile of an input position i ∈ {1, . . . , |u|} of g is the sequence λ i := (a, S, A 1 , . . . , A |v| ), where a = u(i), and S is the set of states p such that there is an accepting run r of A Φ over u with r(i) = p. In short, the set S characterizes the unary MSO-type of position i of u. For j ∈ {1, . . . , |v|}, we have A j := (v(j), s j , P j ), where s j is • if o(j) = i, → if o(j) > i and ← if o(j) < i. The set P j is defined as the set of pairs of states (p, q) such that there is an accepting run r of A Φ over u where r(i) = p and r(o(j)) = q. Intuitively, the clause A j keeps track of the label of position j as well as the binary predicates satisfied at positions (i, o(j)). Note that if A j is local, then P j = {(p, p) | p ∈ S}. The reduced profile (sometimes just profile) of an input position is the reduction of its full profile. The full profile sequence of g = (u, (v, o)) is the sequence fSeq(g) = λ 1 , . . . , λ |u| where λ i is the full a b b a a d,→,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d, • ,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d,→,(q 0 ,q 0 ) d,→,(q 1 ,q 0 ) c, • ,(q 1 ,q 1 ) d,←,(q 1 ,q 0 ) c,→,(q 1 ,q 1 ) d,→,(q 1 ,q 0 ) d, • ,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) d,←,(q 0 ,q 0 ) c,→,(q 0 ,q 1 ) d,→,(q 0 ,q 0 ) d, • ,(q 0 ,q 0 ) d,←,(q 1 ,q 0 ) c,←,(q 1 ,q 1 ) c, • ,(q 1 ,q 1 ) d,→,(q 1 ,q 0 ) d,←,(q 1 ,q 0 ) d,←,(q 0 ,q 0 ) c,←,(q 0 ,q 1 ) c,←,(q 0 ,q 1 ) d, • ,(q 0 ,q 0 ) d,←,(q 0 ,q 0 ) in out clause of the form (b, •, P ) or (b, →, P ). Then the predecessor of K with respect to a, a , S, S is the clause K = (b, →, P ) with P = (p, q) ∈ S × S | ∃(p , q) ∈ P , p a -→ AΦ p . A pair of profiles K, K such that either K is a successor of K or K is a predecessor of K is called an adjacent pair of clauses.

Example 4.4.6. In particular all pairs of clauses linked by a dotted line in Fig. 4.8 are adjacent.

Linked clauses Before defining consistency, we define the notion of linked clauses in two profiles. Let λ = (a, S, A 1 , . . . , A k ) and µ = (b, T, B 1 , . . . , B l ) be two profiles. Let i ∈ k, j ∈ l such that A i , B j is an adjacent pair. We say that A i and B j are linked, with respect to λ, µ, if one of the two following cases occurs:

• the index i is maximal among clauses of λ adjacent to B j and the index j is maximal among clauses of µ such that A i is adjacent to them.

• the index i is minimal among clauses of λ adjacent to B j and the index j is minimal among clauses of µ such that A i is adjacent to them.

We denote that A i and B j are linked by A i λ,µ B j (the profiles λ, µ are often left implicit). Given a profile sequence s = λ 1 , . . . , λ n , we define the link closure of s by * s , the symmetric and transitive closure of 1≤i<n λi,λi+1 .

Consistency of profiles

Let us define the notion of consistent profiles. Intuitively, two profiles are consistent if they are the reductions of two profiles of same size such that for any i the ith A transducer realizing R Seq is simply obtained from the profile automaton of Lem. 4.4.18, by replacing a transition of the form (p, λ, q) where in(λ) = a, by a transition reading a and outputting λ. To realize f link , we define an MSO-transduction, which reads input words over P C (the alphabet of profiles), copies each input position the number of its clauses times and links linked clauses. From the graph of clauses, we can define an MSO-transduction that erases all non local clauses and adds the → s relation which is MSO-definable. According to Prop. 4.4.15, the graph of local clauses with → s is a DAG. Finally we use a result of [START_REF]The monadic second-order logic of graphs X: linear orderings[END_REF] which states that there is an NMSO-transduction that takes a DAG as an input and produces a linearization of it. Additionally the DAG needs to be locally ordered, meaning that the successors of a given vertex must be ordered. This is the case for the graphs of → s over local clauses since local clauses can be ordered by the input order and then the profile order. Thus we can define an MSO-transduction f lin taking as input the graph of local clauses with → s , and linearizing it.

The equality of the domain of R and C o comes from Cor. 4.4.19 where we show that input words of models of C are exactly the domain words of complete valid sequences. Furthermore, the fact that this transduction uniformizes C o , comes from Lem. 4.4.16 which states that the origin-graph obtained from a linearization of a valid and complete sequence is a model of C. Finally since NMSO-transductions are closed under composition [START_REF] Courcelle | The monadic second-order logic of graphs. i. recognizable sets of finite graphs[END_REF], we obtain an NMSOtransduction realizing R. Thus R can be uniformized by an MSO-transduction.

We finally obtain our main result, by reducing synthesis for Lo-transductions to synthesis for MCP instances. Proof. This is a simple consequence of the uniformization from Th. 4.4.24, and the properties of the reductions from Sec. 4.3. Indeed we have seen in Lem. 4.3.11 that having a regular uniformization algorithm for MCP instances yields a regular uniformization algorithm for Lo.

As a consequence we can decide if an Lo-transduction is functional. Proof. Let φ be an Lo-formula, and let T be an MSO-transducer uniformizing φ, which can be obtained by Th. 4.4.25. According to Th. 4.2.7, one can define an Lo-formula φ T such that φ T o = φ o . Thus the formula φ ↔ φ T is valid if and only φ is functional, which is decidable from Th. 4.4.21.

Words with ordered data

Data words have been studied recently as an extension of words over an infinite alphabet. Usually the alphabet is split into a finite part and an infinite part where the infinite part is restricted to only equality tests (see [START_REF] Bouyer | A logical characterization of data languages[END_REF]). Several attempts have been made to extend the expressiveness with additional predicates talking about the data, for instance [BDM + 11, SZ12] have given decidable logics over data words with a linearly ordered data domain. However these extensions come at a price and the logics have to be weakened to keep decidability. We make a bijective connection between origin-graphs and typed data words which are just data words with ordered data and a two-sorted finite alphabet. We then introduce a new logic, Ld over data words whose decidability can be reduced to decidability of Lo. This logic extends the one of [START_REF] Schwentick | Two-variable logic with two order relations[END_REF] by adding arbitrary MSO predicates that talk only about the data. The data of a typed data word w induces a total pre-order over positions of w, defined by i j if d i ≤ d j . We also define i ≺ j by d i < d j and i ∼ j if d i ≤ d j and d i ≥ d j . Hence a typed data word can be seen as a logical structure with one linear order and one total pre-order.

Logics for data words We know from [BDM + 11] that MSO over (untyped) data words (i.e. |A| = 1) is undecidable, even its first-order fragment. However, the fragment FO 2 [≤, , S ] is decidable, according to [START_REF] Schwentick | Two-variable logic with two order relations[END_REF]. The logic we define, called Ld, can be thought of as an extension of FO 2 [≤], with any binary predicates which only talk about the data, generalizing the result of [START_REF] Schwentick | Two-variable logic with two order relations[END_REF]. More precisely we define the binary predicates MSO[A, ] with the semantic restriction that second-order quantification is restricted to sets closed under ∼4 . Because of this restriction, the binary MSO predicates can be thought of as formulas that quantify over data and sets of data, see Rk. 4.5.2. For instance, the formula ∀y x y states that the data value of x is the smallest of all data values. By definition of typed data words, we have that d i = d j implies a i = a j , which means that u is well-defined. We call this word the data quotient of w. Then, the MSO predicates can talk about properties of the word u, for instance "Positions with even pieces of data are labeled by a" can be expressed in the logic.

From transductions to data words and back

Transforming models We describe encodings from non-erasing origin-graphs to typed data words and back. Let g = (u, (v, o)) be a non-erasing origin-graph over alphabets A, B, we 4.6. Decidable extensions of Lo rational transductions (i.e. realized by 1NFTs) is incomparable with Lo-transductions. However these new single-origin predicates allow us to subsume the rational transductions

In terms of data words, the extension allows one to talk about any rational property of a subword induced by a single piece of data. In particular, over data words with data size 1, we recover the rational languages instead of FO 2 [≤]-definable languages.

Let A, B be alphabets, let L be a rational language over B * we define a new unary input predicate L(x) with the semantic interpretation that the subword of positions with origin x belongs to L. We define over alphabets A, B the logic with single-origin predicates, Lo so := Example 4.6.4. Let A, B be alphabets. Let L = (ab) * , we define the Lo so -formula φ := ∀ out x a(x) → even(o(x)) ∧ L(o(x)) which states that an output position labeled by a must have an even origin and that the output word of positions with the same origin must belong to L.

We show that any rational transduction can be expressed by an Lo so -formula. This is not the case for Lo: for instance the transduction {a} × (aa) * cannot be expressed in the logic since the input is trivial and the output is not FO 2 [≤ out ]-definable. Another example of such a transduction is given in Ex. 4.2.9.

Theorem 4.6.5. Any rational transduction is Lo so -definable.

Proof. Let T be a one-way transducer, our goal is to define an equivalent Lo so -formula. We see T as an automaton over the alphabet A B, which we can assume to be deterministic, with state space Q, initial state q 0 ∈ Q and set of final states F ⊆ Q. Given a letter a ∈ A B and a state q ∈ Q, we denote by q.a the state reached from q after reading a. In order to simplify the proof and without loss of generality, we assume that we can only read letters of A from q 0 . We define the origin semantics of T : Let a 1 v 1 . . . a n v n be a word accepted by T , such that for i ∈ n, a i ∈ A and v i ∈ B * . We define the origin graph g := (u, (v, o)) with u := a 1 • • • a n , v := v 1 • • • v n and for j ∈ {1, . . . , |v|} such that |v 1 • • • v j-1 | < i ≤ |v 1 • • • v j | we set o(j) := i. Then we say that T realizes g which we denote by g ∈ T o . Let q, r ∈ Q and let L q,r ⊆ B * be the set of output words that can go from q to r in T (without reading any input letter).

We define the Lo so -formula φ pres ∧ ∃ p,q,r∈Q X p q,r φ with φ pres := ∀ out x, y o(x) ≤ in o(y) → x ≤ out y states that the input order is preserved in the output. The formula φ is a conjunction of four formulas: φ var ∧ φ succ ∧ φ min ∧ φ max . The formula φ var will encode that the input positions in X p q,r can go from p to q by reading the letter and produce output words in L q,r . The formula φ succ ensures that two successive positions must belong to some sets X p q,r and X r s,t , respectively. The formulas φ min and φ max encode that the first position starts in the initial state and that the last one ends up in a final state, respectively. φ var = ∀ in x p,q,r∈Q X p q,r (x) → L q,r (x) a∈A a(x) → p.a = q φ succ = ∀ in x, y p,q,r∈Q S in (x, y) ∧ X p q,r (x) → s,t X r s,t (x) φ min = ∀ in x min(x) → p,q∈Q X q0 p,q (x) φ max = ∀ in x max(x) → p,q∈Q,r∈F X p q,r (x)

By construction we have obtained an Lo so -formula realizing T o .

Our regular uniformization algorithm can be extended to the logic Lo so .

Theorem 4.6.6. Given an Lo so -formula, one can synthesize a regular transduction uniformizing it.

Decidable extensions of Lo

Remark 4.6.7. The same proof would actually work for ∃Lo so . Moreover, let C 1 , C 2 be classes of transducers such that regular uniformization is possible for both classes and C 1 is closed under rational restriction of the codomain. Then one can uniformize any transduction of τ 2 • τ 1 with τ i given by a C i transducer, for i ∈ 2. For instance τ 1 can be given by a two-way non-deterministic transducer and τ 2 by an Lo-formula.

As a consequence we obtain that the satisfiability problem for Lo so is decidable and, since Lo so is closed under boolean operations, the validity and equivalence problems are also decidable.

Theorem 4.6.8. The satisfiability, validity and equivalence problems for Lo so over origin-graphs are decidable.

Proof. This is a direct consequence of Th. 4.6.5. Since one can uniformize an Lo so -transduction, in particular one can decide the emptiness of the domain. Furthermore, by closure under boolean combinations, we obtain the decidability of the validity and equivalence problems.

Conclusion

In this manuscript we have studied definability and synthesis problems for word-to word transductions. In the first part, we tackled definability questions for classes of rational word functions using algebraic and computational minimization techniques. In the second part, we introduced an expressive logic for transductions from words to words and solved the regular uniformization problem for this logic.

Rational functions and canonical models

Canonical models have proven to be very useful to study computational objects. In the case of automata over finite words, having a canonical object is interesting for several reasons. The first one is of course that equivalent automata correspond to the same minimal automaton. The second reason is the size, i.e. the minimal automaton of a language has the least number of states among deterministic automata recognizing the same language, hence the name. Another property of the minimal automaton is that it can be obtained efficiently (in PTime) from any deterministic automaton. Finally, the minimal automaton carries intrinsic algebraic properties of the language, which has proven particularly useful in definability problems, and in particular thanks to the many logic-algebra correspondences which have been established over the years (see [START_REF] Straubing | Finite automata, formal logic, and circuit complexity[END_REF][START_REF] Volker Diekert | A survey on small fragments of first-order logic over finite words[END_REF] e.g. ).

As it has been shown (see [START_REF]Minimizing subsequential transducers: a survey[END_REF]), almost all these good properties of the minimal automaton carry over to the minimal sequential transducer for sequential functions. A first step had been made in that direction with [START_REF] Reutenauer | Minimization of rational word functions[END_REF], but rational functions still lacked a good description of minimal devices with the aforementioned good properties. In this manuscript we have shown that rational functions have not one but a finite number of minimal bimachines. The difficulty comes from the fact the we need to minimize two things at once: the look-ahead and the automaton. In particular any bimachine minimal in the number of states is minimal in the algebraic sense that its transition congruence is minimal. Furthermore, as in the language case, minimization of bimachines can be done in PTime. We also have established a transfer theorem from logic-algebra correspondences over languages to logic-algebra correspondences over functions. In particular this yields an algorithm to decide definability of a rational function in first-order logic. In fact we show that FO-definability is PSpace-complete for rational functions given as bimachines.

Open problems Some problems still remain open. We know (Ex. 2.2.36) that a minimal bimachine can be exponentially larger than another bimachine realizing the same function. We also know (Th. 2.2.35) that a minimal bimachine has size at most doubly exponential with respect to any equivalent bimachine. The open question is what is the exact worst-case size of a minimal bimachine? Another question is the complexity of deciding aperiodicity when the function is given by a transducer instead of a bimachine. We know that the problem is PSpace-hard and in ExpTime, but whether it can be done in PSpace remains open. Another direction of study, already mentioned in [START_REF] Reutenauer | Minimization of rational word functions[END_REF], would be to characterize the functions which are both sequential and right sequential. This would, we believe, help us to better understand the relationships between the different minimal bimachines of a function.

Over infinite words we have more open questions. While the case of sequential functions has been treated satisfactorily, it remains open whether one can minimize right-sequential functions. Such a procedure would probably solve most of the remaining problems and yield a complete description of minimal bimachines, as in the finite case. Another question is whether the ultimate congruence has some minimality property, like the delay congruence. Answering these questions would help us characterize more logical fragments, as in the case of finite words. Finally, the complexity of computing a canonical bimachine is probably much lower than the one of our current algorithm.

Future work Our approach has provided effective characterizations for classes of logical transductions. However the cases we cover are restricted to logical fragments with access to the linear order predicate. One extension that would require new techniques would be to characterize the transductions definable in FO[+1].

Over infinite words, it seems that continuity plays an important role, and we should be able, for continuous rational functions, to obtain a unique minimal look-ahead congruence.

Obtaining a canonical device for regular functions seems to be a very difficult problem. However restricting to sweeping transductions, i.e. functions realized by two-way transducers that can only can direction at the ends of a word, it seems like some of the ideas of [RS91] could be applied. A step in that direction has actually been made in [LLN + 11]. In this article the authors give a normal from for sequential transducers from trees to words. In particular, over unary trees, their model correspond to a deterministic transducer with one forward pass and one backward pass. It looks like this normal form should preserve aperiodicity. This would give good hopes of defining a normal form for aperiodic transductions definable by two-way transducers with two sweeps, and thus deciding FO[≤]-definability for these functions.

Another possible extension, using the same kind of normal form for tree-to-word transducers [LLN + 11, Boi16], would be to decide if a certain transducer is definable in some logical fragment of MSO. Indeed, over tree languages several effective characterizations of logical fragments have been obtain via an algebraic characterization (see [START_REF] Miko | Effective characterizations of tree logics[END_REF]).

Specification and synthesis of transductions

A computational model that takes inputs, performs some computation and then produces outputs defines a transduction. In that framework natural verification questions arise. The modelchecking problem asks whether the model satisfies a given specification, which can itself be seen as a (not necessarily functional) transduction of all acceptable acceptable input/output pairs, and the problem amounts to deciding inclusion. The synthesis problem asks, given a specification, whether one can produce a model in a given class which satisfies the specification. In both cases a good specification language would be somewhat close to the natural language. Indeed, one would want to express high-level properties of a model and check them or synthesize a model from it. Good examples in the case of regular languages would be MSO, regular expressions, or LTL which has some good algorithmic properties.

In the case of transductions, no such specification language existed. Of course the Courcelle NMSO-transducer do express logical properties but they are very limited in what they can express. One of the big limitations of NMSO-transductions is that they cannot underspecify properties, meaning that once an interpretation has been chosen for the parameters, the transduction becomes functional. For instance the transduction A + × B * cannot be expressed as an 126 4.6. Decidable extensions of Lo NMSO-transducer. However any origin-graph satisfies the formula over origin-graphs which realizes the (origin-free) transduction A + × B * .

We have introduced a new logic Lo for transductions, which we believe is well-suited as a specification language for transductions. We have been able to provide a regular uniformization algorithm for Lo-transductions, and as a consequence have obtained many results, such as decidability of satisfiability, equivalence, functionality, etc. We have also shown that the logic can be extended by additional predicates while preserving the uniformization capabilities.

Open problems

We have been able to define decidable extensions of Lo that subsume the classes of transductions definable by 1NFTs and by NMSO-transducers. However we have not been able to come up with an extension that subsumes the transductions definable by 2NFTs, but still has decidable satisfiability. This problem looks challenging, in particular the transduction R = {(u, u n ) | u ∈ A * , n ∈ N} seems difficult to express with only two variables.

In [START_REF] Miko Laj Bojańczyk | Which classes of origin graphs are generated by transducers[END_REF] the authors managed to characterize the origin-transductions definable by NMSO-transducers. This characterization relies on a property they call bounded crossing. Given the profile automaton of an Lo-transduction, one may be able to decide if the correspond transduction has bounded crossing which would give an algorithm to decide if an Lo-transduction can be realized by an NMSO-transducer.

Future work Other extensions of the logic Lo should be possible but the link with data words shows how close we are to the undecidability frontier (see [START_REF] Manuel | Two-variable logic on 2-dimensional structures[END_REF]), and one should tread lightly.

This link between data words and origin-graphs, although surprising at first, has allowed us to guide our search for an expressive and still decidable logic. While most models of computation of data words allow full power on the word without data and restrict heavily the possibility to compare data, our approach is quite different. We restrict the expressiveness on the word but allow one to talk about any property that only involves the data. We think this link should prove fruitful in the study of both data words and transductions.

We have high expectations that our method can be transfered to tree-to-word transductions using tree-automata that recognize profile trees instead of profile sequences. The generalization to tree-to-tree transductions (or even word-to-tree) transductions seems difficult. Indeed if one wants to be able to express MSO-transductions, one quickly obtains transductions where the domain is non-regular which would require a completely different approach. However, using the Courcelle/Bojańczyk-Pilipczuk Theorem ( [START_REF] Miko | Definability equals recognizability for graphs of bounded treewidth[END_REF]) we should obtain a regular synthesis-like result (we would obtain a not necessarily functional NMSO-transduction in the end) for transductions from graphs of bounded tree-width to words. Finally, in terms of data words, a tree-to-word origin-graph can be seen as a data word where the data has more structure than a linear order, i.e. a tree-structure. In [START_REF] Tan | Extending two-variable logic on data trees with order on data values and its automata[END_REF] the author mentions such a model, where data values are strings ordered by the prefix order which gives a ranked tree structure to the data.

In our approach we manage to solve the problem of equivalence of transductions with origins. Of course equivalence of transductions without origins is undecidable even for rational transductions. It may be interesting to investigate a notion of equivalence of transductions up to "small" origin changes, similar to what was done in the case of rational transductions by [START_REF] Filiot | On equivalence and uniformisation problems for finite transducers[END_REF].

Figure 1 :

 1 Figure 1: Automate déterministe reconnaissant le langage (aa) * .

  a n → a 2n

Figure 2 :

 2 Figure 2: Deux transducteurs séquentiels

Figure 3 :

 3 Figure 3: Deux graphes d'origine.

  FO 2 [≤ out , o, MSO[≤ in ]], où ≤ in et ≤ out sont les ordres respectivement sur l'entrée et sur la sortie et o est le symbole de fonction d'origine. Soit even(x, y) le prédicat binaire MSO[≤ in ]-définissable disant que la distance entre les positions d'entrée x et y est paire. Considérons la formule Lo suivante. ∀x, y out(x) ∧ out(y) ∧ a(x) ∧ b(y) → even(o(x), o(y))

ContentsIntroductionI

  Computational, Logical and Algebraic Characterizations of Rational Word Functions 1 Rational languages and rational functions 1.1 Words and languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Finite automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Subclasses of automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Algebraic characterization of rational languages . . . . . . . . . . . . . . . . . . . 1.3.1 Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 Classes of congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.3 Aperiodicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Logics over words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.1 Monadic second-order logic . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.2 MSO for words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Onward to transductions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.1 Transductions and transducers . . . . . . . . . . . . . . . . . . . . . .

Figure 4 :

 4 Figure 4: Deterministic one-way automaton recognizing (aa) * .

Figure 5 :

 5 Figure 5: Two sequential transducers.

Figure 6 :

 6 Figure 6: Two origin graphs.

Figure 1 . 1 :

 11 Figure 1.1: Left automaton recognizing aA * b.

  Example 1.3.5. Let A = {a, b}, let L = aA * b and let A be the automaton recognizing L of Fig. 1.1 on page 13. We have that ∼ L = ∼ A , ≈ L = ≈ A and ≡ L = ≡ A . Let us describe these equivalence relations by their equivalence classes: A * / ∼ L = { , a + aA * a, bA * , aA * b}, A * / ≈ L = { , A * a, b + bA * b, aA * b} and A * / ≡ L = { , a + aA * a, b + bA * b, aA * b, bA * a}.

Figure 1 . 2 :

 12 Figure 1.2: Well-known correspondences for languages of finite words.

  p, we want to show that p u -→ p. By aperiodicity we know that p u n+1 ---→ p. If we consider the runs p u n --→ p . . . p u n --→ p and p u n+1 ---→ p . . . p u n+1

Figure 1 . 3 :

 13 Figure 1.3: Aperiodic automaton with counters.

  Figure 1.4: A transducer realizing f swap .

  an automaton (resp. Büchi, Muller automaton) over A called the underlying automaton of T , i : Q → B * the initial function, o : ∆ → B * the output function and t : Q → B * the final function. Let u ∈ A * , let r be a run of A over u and let α := 1≤i<|r| o(r(i), u(i), r(i + 1)). We denote this by r(1) u|α --→ T r(|r|) if u is finite, and by r(1) u|α

  Figure 1.4 represents a transducer T realizing f swap , where α denotes any letter of A.

  Example 1.5.7. We define the FO 2 [≤]-transducer T swap := ({a, b} , φ dom , (φ a , φ b )) realizing the function of Fig. 1.4 on page 22.

  Example 2.1.1. Consider the function f swap given by the transducer of Fig. 1.4 on page 22. Then we have f swap (u) = for any word u ∈ {a, b}

Figure 2

 2 Figure 2.2: The minimal sequential transducer of f idem .

  denote the outputs before reading w of the runs of B over uw and vw respectively. Let γ := {o([u] L , z, r 0 )t([uz] L ) | z ≈ R w} be the longest common prefix of outputs from state [u] L with look-ahead information [w] R .

Figure 2

 2 Figure 2.5: Automata of a bimachine realizing f idem .

Figure 2

 2 Figure 2.6: Transducer realizing f last,R and right automaton R.

Chapter 3 .Figure 3

 33 Figure 3.1: A sequential Büchi transducer realizing f erase .

  Lemma 3.1.23. Let T be an ω-transducer, and let S be the ω-transducer obtained by powerset construction with delays with underlying automaton D. Then ∼ D ∼ f . Proof. Let T be a transducer realizing a function f : A ω → B ∞ , and let S be the transducer obtained by powerset construction with delays with underlying automaton D. Let u, v ∈ A * such that u ∼ D v, and let S 0 u|α --→ S and v|α

Figure 3 . 2 :

 32 Figure 3.2: Left and right Büchi automata and output table of a bimachine realizing f #a .

Figure 3 . 3 :

 33 Figure 3.3: Sequential transducer realizing f #a,R with R from Fig. 3.2 on page 70.

∪

  ≈f ay, which concludes the proof.Example 3.2.30. Recall the function f #a , which maps words with an infinite number of a letters to a ω and other words to b ω , over the alphabet A = {a, b}. One can see that the ultimate left congruence of f #a contains two classes, (b * a) ω and A * b ω . Theorem 3.2.31. Let f be a quasi-sequential function, the ultimate left congruence of f has finite index. If f is given as a bimachine, one can compute ∪ ≈f in 2 ExpTime. Furthermore, if f is aperiodic, then so is ∪ ≈f .

  Proposition 3.2.33. Let f : A ω → B ∞ be a quasi-sequential function, let R be a right automaton recognizing dom(f ) such that ≈ R ∪ ≈f . The outputs of U f (R) are well-defined. Proof. Let f : A ω → B ∞ be a rational ω-function, let R be a right automaton recognizing dom(f ) such that ≈ R ∪ ≈f . We want to show that the output function o R does not depend on the choice of representatives. Let u ∼ f v, let x ∪ ≈f y and let a ∈ A. Let us first show that

Figure 4 . 1 :

 41 Figure 4.1: Two different origin-graphs, with the same pair of input and output words.

.

  Here we have T d,e = {(u, vv) | v subword of u, |v| = 0 mod 2}.

Figure 4 . 2 :

 42 Figure 4.2: Classes of transductions.

Figure 4 . 3 :

 43 Figure 4.3: Transforming an origin-graph into a non-erasing origin-graph.

  Lemma 4.3.2. Let phi be an Lo formula, and let T be an MSO-transducer uniformizing φ ne o . Then we can obtain an MSO-transducer T uniformizing φ o Proof. Let phi be an Lo formula over alphabets A, B, and let T be an MSO-transducer uniformizing φ ne o . Let T erase be an MSO-transducer defined over alphabets B { } A, B which simply erases all positions not labeled in B. According to Th. 4.3.1, we have that T erase o • φ ne o = φ o . 100 4.3. Reduction of the regular synthesis problem Since φ ne o and φ o this means that if T uniformizes φ ne o , then T erase o • T o uniformizes φ o . Furthermore, since MSO-transducers are closed under composition (see [Cou94]), we can define an MSO-transducer T realizing T erase o • T o , which concludes the proof.

  Theorem 4.3.3. Let φ be an Lo-formula over alphabets A, B. One can obtain an Lo formula ψ over alphabets A, B × B such that: • B is finite • Up to projection π : B × B → B of the output alphabet, φ and ψ have the same models

Figure 4

 4 Figure 4.4: An origin-graph (left) seen as a two-dimensional structure (right).

Figure 4 . 6 :

 46 Figure 4.6: The full profile sequence of an origin-graph.

  S Φ := 2 QΦ×QΦ . A clause for C is an element of the alphabet B × {•, →, ←} × S Φ . Clauses of the form (b, •, P ) are called local clauses and talk about the label of an output position, and the MSO type of its origin (in a local clause P will only contain pairs of the form (p, p)). A clause of the form (b, →, P ) (resp. (b, ←, P )) is called a consistency clause and states that there is an output position labeled b whose origin is greater (resp. smaller) than the current position and such that the binary a b b a a

Figure 4 . 7 :

 47 Figure 4.7: The reduced profile sequence of an origin-graph.

Figure 4 . 8 :

 48 Figure 4.8: The reduced profile sequence of an origin-graph, with linked clauses (dotted).

  Example 4.4.7. The linked clauses are represented by dotted lines in Fig. 4.8.

  Theorem 4.4.25. Given an Lo-formula, one can synthesize a regular function which uniformizes it.

  Corollary 4.4.26. Given an Lo-formula φ, one can decide if φ o is functional.

Figure 4 . 9 :

 49 Figure 4.9: An origin graph and its encoding as a data word.

  Definition 4.5.1. We define the logic Ld := FO 2 [B, ≤, MSO[A, ]] Remark 4.5.2. As we have said, MSO[A, ] predicates can only talk about data, let us make this remark more explicit. Let w = (b 1 , d 1 , a 1 ) • • • (b n , d n , a n ) be a data word over A, B of data size m. The total preorder induces a word over A, that is u = a i1 • • • a im where d i k = k, for any k ∈ m.

  FO 2 [B, ≤ out , o, MSO[A {L(x) | L rational} , ≤ in ]]

  Minimization of sequential transducers . . . . . . . . . . . . . . . . . . . . 2.1.3 Determinization preserves aperiodicity . . . . . . . . . . . . . . . . . . . . 2.2 Algebraic characterization of rational functions . . . . . . . . . . . . . . . . . . . 2.2.1 Bimachines and transductions . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Bimachines and minimization . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.3 Look-ahead versus labeling . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.4 Canonical bimachine and characterization . . . . . . . . . . . . . . . . . . 2.3 Logical transducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 2-F transducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 2-F transducers and C-bimachines . . . . . . . . . . . . . . . . . . . . . . Logic-algebra transfer result . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.4 Decidable fragments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Characterizations of rational functions over infinite words 3.1 Sequential and quasi-sequential functions . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Algebraic characterization of sequential functions . . . . . . . . . . . . . . 3.1.2 Minimization of sequential transducers . . . . . . . . . . . . . . . . . . . . 3.1.3 Quasi-sequential transductions . . . . . . . . . . . . . . . . . . . . . . . . 3.1.4 Determinization preserves aperiodicity . . . . . . . . . . . . . . . . . . . . 3.2 Canonical models for rational functions over infinite words . . . . . . . . . . . . . 3.2.1 Bimachines and transductions . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Left minimization of bimachines . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Look-ahead versus labeling . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.4 Delay look-ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.5 The ultimate look-ahead and a canonical bimachine for quasi-sequential functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.6 Composing look-aheads and a canonical bimachine . . . . . . . . . . . . . 3.3 First-order definability of transductions over infinite words . . . . . . . . . . . . . Uniformization algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

	Contents
	2.3.3
	xiii

. . 1.5.2 Logical transducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Characterizations of rational functions over finite words 2.1 Sequential functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Algebraic characterization of sequential functions . . . . . . . . . . . . . . 2.1.2 3.3.1 Aperiocity and first-order definability . . . . . . . . . . . . . . . . . . . . 3.3.2 Closure under composition . . . . . . . . . . . . . . . . . . . . . . . . . . II Specification and Synthesis of Transductions 4 Logics for transductions with origins 4.1 Transductions with origin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Origin graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 Transductions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 MSO-transducers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Logics with origins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 MSO over word-to-word origin graphs . . . . . . . . . . . . . . . . . . . . 4.2.2 Model-checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3 Satisfiability, validity, equivalence . . . . . . . . . . . . . . . . . . . . . . . 4.2.4 Undecidable fragments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.5 A new fragment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.6 Expressing regular transductions . . . . . . . . . . . . . . . . . . . . . . . 4.3 Reduction of the regular synthesis problem . . . . . . . . . . . . . . . . . . . . . 4.3.1 Non-erasing transductions . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 Scott Normal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 Output formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.4 Sets of constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 4.4.1 Predicate automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.3 Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.4 Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.5 Complete profile sequences . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.6 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.7 Profile automaton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv

  Let i ∈ 2, and let B i be a bimachine with left and right automata L i and R i , respectively. We say that B 1 is finer than B 2 , which we denote by B 1 B 2 , if we have both swap over the word aabb.L 1 L 2 and R 1 R 2 .A bimachine realizing a function f is called minimal if there is no coarser bimachine realizing f . Two bimachines are called equivalent if they realize the same function and are both finer than each other. We will often abuse definitions and say that two bimachines are equal instead of equivalent. The transition congruence of a bimachine B with automata L and R is defined as ≡

		2.2. Algebraic characterization of rational functions
	run of L	l 0	la 1	la 2	la 2	la 2
	input:	a	a	b	b
		o	o	o	o
	run of R	rb 2	rb 2	rb 2	rb 1	r 0
	output:	b	a	b	a
		Figure 2.4: A run of B

B := (≡ L ≡ R ). Let C be a class of congruences, a bimachine is called a C-bimachine if both its automata are C-automata. Equivalently, by closure under intersection and coarser congruences, a bimachine is a C-bimachine if and only if its transition congruence is in C. Proposition 2.2.2. There exists a function f for which there is more than one equivalence class of minimal bimachines.

  Corollary 2.2.4. Let C be a class of congruences. A transduction realized by a C-bimachine is a C-transduction.Proof. Let B be a bimachine realizing a function f with C-automata L and R. Let T be the transducer obtained from Prop. 2.2.3, with underlying automaton L × R. Let u, v ∈ A * be two words such that u ≡ L v and u ≡ R v. This means that u ≡ L×R v, and thus (≡ L ≡ R ) ≡ L×R . Since C is closed under intersection of congruences and coarser congruences, this means that

Problèmes de minimisation et formes canoniques Un problème de minimisation demande, étant donné un objet syntaxique M 2 (par exemple un automate) dans une classe C, avec une interprétation sémantique M 2 , s'il existe un objetM 1 ∈ C tel que M 1 = M 2 et M 1 est "plus petit" que M 2 ,pour une certaine définition de taille. Les problèmes de minimisation sont omniprésents en informatique pour des raisons évidentes d'efficacité. De plus, les objets minimaux sont souvent liés à des formes canoniques qui ont d'autres intérêts algorithmiques. Une forme canonique pour des objets d'une certaine classe est une procédure qui prend en entrée un objet M ∈ C et produit un objet M qui ne dépend que de M et tel que M = M . En particulier, le fait d'avoir une procédure pour calculer une forme canonique permet de tester l'équivalence de deux objets. De plus une telle forme canonique permet souvent de tester d'autres propriétés sémantiques d'un objet. vi

We actually consider more general classes of monoids

A * and A + are usually called the free monoid and the free semigroup generated by A, respectively.

Here we choose, as in[START_REF] Olivier Carton | Automata and semigroups recognizing infinite words, Logic and Automata: History and Perspectives[END_REF], global definitions of determinism and co-determinism which coincide with the usual notions in the case of trim automata.

Such a morphism is called a stamp in[START_REF] Chaubard | Actions, wreath products of C-varieties and concatenation product[END_REF].

In fact ≡ A only weakly recognizes K, since K = [a] [b] ω (see[START_REF] Olivier Carton | Automata and semigroups recognizing infinite words, Logic and Automata: History and Perspectives[END_REF]).

In other words, C(A) is a meet-semilattice with order and meet operation . It is furthermore bounded and its greatest element is the trivial congruence: ∀u, v ∈ A * , u ∼ v.

In the literature these are sometimes called real-time transducers, i.e. transducers without -transitions.

These are sometimes called subsequential in the literature, to denote that final outputs are allowed.

Note that in [RS95] C-transductions are defined by unambiguous C-transducer. The two definitions turn out to be equivalent (see Cor. 2.2.16).

This can be decided in PTime by checking the emptiness of the product of R with the complement of L and vice versa.

i∈N f x(i+1:) (x(:i)) -1 f x(i+2:) (x(:i + 1)) = f R (x). If f x ( ) is infinite equal to αβ ω , then

Usually, R 1 is assumed functional.

The extension of the origin function to dom(u) is just a technicality so that o can be interpreted as a total function.

This assumption is made without loss of generality since our logic will only be able to talk about the relative order of data values.

This can actually be enforced syntactically by guarding quantifications ∃X φ by ∃X (∀x, y (x ∈ X ∧ x ∼ y) → y ∈ X) ∧ φ.

Remerciements

Definability and Synthesis of Transductions

Chapter 2. Characterizations of rational functions over finite words Sufficient conditions Let F be a logical fragment of MSO [≤]. Our goal is to show that 2-F and F c coincide under assumptions (1)-(3), and assumption (4) will ensure that the class of congruences we consider is pure.

(1) F c -formulas over an alphabet A and F-formulas over an alphabet A Ȧ define the same pointed languages.

(2) A language over an alphabet A is definable by a F-formula over A if and only if it is definable by a F-formula over a larger alphabet A ∪ B.

(3) F-languages are closed under pointed concatenation, meaning that for two F-languages L 1 , L 2 over an alphabet A, the language L 1 L 2 is an F-language over A { }.

(4) { } is an F-language over some alphabet.

Remark 2.3.5. As we will see these assumptions hold for most known logical fragments which have access to the linear order predicate, and which are equivalent to some class of congruences.

A co-example is the fragment of first-order logic with successor predicate, FO[+1], which does not satisfy property (3).

From pairs of formulas to pointed formulas and back We now show the equivalence of 2-F and F under assumptions (2) and (3).

Lemma 2.3.6. Let F be a logical fragment equivalent to some class of congruences C. Under assumption (2), any F-definable pointed language is 2-F definable.

Proof. Let F be a logical fragment equivalent to some class of congruences C and satisfying property (2). Let φ be an F-formula recognizing a pointed language L over the alphabet A Ȧ.

Let A be C(A Ȧ)-automaton recognizing L, with a transition relation ∆. Let us define

where φ p I and φ F q denote F-formulas recognizing the languages of words which have an initial run to p and a final run from q, respectively. We know that these languages are C(A Ȧ)-languages since they are recognized by automata obtained from A by changing the initial and final states, which does not change the transition congruence. From the equivalence between F and C, these languages are definable by F-formulas over the extended alphabet A Ȧ. From assumption (2) we thus obtain that these languages can be defined by F-formulas over A.

Lemma 2.3.7. Let F be a logical fragment equivalent to some class of congruences C. Under assumptions (2)-(3), any 2-F definable pointed language is F-definable.

Proof. Let F be a logical fragment equivalent to some class C, satisfying assumptions (2)-(3). Let F = i∈n (φ i , ψ i ) ai be a 2-F formula over an alphabet A. We define the languages L i := φ i ȧi ψ i which are pointed concatenations of F-langugages, and are thus each F-languages over A { ȧi }, respectively, from property (3). Using (2) we have that each L i is a pointed Flanguage over A Ȧ. Since F is equivalent to C, and since C-languages are closed under boolean combinations, we have that i∈n L i is a pointed F-language over A Ȧ.

By combining the two previous lemmas we obtain the correspondence between F c and 2-F pointed languages.

Corollary 2.3.8. Let F be a logical fragment equivalent to some class of congruences C. Under assumptions (1)-(3), F c and 2-F define the same pointed languages.

Proof. Let F be a logical fragment equivalent to some class of congruences C satisfying (1)-(3). From Lem. 2.3.6 and 2.3.7 we know that F and 2-F define the same pointed languages. Using (1) we obtain our result.

Lemma 2.3.9. Let F be a logical fragment equivalent to some class of congruences C. Under assumptions (2) and (4), C is pure.

Proof. According to (4), { } is an F-language over some alphabet A, which means, according to (2) that { } is an F-language over any alphabet. By equivalence with C, we obtain that C is pure.

We are now able to state our main transfer theorem.

Theorem 2.3.10. Let F be a logical fragment satisfying properties (1)-( 4) and equivalent to a class of congruences C. Then any transduction is F-definable if and only if it is C-definable.

Proof. From Lem. 2.3.9, we know that C is pure. From (1)-(3) and Cor. 2.3.8 we have an equivalence between 2-F transducers and F-transducers. From Th. 2.3.3 we have the equivalence between 2-F transducers and C-bimachines. Hence we obtain the equivalence between F-transducers and C-bimachines.

Decidable fragments

We apply our transfer theorem to three well-known fragments of MSO[≤], namely first-order logic Let us show property (1). Let φ be an FO 2 [≤]-formula defining a pointed language over the alphabet A Ȧ. We define φ the FO 2 c [≤]-formula obtained by substituting (x = c) ∧ a(x) for each occurrence of a predicate ȧ(x). Then the FO 2 c [≤]-formula φ recognizes the same pointed language as φ. Let φ be an FO 2 c [≤]-formula over A, and let φ pointed denote the FO 2 [≤]-formula from Ex. 2.3.4 defining the language of pointed words over A Ȧ. Let φ be the FO 2 [≤]-formula obtained from φ by the following syntactic substitutions. Each occurrence of a predicate a(x) is replaced by a(x) ∨ ȧ(x), a(c) is replaced by ∃x ȧ(x), and x < c is replaced by ∃y Ȧ(y) ∧ (x < y). Finally, the formula φ pointed ∧ φ is in FO 2 [≤] and defines the same pointed language as φ.

Let us show (2). Let φ be an FO 2 [≤]-formula over an alphabet A recognizing a language L. In particular, φ is an FO 2 [≤]-formula over A B, but it may recognize a language larger than L in (A B) * . Let φ A := ∀x A(x) be the formula stating that each position is labeled by a letter of A. Then φ ∧ φ A defines L over A B. Let φ be an FO 2 [≤]-formula over an alphabet A B recognizing a language L ⊆ A * . Let φ be the formula obtained from φ by substituting ⊥ for any predicate b(x) for b ∈ B. Then any word is a model for φ over A B if and only it is a model for φ over A.

Let us show (3). Given a formula φ in the fragment FO 2 [≤], we define inductively the guarded FO 2 c [≤]-formula φ <c by restricting every quantification to positions before the position of c. More formally, if φ = ∃x ψ(x), then we define φ <c := ∃x (x < c) ∧ ψ <c (x). Boolean connectives and atomic formulas are not affected. Let L 1 , L 2 be two languages over A recognized by the FO 2 [≤]formulas φ 1 , φ 2 respectively, and let / ∈ A. We define the

which recognizes the pointed language L 1 ˙ L 2 . Using (1), we know that this language can be recognized by an FO 2 [≤]-formula.

Minimization of sequential transducers

Minimization of sequential transducers over infinite words works in almost the same way as in the finite case. The difference is that we actually minimize the transducer of the liminf of the function.

Let T = (A, i , o) be an ω-transducer, let p be a state and let the longest common prefix of outputs from p be α p β ω p := α | p u|α --→ P final , in normal form. In the following, a state p such that β p = is called a constant state. Then T is called in earliest normal form if 1) for any state p, α p = and 2) for any transition (p, a, q) such that p is constant, we have o(p, a, q) = β p .

Proposition 3.1.15. Given an ω-transducer T , one can obtain in PTime a new transducer T in earliest normal form realizing the same function.

Proof. We give the definition of T , show that it realizes the same function and is indeed in earliest normal form, and finally we give a procedure to compute it. Let T = (A, i , o, t) be a transducer realizing a function f , let p be a state of A and let α p β ω p denote the longest common prefix of outputs from p in normal form. We define T = A, i , o by:

If x is a word for which T never reaches a constant state in an accepting run, one can easily see that all the α p s cancel out, and thus T (x) = f (x). If T reaches a constant state q in an accepting run over x, then up until this constant state, all the α p s cancel out except for α q and then all transitions output β q , which means again that T (x) = f (x). By construction, T is in earliest normal form. We have left to show that we can compute the words α p , β p in PTime. We denote by A p the automaton recognizing L p the language of words produced from p. A p is obtained from A by replacing the labels of transitions by their outputs.

We split the proof into three distinct case: 1) L p contains a finite word, 2) L p contains a unique infinite word and 3) L p contains at least two distinct infinite words. To decide if the first case holds, one only has to remove all non -transition and check if there is a circuit of -transitions from a state which is reachable from p and which is final. This can be done in PTime and in that case β p = , and the size of α p is at most linear in |Q|. This means that we can reduce the problem to computing the longest common prefix of an automaton on finite words and thus, using [BC00] we obtain α p in PTime.

If we are not in case 1), let us show how to decide if 2) or 3) holds, in PTime. We can check for emptiness of L p , and if it is not empty then we can obtain an infinite word uv ω , in PTime. From this, assuming A p is trim, we can check if there is a finite word w such that w(|w|) = uv ω (|w|), in NLogSpace. If there is no such word, then α p β ω p = uv ω , so we only have to put uv ω in normal form. Otherwise, if there is such a w, then there is one of polynomial size, and again using the result of [BC00], we obtain α p in PTime.

We now give the minimization theorem for sequential ω-transducers, but before that we need two small lemmas.

Chapter 3. Characterizations of rational functions over infinite words

Let αβ ω := q∈I i (q)β ω q and let S 0 := (q, α -1 i (q)) | q ∈ I \ C (q, α -1 i (q)β ω q , with i (S 0 ) := α. We build Q and ∆ up from S 0 using the following steps. Let P be a state already constructed in Q and let a ∈ A. We define:

Let αβ ω := (q,γ)∈R γ. If α = , then we add the new state S := (q, α -1 γ) | (q, γ) ∈ R to Q and the transition P a|α --→ S S to ∆ . If α = , then we add the state R to Q and the transition

Remark 3.1.20. Note that S is deterministic in its transitions but may not be finite in general.

Proposition 3.1.21. Let f be a rational ω-function realized by a transducer T and let S be the transducer obtained by powerset construction with delays. Then S realizes f .

Proof. Let T be a transducer realizing a function f : A ω → B ∞ , let S be the transducer obtained by powerset construction with delays and let g denote the function realized by S. We assume that T is trim without loss of generality and we thus obtain that dom(S) = dom(f ). Let x ∈ dom(f ) and let u < x. Let S 0 u|α --→ S denote the initial run of S over u. By construction of S, we know that the output along the initial run is a common prefix to all outputs of initial runs of T over u and thus we have i (S 0 )α ≤ f (u). Let S = {(p 1 , γ 1 ), . . . , (p n , γ n )}, for some n ∈ N. By definition of S we have i∈n γ i = β ω (with β potentially empty).

Let us assume that for all u < x, f (u) is finite. Then we have that β = , and there are two cases. Either γ i = for some i ∈ n or we have γ i ∧ γ j = , for i, j ∈ n. In the latter case we have that i (S 0 )α = f (u) since T is in earliest normal form. In the first case, if p i is constant then we have i (S 0 )α = f (u). Finally if p i is non-constant this means there are two runs final from p i producing words δ, δ such that δ ∧ δ = again because T is in earliest normal form. In all cases, we obtain i (S 0 )α = f (u). Thus we have g(x) = lim u<x f (u) = f (x).

Let us now assume that f (u) is infinite for some u < x. This must mean that β = and actually we must have γ i = β ω for all i ∈ n, by definition of S. Thus we have f (u) = δβ ω and i (S 0 )α = δβ k for some integer k. Furthermore, by definition of S, any transition after P must output β and thus we obtain g(x) = δβ ω = f (x).

Weak twinning property A transducer T is said to satisfy the weak twinning property (WTP) if for any initial runs p 1 u|α1 ---→ q 1 v|β1 ---→ q 1 and p 2 u|α2 ---→ q 2 v|β2 ---→ q 2 the following holds:

• if q 1 is not constant and q 2 is constant and produces the rational word γ, then either

Note that if q 2 is constant and β 2 = then γ = β ω 2 .

Proposition 3.1.22 ([BC04]). Let T be a transducer satisfying the WTP, then the transducer obtained by powerset construction with delays terminates. The procedure is in ExpTime.

Chapter 3. Characterizations of rational functions over infinite words as before we obtain that for n ≥ N , f (uv n ) -1 f (uv n x) = f (uv N ) -1 i (p 1 )α 1 β n 1 δ which takes an infinite number of values, and thus contradicts the finite index of ∼ f . We can now state our result characterizing quasi-sequential transductions, which will prove useful in the following section.

Theorem 3.1.25. Let T be an ω-transducer realizing a function f , and let S be the transducer obtained by powerset construction with delays. The following are equivalent:

Proof. The proof from (1) to (2) follows Prop. 3.1.22, the proof from (2) to (3) follows Lem. 3.1.23 and finally (3) to (1) comes from Lem. 3.1.24.

Determinization preserves aperiodicity

Just like in the finite case determinization preserves aperiodicity. This will allow us to show that the canonical bimachine of an aperiodic transduction is aperiodic.

Lemma 3.1.26. Let T be an ω-transducer satisfying the WTP, and let S be the transducer obtained by powerset construction with delays. If T is aperiodic then S is aperiodic.

Proof. We adapt the proof of Lem. 2.1.15 to the infinite case. Let T = (A, i , o), with A = (Q, ∆, I, F ), be an A-transducer realizing a quasi-sequential function f : A ω → B ∞ . Let S = (D, i , o ), with D = (Q , ∆ , S 0 ), be the sequential transducer obtained from T by powerset construction with delays. We want to show that S is aperiodic and actually we will show that D is counter-free, which is equivalent according to Prop. 1.3.9 since S is sequential. A is aperiodic so there is an integer n such that ∀u ∈ A * , u n ≡ A u n+1 . Let u ∈ A + be a word, let k be a positive integer and let R 0

----→ S R 0 denote a counter in S. Let us assume that k is the size of the smallest such counter, which means that all R j s are pairwise distinct, we want to show k = 1.

and let us note that Γ j α j = α j Γ j+1 mod k . Let R = {q 1 , . . . , q m } denote the states appearing in R 0 . For 0 ≤ j < k, the states of R j are exactly the states which can be reached in A from some state of R 0 by reading u kn+j ≡ A u kn . This means that the states of R j are the same as the states of R 0 , namely q 1 , . . . , q m . Thus let R j = {(q 1 , β 1,j ), . . . , (q m , β m,j )}. Let us notice that β i,j is infinite if and only if q i is constant and produces an infinite word. In that case all states reachable from q i are constant with an infinite delay. If we assume that all states in R are constant with infinite delay, then either they have an empty common prefix and thus α j = for any 0 ≤ j < k which means that all R j s are equal and thus k = 1, or they are all equal to some word in normal form β ω and α j = β for any 0 ≤ j < k and again k = 1. Note that the common prefix cannot be a non-empty finite word, otherwise we could not loop back to R 0 .

Let us assume that some states have a finite delay and some have an infinite one. Let q l be a constant state with infinite delay from which there is a run reading u ω . Adapting equation (2) in the proof of Lem. 2.1.15 we obtain that β l,j = Γ ω j . Similarly, if q i a constant state which can be reached by such a state q l , we have by equation (4) that β i,j = Γ ω j . For the states with finite delay, we use the proof of Lem. 2.1.15 and we obtain that for some x ∈ {j, j + 1}, γ is a prefix of all finite β i,x s. However, γ is also a prefix of Γ x , which means that γ is a common prefix to all β i,x s, and thus γ = by definition of S.

• o ((p, s), (a, r), (q, r)) := o(p, a, q) By construction T realizes f R . Let us assume that A and R are aperiodic, and let us show that A then must be aperiodic also. Let u ∈ (A × Q R ) * be a word and let u denote the projection of u onto the alphabet A. Let p, q be states of A and let x ∈ A ω . We assume that we have for some integer n, (p, [u n x] R ) u n --→ (q, [x] R ). By construction of A , we know that the last letter of u is (a, [x] R ) for some a ∈ A. If n > 1, then from the definition of A , we know that we must have [ux] R = [x] R . By aperiodicity of A we have p = p 0 u -→ p 1 . . . p n u -→ p n+1 = q, for n large enough. We have for any 0

2) We use the powerset construction of [BC04] on T , presented in Sec. 3.1, to obtain a sequential transducer S realizing f R in ExpTime, since f R is sequential by assumption. According to Lem. 3.1.26, this procedure preserves aperiodicity.

3) We project away the labels of the input letters of S to obtain a transducer realizing f . Furthermore this transducer is unambiguous, otherwise some word would have two distinct labelings. Let us show that this procedure preserves aperiodicity. Let A S be the deterministic underlying automaton of S , which we assume to be aperiodic. We consider A S , the same automaton but with the input labels projected onto A. Let u ∈ A * , let p, q be states of A S , let n be a positive integer such that p u n --→ A S q. Let x ∈ A ω be a word such that there is a final run of A S over x from q. This means that there is a labeling w of u n , i.e. w = u n , ending in (a, [x] R ) for some a ∈ A, such that: p w -→ A S q. Since R is aperiodic, we know that for m large enough, u m x ≈ R u m+1 x. Let v be the labeling of u with last letter (a, [u m x] R ), then w = v k w with w a labeling of u m . By aperiodicity of A S , if k is large enough we have a run p v k+1 w ----→ A S q. Since v k+1 w = u n+1 , we finally have p u n+1 ---→ A S q, which concludes the proof.

4)

Let us consider the product of automata A S and R, and let D be the left automaton obtained by the usual powerset construction of automata over finite words. This construction preserves aperiodicity, and is in ExpTime. We only have left to show that we can obtain a bimachine B realizing f with D and R as automata. Indeed, if it is the case and D is aperiodic, we have according to Th. 2.2.11 that D L f (R) which means that B is aperiodic a fortiori.

This means that there exists a word which can reach both p i and p j in A S and that there is a final run over x from both p i and p j . Since A S is unambiguous, we have p i = p j . Furthermore, since A S is deterministic, the state q is uniquely defined. One can easily see that the outputs of B exactly match those of S, which means that B realizes f .

Let us now show a result about aperiodicity which will prove useful later. Proposition 3.2.19. Let f be an aperiodic ω-function, and let R be an aperiodic right automaton recognizing dom(f ). Then f R is aperiodic.

First-order definability of transductions over infinite words

By construction, and since A is unambiguous, we have that T is an FO[≤]-transducer realizing f . Conversely, let T = K, φ dom , (φ v ) v∈K be an FO[≤]-transducer realizing a function f : A ω → B ∞ . From T , we define an ω-language over the alphabet A × K. Let φ be an FO c [≤]-formula, we syntactically define φ (c) an FO[≤]-formula with one free variable. Each label predicate a(x) is replaced syntactically by v∈K (a, v)(x). Then each occurrence of the constant symbol c is replaced by a fresh free variable symbol c. For v ∈ K, we define a predicate v(x) := a∈A (a, v)(x). We define the FO[≤]-formula:

The formula φ T recognizes words such that the projection over A ω is in dom(f ). Furthermore each position is labeled by its output. We define an aperiodic deterministic Muller automaton A T = (Q T , ∆ T , I, F ) recognizing the same language as φ T (Th. 1.3.12). From this we naturally define a transducer T := (A, i , o) with A := (Q T , ∆, I, F ) by:

We only have left to show that A is aperiodic. Let us first remark that A is unambiguous, otherwise some input word would have two different images. Let u ∈ A + be a finite word and let p u n |w ---→ A p denote a run of T over u n . Let p 0 u1 -→ A p be an initial run and let p x -→ A P be a final run. Let i ∈ {1, . . . , |u|}, j ∈ {0, . . . , n -1}, and let y i,j := (u 1 u 3n x, |u 1 ||u| n+j + i) denote the pointed word where the ith position in the jth middle occurrence of u is pointed. Since u 1 u 3n x is in the domain of f , ∀ i ∈ {1, . . . , |u|} , j ∈ {0, . . . , n -1} there is a word v i,j ∈ K such that y i,j |= φ vi,j . Since T is first-order, if n is large enough, we have for any j, j ∈ {0, . . . , n -1} that v i,j = v i,j (this can be obtained via an Ehrenfeucht-Fraïssé game argument). This means that we have p

where π A is the projection over the first component and π B is the concatenation of the words of the second component. Since A T is aperiodic and deterministic, it is counter-free (Prop. 1.3.9). This means that p s -→ A T p, and thus p u -→ A p, hence A is counter-free. Now that we have shown the equivalence of aperiodic and FO[≤]-definable ω-transductions, we get the main decidability result of this chapter.

Theorem 3.3.2. One can decide if an ω-transducer realizes an FO[≤]-definable function.

Proof. This is a direct consequence of the fact that the canonical bimachine of an aperiodic function is aperiodic (Th. 3.2.37), and of the equivalence between aperiodic transducers and FO[≤]-transducer (Th. 3.3.1).

Closure under composition

We finally show that FO[≤]-transductions are closed under compositions. This is obtained via classical FO[≤]-interpretations of logical structures, but we state it in our formalism.

) v∈K1 and T 2 := K 2 , φ dom,2 , (φ v,2 ) v∈K2 , respectively. Let k := max v∈K1 |v| be the maximum size of an output of T 1 . The main idea is to interpret formulas for words in B ω over words of A ω . Let φ be a formula over the alphabet B, we define φ f to recognize the words of A ω which are sent by f to words satisfying φ. If φ := ∃x ψ(x), then we set φ k := ∃x 1 , . . . , x k i∈k ψ(x i ), with each variable annotated by an integer in k. From φ k , we define φ k by substituting the atomic formulas (x i < x j ) by the boolean (i < j). For b ∈ B, we also replace b(x i ) by v∈K,v(i)=b φ v,1 (x i ). Finally we set φ f := φ dom,1 ∧ φ k . By definition the words satisfying φ f are exactly the words sent by f to words satisfying φ. Additionally, if φ is an FO c [≤]-formula, let v ∈ K 1 , and let j ∈ {1, . . . , |v|} then we define φ f,v,j by taking φ f defined as above and substituting each b(c) predicate by v(j) = b.

We define T := K, φ dom , (φ v ) v∈K by:

By construction, T realizes the transduction g • f , which concludes the proof.

Part II Specification and Synthesis of Transductions

The formula φ shuffle recognizes origin graphs where the output word is a permutation of the input word. φ id recognizes the identity transduction while φ mirror recognizes the mirror transduction, which reverses the linear order of words.

Model-checking

We state the following theorem from [START_REF] Miko Laj Bojańczyk | Which classes of origin graphs are generated by transducers[END_REF], which solves the model-checking problem in a quite general context. The theorem would actually hold for any device recognizing origin-graphs of bounded tree-width, thanks to the

Satisfiability, validity, equivalence

We define several problems for logics in general. The problem which will interest us the most is the satisfiability problem since a decidable satisfiability problem for a fragment closed under boolean operations entails the decidability of the other two. Let F be a logical fragment of MSO over some signature and let M be a set of structures. The satisfiability (emptiness) problem asks, given as input an F-formula φ, whether there exists a structure M ∈ M such that M |= φ. A logic with decidable satisfiability problem is sometimes called decidable. The validity (universality) problem asks, given as input an F-formula φ, whether for any structure M ∈ M it holds that M |= φ. The equivalence problem asks, given as input two F-formulas φ 1 , φ 2 , whether for any structure M ∈ M it holds that M |= φ 1 ⇔ M |= φ 2 .

Undecidable fragments

We exhibit some fragments of MSO o for which satisfiability of formulas is undecidable. Since the results rely on the comparison between origin-graphs and data words we give the proofs in Sec. 4.5

In the following theorem we consider the logic

Output formulas

An output formula is a formula which only quantifies over output positions, except inside an input predicate. We show that over non-erasing origin-graphs, any Lo-formula can be transformed into an output formula. Intuitively, since we consider non-erasing origin-graphs, we can virtually quantify over the input by quantifying over the output, through the origin function.

Theorem 4.3.6. Given an Lo-formula φ, one can define an output Lo-formula φ out which is equivalent, over non-erasing origin-graphs. Furthermore, if φ is in SNF, then so is φ out .

Proof. We replace any quantification ∃x φ(x) by ∃ out x φ(x)∨φ(o(x)), and ∀x φ(x) by ∀ out x φ(x)∧ φ(o(x)). Since we only consider non-erasing origin-graphs, any input position is the origin of some output position, which means that the new formula is equivalent to the old one (over non-erasing origin-graphs). Since we don't change the alternation of quantifiers, if φ is in SNF then so is φ out . Remark 4.3.7. Given a non-erasing formula, we can obtain an output formula which defines the same origin-graphs (when restricted to non-erasing origin-graphs). Hence if we have a uniformization algorithm for output formulas, we also have one for non-erasing formulas. In the following we will write φ ne o := {g ∈ φ o | g non-erasing}.

Corollary 4.3.8. Let φ be an Lo-formula, and let T be an MSO-transducer uniformizing φ out ne o . Then T uniformizes φ o Proof. This is a direct consequence of Th. 4.3.6.

Sets of constraints

With the previous three subsections we have shown that we only need to obtain a uniformization algorithm for output formulas of quantifier rank two, restricted to non-erasing origin-graphs. In the vein of [START_REF] Schwentick | Two-variable logic with two order relations[END_REF], we transform such a formula into a set of constraints, which are easier to manipulate.

Let A, B be alphabets. An existential constraint is a pair (b, E) with b ∈ B, E a finite set of triples (c, d, φ ) where c ∈ B, d ∈ {< out , = out , > out } and φ is an input predicate. Let g be an origin graph and let p be an output position of g. We say that g, p satisfies the constraint (b, E) if whenever p is labeled by b there exists an output position q and a triple (c, d, φ ) ∈ E such that q is labeled by c, p, q are related by d and the origins of p, q satisfy φ . In that case, such a position q is called a witness of (b, E) for p. Formally, g, p satisfy the constraint if we have g, p |= b(x) → ∃ out y (c,d, φ )∈E c(y) ∧ (x d y) ∧ φ (o(x), o(y)). We say that g satisfies the constraint if for any position p, we have that g, p satisfies the constraint.

Uniformization algorithm

profile sequence of the ith position of u. The (reduced) profile sequence of q is the sequence Seq(g) = ρ(λ 1 ), . . . , ρ(λ |u| ).

Example 4.4.2. In Fig. 4.6 and 4.7 we give the full profile sequence and the reduced profile sequence, respectively, of the origin graph from Fig. 4.4 on page 104. The profiles contain the information relative to the even distance predicate automaton from Fig. 4.5 on page 104. In this two-dimensional representation, profiles are given vertically.

Validity

We define validity of profiles and of profile sequences with respect to an MCP instance C, and show that origin-graphs satisfying C have valid full profile sequences, which in turn have valid reduced profile sequences.

Let C be an MCP, and let λ = (a, S, A 1 , . . . , A k ) be a profile. Let (b, E) be an existential constraint of C. We say that λ satisfies (b, E) if for all j ∈ {1, . . . , k} where A k is a local clause of the form (b, •) there exist (c, d, φ ) ∈ E, and j ∈ {1, . . . , k} such that j d j , A j = (c, s, P ), and P ∩ SP φ = ∅. The clause A j is called a witness of (b, E) for A j . Let (b, c, d, φ ) be a universal constraint. The profile λ satisfies (b, c, d, φ ) if for all j, j ∈ {1, . . . , k}, it is not the case that A j is a local clause with label b, A j = (c, s, P ), j d j and P ∩ SP φ = ∅. The profile λ is valid for C if it satisfies each of its constraints. A profile sequence is called valid for C (or just valid when C is clear from context) if each of its profiles is valid.

We now show the equivalence between being a model and having a valid full profile sequence.

Proposition 4.4.3. Let C be an MCP, then g |= C if and only if fSeq(g) is valid.

Proof. Let g = (u, (v, o)) be an origin-graph and let fSeq(g) = λ 1 , . . . , λ |u| be its full profile sequence. We first show that g satisfies an existential constraint if and only if fSeq(g) does, and then we do the same for universal constraints. Let (b, E) be an existential constraint of C satisfied by fSeq(g) and let j ∈ {1, . . . , |v|} be such that v(j) = b and o(j) = i ∈ {1, . . . , |u|}. Let λ i = (a, S, A 1 , . . . , A |v| ) be the ith full profile of g, then we have A j = (b, •, P ). Since λ i satisfies the constraint, there exists A j = (c, s, P ), j ∈ {1, . . . , |v|}, a witness of the constraint for A j . This means that there exists (c, d, φ ) ∈ E with j d j and P ∩ SP φ = ∅. Hence, by definition of the predicate automaton, we have u |= φ(i, o(j )). Hence we have that g satisfies (b, E).

Conversely let us assume that g satisfies the constraint (b, E), let i ∈ {1, . . . , |u|}, let λ i = a, S, A 1 , . . . , A |v| and let A j = (b, •, P ). Since g satisfies C, there is a witness j of (b, E) for j. Thus we know that there is (c, d, φ ) ∈ E such that j d j , v(j ) = c and u |= φ(o(j), o(j )). By definition we have A j = (c, s, P ) such that P ∩ SP φ = ∅. Hence, λ i satisfies (b, E), and thus fSeq(g) satisfies (b, E).

Let (b, c, d, φ ) be a universal constraint of C, and let us assume that λ i violates the constraint for some i ∈ {1, . . . , |u|}. This means that there exist j, j such that A j = (b, •, P ), A j = (c, s, P ) such that j d j and P ∩ SP φ = ∅. By definition of λ, this means that v(j) = b, v(j ) = c, j d j and u |= φ(o(j), o(j )) and thus g also violates the constraint.

Let us finally assume that g violates a universal constraint. Let (b, c, d, φ ) be a universal constraint and let j, j ∈ {1, . . . , |v|} such that v(j) = b, v(j ) = c, j d j and u |= φ(o(j), o(j )). This means, by definition of the full profile of i = o(j) that it has two clauses A j = (b, •, P ) and A j = (c, s, P ) where P ∩ SP φ = ∅ and thus λ i violates the constraint.

We now show that reduction of profiles preserves validity. Proposition 4.4.4. Let C be an MCP, and let λ be a valid profile. The profile ρ(λ) is valid.

Proof. Let C be an MCP and let λ = (a, S, A 1 , . . . , A k ) be a valid profile. Since ρ(λ) is a subsequence of λ, we have that ρ(λ) satisfies any universal constraint satisfied by λ.

Let l ≤ k and let 1 ≤ i 1 ≤ . . . ≤ i l ≤ k such that ρ(λ) = (a, S, A i1 , . . . , A i l ). Let (b, E) be an existential constraint of C, and let j ∈ {1, . . . , l} such that A ij = (b, •, P ). Since λ is valid, there exists A j a witness of (b, E) for A ij with i j d j (with d ∈ {=, <, >}). However, the reduction of a profile does not remove extremal clauses, thus there exists j ∈ {1, . . . , l} such that A j = A i j either j = i j or j d i j . Either way we have that i j d i j and thus A i j is a witness of (b, E) for A ij .

2-bounded origin-graphs

We define a notion of small models which we call 2-bounded. An origin-graph over A, B is called 2-bounded if for any input position and any output letter b ∈ B, the input position produces at most two output positions labeled by b. Reduced profiles have at most two occurrences of each local clause. Thus we will show that the profile sequence of any origin-graph is equal to the profile sequence of some 2-bounded origin-graph. We show that a 2-bounded origin-graph satisfies an MCP C if and only if its reduced profile sequence is valid.

Proposition 4.4.5. Let C be an MCP and let g be a 2-bounded origin-graph. Then g |= C if and only if Seq(g) is valid.

Proof. Let C be an MCP and let g = (u, (v, o)) be a 2-bounded origin-graph. If g |= C then fSeq(g) is valid, according to Prop. 4.4.3. Then from Prop. 4.4.4, Seq(g) = ρ(fSeq(g)) is also valid.

We have left to show that if Seq(g) is valid then so is fSeq(g). Let i ∈ {1, . . . , |u|} let λ i = a, S, A 1 , . . . , A |v| be the full profile of position i.

Let (b, E) be an existential constraint satisfied by ρ(λ i ), and let A j = (b, •, P ). Since g is 2-bounded, reducing a profile cannot erase a local clause, thus we have A j = A im for some m ∈ l. Since ρ(λ i ) satisfies (b, E) there exists A in a witness of it for A j . Thus A in is also a witness of (b, E) for A j , since λ i is a supersequence of ρ(λ i ). Hence λ i also satisfies (b, E).

Let (b, c, d, φ ) be a universal constraint violated by λ i , this means that there are two clauses A j = (b, •, P ) and A j = (c, s, P ) such that j d j and P ∩ SP φ = ∅. Since A j is a local clause, it is not removed in ρ(λ i ). Furthermore, we can assume without loss of generality that A j is an extremal occurrence of the clause and thus it is not removed either in ρ(λ i ). Hence ρ(λ i ) also violates the constraint, which concludes the proof.

Consistency

Consistency is a property of profile sequences that ensures compatibility of adjacent profiles. Before defining consistency, we need the key notion of successor clauses.

Successor clauses

We define the (unique) successor of a clause which is either local or pointing to the left. Similarly, the predecessor of a clause either local or pointing to the right is also unique. Let C be an MCP over A, B, let A Φ be the associated predicate automaton with state space Q Φ . Let a, a ∈ A, let S, S ⊆ Q Φ and let K be a clause of the form (b, •, P ) or (b, ←, P ). Then the successor of K with respect to a, a , S, S is the clause K = (b, ←, P ) with P = (p , q) ∈ S × S | ∃(p, q) ∈ P, p a -→ AΦ p . Let a, a ∈ A, let S, S ⊆ Q Φ and let K be a clause of the first profile and the ith clause of the second are adjacent. Formally, let λ = (a, S, A 1 , . . . , A k ) and µ = (b, T, B 1 , . . . , B l ) be two profiles. The pair λ, µ is called consistent if 1) each clause of λ is adjacent to some clause of µ and vice versa, 2) each clause is linked to at most one clause, and 3) there are no crossing links i.e. links A i , B j and A i , B j such that i < i and j > j , or such that i > i and j < j . A profile sequence λ 1 , . . . , λ n is consistent if for all i ∈ {1, . . . , n -1}, the pair λ i , λ i+1 is consistent.

Proposition 4.4.8. Let C be an MCP and let g be an origin-graph. The sequence Seq(g) is consistent.

Proof. Let g = (u, (v, o)) be an origin-graph, and let us first show that its full profile sequence is consistent. Let i ∈ {1, . . . , |u| -1} and let λ i = (a, S, A 1 , . . . , A |v| ) and λ i+1 = (b, T, B 1 , . . . , B |v| ) be the full profiles of positions i and i + 1, respectively. By definition, each pair A j , B j is an adjacent pair, for j ∈ {1, . . . , |v|}. Since we never erase all occurrences of a clause, we have that each clause of ρ(λ i ) is adjacent to some clause of ρ(λ i+1 ), and vice versa. Furthermore, by definition of linked clauses, non-extremal clauses can never be part of a linked pair for λ i , λ i+1 . Thus we obtain that linked pairs for λ i , λ i+1 are necessarily of the form A j , B j where both A j and B j are both minimal or both maximal occurrences of their respective clause. Thus, by removing non-extremal clauses, we preserve the linked pairs, and we don't create new ones, which means that each clause is linked to at most one other clause, and hence λ i , λ i+1 is consistent, which concludes the proof.

Complete profile sequences

The notion of completeness pertains to profile sequences and ensures that all the set of states and pairs of states in the profiles contain all possible states of accepting runs. A profile is called initial if it does not contain a clause pointing to the left and final if it does not contain clauses pointing to the right.

Link closure Before defining completeness, we need some properties of the link closure of reduced and consistent profile sequences. Given a profile sequence s, we call the graph of l * s the graph of clause occurrences of s, with edges of l * s .

Lemma 4.4.9. Let s be a consistent profile sequence. The following holds: each connected component of * s is a path with at most one local clause.

Proof. By definition of consistency, a clause is linked at most once on the left and once on the right, which means that connected components of * s are paths. A clause pointing to the right can only be followed by a clause pointing to the right or a local clause, a local clause can only be followed by a clause pointing to the left and clauses pointing to the left must be followed by a clause pointing to the left. This means that each path of * s contains at most one local clause.

We consider the link closure of consistent reduced profile sequences and show that non-local clauses are linked in the direction they point to.

Lemma 4.4.10. Let s = λ 1 , . . . , λ n be a consistent reduced profile sequence, with n ≥ 2. For any i ∈ {1, . . . , n -1}, any clause of type (b, →, P ) of λ i is linked to a clause of λ i+1 . Symmetrically, for any i ∈ {2, . . . , n}, any clause of type (b, ←, P ) of λ i is linked a clause of λ i-1 . Proof. Let s = λ 1 , . . . , λ n be a consistent reduced profile sequence, with n ≥ 2. Let i ∈ {1, . . . , n -1}, let λ i = (a, S, A 1 , . . . , A k ) and let A j = (b, →, P ). Since λ i is reduced, A j is 110 4.4. Uniformization algorithm either the maximal or minimal (or both) occurrence of the clause. Let us assume without loss of generality that A j is the maximal occurrence. If we consider all clauses of λ i+1 whose predecessor is A j , then A j is linked to the maximal of these clauses, by consistency. The symmetric case is proved in the same way.

Combining the two previous lemmas we obtain the following property of consistent and reduced profile sequences.

Corollary 4.4.11. Let s be a consistent reduced profile sequence beginning with an initial profile and ending with a final one. Each connected component of * s is a path with exactly one local clause.

Proof. The result follows from Lem. 4.4.9 and 4.4.10.

Example 4.4.12. In Fig. 4.8 on page 109, we consider the reduced profile sequence of the origin-graph from Fig. 4.4 on page 104 where we added the links between clauses. Note that each linked component is a path and that each path contains exactly one local clause.

Complete sequences

We now have the tools to define complete sequences. Intuitively, a complete sequence does not conceal any predicate information in the clauses. Let s = λ 1 , . . . , λ n be a consistent reduced profile sequence beginning with an initial profile and ending with a final one, and let u = in(s).

Let A j = (b, d, P ) be a clause of λ i , let i be the index of the profile containing the local clause linked to A j by * (which exists and is unique by Cor. 4.4.11). The clause A j is complete with respect to s if P is equal to the set of pairs (p, q) such that there is an accepting run r of A Φ over u with r(i) = p and r(i ) = q. Then the sequence s is called complete if it satisfies the following properties:

• For all i ∈ n, S i is equal to the set of states p such that there is an accepting run r of A Φ over u with r(i) = p.

• For all i ∈ n, all clauses of λ i are complete with respect to s.

We now show that the profile sequence of an origin-graph is complete.

Theorem 4.4.13. Let C be an MCP, and let g be an origin-graph. The sequence Seq(g) is complete.

Proof. Let C be an MCP, and let g = (u, (v, o)) be an origin-graph. By definition, the first profile of Seq(g) is initial and the last one is final. According to Prop. 4.4.8, Seq(g) is consistent. Let Seq(g) = λ 1 , . . . , λ n , let i ∈ n and let λ i = (a, S, A 1 , . . . , A k ). Again, by definition, we have that S is complete.

As we have seen in the proof of Prop. 4.4.8, links in Seq(g) coincide with the links in fSeq(g) thus the local clause linked to a clause of Seq(g) is the same clause in fSeq(g), which is complete by definition of full profiles. This means that all clauses of Seq(g) are complete.

Soundness

We have shown that a model of an MCP has a valid (Prop. 4.4.3 and 4.4.4) and a complete (Th. 4.4.13) reduced profile sequence. Our goal is now to obtain the converse result that any complete and valid profile sequence is the profile sequences of some model of C. Before that we define a partial order on local clauses, the linearization of which will yield an origin graph.

Chapter 4. Logics for transductions with origins

Let s = λ 1 , . . . , λ n be a consistent profile sequence. Let j < k be two integers such that A j and B k are two distinct local clauses of some profiles of s. If there exists a profile λ i = (a, S, C 1 , . . . , C m ) with two clauses C j , C k such that A j * C j , B k * C k and j < k then we set A j → s B k .

Example 4.4.14. Let us consider the profile sequence s of Fig. 4.8 on page 109, which is consistent by Prop. 4.4.8. Let C 2 be the local clause of the second profile and let C 5 be the local clause of the last profile. Since C 2 is linked to a clause of the last profile, below C 5 , then we have C 2 → s C 5 . Let C 1 be the local clause of the first profile, then C 1 and C 5 are incomparable with respect to → s because their link paths never intersect the same profile.

Proposition 4.4.15. Let s be a consistent profile sequence, then → s over occurrences of local clauses of s is acyclic. Proof. Let s = λ 1 , . . . , λ n be a consistent profile sequence. We map clause occurrences into the two-dimensional plane such that if we have A → s B then A has a strictly lower ordinate than B, which will conclude the proof. Let λ i = (a i , S i , A i 1 , . . . , A i ki ) for i ∈ n. We start by setting µ(A 1 j ) := (1, j), for j ∈ i 1 , and then we define µ by induction. For any clause A i+1 j , if it is linked to some clause A i j with µ(A i j ) = (i, q) then µ(A i+1 j ) := (i + 1, q). Let 1 ≤ j 1 < . . . < j k ≤ k i+1 be the indexes of the linked clauses and let q 1 < . . . < q k be their respective ordinates (they are ordered the same, since there are no crossing links by consistency). Let j < j 1 , then µ(A i+1 j ) := (i + 1, q 1 -(j 1 -j)). Let j l < j < j l+1 , then µ(A i+1 j ) := (i + 1, q l + j-j l j l+1 -j l (q l+1 -q l ). Let j > j k , then µ(A i+1 j ) := (i + 1, q k + (j -j k )). Hence by definition, linked pairs have the same ordinate, while two clauses where A → s B implies that the ordinate of A is strictly smaller than that of B, concluding the proof.

From complete sequences to origin-graphs We define a construction from a complete profile sequence to an origin-graph and show some of its properties. Let s = λ 1 , . . . , λ n be a profile sequence with λ i = (a i , S i , A i 1 , . . . , A i ki ) and let ≤ s be a linear order over local clauses, compatible with → s (i.e. A → s B ⇒ A ≤ s B). Let us define g = (u, (v, o)) the origin-graph of s induced by ≤ s , by

Lemma 4.4.16. Let s be a complete profile sequence, let ≤ s be a linear order compatible with → s and let g be the origin-graph of s induced by ≤ s . Then Seq(g) = s.

Proof. Let s = λ 1 , . . . , λ n be a complete sequence, let ≤ s be a linear order compatible with → s and let g = (u, (v, o)) be the origin-graph of s induced by ≤ s . Let i ∈ n, and let

). The sets S i only depend on u and i, and thus by completeness of s we have S i = S i . The local clauses of s are obtained from the local clauses of s and thus for each profile, the number of occurrences as well as the respective order of the local clauses is preserved.

Let us first show that s is a subsequence of s , the full profile sequence of g. Let i ∈ n, let 1 ≤ j < j ≤ k i , then A i j and A i j both point to some local clause in other profiles (Cor. 4.4.11). We have that these positions must be ordered by → * s (the transitive closure of → s ) and thus by ≤ s , which means that these two clauses appear in the same order in the ith full profile of g.

Let us assume that λ i = ρ(λ i ). This means that there is an extremal (let's assume maximal) occurrence of a clause of λ i which does not appear in λ i . If the clause does not appear at all, then by consistency we obtain a contradiction. If this clause does appear in λ i but lower, then this would imply crossing links with a clause that appears above in λ i but below in λ i , contradicting consistency. Hence we have λ i = ρ(λ i ), and thus s = Seq(g).

We now have all the tools to characterize complete and valid profile sequences.

Profile automaton

We show that the language of complete and valid profile sequences is effectively rational. Moreover, we have shown that all models of an MCP have complete and valid profile sequences and conversely that any complete and valid profile sequence is the profile sequence of some model. Thus we obtain a way to compute the domain of an MCP. As a consequence, using the reductions from Sec. 4.3, we can compute an automaton recognizing the domain of an Lo-transduction. profile automaton Lemma 4.4.18. Let C be an MCP. The set of complete and valid profile sequences is effectively rational.

Proof. Let C be an MCP. We consider P C the alphabet of reduced profiles, and we show that the set of complete and valid profile sequences is rational. To this end we show that consistency, completeness and validity are all rational properties of a reduced profile sequence. First one can easily see that validity of a sequence only depends on the alphabet of profiles, so by reducing the alphabet to valid reduced profiles, we only consider valid sequences. Similarly, consistency is a local property, and a profile sequence is consistent if any pair of two consecutive profiles is consistent, which is a rational property. It is easy to check that the first profile of a sequence is initial and that the last one is final.

We have left to show that completeness can be checked rationally. Actually we show that non-completeness can be checked rationally. Let s = λ 1 , . . . , λ n be a profile sequence where λ i = a i , S i , A i 1 , . . . , A i ki for i ∈ n. The sequence s is non-complete if either 1)there is a position i ∈ n such that S i is not equal to the set of states reached in position i of an accepting run of A Φ over a 1 • • • a n or 2) a clause of λ i is not complete. To check non-completeness, we define an automaton that guesses a position i satisfying 1) or 2) and checks that the guess was correct.

Rational domain As a consequence, we obtain that the domain of an MCP is also rational.

Corollary 4.4.19. The domain of an MCP instance is effectively rational.

Proof. Let C be an MCP instance over alphabets A, B. According to Lem. 4.4.17, we have {Seq(g) | g |= C} = {s | s is complete and valid}. Furthermore we have for any origin graph g = (u, (v, o)) that u = dom(Seq(g)). Thus dom(C) = {dom(s) | s is complete and valid}, which is rational by Lem. 4.4.18, by projection of profiles over A (since rational languages are closed under projection).

By the previous reductions we have that the domain of an Lo-transduction is rational.

Theorem 4.4.20. The domain of an Lo-transduction is effectively rational.

Proof. Each of the reductions of Sec. 4.3 preserves the domain of a transduction thus, according to Cor. 4.4.19, the domain of an Lo-transduction is rational.

Satisfiability, validity and equivalence As a corollary, we obtain the decidability of Lo.

Theorem 4.4.21. The satisfiability, validity and equivalence problems for Lo-formulas over origin-graphs are decidable.

Proof. The decidability of the satisfiability problem is a consequence of Th. 4.4.20. The other problems are solved using the closure of Lo under boolean combinations. Given a formula φ, it is valid if and only if ¬φ is satisfiable. Similarly, given φ 1 , φ 2 , they are equivalent if and only if φ 1 ↔ φ 2 is valid.

Remark 4.4.22. Note that the equivalence problem for Lo transductions is only decidable with origins. Indeed it is well known that equivalence of transductions up to origins is undecidable.

Since we translate the input MSO-predicates into predicate automata, we obtain an unavoidable complexity in Tower for deciding satisfiability of Lo formulas. However when the input predicates are given directly as predicate automata, we obtain a tight elementary complexity.

Theorem 4.4.23. The satisfiability of Lo is ExpSpace-complete if the input predicates are given as predicate automata.

Proof. The hardness result comes from [START_REF] Schwentick | Two-variable logic with two order relations[END_REF], where it is shown that satisfiability of FO 2 [≤, ] over data words is PSpace-hard. Equivalently (see Sec. 4.5) one can say that the satisfiability of FO 2 [≤ out , ≤ in , o] over non-erasing origin-graphs with a unary input alphabet is PSpace-hard.

To show that the problem can be decided in ExpSpace, we use the fact that one can decide emptiness of the profile automaton in NLogSpace, with respect to the size of the profile automaton. Let φ be an Lo-formula over alphabets A, B with input predicates given by the predicate automaton A Φ with state space Q Φ . Let us show that the profile automaton of the associated MCP instance has size exponential in |φ| + |Q Φ |. Transforming φ into a non-erasing formula is linear, then putting it into SNF is also linear, however as we have seen, we obtain an output alphabet B × B where B has size exponential in φ. Finally going from a formula to an output formula is also linear and doesn't change the alphabet.

In Subsec. 4.4.2 we have seen that the number of different clauses is

which is exponential. We have also seen that the number of reduced profiles is upper bounded by

which is doubly exponential. Since the set of states of the profile automaton is just the set of reduced profile we obtain that the profile automaton has size doubly exponential in φ and Q Φ , which means that checking for emptiness can be done in ExpSpace.

Synthesis

The rationality of the language of complete and valid profile sequences actually gives us more than rationality of the domain of Lo-transductions. We can indeed use this to effectively uniformize Lo-transductions, and in particular solve the regular synthesis problem for Lo. Let us assume that GtD(g) = w. Then w(i) = (v(i), o(i), u(o(i))), and let

Conversely, let us assume that DtG(w) = g.

Transforming formulas We define a syntactic translation from Ld to Lo formulas that preserves models up to the encodings GtD and DtG. First, an MSO[A, ] binary predicate χ is transformed syntactically into an MSO[A, ≤ in ] binary predicate χ by substituting ≤ in for . Let φ be an Ld-formula over A, B. We define an output Lo-formula φ o inductively, by substitutions of atomic formulas and by replacing quantifications by output quantifications. If:

The boolean connectives are left unchanged. Proof. We show this by induction over Ld-formulas. Let w = (b 1 , d 1 , a 1 ) • • • (b n , d n , a n ) be a data word of data size m over alphabets A, B and let g = DtG(w) = (u, (v, o)). To simplify the induction, the domain of g is denoted by {1, . . . , |v|} ∪ {(1, 1), . . . , (1, |u|)}. We show for φ an Ld-formula and for i, j ∈ n that if w |= φ(i, j) then g |= φ o (i, j). The converse is done in the exact same way. Let φ = χ (x, y), and let i, j ∈ n such that w |= χ (i, j). Then we have that u |= χ (d i , d j ) where u can be seen as the word over A induced by over w. Thus we have g |= φ o (i, j) = χ (o(i), o(j)). Let φ = b(x) and let i ∈ n such that w |= b(i). Then clearly v(i) = b and we have g |= φ o (i) = b(i) since we produce an output formula and we only quantify over output positions. Let φ = x ≤ y and let i, j ∈ n such that w |= i ≤ j, then i ≤ j and we have naturally g |= i ≤ out j. Let φ = ∃x ψ(x, y) and let j ∈ n be such that w |= ∃x ψ(x, j). This means that there is a position i ∈ n such that w |= ψ(i, j). By induction hypothesis we thus have that g |= ψ o (i, j), which concludes the proof.

Decidability As a corollary, we obtain the decidability of Ld, by reduction to Lo-formulas.

Chapter 4. Logics for transductions with origins Theorem 4.5.5. The satisfiability problem for Ld over typed data words is decidable.

Proof. Let φ be an Ld-formula, and let φ o be the obtained output Lo-formula. Since DtG is a bijection between data words and non-erasing origin-graphs (Prop. 4.5.3), we have according to Lem. 4.5.4 that DtG( φ ) = φ o ne o . Thus, using Th. 4.4.21, satisfiability is decidable.

Undecidable fragments

We recall two undecidable logics over data words, and show as a consequence the undecidability of two fragments of MSO o over origin-graphs. The main idea is to use the tight correspondence between origin-graphs and data words, to show that the decidability of some fragment over origingraphs would entail the decidability of a fragment over data words, known to be undecidable. The first one is the logic FO 2 [≤, S ≤ , ] over data words with the linear order predicate, the successor predicate for the linear order and the data order predicate, which was shown to be undecidable in The second logic is FO 2 [S ≤ , S ] over data words with the successor for the linear order and the successor for the data order which was shown to be undecidable in [START_REF] Manuel | A short note on two-variable logic with a linear order successor and a preorder successor[END_REF]. With the same technique we obtain the undecidability of FO 2 [S out , S in , o] over origin-graphs.

Proof of Theorem 4.2.4. We consider the same construction from Ld-formulas to Lo-formulas. We add again to the transformation that if φ = S ≤ (x, y) then φ o := S out (x, y). We also add that if φ = S (x, y) then φ o := S in (o(x), o(y)). Again, the proof of Lem. 4.5.4 means that the decidability of FO 2 [S out , S in , o] over origin-graphs would entail the decidability of FO 2 [S ≤ , S ] yielding a contradiction.

Decidable extensions of Lo

We present two different extensions of Lo for which our uniformization techniques still work. This gives in particular the decidability of the two extensions and shows the robustness of Lo. Furthermore these extensions can be translated in terms of data word logics and so give more expressive decidable data word logics.

The first extension ∃Lo is a classical extension for logics with arbitrary unary predicates. The logic ∃Lo is the set of formulas of the form ∃X 1 , . . . , X n φ where φ is an Lo-formula with additional unary predicates X 1 , . . . , X n .

The second extension Lo so , adds new unary predicates called single-origin predicates. Given a rational language L ⊆ B * , the semantics of a single-origin predicate L(x) is that the word of positions with origin x belongs to L.

In Fig. 4.10 on the facing page we give a summary of the different transduction classes, their relative inclusions and the frontier for regular synthesis and decidability of satisfiability and equivalence.

Decidable extensions of Lo

Existential extension

The fragment ∃Lo allows us to capture NMSO-transducers (Th. 4.2.8) while preserving the decidability, and even the regular uniformization of the logic.

Theorem 4.6.1. Given an ∃Lo-formula, one can synthesize a regular transduction uniformizing it.

Proof. Let φ = ∃X 1 . . . X n ψ be an ∃Lo-formula over alphabets A, B. Then the formula ψ can be seen as an Lo-formula over the alphabets A × 2 {X1,...,Xn} , B × 2 {X1,...,Xn} . Thus using Th. 4.4.25 we can obtain a two-way transducer T uniformizing the transduction of ψ over the extended alphabets. Let T denote the transducer obtained from T by projecting the enriched alphabets to the original alphabets A, B. Thus we have that T o ⊆ φ o and dom( T o ) = dom( φ o ). However the transduction realized by T may not be functional. This can be easily solved by a disambiguation procedure ( [dS13]) which yields a transducer T uniformizing T and thus uniformizing φ as well.

As a consequence we obtain a more expressive decidable logic over data words: ∃Ld defined by formulas of the form ∃X 1 , . . . , X n φ where φ is an Ld-formula with additional unary predicates X 1 , . . . , X n . The same translation from formulas over data words to formulas over origin-graphs works, just by considering extended alphabets.

Corollary 4.6.2. The logic ∃Ld is decidable over typed data words.

The previous results again give us the decidability of ∃Lo, but since the logic is not closed under boolean operations, we cannot conclude that validity and equivalence are also decidable. In fact it turns out that both problems are undecidable for ∃Lo.

Theorem 4.6.3. The validity and equivalence problems for ∃Lo-formulas over origin-graphs are undecidable.

Proof. We prove that the validity problem is undecidable. In particular, the equivalence with the formula is thus undecidable. Since Lo is syntactically closed under negation, we actually show that the satisfiability problem is undecidable for the logic ∀Lo, which consists in formulas of the form ∀X 1 . . . ∀X n φ where φ is an Lo-formula.

The proof works by reduction from the Post Correspondence Problem. Let A be an alphabet, let n ∈ N and let u i , v i ∈ A * for any i ∈ n. We define a formula φ in ∀Lo such that φ is satisfiable Chapter 4. Logics for transductions with origins if and only if there exists a sequence of indices i 1 , . . .

The formula φ is defined over alphabets A, A × 2, such that the projection of the output over A × {j} is the identity, for j ∈ 2. Furthermore, the output word must be of the form (+ i∈n 1(u i )2(v i ))

* , where the morphism j : A * → (A × {j}) * is defined by j(a) = (a, j) for a ∈ A and j ∈ 2.

We only have left to define the formula φ to conclude the proof. We define the formula φ := ∀ out X φ well-formed (X) ∧ φ id,1 ∧ φ id,2 . The formulas φ id,j , for j ∈ 2, stating that over each copy of A the origin-graph belongs to the identity, are easily defined as in Ex. 4.2.6:

• j(x) := a∈A (a, j)(x)

• φ inj,j := ∀ out x, y (j(x) ∧ j(y) ∧ o(x) = in o(y) ) → x = y • φ surj,j := ∀ in x ∃ out y o(y) = in x ∧ j(y)

• φ lab,j := ∀ out x a∈A (a, j)(x) → a(o(x))

• φ shuffle,j := φ inj,j ∧ φ surj,j ∧ φ lab,j

• φ id,j := φ shuffle,j ∧ ∀ out x, y (j(x) ∧ j(y) ∧ o(x) ≤ in o(y) ) → x ≤ out y

We now have left to define φ well-formed (X) such that ∀ out X φ well-formed (X) will ensure that the output is indeed in the language L := (+ i∈n 1(u i )2(v i ))

* . We first define a formula stating that X is a contiguous set of positions: cont(X) := ¬ ∃ out x x ∈ X ∧ (∃ out y x < out y ∧ y / ∈ X ∧ (∃ out x ∧ y < out x ∧ x ∈ X))

Let m := max {|u i | + |v i | | i ∈ n} + 1, then the words in L can be characterized by their factors, prefix and suffix of length ≤ m. Let w ∈ (A × 2) * we define a predicate w(X, x) which states that w is a subword of X starting at position x. The predicates are defined by induction on the length of w. Let a ∈ A × 2, then a(X, x) := x ∈ X ∧ a(x), aw(X, x) := a(X, x) ∧ ∃ out y x < out y ∧ w(X, y). With the same technique we can define |X| = p for any integer p ∈ N. Let F ⊆ (A × 2) be the set of factors of length m of L. Similarly, let P and S be the set of prefixes and suffixes of length m in L, respectively. Let min(X) and max(X) denote that the minimum position and the maximum position of the word belongs to X, respectively. φ well-formed (X) := cont(X) ∧ |X| = m → w∈F w(X) ∧ w∈P min(X) → w(X) ∧ w∈S max(X) → w(X) Note that the formula does not consider the small PCP solutions, i.e. of the form u i = v i for instance. Of course this is not a problem because if there exists a solution then there is a solution of any arbitrary size.

Single-origin predicates

One problem with Lo is the impossibility to express arbitrary rational properties of the output independently of the input. Of course as we have seen, just adding this ability without any restriction would in fact cause undecidability of the logic (see the undecidability proof from [BDM + 11]). We find a middle ground and add predicates that talk about rational properties of the output word, but restricted to positions with a single origin. For instance if the input word contains only one position then Lo can only talk about FO 2 [≤ out ]-definable properties. However in that case Lo so can define any rational property of the output. As we have seen, the class of Chapter 4. Logics for transductions with origins Proof. Let φ be an Lo so -formula over alphabets A, B. We view φ o as the composition of two transductions, τ 2 • τ 1 where τ 1 is a rational transduction (i.e. given by a 1NFT) and τ 2 is an Lo-transduction. From Th. 4.4.25, we can obtain a regular function f 2 uniformizing τ 2 . Before defining τ 1 and τ 2 let us show how one can use such a decomposition to prove the statement. We define τ 1 , a restriction of the codomain of τ 1 to dom(f 2 ). Formally, τ 1 := {(u, (v, o)) ∈ τ 1 | v ∈ dom(f 2 )}. Since f 2 is regular, its domain is a rational language and we can define a 1NFT realizing τ 1 . Then we uniformize τ 1 , which can be done by an unambiguous 1NFT ([EM65]), and obtain a rational function f 1 , such that f 2 • f 1 uniformizes φ o . The transduction τ 1 is a rational transduction over A, A B which after reading a letter a ∈ A produces an arbitrary word in aB * . The idea is that each letter produces its subword so that τ 2 can talk about the input instead of the output. Let g = (u, (v, o)) be an origin-graph over A, B, we define g = (u , (v, o )) over A B, B: let V i := {j ∈ dom(v) | o(j) = i}, for i ∈ dom(u). Let v i = j∈Vi v(j), then u := u(1)v 1 • • • u(|u|)v |u| . Finally we set o (j) := i + j for j ∈ V i . We illustrate this in Fig. 4.11.

We now transform φ syntactically into an Lo-formula φ over alphabets A B, B. Our goal is then to show that φ o := {g | g |= φ}. We define a binary input predicate that relates an input position y labeled in B to the previous input position x labeled in A, i.e. its "origin" with respect to τ 1 and which we call the virtual origin: vo(x, y) := A(x) ∧ B(y) ∧ x < in y ∧ ∀ in z (x < in z < in y) → B(z)

Let L be a regular language over B, we denote by φ L an MSO[≤]-formula recognizing it. Our syntactic transformations only modifies the input predicates and is done in three steps.

1) We guard all quantifications so that they only talk about input positions labeled in A: (∃ in x ψ(x)) := ∃ in x A(x) ∧ ψ (x).

2) The binary predicates φ(x, y) are replaced by ∃ in z, t vo(z, x)∧vo(t, y)∧φ (z, t) . One can see that g |= φ(x, y) (o(i), o(j)) if and only if g |= ∃ in z, t vo(z, x) ∧ vo(t, y) ∧ φ (z, t) (o(i), o(j)).

3) Finally a single origin predicate is replaced by an input predicate which talk about the input positions with a fixed virtual origin. A predicate L(x) is replaced by a formula φ vo(x, ) L defined from φ L by restricting quantifications to positions with virtual origin x.

The final formula is φ ∧ φ well-formed where φ well-formed is the conjunction of:

• input positions labeled in A do not produce anything: ∀ in x A(x) → ∀ out y x = o(y)

• input positions labeled in B produce exactly one output position with the same label: • over a fixed virtual origin, the linear order is preserved which translates into the Lo-formula: ∀ out x, y ∃ in z vo(z, o(x)) ∧ vo(z, o(y) ∧ x < in y → x < out y.

By construction τ 2 := φ ∧ φ well-formed o = {g | g |= φ}. Since we have indeed that τ 2 • τ 1 = φ o , then this concludes the proof.