Un jour vous verrez la serveuse automate S'en aller cultiver ses tomates Au soleil…

Starmania on semigrape varieties

When Randolph Carter was thirty he lost the key of the gate of dreams. Prior to that time he had made up for the prosiness of life by nightly excursions to strange and ancient cities beyond space, and lovely, unbelievable garden lands across ethereal seas […] He had read much of things as they are, and talked with too many people. Well-meaning philosophers had taught him to look into the logical relations of things, and analyse the processes which shaped his thoughts and fancies.

H. P. Lovecraft, The Silver Key

Il en est qui, face à cela, se contentent de hausser les épaules d'un air désabusé et de parier qu'il n'y a rien à tirer de tout cela, sauf des rêves. Ils oublient, ou ignorent, que notre science, et toute science, serait bien peu de chose, si depuis ses origines elle n'avait été nourrie des rêves et des visions de ceux qui s'y adonnent avec passion.

Alexander Grothendieck, Esquisse d'un programme 52128/complexity-of-convertibility-in-simply-typed-%CE%BB-calculus-with-sums -and combine the two into a single paper. It ended up more technical than expected, so I've abandoned it for now.

5 Our "order 2" corresponds to Sénizergues's "level 3". CONTENTS 2.1.2. Strings (a.k.a. words) 2.1.3. Ranked trees 2.2. Sequential transducers 2.2.1. The Krohn-Rhodes decomposition and wreath products of monoids 2.3. Streaming string transducers (SSTs) 2.3.1. Copyful SSTs 2.3.2. Copyless SSTs and regular functions 2.3.3. Layered SSTs 61 2.3.4. Transition monoids of (copyless) SSTs 2.4. HDT0L transductions 2.4.1. Layered HDT0L systems 2.5. Polyregular functions 2.5.1. Layered SSTs vs polyregular functions 2.5.2. Polynomial list functions 2.5.3. More on the "map" combinator 2.6. Tree transducers 2.6.1. Trees as output 71 2.6.2. Trees as input 71 2.6.3. Bottom-up (ranked|register) tree transducers 1

Turing's seminal paper [Tur37] uses the word "computer" to refer to a person performing calculations, as was the historical usage. Indeed, computer science precedes the construction of computers in the modern sense (Konrad Zuse's Z3 was finished in 1941), although there are some precursors, for instance the 18th century Jacquard looms that could be "programmed" using punch cards. The first design for a general-purpose computer is Charles Babbage's Analytical Engine from the 19th century -for which Ada Lovelace wrote the first computer program in history -but it was not built at the time.

2 Or historically, recursive, although this can be a bit misleading with respect to the current usage in programming practice. Likewise, computability theory is also called recursion theory.

52 This is why computational trinitarianism is also called the Curry-Howard-Lambek correspondence. 53 Here there is a slight historical mismatch between syntax and semantics: "cartesian" refers to a

Abstract. This thesis aims to establish new connections between two distinct fields within theoretical computer science. The first is automata theory, whose objects of study are models of computation with limited memory. The second is the theory of programming languages, in particular of the λ-calculus upon which the functional paradigm is based.

It is known that the functions from strings to booleans definable by programs written in the simply typed λ-calculus, using Church encodings, correspond exactly to regular languages. Taking this as our starting point, we give several other characterizations of automata-theoretic classes of languages and string-to-string (or even tree-to-tree) functions using λ-calculi with linear types. To prove those results, we develop some connections between denotational semantics -which we use to evaluate λ-terms -and categorical automata theory; in particular, we show that monoidal closed categories, which appear in the semantics of linear logic, also provide a basis to generalize some constructions on automata that morally involve function spaces. Our investigations into linear λ-calculi also lead us to introduce and study a new transducer model that computes string-to-string functions with polynomial growth.

The results presented in this dissertation are all joint work with Cécilia Pradic.

Résumé. Cette thèse cherche à établir de nouveaux liens entre deux domaines distincts au sein de l'informatique théorique : d'une part la théorie des automates, dont les objets d'étude sont des modèles de calcul à mémoire limitée, et d'autre part celle des langages de programmation, en particulier du λ-calcul qui sert de base au paradigme fonctionnel. Il est connu que les fonctions des mots vers les booléens définissables par des programmes écrits en λ-calcul simplement typé, en utilisant les codages de Church, correspondent exactement aux langages rationnels. Partant de là, nous employons des λ-calculs à types linéaires pour caractériser plusieurs autres classes de langages et de fonctions sur les mots (voire sur les arbres) provenant de la théorie des automates. Afin de démontrer ces résultats, nous tissons des liens entre les sémantiques dénotationnelles -qui nous servent à évaluer les λ-termes -et la théorie catégorique des automates ; en particulier, nous montrons que les catégories monoïdales closes, qui apparaissent en sémantique de la logique linéaire, fournissent également une base pour généraliser quelques constructions sur les automates qui font moralement intervenir des espaces de fonctions. Nos recherches sur les λ-calculs linéaires nous mènent également à introduire et étudier un nouveau modèle de transducteurs qui calcule des fonctions sur les mots à croissance polynomiale.

Les résultats présentés ici sont tous issus d'une collaboration avec Cécilia Pradic.

Preface to the revised version (March 2023)

This new version of my PhD thesis finally incorporates the corrections suggested by the reviewers (most notably an overhaul of Chapter 7), after I massively procrastinated doing so. It also updates a few references to papers that were announced as "in preparation". Most importantly, I have taken the opportunity to purge my main coauthor's deadname from the document, after she made her coming-out in academic circles in January 2023 -thus removing my last excuse for delaying this revision. Which brings me to… 1 Credits … Cécilia Pradic's status as my collaborator on all the results presented here -in the original version, this was only mentioned at the start of the "Contributions" section ( §1.2), so after 17 pages of preliminary background. While this is officially my dissertation, the scientific substance that it contains is clearly also hers; I cannot overemphasize how crucial Cécilia's exceptional breadth and depth of technical knowledge was for embarking on this research programme. She also convinced me by her actions that scientific collaborations could be happy and fruitful, at a time where I was deeply cynical 2 about the possibility of working with other researchers in an environment that encourages people to obsess over filling their resumes at the expense of (rigor | honesty | climate responsibility | …). Ideally, I would like this paragraph to serve as sufficient proof for bureaucrats to consider that her involvement in this thesis counts as some kind of supervision / advising activity.

It is also thanks to Cécilia's familiarity with the automata group in Warsaw -where she had spent half of her PhD -that I was put in contact with Mikołaj Bojańczyk, whose work has exerted a considerable influence over mine. I am grateful to Mikołaj and to the rest of the "polyregular gang" for making me feel part of a collective enterprise. I should also acknowledge my intellectual debt to the French-Italian linear logic community, who warmly welcomed me at the TLLA 2017 workshop when I presented my solitary work on proof nets [START_REF] Thành | Unique perfect matchings, forbidden transitions and proof nets for linear logic with Mix[END_REF] -which led me to becoming a PhD student in Paris XIII.

Finally, I may have given insufficient credit in the first version of this thesis to the work of Gallot, Lemay and Salvati [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF]. Their characterization of regular tree functions, when read properly (i.e. in the light of the top-down states vs bottom-up registers duality of Remark 6.0.1), is in fact very close 3 to our characterization using "L-BRTTs" in Chapter 6, which is key to obtaining the corresponding "implicit automata" result (third row of Theorem 1.2.3). More generally, while working on this thesis, I found Sylvain Salvati's numerous works relating automata and λ-calculi [START_REF] Salvati | Lambda-calculus and formal language theory[END_REF] to be very inspiring. 1 In these credits, I am omitting the people whose names appear in the frontpage; their contribution goes without saying. This is not meant to be an exhaustive acknowledgments section: it would not possible to mention all of the many researchers with whom I have had inspiring and informative discussions (see the acknowledgments of [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF] for a small sample); and I do not wish to perpetuate the practice of showing off one's strong family ties, rich social life and connections to famous people (you also have to wonder how many messy breakups have followed heartfelt declarations of love in thesis acknowledgments…).

2 To quote a colleague who shall remain anonymous: "most people are doing their best, but sometimes that's observationally equivalent to dishonesty".

3 The main differences are discussed at the end of this preface.

Updated references and errata

• One result first claimed in this dissertation, without proof, is that pebble minimization fails for general polyregular functions (refuting the central claim of [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF]), a discovery made in Summer 2021 (so, at a time when I was supposed to be writing this manuscript…).

Proofs have now finally been made available, first in a rather technical paper by Mikołaj Bojańczyk [START_REF] Bojańczyk | On the growth rate of polyregular functions[END_REF], followed shortly by a draft by Sandra Kiefer, Cécilia Pradic and I [START_REF] Kiefer | Revisiting the growth of polyregular functions: output languages, weighted automata and unary inputs[END_REF] where we propose simpler approaches. Both papers also prove the dimension minimization theorem for MSO interpretations (a characterization of polyregular functions that does not appear in this thesis, outside of a mention in the introduction).

-In Chapter 3, we reused Nathan Lhote's techniques and ideas from [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF] to get a (hopefully) correct proof of comparison-free pebble minimization. This has been reproved in a shorter way using factorization forests by Gaëtan Douéneau-Tabot [START_REF] Douéneau-Tabot | Pebble minimization: the last theorems[END_REF], who also extends the result to a more permissive subclass of pebble transducers. -Concerning polyregular functions, see also Bojańczyk's recent survey [START_REF] Bojańczyk | Transducers of polynomial growth[END_REF].

• Another claim without proof in Chapter 1 was the P-completeness of normalization for planar λ-terms -a joint work [START_REF] Das | Complexity of normalization for subsystems of untyped linear lambda calculus[END_REF] with Anupam Das, Damiano Mazza and Noam Zeilberger. It turns out that our proofs were subtly wrong. At the time of writing, the problem is still open -we are seriously considering the possibility that planar normalization could in fact be sub-polynomial -but we know that in the planar λ-calculus extended with multiplicative pair types σ ⊗ τ (that is, in Intuitionistic Non-Commutative Multiplicative Linear Logic), normalization is indeed P-complete. • I have also updated the reference concerning my work with Lutz Straßburger [START_REF] Thành | A System of Interaction and Structure III: The Complexity of BV and Pomset Logic. Significantly extended journal version of the CSL 2022 paper[END_REF] which is far from the topic of this thesis, and thus appears only in two footnotes of the introduction -to point to a significantly extended preprint, invited for a special issue of Logical Methods in Computer Science, instead of the conference version. Our hope is that this preprint can serve as a general introduction to pomset logic and BV; it also ends with a survey of many related works.

What's new concerning the related and "future" work

• We have mentioned in Section 1.2.3 that composition of copyless streaming string transducers is highly non-trivial. Yet a seemingly simple and short proof was given in the original paper [AČ10, Proposition 1]. Actually, it was known for a while among experts in transducer theory that this proof is wrong. (Morally, in the categorical language of Chapter 4, they proceed as if SR ⊕ was monoidal closed, which is not the case, although their ideas suffice to establish the weaker Lemma 4.3.14.) This piece of folklore has now been made public in the preprint [START_REF] Alur | Composing Copyless Streaming String Transducers[END_REF], which shares a coauthor with [START_REF] Alur | Expressiveness of streaming string transducers[END_REF]; the discovery of the bug is attributed to Joost Engelfriet. A correct construction for composing copyless SSTs is also provided in [START_REF] Alur | Composing Copyless Streaming String Transducers[END_REF], but techniques to do so were also already known (in fact, this dissertation contains a proof of closure under composition, cf. §1.2.3). • Mikołaj Bojańczyk and I have a new categorical take on regular string functions [START_REF] Bojańczyk | Algebraic Recognition of Regular Functions[END_REF].

We are also working together (with Clovis Eberhart, Cécilia Pradic and Rafał Stefański) on monoidal closed categories of single-use functions on atoms; it turns out, however, that the ideas put forth in Section 1.4.4 for generalizing this to trees were excessively optimistic (already the notion of regular language of trees with atoms is less robust than for strings). • After delving into the literature on collapsible pushdown automata, I have convinced myself that I could prove Conjecture 1.4.3, concerning the expressiveness of the simply typed λ-calculus, and presented this in seminars in Warsaw and Lyon; however, the proof is not yet written, so beware… A key ingredient is a result of Gordon Plotkin dating back to 1982, which became public 40 years later [START_REF] Plotkin | Recursion does not always help[END_REF].

• In my discussion on complexity in the simply typed λ-calculus (Section 1.3.6), I did not mention the precise complexity of β-convertibility for this system (which I didn't know at the time): it is Tower-complete. In an upcoming4 paper [START_REF] Thành | Simply typed β-convertibility is Tower-complete even for safe λ-terms[END_REF], I plan to clarify this folklore fact and extend the Tower-hardness result to the safe (cf. §1.3.4) λ-calculus. Blum and Ong [START_REF] Blum | The Safe Lambda Calculus[END_REF] had only managed to prove PSpace-hardness in the safe case; it is by using automata-theoretic techniques, inspired by the work presented in this dissertation, than I could establish Tower-hardness by reduction from star-free expression emptiness. • In several papers [START_REF] Douéneau-Tabot | Pebble Transducers with Unary Output[END_REF][START_REF] Douéneau-Tabot | Hiding Pebbles When the Output Alphabet Is Unary[END_REF][START_REF] Douéneau-Tabot | Pebble minimization: the last theorems[END_REF], Gaëtan Douéneau-Tabot has pushed for renaming "comparison-free pebble transducers" (Section 1.2.4 / Chapter 3) to "blind pebble transducers", and "comparison-free polyregular functions" to "polyblind functions". The latter has an undeniable advantage in brevity, so I am inclined to go along with this terminological change.

-Gaëtan's also has a preprint with Thomas Colcombet and Aliaume Lopez [START_REF] Colcombet | [END_REF] on "Z-polyregular functions" -their new name for the class of Z-rational series of polynomial growth (cf. Remark 2.3.15). • The study of recognizable languages of simply typed λ-terms (mentioned in Section 1.3.3) is being revived in Vincent Moreau's ongoing PhD (see the recent preprint [START_REF] Sam Van Gool | Profinite lambda-terms and parametricity[END_REF] on "profinite λ-terms"). Amina Doumane and I have started looking at the order 3 case, which corresponds to syntax trees with binders modulo α-renaming. • We mentioned in Section 1.4.1 a class E of tree functions studied by Engelfriet et al., and Géraud Sénizergues's claim [START_REF] Sénizergues | Sequences of Level 1[END_REF] that the string-to-string functions in E can be characterized as compositions of HDT0L transductions. He has now uploaded to arXiv a proof of the "order 2" case 5 of this claim [START_REF] Sénizergues | Word-Mappings of level 3[END_REF], and a preprint with the general case should appear in the coming months. • In Section 1.4.5 I mentioned a failed attempt by Damiano Mazza, Gabriele Vanoni and I to use some variant of the Interaction Abstract Machine to relate polyregular functions and the parsimonious λ-calculus. There have been two developments on that front: -A recent preprint by Bojańczyk [START_REF] Bojańczyk | Folding Interpretations[END_REF] uses a system with a parsimonious type discipline in order to characterize polyregular functions. -Gabriele and I have abandoned parsimony for now, and are working on using the IAM to prove other connections between automata and λ-calculi: * To prove Claim 1.4.8 on tree-walking automata -we claimed in Section 1.4.3 that this could be done with a semantic evaluation argument based on the geometry of interaction (GoI), but attempting to apply this to affine rather than linear λ-terms leads to bureaucratic complications (the Int-construction produces monoidal closed categories which are not (quasi-)affine) that could perhaps be sidestepped by the more operational version of the GoI given by the IAM. * To characterize the functions computed by invisible pebble tree transducers [START_REF] Engelfriet | XML navigation and transformation by tree-walking automata and transducers with visible and invisible pebbles[END_REF] by a λ-transducer in the style of Gallot et al. [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF] with a limited amount of non-linearity. One main difference between [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF] and our characterization of regular tree functions (Theorem 1.2.3) is the use of regular lookaround vs additive connectives (another is that our characterization of polyblind functions does not fit into the setting of [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF]). GoI-based approaches such as the IAM do not handle additives very well (though see [START_REF] Clairambault | On the Expressivity of Linear Recursion Schemes[END_REF] for an exception), so we are led to use regular lookaround instead in this upcoming work.

Introduction

Theoretical computer science (TCS) was born in the 1930s when several formalisms for general-purpose computation were introduced. Arguably the two most important ones were:

• Turing machines, idealized mechanical devices arising from Alan Turing's conceptual analysis of how human beings carry out concrete pen-and-paper calculations, 1 • and Alonzo Church's λ-calculus, a somewhat more abstract formal system which is recognized today as the first (high-level) programming language, that is, a means of specifying algorithms while abstracting away from the details of the hardware meant to execute them. It turns out that a function (i.e. a deterministic input-output relation) can be computed by a Turing machine if, and only if, it can be defined in the λ-calculus; and other models of computation were also shown to be equivalent in this sense. This led to a rigorous way to capture the intuitive concept of "which tasks can be solved by computers": a function is computable 2 when it can be defined in any of those equivalent models. That two starkly different approaches -through "machines" and through "programs" -converge to the same definition of computability is a testament to the robustness of this definition.

But this also planted the seeds of the diversity of contemporary TCS. This manuscript deals with two subfields that are on different sides of the machine/program dichotomy:

• Automata theory is concerned with a wide variety of machine models which often be seen as restricted variants of Turing machines, with far less computational power. The most famous example, covered in most undergraduate computer science curricula, is finite automata (also known as finite state machines) which can find patterns in text using a low amount of memory (they are used for instance to implement the Unix grep command). • Programming language theory is an area aptly described by its name. Among its objects of study are certain languages similar to the λ-calculus, called typed λ-calculi. They are statically typed functional languages, like the "real world" languages Haskell and OCaml. The work that we present here contains a modest contribution to "pure" automata theory, but it is mostly about drawing connections between those two areas. At an impressionistic level, the main ideas that we defend -or, to be pedantic, the thesis of the dissertation that you are reading -are the following:

• Automata are relevant to natural questions on the expressive power of typed λ-calculi; we demonstrate this by proving equivalences in the same sense as above. • Conversely, the tools of programming language theory (in particular categorical semantics) can provide conceptual insights on automata.

Before we can explain the precise contributions behind those slogans, we must first recall some more background in order to explain what distinguishes our work from related topics such as higher-order model checking or implicit computational complexity.

1.1. Background 1.1.1. On the landscape of TCS today: algorithms/complexity vs "logic in CS".

The two themes that we have mentioned until now are both part of what is sometimes called "Volume B" of theoretical computer science, or "European" TCS. The other half of the subject, "Volume A", is concerned essentially with algorithmics and computational complexity -and it is often called simply "theory" in North American computer science departments (despite the fact that a lot of interesting work on Volume B subjects is done in the programming language research groups of some of those departments). To give an illustration of this cultural divide, consider for instance Boaz Barak's Introduction to Theoretical Computer Science (https://introtcs.org): at the time of writing, out of 23 chapters, a single one is dedicated to finite automata, and the λ-calculus only takes up two sections in the chapter on computability, while most other chapters are focused on complexity. For further historical discussion and an explanation of the "Volume A/B" terminology, we refer to Moshe Vardi's column in Communications of the ACM [START_REF] Vardi | Why Doesn't ACM Have a SIG for Theoretical Computer Science?[END_REF] and to the interesting comments at https://archive.md/v6iYu that it elicited in response.

Complexity theory focuses mainly on the "resources" necessary to carry out computations. Two central examples are time complexity and space complexity: how long does it take for an algorithm to execute, and how much memory does it need to consume during that execution, depending on the size of its input? Typically, the Millennium Prize problem "P vs NP" (see [START_REF] Aaronson | P=?NP[END_REF] for a comprehensive survey) is about time complexity: roughly speaking, a function is in P if there exists an algorithm that solves it "reasonably quickly" (to be precise, the running time must be bounded by some polynomial function of the input size).

To define formally what this means, one must fix a model of computation with a measure of execution time. There is an invariance thesis due to Slot and van Emde Boas [START_REF] Cees | The Problem of Space Invariance for Sequential Machines[END_REF] which claims that all "reasonable" models of computation can simulate each other with a low overhead in time and space complexity (polynomial in time and constant in space). As a consequence, the aforementioned class P of tractable problems should not depend on the considered model, which is an argument in favor of its canonicity, similarly to the multiple equivalent definitions of computability. But those "reasonable" models tend to be ultimately machines (in fact, theoreticians customarily use Turing machines for this purpose): it is difficult to define the running time of a program in a high-level language without referring to an (idealized) machine that executes it. 3 So, in our earlier machines vs programs dichotomy, complexity theory and automata theory are arguably on the same side, with the difference being the kind of restrictions 3 In the λ-calculus, there is a seemingly natural intrinsic measure of time complexity, namely the number of β-reduction steps. But there are two issues: first, this number depends on the reduction strategy chosen, and second, it is far from clear whether each β-reduction step can be simulated efficiently, since a naive implementation would need to duplicate arbitrarily large data for a single step. A surprising positive resultthat a certain reduction strategy satisfies the time invariance thesis -was proved a few years ago [START_REF] Accattoli | Leftmost-Outermost) Beta Reduction is Invariant, Indeed[END_REF]; we refer to that paper for further discussion of the questions related to complexity invariance for the λ-calculus.

We should also mention that complexity theory papers do not describe their algorithms directly as Turing machines, but as pseudocode that could in principle be complied into a machine. (In the same way most mathematics could "in principle" be translated into Bourbaki's foundational system, though this would be completely intractable in practice [START_REF] Mathias | A Term of Length 4 523 659 424 929[END_REF].) By sticking to an imperative programming paradigm and a limited feature set, the complexity cost of each primitive operation in such pseudocode can be easily understood, circumventing the second problem mentioned for the λ-calculus. considered on machine models (quantitative vs qualitative). Furthermore, questions concerning "what can be computed by given means" play an important role in both fields. For instance, P vs NP is about whether two classes of functions are equal -in other words, whether polynomial time algorithms are "powerful enough" to compute all NP functions. Most people expect the answer to be negative, so the problem is to separate those classes. Separation results are also fundamental for automata; the main difference is that while such results for complexity classes tend to be either trivial or utterly out of reach of current mathematics (P = NP is the latter), proving non-trivial separations is something ordinary in automata theory -and we will do this in Chapter 3. And sometimes a qualitative constraint and a quantitative bound yield the same class: for instance, multi-head finite automata are equivalent to logarithmic space Turing machines (see [START_REF] Holzer | Complexity of multi-head finite automata: Origins and directions[END_REF] for a survey).

All this to say that the Volume A/B distinction, grouping automata with programming languages rather than with complexity, is not entirely self-evident from a purely technical point of view. In order to give an impression of unity, Volume B is sometimes called "logic in computer science"; it corresponds indeed to the scope of various CS conferences 4 with "logic" in their name, and of the journal Logical Methods in Computer Science. However, we shall be mostly uninterested 5 in the logical aspects here, although we will explain them briefly in this introduction for the sake of broad cultural interest. Instead, we will emphasize another commonality of both main currents of Volume B which, we believe, explains to a large extent the success of the research programme presented in this dissertation: their algebraic and compositional perspective on computation.

1.1.2. Automata on strings and monoids. We limit our presentation of automata theory here to the kind that lends itself to such algebraic methods. For instance, we exclude the above-mentioned multi-head automata from our scope, precisely because of their equivalence with a standard space complexity class, which signals to us that their study is better left to complexity theory. 6 The spirit of what lies within our scope, though, is perhaps best illustrated, at an elementary level, on the well-known regular languages.

What is called a language 7 in TCS is a set of strings (or finite words); a string is a finite sequence of letters taken in a finite alphabet. Given an alphabet Σ, we write Σ * for the set of all strings over Σ; thus, a language is a subset of Σ * (for instance, {aa, abb, ba} ⊆ {a, b} * ). A language L ⊆ Σ * can also be presented a function that maps each string in Σ * to either "yes" or "no" (L is the set of strings mapped to "yes" by the corresponding function); such functions are called decision problems in computability theory and complexity theory (and decidability is sometimes used as a synonym for computability for such problems). 4 Of course, the mere existence of those conferences confirms the sociological reality of "Volume B". But this should be nuanced by the observation that their audience generally consists of two clusters that rarely attend each other's talks. 5 Not to say that these connections with logic are uninteresting per se -quite the contrary! -but they simply fall out of the scope of this dissertation. The "linear logic" part of the title has been chosen to avoid including a Greek letter: "linear λ-calculi" would have been more accurate. This is why no mention of Aristotle, Frege or the crisis of foundations and Gödel's incompleteness theorems had been made before the present sentence. (Nor did we talk about the Ariane 5 maiden flight, a common argument for the necessity of certified software and thus of logic; by the way, the final sequence in Koyaanisqatsi draws from a similar incident something quite different, namely a statement against industrial civilization.)

6 Thus, we are narrowing our focus to ignore the uses of automata as a qualitative approach to usual time/space complexity classes, advocated in e.g. [START_REF] Aubert | An in-between 'implicit' and 'explicit' complexity: Automata[END_REF].

7

A different use of "language" that will sometimes occur in this manuscript is as an abbreviation for "programming language" when the context makes this clear. The connection is that the set of source codes without syntax errors in a given programming language is a set of strings. This is why some old textbooks on compilers dedicate several chapters to the kind of formal language theory that uses automata.

For instance, P and NP are classes of decision problems, that is, any element of P or NP is a function Σ * → {yes, no} for some finite alphabet Σ; equivalently, they can be defined as classes of languages. Therefore, formally speaking, the class of regular languages is the same type of object as P or NP; more than that, a language is regular if and only if it is recognized 8 by some constant-space Turing machine. 9 But it is arguably not very well-behaved as a complexity class. 10 Still, the notion of regularity can be said to be canonical, just like computability and polynomial time complexity: there are many automata models that can recognize exactly the regular languages.

The algebraic point of view on these equivalent machine models starts from the following observation: many of them have a notion of "behavior of an automaton on a string", which determines whether the automaton returns "yes" when given that string as input, but contains more information. We give some examples below; prior knowledge of the keywords is not necessary to get the rough idea.

• The behavior of a deterministic finite automaton (DFA) on a word describes how its internal memory is updated when it reads this word from left to right. The possible values for the contents stored in memory are represented by a finite set of states Q, and a behavior of the automaton is described by a function Q → Q. • Just like DFA, non-deterministic finite automata (NFA) process their input from left to right, but they can "choose" between different updates, so that each initial state may lead to multiple final states. Therefore, their behavior is best represented by a binary relation on their finite set of states. • Two-way deterministic finite automata (2DFA) -which are mostly the same thing as constant-space Turing machines -can move their reading head back and forth over the input, but they still admit a well-known notion of behavior which is a bit more complicated to describe (see e.g. [START_REF] Birget | Concatenation of Inputs in a Two-Way Automaton[END_REF]). We will not describe it formally here, but Figure 1.1.1 should give a vague impression of the combinatorics involved. The second crucial observation is that these behaviors enjoy a compositionality property. Compositionality is the idea that "the parts determine the whole"; its concrete incarnation here is that if we know the behaviors of an automaton on two strings (say, abb and aa), then we can deduce its behavior on their concatenation (abbaa in this example). For DFA and NFA, input concatenation is reflected at the level of behaviors by composition of functions and of relations, respectively; there is also an associative composition operation for 2DFA behaviors, illustrated in Figure 1.1.1. To put it succinctly: for a fixed automaton, • the set of possible behaviors admits a monoid structure;

• the map from input strings in Σ * to the corresponding behaviors is a monoid morphism. 8 To recognize a language is to compute the corresponding yes/no function. 9 Some more results along these lines: Turing machines using o(log log n) space can only recognize regular languages, but there are non-regular languages that can be recognized with O(log log n) space [START_REF] Stearns | Hierarchies of memory limited computations[END_REF]. Concerning time complexity, every single-tape Turing machine that runs in time o(n log n) recognizes a regular language [START_REF] Kobayashi | On the structure of one-tape nondeterministic Turing machine time hierarchy[END_REF].

10

To go below logarithmic space complexity, the usual approach is to use circuit complexity. From its point of view, regular languages are strange: they are not closed under uniform AC 0 (i.e. ALOGTIME) reductions, but there exist NC 1 -complete regular languages. That said, there is a substantial body of research at the intersection of algebraic automata theory and circuit complexity, see [START_REF]Handbook of Automata Theory[END_REF]Chapter 14].

There are also parts of automata theory that do not fit neatly into either algebraic language theory or complexity theory. An important example is pushdown automata which recognize context-free languages. In theory, the syntax of most real-world programming languages (cf. Footnote 7) is context-free (an (in)famous counterexample is that parsing Perl is undecidable [START_REF] Kegler | Perl and Undecidability, Part III[END_REF]), and students are taught to write compilers using parser generators based on context-free grammars. In practice… well, to quote [START_REF] Bessey | A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World[END_REF]: "Parsing is considered a solved problem. Unfortunately, this view is naïve, rooted in the widely believed myth that programming languages exist."

a b q → 1 q ← 2 q ← 3 q → 1 q ← 2 q ← 3 q → 1 q ← 2 q ← 3 ab q → 1 q ← 2 q ← 3 q → 1 q ← 2 q ← 3 Figure 1.1.1.
The behavior of a 2DFA with 3 states on the inputs a and b determines, by monoid multiplication, its behavior on the concatenation ab.

The third and last important point is that a fixed automaton has finitely many possible behaviors (despite having infinitely many potential inputs). This strong limitation finally brings us to the remarkably concise algebraic definition of regular languages:

Definition 1.1.1. A language L ⊆ Σ * is regular when there exist a finite monoid M , a subset P ⊆ M and a morphism ϕ : Σ * → M such that L = ϕ -1 (P ).

(Σ * endowed with concatenation is the so-called free monoid on the set Σ, with the empty string as its identity element.) For example, the set of words in {a, b} * that contain an even number of as and an odd number of bs is regular: take M = (Z/(2)) 2 and P = {(0, 1)}.

Let us forget about machine models for a moment and focus on the above definition in itself. It opens up the possibility of studying correspondences between subclasses of regular languages and classes of finite monoids: what languages can one define when the possible values for the target monoid (M above) are limited? This is part of the field of algebraic language theory, and a lot of research has been dedicated to such correspondences 11 since the 1960s. The initial and most famous is Schützenberger's theorem, whose history is recapitulated in [START_REF] Straubing | First-order logic and aperiodic languages: a revisionist history[END_REF], and which we shall take as the definition of star-free languages. 12 Definition 1.1.2. A monoid M is said to be aperiodic when for every x ∈ M there is some n ∈ N such that x n = x n+1 . A language L ⊆ Σ * is star-free if and only if there exist a finite aperiodic monoid M , a subset P ⊆ M and a morphism ϕ : Σ * → M such that L = ϕ -1 (P ).

As an example, the monoid (Z/(2)) 2 is not aperiodic because n ≡ n + 1 (mod 2). This is consistent with (but not sufficient by itself to imply) the fact that the aforementioned language defined via parity conditions is not star-free.

In this dissertation, the only classes of languages that we consider are regular and star-free languages. But they are by no means the only sensible possibilities: for instance, there are recent results on a concrete algorithmic problem [START_REF] Amarilli | Dynamic Membership for Regular Languages[END_REF] whose statements involve somewhat exotic classes of finite monoids, and whose proofs required new developments in algebraic language theory of potential independent interest [START_REF] Amarilli | Locality and Centrality: The Variety ZG[END_REF].

1.1.3. Transducers, trees, etc. Coming back to machine models now, we have seen that the "monoid of behaviors" philosophy allows one to prove that various automata only recognize regular languages. This implies for instance that 2DFA are no more expressive 11 A fundamental meta-result indicating what kind of correspondences to look for is Eilenberg's variety theorem. It states that varieties of regular languages correspond to pseudovarieties of finite monoids (here "(pseudo)variety" means "well-behaved class" in a precise technical sense).

12 What Schützenberger proved is that the algebraic definition we give is equivalent to regular expressions without iteration star (hence "star-free") but with complementation. Regular expressions are originally a syntactic means to describe regular languages; they have been extended into a powerful tool for text processing tasks, supported in the standard libraries of many general-purpose programming languages.

than (one-way) DFA, a result that would be non-trivial without this algebraic point of view. But we will now discuss an extension that makes them no longer equivalent: instead of merely returning a yes/no answer, we allow them to produce an output string, so that they compute string functions Σ * → Γ * instead of languages. Such automata with output are called transducers. The respective transducer counterparts to the three automata models mentioned previously are:

• deterministic finite transducers, which compute sequential functions;

• (functional) non-deterministic finite transducers, which compute rational functions;

• two-way deterministic finite transducers, which compute regular functions; and there is a strict hierarchy of function classes (surveyed in [FR16; MP19]) sequential functions rational functions regular functions

Those classical transduction classes have linear growth: input strings of length n are mapped to output strings of length O(n). In this manuscript, we will also encounter the exponentially growing HDT0L transductions (see [START_REF] Ferté | Word-Mappings of Level 2[END_REF][START_REF] Filiot | Copyful Streaming String Transducers[END_REF]) and various recently investigated classes with polynomial growth [Boj18; DFG20] -including a new one that we introduce and study in detail in Chapter 3. All those transductions also collapse to regular languages if we ask them to produce a single output bit. In fact, a slightly stronger property satisfied by all functions under consideration is the following:

Definition 1.1.3. We say that f : Σ * → Γ * preserves regular languages (by preimage) when f -1 (L) ⊆ Σ * is regular for every regular L ⊆ Γ * .

This preservation property hints that those function classes and the devices that compute them can be studied algebraically. Indeed, while the monoids of behaviors of transducers tend to be infinite (since they have to record enough information to determine an output string of unbounded length), they generally admit finite quotients on which we may apply the powerful tools of finite monoid theory 13 such as Ramsey's theorem for additive colorings 14 (used in Chapter 3) and the somewhat related 15 Factorization Forest Theorem [START_REF] Simon | Factorization Forests of Finite Height[END_REF]. Let us also mention that a fundamental theorem called the Krohn-Rhodes decomposition [START_REF] Krohn | Algebraic theory of machines. I. Prime decomposition theorem for finite semigroups and machines[END_REF] can equivalently be stated either on sequential transducers -this is the version applied in Chapter 7 -or on finite monoids.

The differences in expressive power between the transducer models listed above are orthogonal to the considerations of algebraic language theory. One can combine both: there exist suitable notions of aperiodic sequential/rational/regular functions. Another name for aperiodic regular functions is first-order transductions; we will explain the "first-order" part in the subsection on logic-automata connections ( §1.3.1).

But before that, there is another source of diversity in automata theory that cannot go unmentioned: the choice of input structure. For instance, there exist tree automata 13 The area is generally called finite semigroup theory instead -a semigroup is like a monoid, but does not necessarily have an identity element. There is not much technical difference since an identity can be adjoined freely to a semigroup. (However, subsemigroups are often more useful than submonoids.) 14 Ramsey's theorem is a celebrated result from the early history of combinatorics on monochromatic cliques in edge-colored complete graphs. It has spawned a whole subfield called Ramsey theory, with many ties to other areas of mathematics (for instance set theory and the geometry of infinite-dimensional vector spaces, as can be seen in the recent PhD thesis [START_REF] De | Ramsey theory without pigeonhole principle and applications to the proof of Banach-space dichotomies[END_REF]). The special case useful for automata theory considers edge colors taken in a finite monoid and required to be "additive" i.e. compatible in some way with a given order on the vertices. This "additive Ramsey theorem" turns out to be equivalent in logical strength (in the sense of reverse mathematics) to fundamental results on automata over infinite words [START_REF] Leszek Aleksander Kołodziejczyk | The logical strength of Büchi's decidability theorem[END_REF]. 15 It is said to be analogous to Ramsey's theorem in both [START_REF] Simon | Factorization Forests of Finite Height[END_REF] and [START_REF]Handbook of Automata Theory[END_REF]Chapter 18] but there is no consensus on whether the analogy is truly relevant (according to personal communication from Charles Paperman). Unlike in Ramsey's theorem, the monoid structure is essential for factorization forests. taking trees as input. The main "practical" motivation for such devices is to process hierarchically structured data, such as HTML documents. 16 Here we must note a difference with computability and complexity, which are mostly indifferent to input encodings: all data is ultimately serialized as string of bits in real computers, and in particular a tree could very well be given as text with matching delimiters (such as HTML tags). The issue with automata is that they are too weak to recover the structure of a tree from its string representation. 17 Therefore, tree automata do not reduce to string automata; furthermore, they have a rich algebraic theory of their own (the structures involved are more complicated than monoids, see e.g. [START_REF]Handbook of Automata Theory[END_REF]Chapter 22]). And of course, there are also tree transducers.

There is a more radical departure from computability/complexity in the theory of automata taking infinite structures as inputs [Pin21a, Chapters 6 and 8]. While there exist meaningful notions of computability over infinite data, the languages of infinite words or trees recognized by automata models are generally uncomputable. 18 One major impetus for studying such seemingly strange devices is their connection with logic, that we shall describe in §1.3.1. For now, let us just say that logic provides alternative characterizations of various classes of languages and transductions, demonstrating that those classes are somehow natural. One could even say that logic, computation and algebra are three tightly entangled aspects of the kind of automata theory featured in this dissertation.

The other half of "logic in CS" or "Volume B" has a celebrated logic/computation/algebra trinity 19 of its own, and it is finally time for us to properly introduce this topic. We shall start by focusing on the logical and computational sides, and cover the algebra later. 16 In the 2000s, many tree automata papers purported to be motivated by XML processing. At the time, XML seemed poised to take over the Web, with the standardization of various formats (XHTML, SVG, …) and technologies (XSLT, XPath/XQuery, …). But the trend faded away: HTML5 renounced the rigidity of XHTML and JSON emerged as a more lightweight alternative for most data serialization purposes. 17 As a famous StackOverlow answer puts it: "Parsing HTML with regex summons tainted souls into the realm of the living" (regex = regular expressions, cf. Footnote 12 -though "regex" is sometimes used (e.g. in [START_REF] Schmid | Regular Expressions with Backreferences: Polynomial-Time Matching Techniques[END_REF]) to refer to the extended regular expressions with backreferences supported by Perl and by the PCRE library). Formally speaking, the Dyck language of well-bracketed words using the letters '(' and ')' is not regular. It is also TC 0 -complete (see [START_REF] Barrington | On the Relative Complexity of Some Languages in NC[END_REF] for membership; completeness is folklore), so these format conversions are not completely innocuous either from the point of view of circuit complexity.

18

It is worth noting that several questions around computability for transductions between infinite words have been tackled by recent research [START_REF] Vrunda Dave | Synthesis of Computable Regular Functions of Infinite Words[END_REF][START_REF] Filiot | Synthesizing Computable Functions from Rational Specifications over Infinite Words[END_REF].

19

Robert Harper, a programming languages researcher, coined the term "computational trinitarianism" in a 2011 blog post; see https://ncatlab.org/nlab/show/computational+trinitarianism (and for another trinity in computing, see Figure 1.1.2; tip: use the strict equality operator === instead!).

1.1.4. From proofs-as-programs to implicit complexity. An influential principle in contemporary programming language theory is the proofs-as-programs correspondence. The idea is that, in certain logical systems, formal proofs admit a "normalization procedure" that can be seen as the execution of a program -or, perhaps more accurately, as the evaluation of an expression, i.e. a piece of code that denotes a value. According to this analogy, a proof is thus a expression 20 and the formula that it proves is the type of the expression: a label that tells us what kind of result its evaluation yields. A remarkable empirical fact is that this manifests as several concrete isomorphisms between proof systems and (theoretical) programming languages that were originally designed independently.

The first instance of this correspondence, due to Howard 21 [START_REF] William | The Formulae-as-Types Notion of Construction[END_REF], was the relation between intuitionistic propositional logic 22 and the simply typed λ-calculus. The latter is obtained by adding a type system 23 on top of the (untyped) λ-calculus that we mentioned in the very beginning. To illustrate this, consider two λ-terms (i.e. expressions in the λ-calculus) t and u. One can always combine them into a new λ-term t u, the application of t to u, whose intended intuitive meaning is that the function t is fed the argument u. But even if this is allowed, it might not make sense: can you expect to get a meaningful result if you give a string as argument to a function that expects an integer? 24 Type systems classify λ-terms to avoid such situations. In this example, the simply typed λ-calculus requires t to have a type of the form σ → τ (notation: t : σ → τ ) and u to have the type σ in order for the application to be well-typed; moreover, in this case, t u : τ . The logical counterpart of this typed application is the deduction rule "if A ⇒ B and A then B" (whose traditional name is modus ponens); application can be seen as a way to combine a proof of A ⇒ B with a proof of A to get a proof of B. 25 Here it is important to understand that the λ-term t u is just a piece of source code that says "apply t to u"; it is not in itself the result of this application. To get the result, one must 20 The usual slogan is "a proof is a program" but in real-world programming languages, expressions are merely parts of programs and can almost never constitute whole programs by themselves. Arguably, a Haskell program could be seen as ultimately being an expression of type IO () but even then, this is too narrow for us: we want to state a correspondence with logic that works for all formulas/types.

21

Since Howard was inspired by an earlier remark by Curry, the proofs-as-programs correspondence is also known as the Curry-Howard correspondence; another name is formulae-as-types (from the title of [START_REF] William | The Formulae-as-Types Notion of Construction[END_REF]).

22

Intuitionistic logic is a variant of classical logic that rejects the law of excluded middle "A or (not A)". What this restriction achieves is that intuitionistic logic is constructive; this means that, for instance, in intuitionistic arithmetic, a proof of ∀x ∈ N. ∃y ∈ N. P (x, y) (implicitly) provides a way to "construct", given some x, a y such that P (x, y). The notion of construction is not precisely defined, but concretely, the function that maps x to y is computable. More generally, the Brouwer-Heyting-Kolmogorov interpretation, introduced in the 1930s, informally explains the meaning of intuitionistic formulas in terms of constructions; and long before the proofs-as-programs correspondence, the theory of realizability gave this idea a formal incarnation with computable functions as constructions. (Another famous computational interpretation of intuitionistic arithmetic, Gödel's Dialectica intepretation [START_REF] Gödel | Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes[END_REF], also predates proofs-as-programs; it will be discussed again in §1.1.8 and Footnote 59.) Therefore, Howard's contribution was not the mere idea of relating proofs and computation; it was the stronger observation that syntactic proofs are isomorphic to typed λ-terms, while the BHK interpretation only saw them as indirect linguistic descriptions of "constructions". 23 In this manuscript, type systems are always static: the type of each expression is determined without evaluating it. This is an usual meaning of "type system" in academic circles. However, programmers often speak of "dynamically typed" languages; "types" in this context are labels attached to values during program execution. (There is also a somewhat orthogonal "strongly typed" vs "weakly typed" distinction, referring to the type-casts allowed or implicitly performed: the type system of C is often considered static but weak.) For a discussion of this polysemy of the word "type" in computing, see [START_REF] Petricek | Against a universal definition of 'Type[END_REF]. 24 In some weakly typed languages, you might get a result using implicit conversions, whose behavior might be unexpected: see https://www.destroyallsoftware.com/talks/wat and Figure 1.1.2. 25 Observe that this is very close to the BHK interpretation (Footnote 22) of implication: "a proof of A ⇒ B is a construction that turns proofs of A into proofs of B".

execute this code. In the untyped λ-calculus, the execution might get stuck in an infinite loop, but this never happens for λ-terms that are well-typed according to the simply typed λ-calculus. Thus, the type system ensures termination by ruling out all non-terminating λ-terms; but it also excludes some well-behaved λ-terms along the way, and the price to pay is the loss of Turing-completeness 26 (i.e. the ability to express all computable functions).

From a logical point of view, this is an acceptable price: termination is highly desirable since it entails consistency, that is, the absence of contradiction in a logic. 27 Such a termination guarantee might even come with quantitative time complexity bounds. For instance, Hillebrand et al. [START_REF] Gerd | Database Query Languages Embedded in the Typed Lambda Calculus[END_REF] show that simply typed λ-terms operating over certain data encodings and returning booleans can compute all functions 28 in the complexity class ELEMENTARY (i.e. those with a time complexity bounded by a tower of exponentials), and only those. This result illustrates the type-theoretic approach to implicit computational complexity (ICC), a well-established field concerned with machine-free characterizations of complexity classes via high-level programming languages.

1.1.5. Linearity in types and in automata. Many works in implicit computational complexity have taken inspiration from linear logic [START_REF] Girard | Linear logic[END_REF] to design more sophisticated type systems; see [Péc20, §1.2.4] for a survey. The key concept of linear logic is that a proof that "A linearly implies B" must use A "exactly once" to deduce B. From a computational point of view, this has a clear meaning: a function is linear when it does not duplicate nor discard its argument. Since duplication is a major source of complexity in the λ-calculus, controlling it can lead to complexity bounds, hence the relevance to ICC.

An important point for us is that linearity has a counterpart in the old theme of restricting the copying power of automata models (see e.g. [START_REF] Engelfriet | Tree Transducers, L Systems, and Two-Way Machines[END_REF]). The latter is manifested in one of the alternative definitions of regular functions (recall from §1.1.3 that these are the functions computed by two-way transducers): copyless 29 streaming string transducers (SSTs) [START_REF] Alur | Expressiveness of streaming string transducers[END_REF]. An SST is roughly speaking an automaton whose internal memory consists of a state (in a finite set) and some string-valued registers, and its transitions are copyless when they compute new register values without duplicating the old ones. The term "linear" itself has been used to describe this condition, e.g. "updates should make a linear use of registers" [START_REF] Filiot | Transducers, Logic and Algebra for Functions of Finite Words[END_REF]§5], although strictly speaking one should speak of affineness: duplication is forbidden, but not erasure. One also finds the terminology single use restriction in various tree transducer models [EM99; BE00; BD20] where it sometimes stands for more sophisticated restrictions that mere copylessness. And more recently, copylessness has been shown to play an important role in the theory of automata over infinite alphabets [START_REF] Bojańczyk | Single-Use Automata and Transducers for Infinite Alphabets[END_REF]. 26 A programming language whose programs always terminate cannot be Turing-complete -in particular, it cannot define its own interpreter! (See [START_REF] Brown | Breaking through the normalization barrier: a selfinterpreter for F-omega[END_REF], which also counter-intuitively exhibits a self-interpreter for a terminating language that operates on typed representations of programs; the impossibility result assumes that the interpreter takes a string containing raw source code as input.) Most real-world statically typed languages choose to be Turing-complete and to allow non-termination; the type system is still useful in that case, e.g. to detect whole classes of bugs during compilation, following Milner's dictum that "well-typed programs do not go wrong" [START_REF] Milner | A Theory of Type Polymorphism in Programming[END_REF] (but one could argue that infinite loops are one way of "going wrong"…).

27 Normalization of proofs, the logical counterpart of program execution, was first investigated by Gentzen in the 1930s for the purpose of proving the consistency of Peano arithmetic, and his main result (the so-called Hauptsatz) was a termination guarantee. Nowadays, terminating programming languages can be found in proof assistants based on the proofs-as-programs paradigm. 28 This does not mean that a given algorithm with elementary complexity must admit a direct implementation in the simply typed λ-calculus. Instead, what must exist is a λ-term computing the same function from inputs to outputs, with potentially different inner workings. (The nuance is admittedly vague since the notion of "equality of algorithms" does not have a proper mathematical definition.) 29 The adjective "copyless" does not appear in the original paper [START_REF] Alur | Expressiveness of streaming string transducers[END_REF] but is nowadays commonly used to distinguish them from the later copyful SSTs [START_REF] Filiot | Copyful Streaming String Transducers[END_REF].

Let us briefly digress to review some other uses for linear logic. For theoreticians, it has proved to be an invaluable tool in the fine-grained study30 of the (non-linear) λ-calculus and its variants, thanks to translations of intuitionistic logic into linear logic. It also led to the invention of proof nets -graph-like representations of proofs first introduced in Girard's seminal paper on linear logic [START_REF] Girard | Linear logic[END_REF] -and inspired another way to build proofs known as deep inference [START_REF] Guglielmi | A system of interaction and structure[END_REF]; both are innovative approaches to structural proof theory. 31 On the programming side, linear types are especially useful for resource management. 32 The last application that we will mention -our list is far from exhaustive -concerns neither proofs nor programs, but linguistics; the relevant keyword for this line of work is "categorial grammar" (not "categorical"!), see [START_REF] Moot | The Logic of Categorial Grammars. A Deductive Account of Natural Language Syntax and Semantics[END_REF]. It started out with the Lambek calculus [START_REF] Lambek | The Mathematics of Sentence Structure[END_REF], which is actually a linear λ-calculus ante litteram, predating the official birth of linear logic by three decades. An interesting feature of the Lambek calculus is that its type system enforces not only linearity but also non-commutativity: roughly speaking, functions must use their arguments in the same order that they are given in. 33 As we shall see later, one of the main results of this dissertation involves a non-commutative λ-calculus. 34 1.1.6. Towards implicit automata: computation on Church encodings. We have now given enough background to explain one of the main ambitions of this manuscript: to provide for automata what (type-theoretic) implicit complexity has done for complexity classes. One expected benefit would be, typically, to turn the analogy between linear types and copyless / single use automata into precise technical connections. There are some previous works tackling this theme of "implicit automata", but not many (see §1.3.3). Our main inspiration is a remarkable yet little-known 35 result by Hillebrand and Kanellakis: a language can be defined by a simply typed λ-term taking Church-encoded strings as inputs if and only if it is regular [START_REF] Gerd | On the Expressive Power of Simply Typed and Let-Polymorphic Lambda Calculi[END_REF]Theorem 3.4].

of logic. This stated ambition should perhaps not be taken too literally, but linear logic sometimes feels like a significant step in that direction, e.g. intuitionistic connectives are broken into "more primitive" linear connectives. Let us give a concrete example of a technical breakthrough achieved through this approach: the proof of the time invariance thesis for the (untyped) λ-calculus (cf. Footnote 3) in [START_REF] Accattoli | Leftmost-Outermost) Beta Reduction is Invariant, Indeed[END_REF] relies on the linear substitution calculus, which is heavily inspired by linear logic, and whose role is roughly to decompose evaluation (β-reduction) into finer steps.

31 Actually, both have forerunners in category theory: proof nets are related to the free compact closed categories from [START_REF] Kelly | Coherence for compact closed categories[END_REF], as explained in e.g. [START_REF] Melliès | Ribbon Tensorial Logic[END_REF]§1]; and for deep inference vs categorical logic, see [START_REF] Dominic | Deep inference proof theory equals categorical proof theory minus coherence[END_REF]. 32 The most noteworthy industrial success in this vein is perhaps the Rust systems programming language, whose notion of ownership depends on linearity: each value can only have one "owner" at a time. The academically-minded reader might want to read the recent column [START_REF] Jung | Safe systems programming in Rust[END_REF] on Rust. It also covers the formalization efforts surrounding it, taking place in a framework for program verification called separation logic; and separation logic itself is based on a variant of linear logic (namely the logic of bunched implications [START_REF] O'hearn | The logic of bunched implications[END_REF]).

Other applications of linearity to resource management can be found in [Bak92; Mun18] (with a historical overview in [START_REF] Munch-Maccagnoni | Resource Polymorphism[END_REF]§3]). Finally, let us note that version 9.0.1 of the Glasgow Haskell Compiler, released in February 2021, added support for the LinearTypes extension (based on [START_REF] Bernardy | Linear Haskell: practical linearity in a higher-order polymorphic language[END_REF]). 33 In versions of linear logic that admit a tensor product, this makes the formulas/types A ⊗ B and B ⊗ A non-isomorphic in general, hence "non-commutativity". On λ-terms or proof nets, non-commutativity corresponds to a topological planarity condition; to our knowledge, this was first remarked in [Gir89b, §II.9]. For more recent works pursuing this idea, see e.g. [APR05; Abr07; Mel18]; there is an especially noteworthy connection with bijective and enumerative combinatorics [START_REF] Zeilberger | A correspondence between rooted planar maps and normal planar lambda terms[END_REF]. Finally, there is another tradition that studies extensions of commutative linear logic with a self-dual non-commutative connective, starting with pomset logic [START_REF] Retoré | Pomset Logic: A Non-commutative Extension of Classical Linear Logic[END_REF] (defined using proof nets) and continuing with BV [Gug07] (whose proof system was the first based on deep inference); see [START_REF] Thành | A System of Interaction and Structure III: The Complexity of BV and Pomset Logic. Significantly extended journal version of the CSL 2022 paper[END_REF] for a recent overview. 34 Non-commutative types have also been used to restrict the expressive power of a domain-specific programming language in [START_REF] Kodama | Translation of tree-processing programs into stream-processing programs based on ordered linear type[END_REF]. 35 At least this was the case when I started my PhD, see e.g. Damiano Mazza's answer to this MathOverflow question: https://mathoverflow.net/q/296879 -maybe this theorem has become more famous since then!

To explain this statement, we must first remark that many λ-calculi, including Church's original λ-calculus, do not feature integers or strings as primitive data types. But such data can still be represented indirectly as functions, 36 and one standard way to do so is by using Church encodings. For instance, n ∈ N is represented, morally, as the n-fold iterator

f → f • • • • (n times) • • • • f (this
is a higher-order function: a function that takes another function as its argument). This encoding of natural numbers was used by Church to define computable functions N → N in the λ-calculus; the idea was later generalized by Böhm and Berarducci [START_REF] Böhm | Automatic synthesis of typed Λ-programs on term algebras[END_REF] to encodings of all "algebraic data types" (to use functional programming jargon), a class that includes strings and trees.

In some terminating typed λ-calculi, most conceivable functions can still be programmed over these encodings. 37 This is very far from being the case for the simply typed λ-calculus, as Hillebrand and Kanellakis's theorem shows. Consistently with this, the characterization of ELEMENTARY in the simply typed λ-calculus [HKM96] that we mentioned earlier uses a somewhat unusual (though entirely justified) representation for the inputs: in this perspective, the fact that Church encodings only allow regular languages to be recognized is an obstruction to be overcome in order to capture an interesting complexity class. We prefer to see this fact as a feature rather than a bug: it is our starting point to relate λ-calculi to automata. (Church encodings also play an important role in another well-established topic at the interface between λ-calculi and automata, higher-order model checking, see §1.3.4.)

Since "λ-term taking Church encodings as inputs" can be ambiguous, let us give a more technical statement (which is not necessary to follow most of the rest of the introduction).

Theorem 1.1.4 (Hillebrand & Kanellakis [HK96, Theorem 3.4]). A language L ⊆ Σ * can be defined by a simply typed λ-term 38 of type Str Σ [τ ] → Bool for some simple type τ (that may depend on L) if and only if it is a regular language. Some explanations are in order. A type of the simply typed λ-calculus, or simple type for short, is either the base type o or a function type σ → τ where σ and τ are types; in other words, types are syntax trees with binary nodes → and leaves o. We write Bool and Str Σ to denote the types for the Church encodings of booleans and strings respectively: they have the property that the values 39 of type Bool (resp. Str Σ ) are in canonical bijection with {true, false} (resp. Σ * ). We use the notation σ[τ ] for the substitution of all occurrences of o in σ by τ ; since the base type o is morally "generic" -it is not a primitive data type!every λ-term of type σ can also be given the type σ[τ ]. In particular, each string w ∈ Σ * has an encoding w : Str Σ (recall that t : τ means "t has type τ "); according to the previous remark, w : Str Σ [τ ] for every simple type τ . Thus, any λ-term t : Str Σ [τ ] → Bool defines a function Σ * → {true, false}, that corresponds to a language: given an input w ∈ Σ * , the application t w has type Bool and thus evaluates to either true or false.

The main ambiguity in our initial informal statement is that it could be interpreted without the type substitution in the input. We discuss this, as well as some open questions related to definability over Church encodings, in Section 1.3.5. But the results of this dissertation will always involve this kind of substitution. 36 For practical programming, it can sometimes be useful to represent data as functions. For instance, difference lists are a functional representation of lists used by Haskell programmers, that supports a more efficient concatenation operation than usual linked lists. More philosophically, this idea of "data as functions" is also a sort of converse to "code is data", one of the pillars of computing since the universal Turing machine and the von Neumann stored-program architecture. (Or, as a pithy soundbite: Lisp is dual to Haskell.) 37 For example, this is the case for the polymorphic λ-calculus a.k.a. System F, see e.g. [START_REF] Wadler | The Girard-Reynolds isomorphism (second edition)[END_REF]. 38 A technical detail: one must consider a closed λ-term, i.e. without free variables. This also applies to the following paragraph: "any closed λ-term t : StrΣ[τ ] → Bool defines a function Σ * → {true, false}". 39 The precise technical meaning of "value" here is "β-normal η-long term"; the important point is that every simply typed λ-term evaluates to exactly one value.

1.1.7. Implicit complexity meets denotational semantics. We will now introduce an important tool used to prove Theorem 1.1.4: the naive reading of the simply typed λ-calculus as a way to define set-theoretic functions. One can assign to each simple type τ a set τ called its denotation, and to each term t : τ a denotation t ∈ τ , in such a way that (among other properties) σ → τ = τ σ and t u = t ( u ). The second equation makes sense because when t u : τ is well-typed, there must exist (according to the type system) some σ such that t : σ → τ and u : σ, and then t ∈ τ σ is a function from σ to τ while u ∈ σ so t ( u ) is a well-defined element of τ . This set-theoretic interpretation obeys an important invariance property: if two λ-terms evaluate to the same value, then they have the same denotation. This means that computing the denotation of a term is somewhat related to evaluating it; what is particularly useful for us is that when the type of a term t is simple enough, one can "read" the value of t from t . Thus, a conceivable strategy to compute this value is to compute t by operating on functions between sets. This is made possible by the compositionality of the interpretation (compare with our discussion of monoids of behaviors in §1.1.2): the denotation of the application t u is determined by the denotation of its subterms t and u (plus some other similar properties, since application is not the only way to build λ-terms).

The readers who followed the technical details in the statement of Hillebrand and Kanellakis's theorem may be interested in the proof sketch that we give below leveraging the above ideas; others can safely skip to the subsequent discussion.

Proof idea for Theorem 1.1.4. We prove the non-trivial direction ("only if"): the language L defined by a simply typed λ-term t : Str Σ [τ ] → Bool must be regular.

The idea is that Str Σ [τ ] can be given a monoid structure, by using as monoid multiplication the denotation of a λ-term that computes the concatenation of two encoded strings. One then checks that ϕ : w ∈ Σ * → w ∈ Str Σ [τ ] is a monoid morphism by compositionality. We have L = ϕ -1 ({x | t (x) = true }), assuming that true = false ; this can be shown to hold when the denotation of the base type is of cardinality at least 2. (We are free to choose the set o , and this determines inductively, by σ → κ = κ σ , the denotation of all other types.) Finally, in order to apply Definition 1.1.1 and deduce the regularity of L, we want Str Σ [τ ] to be finite, which is the case when o is finite.

The same paper [START_REF] Gerd | On the Expressive Power of Simply Typed and Let-Polymorphic Lambda Calculi[END_REF] contains a more sophisticated application of this set-theoretic interpretation: characterizations of k-EXPTIME and k-EXPSPACE for all k ∈ N (including P = 0-EXPTIME) in an extension of the simply typed λ-calculus with constants. In general, one can also use other denotational semantics -interpretations of terms and types that satisfies the invariance and compositionality properties mentioned previously -for this kind of strategy. The technique using denotations to compute values 40 is called semantic evaluation. It has also been succesfully applied, for example, to study the complexity of evaluating simply typed λ-terms [START_REF] Terui | Semantic Evaluation, Intersection Types and Complexity of Simply Typed Lambda Calculus[END_REF] and to implicit computational complexity in other typed λ-calculi such as System T or PCF 41 (see e.g. [START_REF] Kristiansen | Higher Types, Finite Domains and Resource-bounded Turing Machines[END_REF] and the references therein).

However, it should be noted that most of the works in ICC based on linear logic do not use denotational semantics. The influential methodology introduced by Girard's Light Linear Logic [START_REF] Girard | Light Linear Logic[END_REF] is to control the complexity of syntactic evaluation thanks to combinatorial 40 There is a loosely related idea in type theory, applied in very different contexts, called normalization by evaluation; see for example [START_REF] Abel | Normalization by Evaluation: Dependent Types and Impredicativity[END_REF]. In this broad family of ideas, we should also mention the application to ICC of realizability semantics with bounded-complexity programs as realizers [START_REF] Dal | Realizability models and implicit complexity[END_REF][START_REF] Hofmann | A quantitative model for simply typed λ-calculus[END_REF]. 41 Both are extensions of the simply typed λ-calculus (though System T was originally formulated as an axiomatic theory in [START_REF] Gödel | Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes[END_REF]), supporting natural numbers as a primitive data type. But PCF does not correspond to a consistent constructive logic: it is Turing-complete, and therefore necessarily non-terminating.

invariants (deemed "geometric" 42 ) that do not depend on types. This means that those works take place in settings where untyped proofs/terms terminate; 43 in fact, the underlying untyped language may suffice to get an ICC result, as in [START_REF] Laurent | Polynomial time in untyped elementary linear logic[END_REF] for instance. This is rather uncommon in the world of proofs-as-programs: usually, types are the reason for termination and thus the primary cause of any complexity bound. And semantic evaluation is a way to study this causation, since semantic interpretations are made possible by typing. Denotational semantics is not just useful for its application to ICC: it is also, in itself, an important subfield of programming language theory. Originally, its goal was to provide a way to rigorously define the meaning of programs, but these days, for "big" enough programming languages, one generally prefers to specify what a program formally means by describing (a mathematical model for) its execution -an approach named operational semantics. 44 Still, the denotational approach is well-suited to study minimalistic languages such as the typed λ-calculi considered in this dissertation, and interpreting programs in rich mathematical structures can yield valuable insights. Those insights may then sometimes inform the design of new logical systems. Linear logic itself is a famous historical example, since Girard came up with it by analyzing denotational models 45 for λ-calculi that he had built earlier. 46 More recently, Voevodsky's investigations into topological semantics of dependent type theory (published in [START_REF] Kapulkin | The simplicial model of Univalent Foundations (after Voevodsky)[END_REF] posthumously) inspired homotopy type theory [START_REF]Homotopy Type Theory: Univalent Foundations of Mathematics[END_REF]; it is completely unrelated to our work, but still worth mentioning as undoubtedly one of the most significant 42 French and Italian proof theorists who are familiar with linear logic are fond of speaking of "geometry of computation" (or similar expressions) to describe this kind of analysis of proofs/programs. The choice of words might be influenced by the visual intuitions associated with proof nets, but it is unclear whether pure mathematicians would consider this to be truly geometric. Why not "combinatorics of interaction" instead? The initial aim of "geometry" was to suggest something less ad hoc than operational semantics [Gir89b, §III.1]; one should perhaps be careful not to reenact Bourbaki's historical contempt towards discrete math… (the problem was not just French: Whitehead allegedly said that "combinatorics is the slums of topology" [START_REF] Peter | [END_REF]). 43 Recalling that termination implies consistency, when we put types on top of such an untyped language, the logic that we get is consistent no matter what the type system looks like. Light Linear Logic was indeed designed to avoid a logical inconsistency, to wit, Russell's paradox in naive set theory (see also [START_REF] Terui | Light Affine Set Theory: A Naive Set Theory of Polynomial Time[END_REF]).

44

Most real-world programming languages do not have any mathematically precise specification at all: either there is no specification except for how the reference implementation behaves, or there is a standard written in natural language that can be ambiguous. (For instance, you can test your knowledge of fine details in the C++17 standard on https://cppquiz.org/.) Standard ML was the first "realistic" programming language designed directly with a formal semantics [START_REF] Milner | The Definition of Standard ML[END_REF], and it was very influential for this reason. From [MHR20, §6.3]: "While Michael Gordon and Milner had written, but not published, a denotational semantics for LCF/ML in the late 1970s, that approach was abandoned for the definition of Standard MLinstead, an operational approach was adopted. […] These operational approaches had several advantages over denotational techniques" (a list of such advantages follows). A major application of formal semantics of real-world languages in the 21st century is certified compilation: to convince a proof assistant that a compiler is correct, the meaning of the source code that it takes must be rigorously specified. Some examples of certified compilers are CakeML [START_REF] Kumar | CakeML: a verified implementation of ML[END_REF] (for a subset of Standard ML) and CompCert [START_REF] Leroy | Formal verification of a realistic compiler[END_REF] (for the C language -see also [START_REF] Krebbers | The C standard formalized in Coq[END_REF] for a formalized version of the C standard). 45 We use "model" as a synonym for "semantics" when there is no risk of confusion (e.g. with the relational structures of §1.3.1 which are models in the traditional sense i.e. Tarskian ( = denotational) semantics). 46 To quote [Gir87, §III]: "For logic, computer science is the first real field of application since the applications to general mathematics have been too isolated. The applications have a feedback to the domain of pure logic by stressing neglected points, shedding new light on subjects that one could think of as frozen into desperate staticism […]. Linear logic is an illustration of this point: everything has been available to produce it since a very long time; in particular, retrospectively, the syntactic restriction on structural rules seems so obviously of interest that one can hardly understand the delay of fifty years in its study. Computer science prompted this subject through semantics: […]". For a firsthand account of the birth of linear logic and its very early history, see [START_REF] Girard | Linear logic[END_REF]§V] where the curious idea of a "Taylor expansion" of λ-terms is mentioned. This, together with further semantic motivations (in particular vector space semantics, see [START_REF] Kerjean | Reflexive spaces of smooth functions: a logical account of linear partial differential equations[END_REF] for recent developments on the subject), would later give rise to differential linear logic [START_REF] Ehrhard | The differential lambda-calculus[END_REF][START_REF] Ehrhard | An introduction to differential linear logic: proof-nets, models and antiderivatives[END_REF] where one can take "derivatives" of proofs/terms extending the analogy between linear types and linear algebra.

developments in type theory since the start of the millennium (it includes in particular a new logical treatment of equality 47 and a proposal for new foundations of mathematics).

1.1.8. Categorical semantics. But how to define precisely what is a denotational semantics for, say, the simply typed λ-calculus? A first attempt could be to consider that the denotation of a type τ should be a set τ equipped with some additional structure, while a λ-term t : τ would have as its denotation an element t ∈ τ . For the interpretation of types to be compositional, σ → τ should be determined by σ and τ ; the natural option would be to take the set of structure-preserving functions between them. This fits with the set-theoretic semantics that we saw previously, as well as with several important denotational models, such as the partially ordered sets 48 used for semantic evaluation in [START_REF] Terui | Semantic Evaluation, Intersection Types and Complexity of Simply Typed Lambda Calculus[END_REF][START_REF] Kristiansen | Higher Types, Finite Domains and Resource-bounded Turing Machines[END_REF]. However, some semantics do not fit into this mould: their interpretation of function types does not consist of mere input-output maps. For example, in game semantics 49 (see e.g. [START_REF] Castellan | Disentangling Parallelism and Interference in Game Semantics[END_REF] for a modern account), a denotation t ∈ σ → τ records some information on how the term t processes an input of type σ to yield an output of type τ . This echoes earlier developments in structuralist mathematics (told for instance in the book [START_REF] Corry | Modern Algebra and the Rise of Mathematical Structures[END_REF]). In the early-mid 20th century, the Bourbaki group had the ambition to rebuild mathematics with a notion of structure at its center. They conceived structures as collections of sets with auxiliary data, plus maps between those sets compatible with the data; this encompassed various algebraic structures (monoids, groups, rings, …) and morphisms between them, topological spaces and continuous functions, etc. 50 But it turned out later to be extremely fruitful to generalize this further: a category consists of a collection of objects that are not necessarily sets 51 , and of a collection of morphisms that are not necessarily set-theoretic maps. Instead, the desirable properties of sets and maps become axioms included in the definition of categories (each morphism has a source and a target that are both objects, two morphisms whose source and target match can be composed, …).

It makes sense, then, to use categories (with additional properties) for the denotational semantics of typed λ-calculi. Hence the "computational trinity" of programming languages:

formulas ←→ types ←→ objects proofs
←→ programs ←→ morphisms 47 The key to this new perspective on equality is the Univalence Axiom; the very vague idea is that this makes equality the same thing as a certain notion of "equivalence" so that, for example, two isomorphic algebraic structures are equal. It is validated by Voevodsky's semantics, but at first, there was no known way of computing with this new axiom. This problem was solved by cubical type theories (see [START_REF] Mörtberg | Cubical methods in homotopy type theory and univalent foundations[END_REF]), which, interestingly, were also reverse-engineered from a constructive (cf. Footnote 22) denotational semantics! By the way, these semantics have a reasonable claim at being "geometric" (cf. Footnote 42) since they are close to topological spaces up to homotopy. (Some would argue that the recent normalization proof for cartesian cubical type theory [START_REF] Sterling | Normalization for Cubical Type Theory[END_REF] is also geometric for different reasons, namely its reliance on Grothendieck topoi.) 48 More precisely, we are speaking of a kind of posets called Scott domains (that can also be seen as exotic topological spaces); morphisms between them are not just monotone, but also commute with directed suprema. Domains are famous for providing the first non-trivial model for the untyped λ-calculus [START_REF] Scott | Outline of a mathematical theory of computation[END_REF]; the same paper also presents a conceptual analysis of computation that led to their definition. Hyland has argued that in retrospect, Scott domains are not at all the simplest conceivable such model [START_REF] Hyland | Some reasons for generalising domain theory[END_REF]§3].

49

An important historical precursor to game semantics is Berry and Curien's model of sequential algorithms [START_REF] Berry | Sequential Algorithms on Concrete Data Structures[END_REF]. It led Berry to argue against set-based definitions of denotational models proposed by previous authors and in favor of Lambek's categorical proposal [START_REF] Berry | On the Definition of Lambda-Calculus Models[END_REF].

50 Algebraic structures are the product of an axiomatic approach to algebra pursued in the early 20th century by German algebraists (the central figure being Emmy Noether) -which we now take for granted when we work e.g. with arbitrary monoids defined as sets endowed with an associative binary operation and a unit. Point-set topology was also invented around the same time.

51 Well, if one uses ZF(C) as a foundation of mathematics, everything is technically a set (e.g. the natural number 42 is a set!). But morally, one is not interested in the set-theoretic elements of an object in a category. The idea was first advocated by Lambek 52 [Lam72], who showed that cartesian closed categories provide denotational models for the simply typed λ-calculus (with product types 53 ); it has been widely adopted as the "right" way to conceive of denotational semantics, despite the frightening reputation of category theory as an esoteric subject full of scary diagrams (aptly surrounded by the flames of Hell in Figure 1.1.3). 54 From a modern point of view, a semantics is thus primarily understood as a category that supports internal operations reflecting those of the programming language being interpreted -for example, the application of a λ-term to another is modeled as (a special case of) composition of morphisms. The mapping -from types/terms to denotations comes later: categorical interpretation of product types σ × τ , which are not present in the most common version of the simply typed λ-calculus. Multicategories (also known as colored operads) can be used to provide a semantics for simple types without products: they handle "multimorphisms" with multiple arguments A1, . . . , An directly, instead of turning them into morphisms with a single argument A1 × • • • × An using products (see [START_REF] Hyland | Classical lambda calculus in modern dress[END_REF] or [Pel17, Chapter 1]). We will use multicategories in Chapter 6.

54

This has not prevented some categorical concepts -most famously monads, see e.g. [Pet18, §2.1] -from being incorporated into programming practice, especially in the Haskell language and its library ecosystem.

it is the only map 55 that "preserves" the aforementioned operations, e.g. t u = t • u -this corresponds to compositionality of the semantics. To ensure the other important property, invariance (if t and u evaluate to the same value, then t = u ), one asks that certain equations hold inside the category (for example, composition must be associative 56 ).

This means that a category may turn out to provide denotational models for some programming language despite having been defined and studied for a priori unrelated reasons; it suffices to exhibit the appropriate structure on the category. Valeria de Paiva's Dialectica categories [START_REF] Valeria | The Dialectica categories[END_REF] are an example of this (whose application in our work 58 will be discussed in §1.2.3). They originated as a categorical account of Gödel's "Dialectica" functional interpretation [START_REF] Gödel | Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes[END_REF], a kind of translation from one logical system to another with a computational flavor. 59 It was then noticed that Dialectica categories form a semantics of linear logic -and at a time when linear logic was still very young, this provided an argument in favor of its relevance (no pun intended [START_REF] Arnon Avron | What is relevance logic?[END_REF]).

1.1.9. Automata and categories. An emphasis on intrinsic algebraic structure is present both in semantics and in the approach to automata behaviors we saw in §1.1.2. In the latter, one starts by coming up with the target monoid; the morphism from strings to behaviors is then uniquely determined by the images of the input alphabet letters (this is what "free monoid" ( §1.1.2) means). We could even argue that this is an instance of denotational semantics if the letters are seen as instructions -strings would then be simple sequential programs. Indeed, monoids and categories with a single object are the same thing! 60 More generally, for an object X in a category C, the set Hom C (X, X) of morphisms from X to X has a canonical monoid structure (given by composition of morphisms in C). This is particularly relevant to us: thanks to this, our descriptions of the behaviors of various automata models in §1.1.2 can be recast in categorical terms. (By FinSet (resp. FinRel) we mean the category of finite sets and functions (resp. relations) between them.) • Monoids of behaviors of deterministic finite automata are of the form Hom FinSet (X, X). 55 Up to natural isomorphism, if -is seen as a functor from the syntactic category (whose objects and morphisms are types and terms respectively) to the category of denotations.

56 This is part of the definition of a category. But programming languages with side effects (mutable state, exceptions, input/output…) have a non-associative composition that reflects their sensitivity to the order of evaluation. A major focus of the "French school" has been to gain a subtle understanding of such situations using the notion of polarity, starting with Girard's work on classical logic [START_REF] Girard | A New Constructive Logic: Classical Logic[END_REF]. Indeed, one widespread proofs-as-programs counterpart of classical logic (though not the only possible one 57 ) is a family of λ-calculi with the side effect of non-local control flow (using "call with current continuation" or similar operators) [Gri90; Par92; CH00]. For modern accounts of polarity and non-associativity, see [START_REF] Zeilberger | The Logical Basis of Evaluation Order and Pattern-Matching[END_REF][START_REF] Munch-Maccagnoni | Syntax and Models of a non-Associative Composition of Programs and Proofs[END_REF]. Let us also mention classical realizablity [START_REF] Krivine | Realizability in classical logic[END_REF] which attempts to give a computational content to axioms in set theory (e.g. the Axiom of Choice [FG20; Kri20]) using side effects.

58

In fact Dialectica-like categorical structures have already appeared in quite varied and unexpected contexts. In "applied category theory", a recent example is [START_REF] Di Lavore | Dialectica Petri nets[END_REF]; we also highly recommend reading Jules Hedges's Lenses for philosophers (https://archive.md/R72aj) for an explanation of the connections with lenses from functional programming (see e.g. [START_REF] Clarke | Profunctor optics, a categorical update[END_REF]) and with categorical approaches to game theory and microeconomics [START_REF] Ghani | Compositional Game Theory[END_REF]. More in line with the topic of this dissertation, Dialectica-like semantics of linear logic have also been built out of automata on infinite words [START_REF] Pradic | A Dialectica-Like Interpretation of a Linear MSO on Infinite Words[END_REF] and infinite trees [START_REF] Riba | Monoidal-closed categories of tree automata[END_REF].

59

For a modern account of the Dialectica translation in terms of side effects, following the paradigm described in Footnote 56, see [START_REF] Pédrot | A Materialist Dialectica[END_REF] (as well as [START_REF] Kerjean | ∂ is for Dialectica: Typing Differentiable Programming[END_REF] for a connection with differential LL (cf. Footnote 46)).

60

This observation leads to working with finite categories as a generalization of finite monoids, which can be useful in the context of algebraic language theory, as demonstrated in the (very long) paper [START_REF] Tilson | Categories as algebra: An essential ingredient in the theory of monoids[END_REF]. The recent work [START_REF] Amarilli | Locality and Centrality: The Variety ZG[END_REF] that we cited at the end of §1.1.2 relies on the Delay Theorem from [START_REF] Tilson | Categories as algebra: An essential ingredient in the theory of monoids[END_REF], whose statement involves categories. However, all this is quite different from the kind of connections between category theory and automata that we investigate in this manuscript. Also, feel free to add "locally small" in front of "categories" if you want to be pedantic about sets vs proper classes.

• Monoids of behaviors of nondeterministic finite automata are of the form Hom FinRel (X, X).

• For two-way automata (2DFA), Hines [START_REF] Hines | A Categorical Framework For Finite State Machines[END_REF] has shown that this pattern can be continued by considering the category Int(PFSet) (PFSet = partial functions on finite sets), defined using the generic Int-construction on traced monoidal categories [START_REF] Joyal | Traced monoidal categories[END_REF]. It is noteworthy that the not-quite-trivial combinatorics of this automata model can be recovered from categorical "abstract nonsense", which moreover is also related to the so-called geometry of interaction semantics of linear logic -we will say more about this connection in §1.4.3. This observation almost suffices by itself to establish category theory as a language to uniformly describe these different kinds of automata. (Such unification and generalization is typical of the role played by categories in mathematics.) There remains to take care of a few details, such as the fact that automata have initial and final states -here, morphisms whose source and target do not coincide have a role to play. This has been done by Colcombet and Petrişan [CP17a;[START_REF] Colcombet | Automata Minimization: a Functorial Approach[END_REF], who provide a suitable framework in which one can say that a DFA (resp. NFA, 2DFA) is an automaton over the category FinSet (resp. FinRel, Int(PFSet)).

One benefit of this framework is that it allows one to relate the expressive power of various automata models using functors, i.e. "morphisms between categories". Let us illustrate this with an example from [CP20, §3.3]. There is a functor P : FinRel → FinSet that sends any object (finite set) X to its powerset P(X) and any morphism (relation) R ⊆ X × Y to the function S ∈ P(X) → {y ∈ Y | ∃x ∈ S. (x, y) ∈ R} ∈ P(Y ). It induces a translation between the corresponding automata, that is, from NFA to DFA: a determinization procedure. As the reader might already have guessed, this is none other than the "powerset construction" covered in undergraduate theory of computation courses! (It is a bit more efficient, in terms of state space explosion, than the determinization through monoids sketched in §1.1.2.)

A large focus of [START_REF] Colcombet | Automata Minimization: a Functorial Approach[END_REF] is on developing a general automata minimization theorem that can be instantiated on various categories (applications may be found in [START_REF] Colcombet | Automata in the Category of Glued Vector Spaces[END_REF][START_REF] Colcombet | Learning Automata and Transducers: A Categorical Approach[END_REF]). This kind of use of category theory to understand the essence of various constructions on automata -such as determinization or minimization -and to generalize them to other settings has a long history, see for instance [START_REF] Gerco Van Heerdt | Tree Automata as Algebras: Minimisation and Determinisation[END_REF] and the many references therein; it is also among the main interests of the "coalgebra community" (https://www.coalg.org/).

Contributions

Since this document is a PhD thesis, in order to fulfill one of its functions, there must come a moment (much to my chagrin) when I -the author of these lines -argue that I have made some modest contribution to the sum of human knowledge. In this section, I will therefore summarize the portion of my research that I have included in this dissertation. 61 It has been carried out in collaboration with Cécilia Pradic, and all chapters except for this introduction are based on jointly written material (either published papers 62 [NP20; NNP21] or unpublished drafts) that I have slightly reworked for the sake of a consistent narrative.

61 I have also been working during my PhD on a mostly unrelated topic, which will not be covered here: applying graph algorithms to tackle old questions on proof nets and deep inference [Ngu20; NS22].

62 One of the authors of [START_REF] Thành | Comparison-Free Polyregular Functions[END_REF], C. Noûs (https://www.cogitamus.fr/camilleen.html), is fictional (see also [START_REF] Penders | Civil disobedience in scientific authorship: Resistance and insubordination in science[END_REF]). They symbolize the fundamental dependence of any piece of research on the wider community of scientists beyond its handful of coauthors, as well as an opposition to metrics devised by bureaucrats, among other things. It is because of this distaste for bean-counting that I will not guesstimate here which percentage of the work presented here is mine, or worse, indicate which theorems I have personally proven and which ones are due to my coauthor in this manuscript; in any case, since many ideas exposed here emerged from our conversations, this would not be very meaningful. That said, it can sometimes be appropriate to delineate individual contributions in a joint work -for instance, in case of significant differences in seniority between coauthors, or to counteract bias against (or the invisibilization of) under-represented minorities. An example of such authorship statements done right, in my opinion, can be found in [START_REF] Ringer | Proof Repair[END_REF] (that PhD thesis is also interesting scientifically: it applies univalence (Footnote 47) to practical proof engineering).

Without further ado, let me drop the first-person pronoun and get back to the actual scientific content. 63 (Henceforth, "we" stands for either "Pradic and I" or "the narrator and you, dear reader, together on a wonderful(?) journey" depending on the context.) We do not indicate in this section where our claims are supported in the body of the dissertation; this will be the role of the outline ( §1.5).

1.2.1.

A research programme: implicit automata in typed λ-calculi. As already announced in §1.1.6, a substantial portion of the results of this dissertation consists of characterizing automata-theoretic classes of languages and functions using typed λ-calculi, in the same way that implicit computational complexity (ICC) characterizes complexity classes. There have previously been a few results of this kind, or more than a few if one considers a broad definition of ICC (cf. §1.3.2) that includes non-type-theoretic approaches; we cover this related work in §1.3.3. However, it seems that most of the previous papers on "implicit automata" do not mention the connection with ICC (with the exception of [START_REF] Seiller | Interaction Graphs: Non-Deterministic Automata[END_REF]), and therefore that we are the first to give this topic the name that it deserves.

Beyond such superficial naming considerations, our awareness of this historical context inspired us to put forth a new recipe for type-theoretic implicit automata results: consider functions operating on Church encodings in a λ-calculus with a substructural (e.g. linear / affine / non-commutative / …) and monomorphic type system. For the reader who is unfamiliar with this technical term, "monomorphic" can be replaced by "admitting a translation into the simply typed λ-calculus (with product and sum types)" in this context while preserving most of the intended meaning; thanks to Hillebrand and Kanellakis's Theorem 1.1.4 (cf. §1.1.6) this condition ensures that we are more likely to get something corresponding to an automata model than a complexity class. This draws upon two distinct traditions within implicit complexity: while Theorem 1.1.4 comes from the study of the simply typed λ-calculus and its extensions by semantic means, previous works on ICC taking inspiration from linear logic mostly did not use semantic evaluation (as we said in §1.1.7).

There are many possible variations on this theme: one can obviously vary the typed λ-calculus under consideration, but the same type system can also be used to impose different constraints. Given the diversity of automata-theoretic function classes (especially concerning transducers, cf. §1.1.3), one could expect these variations to yield characterizations of many different classes. This is why we believe our approach to implicit automata to be worthy 64 of a systematic investigation that the present manuscript has merely begun. Our first results, described in §1.2.2, have not even exhausted the low-hanging fruits! The work-in-progress section ( §1.4) should hopefully convince the reader that much remains to be done.

Furthermore, we have come to consider some of our equivalence results about definability of languages or functions as surface-level manifestations of deeper structural connections. As we announced from the start, this is made possible by the emphasis on compositionality, embodied by algebraic tools, that is prevalent in both automata theory and programming languages. What this means concretely is that we express these connections in the language of category theory, which leads us to bring ideas from denotational semantics into categorical automata theory along the way ( §1.2.3). Our exploration of the expressive power of typed λ-calculi has also fed back into "pure" automata theory, suggesting relevant objects of study for the latter ( §1.2.4). All this has been a welcome surprise: ICC has not had much influence on (nor structural insight about) "mainstream" complexity theory (cf. the end of §1.3.2).

63

Adrien Douady, former member of the Bourbaki group : "Le but de ce travail est de munir son auteur du grade de docteur ès-sciences mathématiques et l'ensemble H(X) des sous-espaces analytiques compacts de X d'une structure d'espace analytique" (from the introduction to [START_REF] Douady | Le problème des modules pour les sous-espaces analytiques compacts d'un espace analytique donné[END_REF]).

64 Such a turn of phrase implicitly assumes that research in pure mathematics -or scientific research in general -is something worthwhile, which is of course highly debatable (see Figure 1.1.3 and [START_REF] Grothendieck | Allons-nous continuer la recherche scientifique ?[END_REF]). NBool for some purely linear type τ (that may depend on L) if and only if it is a star-free language (cf. Definition 1.1.2 in §1.1.2).

This mirrors Theorem 1.1.4, with several additional linearity conditions. First of all, observe that the type

Str Σ [τ ]
NBool uses a linear function arrow ' ', indicating that the argument Str Σ [τ ] is "used only once", rather than the non-linear arrow '→'. We also have a linearity requirement on τ : Definition 1.2.2. A type is purely linear when it does not contain '→'.

In the case of the λ ℘-calculus, purely linear types are generated by ' ' from the base type o. There are also other less visible amendments to the pattern of Theorem 1.1.4 in order to take linearity into account: Str Σ now denotes the type of linearized Church-encoded strings [Gir87, §5.3.3], while NBool is a purely linear type of booleans that works in a linear non-commutative setting. Writing the types with a left-associative convention for function arrows (σ τ κ = σ (τ κ)) as usual, we have

Str Σ = (o o) → • • • → (o o) |Σ| times → o → o NBool = ((o o) (o o) o) (o o)
o (how these encodings work will be explained in Chapter 5 and Chapter 7 respectively).

Aside from the connection to algebraic language theory, let us point out two less obvious novelties compared to previous work in ICC. First, star-free languages might be, as far as we know, the smallest class of languages ever characterized in ICC: they are a strict subclass of both regular languages and uniform AC 0 . Second, our proof for the "if" direction of Theorem 1.2.1 is somewhat deeper than the "programming exercise of limited theoretical interest" [Maz17, §4.2.1] that is common for analogous proofs in ICC: we had to use the Krohn-Rhodes decomposition theorem (mentioned in §1.1.3).

We also show that when the λ ℘-calculus is replaced by its commutative counterpart in Theorem 1.2.1, we get regular languages instead of star-free languages. This shows that non-commutative types are crucial to get the upper bound on computational power that we want. The key lemma for this upper bound is a property of the planar λ-calculus, that is, the purely linear fragment of the λ ℘-calculus. It seems to be the first result exhibiting this kind of difference between the planar λ-calculus and its commutative version, namely the linear λ-calculus. (This may be contrasted with the fact that 65 normalizing planar λ-terms with multiplicative pair types σ ⊗ τ is P-complete, just like for general linear λ-terms.)

The linearity restriction, by itself (without non-commutativity), does not make any difference compared to the simply typed λ-calculus concerning definable languages over Church encodings. However, if we look at functions, there is much more to say. While characterizing the class of string-to-string functions corresponding to Str Γ [τ ] → Str Σ is still an open problem in the simply typed λ-calculus (we shall come back to this in §1.3.5), we have managed to prove several equivalences with transduction classes for the λ ⊕& -calculus. 65 A recent discovery by Anupam Das, Damiano Mazza, Noam Zeilberger and me [START_REF] Das | Complexity of normalization for subsystems of untyped linear lambda calculus[END_REF]. Warning (added in March 2023): these slides claim P-completeness for the "usual" planar λ-calculus, without ⊗, with a proof strategy using NBool; but that proof attempt turned out to be subtly wrong.

The latter is basically a version of Dual Intuitionistic Linear Logic [START_REF] Barber | Dual Intuitionistic Linear Logic[END_REF] incorporating additive connectives (i.e. categorical products and coproducts).

Theorem 1.2.3. We have the following implicit characterizations of transductions in the λ ⊕& -calculus, in the style of Theorems 1.1.4 and 1.2.1:

Str Γ [τ ]
Str Σ regular string functions

Str Γ [τ ] → Str Σ comparison-free polyregular functions Tree Γ [τ ]
Tree Σ regular tree functions where Γ and Σ are finite alphabets, Γ and Σ are ranked alphabets and τ is a purely linear type that may be chosen depending on the function that one wants to define.

The first row above is not too surprising, given the resemblance between copyless streaming string transducers -that compute regular functions -and linear types that we already discussed in §1.1.5. (Although, as we shall see in §1.2.3, there is slightly more than meets the eye.) Comparison-free polyregular functions will be the subject of Section 1.2.4. As for the class of regular tree functions, it is is obtained by generalizing the definition for strings based on monadic second-order logic (cf. §1.

3.1).

There is also an automata model adapting copyless SSTs to trees, namely bottom-up ranked tree transducers (BRTTs) [START_REF] Alur | Streaming Tree Transducers[END_REF]. 66 However, it is conjectured that some regular functions cannot be computed by copyless BRTTs. Instead, a more sophisticated linearity condition, called the single use restriction in [START_REF] Alur | Streaming Tree Transducers[END_REF], is imposed on BRTTs in order to characterize the regular tree functions. The additional flexibility thus afforded, compared to copyless BRTTs, turns out to correspond directly to an important feature of linear type systems: the additive conjunction or categorical product, denoted by the '&' in λ ⊕& . This is one reason for working in a calculus with additive connectives. What happens if we drop them? We prove that in this case, Theorem 1.2.3 stops working even for strings, but it does so for uninteresting reasons which do not apply anymore if we consider affine instead of linear types. 67 This leaves many questions as to the expressiveness of affine λ-calculi without additives; another natural question in line with Theorem 1.2.3 is the possibility of characterizing first-order transductions (recall from §1.1.3 that those are to regular functions what star-free languages are to regular languages). We have tentative answers to all those questions; we do not develop them in this manuscript because they have not yet been written up rigorously, but we will state our claims in §1.4.2. Let us say for now that we have found a situation where, if our claims are correct, the presence or absence of additive connectives makes a true difference concerning expressive power for meaningful reasons; such a phenomenon has not been observed before in implicit complexity to our knowledge (though it is known that additives increase the complexity of proof normalization [START_REF] Harry | On the Computational Complexity of Cut-Elimination in Linear Logic[END_REF]).

Semantic evaluation and contributions to categorical transducer theory.

Our proof of Theorem 1.2.1 uses purely syntactic methods, i.e. combinatorial manipulations of λ ℘-terms. We could perhaps tackle Theorem 1.2.3 syntactically as well, by taking inspiration from the proof techniques used in a recent work by Gallot, Lemay and Salvati [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF]: they show that a tree transducer model containing linear λ-terms computes regular tree functions.

But the strategy that we present here for the characterization of regular string functions in Theorem 1.2.3 -which we developed while being unaware of [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF] -is arguably more conceptual. (The price to pay is that there are more technical prerequisites.) It is expressed 66 As we shall explain in the beginning of Chapter 6, a better choice in hindsight would have been to work with macro tree transducers [EV85; EM99]. 67 In general, ICC results using affine types tend to also work with linear types if one dedicates part of the output to collect the "garbage" that could not be discarded during the computation; see for example [START_REF] Laurent | Polynomial time in untyped elementary linear logic[END_REF].

in a categorical framework for automata, the same as the one introduced by Colcombet and Petrişan ( §1.1.9) up to insignificant details. Consider:

• some category C corresponding to a transducer model, such that the functions computed by C-automata are exactly the regular functions; • a "syntactic category" L whose objects are purely linear types and whose morphisms are λ ⊕& -terms, such that L-automata can be shown to be equally expressive as λ ⊕& -terms of type Str Γ [τ ] Str Σ (for purely linear τ ) through syntactic means. Our goal is to show that L-automata are at most as expressive as C-automata by exhibiting a functor L → C (with a few additional properties). This would mean that λ ⊕& -definable string functions are regular, the converse being easier. According to the discussion in §1.1.5 and §1.2.2, the natural choice would be to take C to be the category corresponding to copyless streaming string transducers. We can decompose the latter as SR ⊕ where • SR corresponds to single-state copyless streaming string transducers: objects are finite sets of register names and morphisms are copyless assignments. (We will also characterize the category SR through an universal property.) • (-) ⊕ is the free coproduct completion, a standard construction on categories whose automata-theoretic meaning is to add finite states. (Similar completions by certain colimits have been previously exploited [START_REF] Colcombet | Automata in the Category of Glued Vector Spaces[END_REF] within Colcombet and Petrişan's framework.) At the same time, we would like C to be a categorical semantics ( §1.1.8) of the purely linear fragment of the λ ⊕& -calculus -also known as a symmetric monoidal closed category (SMCC), see [START_REF] Melliès | Categorical semantics of linear logic[END_REF]§4.7]. The functor that we seek would then be the functor -: L → C that maps each λ ⊕& -term (i.e. morphism in L) to its denotation, in the spirit of the semantic evaluation technique described in §1.1.7. Unfortunately, SR ⊕ is not an SMCC.

To fix this, instead of working with SR ⊕ -automata i.e. copyless SSTs, we consider a transducer model that is close (although not identical) to single-use-restricted SSTs (in the same sense as the so-called single-use-restricted BRTTs mentioned in §1.2.2). Since copylessness and the single use restriction morally differ by the presence of the additive conjunction '&' of linear logic, we "add '&' freely" to achieve a similar effect. Thus, we are led to work with (SR & ) ⊕ -automata, where (-) & denotes the free product completion (the dual operation to (-) ⊕ ). We then get the missing piece of our aforementioned strategy:

Theorem 1.2.4. (SR & ) ⊕ is a symmetric monoidal closed category.
The double completion ((-) & ) ⊕ is reminiscent of a factorization into free sums and free products of a fibrational Dialectica ( §1.1.8) construction [START_REF] Hofstra | The dialectica monad and its cousins[END_REF]. Thanks to this, generic considerations similar to the monoidal closure proof of Dialectica categories can be used to reduce the above theorem to properties of SR that can then be proved by simple combinatorics on strings.

Theorem 1.2.4 is also meaningful from the point of view of categorical automata theory, independently of any connection with the λ ⊕& -calculus. Indeed, an SMCC provides a setting in which constructions relying on function spaces (i.e. internal homsets) can be carried out in a generic way; this generalizes the kind of proofs where one exploits the finiteness of the set of functions Q → Q for any finite set of states Q. (A symmetric monoidal category is closed when all internal homsets exist.) To illustrate this, we prove two generic theorems on automata over categories that rely on monoidal closure: • We show that (C & ) ⊕ -automata are equivalent to functional non-determinstic C-automata with states. 68 We also provide a (somewhat intricate) construction that, assuming that certain internal homsets exist, turns (C & ) ⊕ -automata into C ⊕ -automata. It can be seen as a 68 That additive connectives in linear logic have something to do with non-determinism has previously been observed in other settings, for instance in [START_REF] Harry | On the Computational Complexity of Cut-Elimination in Linear Logic[END_REF].

categorical determinization procedure, whose main technical ingredient is a data structure called "transformation forest", reminiscent of the Muller-Schupp determinization [START_REF] Muller | Simulating alternating tree automata by nondeterministic automata: New results and new proofs of the theorems of Rabin, McNaughton and Safra[END_REF] for automata over infinite words (see also [START_REF] Bojańczyk | An automata toolbox[END_REF] Chapter 1]). For C = SR, we get that functional non-deterministic copyless SSTs can be determinized; this was already known, with an indirect proof [START_REF] Alur | Nondeterministic Streaming String Transducers[END_REF] via monadic second-order logic ( §1.3.1). • We give sufficient conditions on C for the class of functions computed by C-automata to be closed under precomposition by regular functions: if f is regular and g is defined by a C-automaton, then there exists a C-automaton that computes g • f . Those conditions include asking for C to be an SMCC. For instance, taking C = FinSet, we recover the fact that regular functions preserve regular languages by preimage (Definition 1.1.3 in §1.1.3). Using Theorem 1.2.4, we can also apply this to C = (SR & ) ⊕ . These two results jointly entail that (the functions computed by) copyless SSTs are closed under precomposition by regular functions. And since we have defined the latter using copyless SSTs, we have actually reproved 69 the fact that the composition of two copyless SSTs can also be computed by a copyless SST. This composition property was previously known, but it is highly non-trivial (in [BC18, Chapter 13], a special case is proved using the aforementioned "transformation forests", and this already requires some efforts); in the light of the second item above, the difficulty can be explained by the fact that SR ⊕ is not monoidal closed. By contrast, composing two λ ⊕& -terms of types

Str Γ [σ] Str Σ and Str Σ [τ ]
Str Π is completely trivial (the result having type Str Γ [σ[τ ]] Str Π ). Thus, it was to be expected that the same tools used to prove our characterization of regular functions in the λ ⊕& -calculus could be used to compose copyless SSTs.

Concerning the rest of Theorem 1.2.3, the result on regular tree functions follows similarly from the monoidal closure of a category (T R & ) ⊕ for trees. As for comparisonfree polyregular functions, we do not know how to express them directly as the functions computed by automata over some category, but we were able to devise a more ad-hoc semantic evaluation argument that also leverages Theorem 1.2.4 to establish their characterization. 1.2.4. Benefits for pure automata theory: a new class of transductions. The class of comparison-free polyregular functions is itself a byproduct of our research on "implicit automata": we discovered it by studying the functions definable by λ ⊕& -terms of type Str Γ [τ ] → Str Σ (for purely linear τ ). It turned out that they were included in the class of polyregular functions, defined in [START_REF] Bojańczyk | Polyregular Functions[END_REF] by four equivalent computational models (and a fifth characterization using logic is mentioned in §1.3.1).

One of those models, the pebble transducers, is the specialization to strings of a tree transducer model that existed previously in the literature [START_REF] Milo | Typechecking for XML transformers[END_REF][START_REF] Engelfriet | A comparison of pebble tree transducers with macro tree transducers[END_REF]. They can also be seen as multi-head automata (with output) that obey a "stack discipline" on their heads. This restriction ensures that polyregular functions preserve regular languages by preimage, suggesting that they belong to the kind of automata theory amenable to algebraic methods, unlike general multi-head automata (see the beginning of §1.1.2, as well as the discussion following Definition 1.1.3). This partially explains the "regular" part of the name, which also hints at the fact that every regular string function is polyregular. As for the prefix "poly", it comes from the polynomial growth property of these functions: |f (w)| = |w| O(1) (where |w| denotes the length of the string w).

Just like multi-head automata, pebble transducers are allowed to compare the positions of their reading heads. We discovered that those without such comparisons had precisely 69 We claim that our new proof is "honest" in the following sense: we do not use previous non-trivial results on SSTs as black boxes to establish our categorical theorems, so there are no hidden formal dependencies. But we do largely take inspiration from the preexisting proofs of previous results. Thus, in a way, it is a proof using old techniques, rephrased and factorized through a new abstract apparatus.

the same expressive power as the aforementioned λ ⊕& -terms, hence "comparison-free". And since comparison-free polyregular functions did not already exist in the literature, we undertook a purely automata-theoretic study of those functions. (The machine model is quite natural, and some colleagues had thought of it, but they had not yet pushed it further.)

In particular, one insight that the λ ⊕& -calculus characterization immediately gave us is that comparison-free polyregular functions are closed under composition. This is indeed a trivial observation on λ ⊕& -terms (just as in the case of regular functions), but it is far from obvious when looking at comparison-free pebble transducers. To convince an audience unfamiliar with programming language theory, we devised an alternative proof 70 that does not involve any λ ⊕& -term or category. But it is nonetheless morally related to our semantic machinery: we use a standard technique for manipulating copyless assignments in SSTs 71 (a decomposition into "shape" plus "labels") which is, in fact, the domain-specific core (as opposed to the Dialectica-like generalities involved) of the proof of Theorem 1.2.4.

Our results on this function class also include: • alternative characterizations, one of which is the composition closure of regular functions plus some other "basic" functions; • a relation between the growth rate of a function and the number of pebbles (i.e. reading heads) required to compute it using a comparison-free pebble transducer; • separation results: we give concrete examples of functions demonstrating that some polyregular functions are not comparison-free; comparison-free polyregular functions and polynomially bounded HDT0L transductions are incomparable classes, in other words, neither is included in the other. To explain the last item above, HDT0L transductions are the functions computed by copyful streaming string transducers [START_REF] Filiot | Copyful Streaming String Transducers[END_REF], and they also admit several other equivalent definitions (e.g. [START_REF] Ferté | Word-Mappings of Level 2[END_REF][START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF]). They also preserve regular languages by preimage, and may have exponential growth. Recently, two machine models corresponding to polynomially growing HDT0L transductions were introduced by Douéneau-Tabot, Filiot and Gastin [DFG20]:

• marble transducers, that can be seen as pebble transducers with a further restrictionthis means that every HDT0L transduction with polynomial growth is polyregular; • layered streaming string transducers, that lie in-between copyless and copyful SSTs. This idea of allowing a limited form of duplication to control expressive power is very similar to the usual approach to implicit complexity using variants of linear logic. In this specific case, we even independently reinvented the "layering" condition by transposing the intuition behind its linear type system to SSTs! The type system in question was that of the parsimonious λ-calculus [Maz15; MT15; HMP20], and we will come back to it in §1.4.5.

A few months before the paper [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF] appeared on arXiv, we had privately circulated a note on this "new" transducer model. We did not suspect at the time any alternative characterization of the functions computed by layered SSTs, and the main result in this note was that any polyregular function can be realized by a composition of layered SSTs. Since this last property does not appear in [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF], we ended up including its elementary proof in our paper [START_REF] Thành | Comparison-Free Polyregular Functions[END_REF], and it will also appear in this manuscript. And while we later learned that Douéneau-Tabot et al. had started investigating layered SSTs before us, 72 this 70 "Alternative" because the detour through the λ ⊕& -calculus is a legitimate proof: we do not rely on the fact that comparison-free polyregular functions are closed under composition to show Theorem 1.2.3. 71 We are able to use SSTs thanks to a reformulation of comparison-free pebble transducers as the closure of 2DFTs under a "composition by substitution" operation, in which 2DFTs can be replaced by any machine model for regular functions (in particular copyless SSTs). 72 Personal communication from Gaëtan Douéneau-Tabot. Furthermore, we recently found out about a precursor to layered SSTs dating back to the 1960s, see Remark 2.3.15.

anecdote still serves as an additional example of how looking at λ-calculi can lead to new ideas in automata theory. (We will give yet another example in §1.4.3.) 1.2.5. A methodological commitment: naturality. Having now exposed our concrete results, let us return briefly to the "programmatic" dimension of this dissertation. We wish to stress that the work presented here has been guided by a desire for natural statements and constructions. Admittedly, it is an inherently subjective notion, devoid of precise technical meaning. 73 But what it means for us is that we explore the expressive power of typed λ-calculi that already existed before, perhaps up to a few minor details -in any case, that are designed according to standard recipes -and whose features have original motivations that are entirely unrelated to complexity or automata. (For example, we mentioned the applications of noncommutative types to linguistics in §1.1.5.) This is unlike a system such as Light Linear Logic [START_REF] Girard | Light Linear Logic[END_REF] (cf. §1.1.7) which is engineered in an ad-hoc fashion in order to get a desired complexity bound 74 -as is often the case, but not always, for ICC results based on linear logic. 75 It is also the same mindset that led us to account for usual features of automata models (finite states and nondeterminism) using simple and classical category-theoretic constructions; our reward for this has been to discover a connection with previous work on denotational semantics. One more example: the Church encodings that we use are completely standard as well.

As a consequence, some of our results have a satisfying feeling of inevitability. For example, in retrospect, Theorem 1.2.1 could have been discovered two decades ago! A more negative take would be to point out that we study old objects using old techniques. But the relationships between the objects are new, and so are the contexts in which the techniques are applied; and those novelties only look inevitable with the benefit of hindsight and the specific background knowledge that we have attempted to impart in §1.1.

Further related themes

In this section, we will cover some more related work, as well as some background that our research does not directly depend on but which is important to fully grasp its context. 73 In category theory, natural transformation is a technical term (from which "natural isomorphism" -as in Footnote 55 -is derived). In the end notes to [Mac98, Chapter 1], Mac Lane speaks of "the pleasure of purloining words from the philosophers: 'Category' from Aristotle and Kant, 'Functor' from Carnap (Logische Syntax der Sprache), and 'natural transformation' from then current informal parlance". 74 Girard himself has pointed this out in [Gir03, §5.3.2]: "Several systems with 'light exponentials' have been produced; my favourite being LLL, light linear logic, which has a polytime normalisation algorithm and can harbour all polytime functions. Unfortunately these systems are good for nothing, they all come from bondage: artificial restrictions on the rules which achieve certain effects, but are not justified by use, not even by some natural 'semantic' considerations." 75 For instance, Elementary Linear Logic (ELL), introduced in the same paper as Light Linear Logic [START_REF] Girard | Light Linear Logic[END_REF] (the latter is ELL with further restrictions), is somewhat better justified: as mentioned in [START_REF] Danos | Linear logic and elementary time[END_REF], ELL can be motivated both from modal logic considerations (as heretical as this might be 76 ) and from the geometry of interaction. It also rules out Russell's paradox (Footnote 43). The parsimonious λ-calculus (cf. §1.2.4) is also not just motivated by complexity, but by the study of affine approximations [START_REF] Mazza | Polyadic Approximations in Logic and Computation[END_REF] as well. Moreover, my opinion is that its typing discipline captures quite well -with a better fit than LLL or ELL -the intuition conveyed by Girard's metaphor for restricted non-linearity [Gir11b, §15.1.2]: "[…] the image of this glass of water that one can indefinitely dip from the sea. It is a modest perenniality, which does not allow one to nibble a sea from the sea -at least not indefinitely". In the parsimonious λ-calculus, we indeed have terms of type !τ !τ ⊗ τ , but not of type !τ !τ ⊗ !τ -think of τ as the glass and !τ as the sea.

While Girard harshly criticizes the modal logic S5 for its lack of cut-elimination [Gir11b, §4.E], it turns out that this can be remediated in modern proof-theoretic frameworks, for instance deep inference [START_REF] Goré | Classical Modal Display Logic in the Calculus of Structures and Minimal Cut-free Deep Inference Calculi for S5[END_REF]. For more on the contemporary proof theory of modal logics, see e.g. [START_REF] Marin | Modal proof theory through a focused telescope[END_REF].

1.3.1. Monadic second-order logic. As promised in §1.1.3, let us discuss the logical aspects of automata theory. It involves classical logic, usual first-order quantifiers, and truth-value semantics (also known as "Tarskian semantics"): a side of mathematical logic which could be seen as somewhat old-fashioned -yet no less important -compared to the proof theory of constructive logics that is related to programming languages ( §1.1.4).

For our exposition of this topic, we first need to recall the usual notion of interpreting a logical formula (or sentence) in a structure. Consider for instance the formula ∃x. ∀y. x ≤ y. It is meaningless to speak of its truth or falsity in absolute terms, since it is true over N and false over Z. One must specify:

• a set called a domain over which the quantifiers ∃x and ∀y range; • a binary relation over this domain that tells us the meaning of ≤ (in our example, we took the canonical ordering relations over N and Z respectively).

More generally, a set D equipped with several relations is known as a relational structure.

By representing strings over an alphabet Σ as relational structures, a formula that can be interpreted in these structures induces a map Σ * → {true, false}, which is the same thing as what we called earlier a "decision problem" or a "language"; hence the connection with computation. The classical representation of a string w ∈ Σ * is as follows:

• the domain is the set {1, 2, . . . , |w|} of positions in w (where |w| is its length);

• there is a binary relation ≤ that gives us the left-to-right ordering of positions;

• for each letter c ∈ Σ, we have a unary relation (i.e. subset of the domain) which is the set of positions in w that contain the letter c.

For instance, if we interpret the formula ∀x. ∀y. (a(x) and b(y)) ⇒ x ≤ y in the structure corresponding to w ∈ {a, b} * , the result will be true if and only if w = a . . . ab . . . b.

The fundamental discovery independently made in the early 1960s by Büchi, Elgot and Trakhtenbrot [START_REF] Büchi | 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 single-place predicates[END_REF] is that a language is regular if and only if it can be defined by a formula in monadic 77 second-order logic (MSO) -the latter is a logic in which one can quantify not just over elements of the domain (positions in a string), but also over subsets. This was quickly followed by an extension of this equivalence to infinite words [START_REF] Büchi | Symposium on Decision Problems: On a Decision Method in Restricted Second Order Arithmetic[END_REF] (to represent them as relational structures, use N as the domain). Nowadays, correspondences with MSO are a central motivation for automata models over various kinds of data, infinite or not, all of which can be encoded as relational structures.

The case of infinite words and infinite trees is especially important for the theoretical underpinnings of (automated) formal verification of hardware or software systems: MSO over such structures subsumes many logics used to specify system behaviors (e.g. by considering N as an ordered set of discrete time steps, linear-time temporal logic can be translated into MSO over (N, ≤) which corresponds to the aforementioned [START_REF] Büchi | Symposium on Decision Problems: On a Decision Method in Restricted Second Order Arithmetic[END_REF], though it is more efficient to directly translate temporal logics to automata, see [START_REF]Handbook of Automata Theory[END_REF]Chapter 38]). This is mostly out of scope for this manuscript, but see §1.3.4 for a brief discussion of something in this spirit. Even ignoring applications to formal verification, connections with logic are pervasive in automata theory, justifying its classification as part of "logic in computer science".

• In algebraic language theory, there are many correspondences between algebraically defined subclasses of regular languages and subsystems of MSO, providing further evidence that those classes are natural. The most famous case is, again, star-free languages: they are exactly those definable in first-order logic (FO). (Although often attributed to McNaughton and Papert, this result is due to Schützenberger, as discussed in [START_REF] Straubing | First-order logic and aperiodic languages: a revisionist history[END_REF].)

77 "Monadic" in MSO just means "unary" -full second order logic allows quantifying over relations of arbitrary arity on the domain, not just subsets. It does not have anything to do with monads from category theory (though monads and MSO can be combined in categorical automata theory [START_REF] Bojańczyk | Monadic Monadic Second Order Logic[END_REF]).

• Concerning transducers, there are various ways to define string-to-string functions (rather than just languages) using MSO. They give rise to characterizations of rational [Fil15, §5.3], regular [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF] and polyregular [START_REF] Bojańczyk | String-to-String Interpretations With Polynomial-Size Output[END_REF] functions. And Schützenberger's theorem lifts to transducers as one might hope: in all three cases, replacing MSO by FO leads to a characterization of the corresponding aperiodic transduction class [FGL16; CD15; BKL19] (this explains why aperiodic regular functions are called "FO transductions"). The last thing concerning MSO whose mention is almost mandatory is that it has a celebrated application to computational complexity. To formulate it, we must first remark that a graph can be represented as a relational structure using its vertex set as the domain, and an adjacency relation to encode edges. Given any MSO formula over graphs, Courcelle's theorem says that for any k ∈ N, the decision problem that this formula defines can be solved in linear time over graphs of treewidth at most k. 78 Fixed-parameter tractability results involving treewidth are a major theme in graph algorithms, a firmly "Volume A" ( §1.1.1) topic, and Courcelle's theorem implies many such results at once. There is a lot more to say about MSO over graphs (e.g. about graph-to-graph transductions), see the book [START_REF] Courcelle | Graph structure and monadic second-order logic. A language-theoretic approach[END_REF]. 79 1.3.2. Descriptive vs implicit complexity and their legacies. Monadic Second-Order Logic over graphs is not the only point of contact between model theory 80 -the area of mathematical logic that focuses on the interpretation of formulas in structures -and computational complexity. By considering a logic that is not included in MSO, one could hope to characterize some complexity class -rather than an automata-theoretic class of languages -as the set of decision problems (over strings) that are defined by the formulas in this logic. This is indeed the basic conceit of an entire field called descriptive complexity 81 . For example, Fagin's theorem [START_REF] Fagin | Contributions to the model theory of finite structures[END_REF] says that a problem is in NP if and only if it can be expressed in existential second-order logic. This is considered to be the first main result of the field (coming a decade after the connection between MSO and regular languages), and many other complexity classes have been described in this way since then (see e.g. [START_REF] Immerman | Descriptive Complexity[END_REF]).

A logic used this way can be seen as a kind of programming language offering a very high level of abstraction, in which one directly 82 expresses what one wants to compute, rather than how to compute it: a declarative language. Thus, strictly speaking, descriptive complexity fits our previous definition of implicit computational complexity ( §1.1.4): "machine-free characterizations of complexity classes via high-level programming languages" (and similarly, the MSO-based characterizations from §1.3.1 are arguably a kind of "implicit automata".)

But the common usage of those words does not consider descriptive complexity as a part of ICC. The latter is used as an umbrella term encompassing basically all approaches to "machine-independent complexity" that do not fit in the specific model-theoretic approach of descriptive complexity. The type-theoretic characterizations of complexity classes that we already saw are merely a part of ICC; the field also includes tools such as recursive function 78 See [CE12, Chapter 6] for a modern exposition. An early statement can be found in [START_REF] Courcelle | The Monadic Second-Order Logic of Graphs: Definable Sets of Finite Graphs[END_REF] with a quadratic rather than linear bound; the result was also independently rediscovered in [START_REF] Borie | Automatic Generation of Linear-Time Algorithms from Predicate Calculus Descriptions of Problems on Recursively Constructed Graph Families[END_REF]. The complexity bottleneck was the tree decomposition step, concerning which many further works offered algorithmic improvements, see [CE12, §6.2]. 79 One recent development that it does not cover is the proof of an old conjecture of Courcelle concerning an automata-MSO connection for graphs of bounded treewidth [START_REF] Bojańczyk | Definability equals recognizability for graphs of bounded treewidth[END_REF]. 80 To explain the terminology, a structure is said to be a model of a set of formulas when all of them are true in the structure. Traditional model theory focuses mostly on infinite structures, but the needs of computer science prompted the study of finite model theory.

81 Beware: "descriptive complexity" has a different meaning in the context of descriptive set theory. 82 Relatively speaking… Intuitively straightforward properties are sometimes expressed as unavoidably convoluted formulas in a given logic. But the point is that even then, the formula reads like a description of some property of the input, rather than an algorithm that computes and then returns a boolean at the end.

algebras or term rewriting. For example, a result published by Gurevich in 1983 [START_REF] Gurevich | Algebras of feasible functions[END_REF] captures logarithmic space complexity using a form of primitive recursion over finite relational structures. It can be considered part of the "prehistory" of ICC, as it is often considered that the latter only really took off starting from the early 1990s, with [GSS92; BC92 What must be taken into account is symmetry: the fact that some structures may have automorphisms, i.e. permutations of the domain that fix all relations. This symmetry is broken when one serializes a structure as a string: for instance, for graphs, the vertices might be numbered in some arbitrary order. And the execution of a program that takes graphs as inputs can depend on this order, e.g. to loop over all vertices successively, even when the end result is invariant under automorphism (example: a depth-first search to decide whether a graph is connected). Logical formulas cannot do that sort of thing: 86 if two vertices can be 83 For instance, techniques from ICC have been applied to compiler optimizations [START_REF] Rubiano | Implicit Computational Complexity and Compilers[END_REF]. Automated analyses of the computational complexity of functional programs are also close to ICC, with some overlap between the people working on those two topics; one manifestation of this was the (now defunct) DICE-FOPARA joint workshops. The more general area of formal methods for time complexity analysis is surveyed in [Gué19, §9.2], as part of a PhD thesis [START_REF] Guéneau | Mechanized Verification of the Correctness and Asymptotic Complexity of Programs[END_REF] whose main subject is to formally prove complexity bounds using separation logic; and recall from Footnote 32 that separation logic relies on a variant of linear logic.

84 An important real-world example of declarative programming language is SQL, the usual language for querying relational databases. The latter remain the most common kind of database despite some hype in the 2010s around key-value stores (the "NoSQL" movement). Their name comes from the fact that they can be seen as relational structures: think of a k-ary relation as a table with k columns, and of each k-tuple that it contains as a row. The expressivity of SQL can be characterized using an extension of first-order logic [Imm99, Chapter 14] (and the same goes for Datalog, another database query language).

85

The reader familiar with graph algorithms might object that, for example, finding a path between two vertices in a graph with n vertices and m edges takes O(n 2 ) time on the adjacency matrix representation but O(n + m) time on the adjacency list representation. But here we mean the kind of complexity that is concerned with "robust" classes such as P, NP, … whose definition should not depend on the choice of "reasonable" model; and "reasonable" is defined by the invariance thesis ( §1.1.1) which allows for polynomial overhead in time. In this example, both representations put the problem in P. Nevertheless, there is a recent and active area of research named fine-grained complexity that applies the philosophy of complexity theory (e.g. look for conditional lower bounds via reductions) in a way that is sensitive to some (but not all) distinctions within P made by traditional analysis of algorithms; see [START_REF] Vassilevska | On some fine-grained questions in algorithms and complexity[END_REF].

86

To circumvent this limitation of logic, one can add an arbitrary total order to the relational structures considered, and allow formulas that syntactically refer to this order but whose truth value is independent from it. The established keyword for this idea is "order-invariant logics", see e.g. [START_REF] Grange | On the Expressive Power of Invariant Logics over Sparse Classes of Structures[END_REF].

exchanged by an automorphism, then a formula necessarily treats them the same way. This is why descriptive characterizations of standard complexity classes often apply only to a class of structures that do not admit non-trivial automorphisms: totally ordered structures, in which one of the provided relations is a total order on the domain. This is the case for strings, with their order on positions, but not for graphs.

For example, there is no known "logic for polynomial time" over arbitrary finite relational structures. In fact, Gurevich has even conjectured that such a logic does not exist, in a precise sense, and this has been called "the perhaps most fundamental and challenging open problem of finite model theory" [START_REF] Grädel | Is Polynomial Time Choiceless?[END_REF]. Since Fagin's theorem actually provides a logic for NP over all structures, the conjecture implies P = NP. By contrast, a logic for P has been known for a long time for totally ordered structures [START_REF] Vardi | The Complexity of Relational Query Languages (Extended Abstract)[END_REF][START_REF] Immerman | Relational Queries Computable in Polynomial Time[END_REF]. Currently, the main candidate for a "logic for P", which would refute the conjecture since it fits Gurevich's definition, 87 is choiceless polynomial time, introduced in [START_REF] Blass | Choiceless Polynomial Time[END_REF]. It is defined using a non-declarative programming language, so nominally, it should arguably belong to implicit complexity. The fact that it is much better known among descriptive complexity theorists than in the ICC community is more evidence towards their true difference in focus today.

There is an important former candidate logic for P that looks more like the kind of "logic" usually considered in descriptive complexity (it is an extension of first-order logic, with a notion of truth-value semantics in relational structures): fixed-point logic with counting (FPC). It was first suggested in the 1980s [Imm86, §5], and it is still relevant today, 88 even though a decision problem in P that it cannot express was found in the same decade [START_REF] Cai | An optimal lower bound on the number of variables for graph identifications[END_REF]. The modern understanding of FPC is that it "can be seen as capturing a natural class of symmetric algorithms inside P, with equivalent formulations in circuit complexity and linear programming" -the quote (emphasis included) is taken from the survey [START_REF] Dawar | Symmetric Computation (Invited Talk)[END_REF]. Intuitively, an algorithm is symmetric when its execution -not just its result -is preserved by automorphisms; a logician would say that this is an intensional property.

This recently discovered connection with circuits (see [START_REF] Wilsenach | Symmetric Circuits and Model-Theoretic Logics[END_REF]) shows that logic is not required to define this notion of symmetric computation; it is a convincing argument for considering the latter as part of complexity theory properly speaking. (On top of that, the idea shares some commonalities with monotone complexity, 89 a topic which definitely belongs to "Volume A".) That descriptive complexity, by investigating its internal questions, has been able to come up with such a natural and interesting concept in complexity theory is a remarkable achievement.

It is unmatched by implicit complexity as far as we know, but the thing that comes closest, perhaps, is that programming language theory and denotational semantics provide tools to study the computational complexity of higher-order functions, 90 though this is not 87 Therefore, it is widely believed that choiceless polynomial time cannot compute all functions in P, but this remains an open problem. For recent progress on this question, see [START_REF] Pago | Choiceless Computation and Symmetry: Limitations of Definability[END_REF].

88 A notable recent achievement is the very long proof, published as a book [START_REF] Grohe | Descriptive Complexity, Canonisation, and Definable Graph Structure Theory[END_REF], that FPC captures polynomial time on every minor-closed class of graphs; it involves deep combinatorics related to the graph isomorphism problem. See also Sandra Kiefer's PhD thesis [START_REF] Kiefer | Power and limits of the Weisfeiler-Leman algorithm[END_REF] (or her introductory paper [START_REF] Kiefer | The Weisfeiler-Leman algorithm: an exploration of its power[END_REF]) for more recent developments in this vein; its focus is on the Weisfeiler-Leman algorithm for graph isomorphism, which is closely related to FPC over graphs (as already remarked in [START_REF] Cai | An optimal lower bound on the number of variables for graph identifications[END_REF]).

89 Extensional: a function {0, 1} * → {0, 1} is monotone when flipping some input bits from 0 to 1 cannot decrease the output from 1 to 0. Intensional: an algorithm is monotone when it "does not use negations". For more information, we refer to the introduction of [START_REF] Das | A Recursion-Theoretic Characterisation of the Positive Polynomial-Time Functions[END_REF] (a paper concerned with ICC for monotone complexity). Let us also cite [START_REF] Kuperberg | Positive First-order Logic on Words[END_REF] as an example of work on a very similar theme in automata theory.

90

In particular, game semantics (previously mentioned in §1.1.8) are the basis of two recent works of this kind: a proposal for a time complexity measure on higher-order functions [START_REF] Férée | Game semantics approach to higher-order complexity[END_REF], and an exploratory work on notions of higher-order cryptographic primitives [START_REF] Barak | On Higher-Order Cryptography[END_REF] (the theoretical foundations of cryptography depend on complexity theory to bound the computational power of adversaries).

part of ICC per se. Non-type-theoretic forms of ICC have also served to characterize the basic feasible functionals, a canonical counterpart to P for functions (Γ * → Σ * ) → Π * , called "second-order" or "type-2" functions, cf. [Péc20, §4.2]. 91 And yet, a limitation of both descriptive and implicit complexity (pointed out for instance in [Maz17, §4.2.1]) is that they have provided no major ideas for the main questions concerning the most basic complexity classes such as P or NP, especially when it comes to separations between them. To be fair, two major results (namely NL = coNL and PARITY / ∈ AC 0 ) of classical complexity theory were discovered through descriptive complexity; but in both cases, they were also independently proved around the same time in other ways, and the essence of the descriptive proofs turned out not to depend on logic on a fundamental level (cf. [START_REF] Aaronson | P=?NP[END_REF]§3]). Concerning the proofs-as-programs approach to ICC, the somewhat related idea that separation results in complexity could reflect foundational issues concerning "infinity as reuse" best expressed in linear logic (see e.g. [Gir03, §5] and [START_REF] Girard | Epistemology versus Ontology: Essays on the Philosophy and Foundations of Mathematics in Honour of Per Martin-Löf[END_REF] 93 ) has stayed at the level of speculation. 94 ICC results often teach us about the programming languages involved much more than about the complexity classes that they capture -but the former are sometimes contrived for the sake of the result, as we say in §1.2.5.

On the contrary, as we argued in §1.2, we feel that our work on implicit automata has provided us with a better understanding of transducers, 95 by uncovering some categorical structure. Throughout this introduction, we have indeed attributed our successes to the deeply algebraic nature of modern automata theory. Conversely, one might wonder whether the limitations of ICC until now are due to a lack of compositional methods for fundamental complexity theory. 96 If the toolset of programming language theorists has any role to play 91 As a cultural remark, let us mention that computability for such functions sometimes goes under the name "type-2 theory of effectivity"; it is part of the computability theory of higher-order functions, for which the standard reference is [START_REF] Longley | Higher-Order Computability[END_REF]. To get a taste of the field, Martín Escardó's very accessible blog post Seemingly impossible functional programs 92 explains a spectacular phenomenon. A major application of type-2 effectivity is to study computability and complexity for functions between separable topological spaces, see the books [Wei00; BH21]. For instance one can define what it means for the integration map : C([0, 1], R) → R to be computable, by representing arbitrary real numbers (resp. continuous functions) by convergent sequences (that need not be computable!) in Q N (resp. Q[X] N ). See also [START_REF] Steinberg | Computational Complexity Theory for Advanced Function Spaces in Analysis[END_REF] for complexity-theoretic aspects of computable analysis; finally, we should mention that an implicit characterization of the polynomial time functions R → R has been given using a parsimonious λ-calculus in [START_REF] Hainry | Polynomial Time over the Reals with Parsimony[END_REF].

92

Available at https://archive.md/rUGpG. The ideas behind this have been unexpectedly applied to prove that in intuitionistic set theory (cf. Footnote 22), the Cantor-Schröder-Bernstein theorem is equivalent to the law of excluded middle [START_REF] Pradic | Cantor-Bernstein implies Excluded Middle[END_REF] (see also [START_REF] Hötzel | The Cantor-Schröder-Bernstein Theorem for ∞-groupoids[END_REF] for an extension to homotopy type theory). 93 Girard's paper [START_REF] Girard | Epistemology versus Ontology: Essays on the Philosophy and Foundations of Mathematics in Honour of Per Martin-Löf[END_REF] sketches a characterization of non-deterministic logarithmic space using von Neumann algebras. It actually led to quite a few subsequent works, which however abandoned the original foundational and philosophical ambitions that initially motivated [START_REF] Girard | Epistemology versus Ontology: Essays on the Philosophy and Foundations of Mathematics in Honour of Per Martin-Löf[END_REF]: Aubert and Seiller clarified and extended Girard's technical ideas [AS16a; AS16b], and with Bagnol and Pistone, they also adapted their techniques to more down-to-earth settings to characterize various complexity classes [AB18; Aub+14; ABS16]. Finally, Seiller obtained similar results [START_REF] Seiller | Interaction Graphs: Non-Deterministic Automata[END_REF] in the setting of his interaction graphings semantics [START_REF] Seiller | Interaction Graphs: Exponentials[END_REF].

(Furthermore, those interaction graphings and the aforementioned [START_REF] Girard | Epistemology versus Ontology: Essays on the Philosophy and Foundations of Mathematics in Honour of Per Martin-Löf[END_REF] share the same main inspiration: a version of the geometry of interaction using von Neumann algebras [START_REF] Girard | Geometry of Interaction V: Logic in the hyperfinite factor[END_REF].) 94 It must be said, however, that the work mentioned above in Footnote 93 has led Seiller to consider graphings as a mathematical abstraction of programs whose structure might help to prove separation results in complexity theory. As a first demonstration of this idea, Pellissier and Seiller [START_REF] Pellissier | PRAMs over integers do not compute maxflow efficiently[END_REF] have rephrased various proofs of complexity lower bounds in a unified way within the framework of graphings, reformulating the key arguments of those proofs using the notion of topological entropy. Thus, [START_REF] Girard | Epistemology versus Ontology: Essays on the Philosophy and Foundations of Mathematics in Honour of Per Martin-Löf[END_REF] ended up indirectly inspiring, through a long and winding path, a promising approach to separation results -even though no trace of logic remains in this approach. 95 There might be a personal bias here: I embarked on this project not knowing much about automata theory, and my grasp of the field increased alongside the discovery of new results. 96 There are exceptions in some sub-areas, such as constraint satisfaction problems [START_REF] Bulatov | Symmetries and Complexity (Invited Talk)[END_REF]: the recent proofs of the CSP Dichotomy Conjecture [Zhu20; Bul20] both use an algebraic approach to leverage symmetries.

in the future of computational complexity, it is perhaps in providing those missing methods (or serving as their inspiration), rather than giving yet another implicit characterization of, say, polynomial time. We also mentioned earlier ( §1.2.4) that Bojańczyk gave four different characterizations of polyregular functions in [START_REF] Bojańczyk | Polyregular Functions[END_REF]. One of them is a successor to the aforementioned [START_REF] Bojańczyk | Regular and First-Order List Functions[END_REF]. Interestingly, while the functional language of [START_REF] Bojańczyk | Regular and First-Order List Functions[END_REF] did not support λ-abstraction, its extension in [START_REF] Bojańczyk | Polyregular Functions[END_REF] uses a simply typed λ-calculus enriched with a ground type of lists and several primitive functions on lists. Strings are represented as lists of characters, which differs from our use of functional encodings in a λ-calculus without any primitive data type.

We will now restrict our attention to works that involve typed λ-calculi.

Automata as circular proofs. Aside from Hillebrand and Kanellakis's Theorem 1.1.4 and the above-mentioned characterization of polyregular functions, perhaps the only previous works that completely fit the theme of "implicit automata via proofs-as-programs" are those by DeYoung and Pfenning [START_REF] Deyoung | Substructural Proofs as Automata[END_REF] on sequential transducers and by Kuperberg, Pinault and Pous [START_REF] Kuperberg | Cyclic Proofs and Jumping Automata[END_REF] (see also [START_REF] Pinault | From automata to cyclic proofs: equivalence algorithms and descriptive complexity[END_REF] Chapter 3]) characterizing regular languages and deterministic logarithmic space complexity. Both rely on a proofs-as-programs interpretation of circular proof systems for some variants of linear logic with fixed points. Circular proofs allow some amount of controlled self-referentiality to handle recursive definitions; they are sometimes called "cyclic" proofs, but in our context, this would create a confusion with an unrelated non-commutative logic, cyclic linear logic [START_REF] Yetter | Quantales and (noncommutative) linear logic[END_REF]. The Church encoding of strings is obtained by a systematic procedure [START_REF] Böhm | Automatic synthesis of typed Λ-programs on term algebras[END_REF] from the inductive definition s ::

= ε | c 1 • s | . . . | c |Σ| • s (Σ = {c 1 , . . . , c |Σ| }).
Using fixed points of formulas, one can instead turn it into the recursive type 99 Str µ Σ = 1 ⊕ Str µ Σ ⊕ . . . ⊕ Str µ Σ ; this is the definition of the type of strings in [START_REF] Deyoung | Substructural Proofs as Automata[END_REF], and it is also implicit in 100 [START_REF] Kuperberg | Cyclic Proofs and Jumping Automata[END_REF].

97 But it would be unfair to reduce current developments in ICC to this: several research perspectives such as probabilistic and quantum computation are outlined in [Péc20, Chapter 5], and there are other recent works covering new ground such as parallel complexity bounds for process algebras [START_REF] Ghyselen | Sized Types Methods and their Applications to Complexity Analysis in Pi-Calculus[END_REF]. 98 The introduction to [AS21] mentions a "structure vs power" dichotomy further discussed in [START_REF] Abramsky | Whither semantics?[END_REF] which partially correlates with the "machines vs programs" and "Volume A/B" distinctions from §1.1.1. Interpreted literally, "structure" is what we call algebra/compositionality while "power" refers to expressiveness; but the actual intended meaning is that "structure" covers programming language theory and semantics, while "power" contains basically the rest of theoretical computer science (including complexity, automata and finite model theory). I would slightly object to this terminology: in my opinion, automata theory is a field in which algebra can be fruitfully applied to study expressiveness today (this is one of the points I tried to make in Section 1.1.3). In any case, the three aforementioned dichotomies agree on the gap between computational complexity and programming languages and the disjointness of their research communities. 99 Formally, this is expressed as the least fixed point Str µ Σ = µα. 1 ⊕ α ⊕ . . . ⊕ α. 100 The left rules given in [KPP19, Figure 1] for A and A * correspond respectively to A = 1 ⊕ . . . ⊕ 1

and A * = 1 ⊕ (A ⊗ A * ).
So both our approach and those using fixed point logics morally work because the consumption of strings represented as inductive data types is similar to their traversal by automata. However, while the use of the "right fold" provided by a Church-encoded string involves an "inversion of control" (in programming jargon) that, in the case of the simply typed λ-calculus, has drastic effects on expressive power (contrast Theorem 1.1.4 with the much larger computational power of the simply typed λ-calculus in other contexts, cf. §1.3.6), circular proofs seem to give the programmer more degrees of freedom: Kuperberg et al. do not need to add polymorphism to go beyond regular languages. In fact it was shown later in [Pin21b, Chapter 4] 101 (which is refined in [START_REF] Das | A circular version of Gödel's T and its abstraction complexity[END_REF]) that much higher complexities (above primitive recursion) can be reached using other monomorphic circular proof systems. 102 Automata characterizations with a semantic flavor. Using a computational model inspired by 103 denotational semantics of linear logic, Seiller [START_REF] Seiller | Interaction Graphs: Non-Deterministic Automata[END_REF] has given a characterization of each level of the k-head two-way non-deterministic automata hierarchy. The lowest level (k = 1) corresponds to regular languages, while the union over k ∈ N ≥1 gives the complexity class NL (non-deterministic logarithmic space). Something in common with our work is that the representation of strings used by [START_REF] Seiller | Interaction Graphs: Non-Deterministic Automata[END_REF] is more or less a semantic version of Church encodings (see [Sei18, §3.2]). There is one main difference with what one usually calls implicit complexity: Seiller's result does not take place inside a syntactically defined programming language (and it is far from obvious how to turn this model into a similarly expressive syntax, because of the previously mentioned inversion of control). 104 Terui's investigations [START_REF] Terui | Computational ludics[END_REF] on a form of game semantics for (polarized 105 ) linear logic called ludics [START_REF] Girard | From foundations to ludics[END_REF] also include a characterization of regular languages.

Recognizable languages of λ-terms. We have emphasized in §1.1.7 the use of evaluation in a finite denotational semantics used to prove Theorem 1.1.4. Along these lines, general notions of recognizable languages of closed λ-terms of a given type (specializing to regular languages for the type of Church-encoded strings) have been proposed, based on finite semantics, in the simply-typed λ-calculus by Salvati [START_REF] Salvati | Recognizability in the Simply Typed Lambda-Calculus[END_REF] and in an infinitary λ-calculus by Melliès [START_REF] Melliès | Higher-order parity automata[END_REF]. It is plausible that Theorem 1.1.4 can be extended to give an equivalent syntactic definition for Salvati's recognizable languages: for a simple type τ they would be the languages definable by τ [σ] → Bool. An interesting question would be whether one can give an encoding of higher-dimensional trees in the simply typed λ-calculus so that this notion of recognizability coincides with Rogers's automata for those trees [START_REF] Rogers | Syntactic Structures as Multi-dimensional Trees[END_REF][START_REF] Ghani | Higher Dimensional Trees, Algebraically[END_REF].

101 Following what we said in §1.3.2, "descriptive" should be replaced by "implicit" in the title of [START_REF] Pinault | From automata to cyclic proofs: equivalence algorithms and descriptive complexity[END_REF]! 102 The theory of circular proofs is also connected to automata over infinite structures for reasons that are orthogonal to these "implicit automata" results: circular proofs are subject to "correctness criteria" that correspond to acceptance conditions for such automata. For instance the aforementioned [START_REF] Das | A circular version of Gödel's T and its abstraction complexity[END_REF] relies on a study of circular arithmetic [START_REF] Das | On the logical complexity of cyclic arithmetic[END_REF] which in turns applies results on the reverse mathematics of MSO over (N, ≤) [START_REF] Leszek Aleksander Kołodziejczyk | The logical strength of Büchi's decidability theorem[END_REF] (that were already mentioned in Footnote 14). We will not attempt to survey the growing field of circular proofs here; let us just mention one application that has garnered significant attention: the solution of an old problem concerning automata and formal verification [START_REF] Doumane | On the infinitary proof theory of logics with fixed points[END_REF]Part II].

103 This inspiration has already been discussed at length in Footnote 93. 104 A personal digression: my first steps in implicit complexity took place during an internship with Thomas Seiller whose initial subject was to design a syntactic counterpart to this result. In retrospect there are major obstructions to doing so, but a discussion with Damiano Mazza during this internship led us to rediscover Theorem 1.1.4, thus planting the first seeds for the "implicit automata in typed λ-calculi" research programme! I first applied Hillebrand and Kanellakis's ideas to explain a puzzling phenomenon in the elementary affine λ-calculus ( §1.4.7), and the work on implicit automata properly began one year later after Mikołaj Bojańczyk went around at ETAPS'19 suggesting to a few people (including Cécilia Pradic, who relayed this to me) that there could be some connection between polyregular functions and linear logic.

105

See Footnote 56 and [START_REF] Laurent | Étude de la polarisation en logique[END_REF]. The polarities of linear logic are also closely related to the focusing used in Chapter 5; both were first discovered in the context of proof search for linear logic [START_REF] Andreoli | Logic Programming with Focusing Proofs in Linear Logic[END_REF].

As for Melliès's notion of recognizability for simply typed infinitary λ-terms [START_REF] Melliès | Higher-order parity automata[END_REF], it is mainly inspired from his work with Grellois (compiled in the latter's PhD dissertation [START_REF] Grellois | Semantics of linear logic and higher-order model-checking[END_REF]) on higher-order model checking. Let us explain that topic now. 1.3.4. Higher-order recursion schemes. Let Σ be a ranked alphabet and Tree Σ be the type of Church-encoded trees over Σ. The simply typed λ-terms of type Tree Σ correspond to finite trees. Now, consider the λY-calculus, which extends the simply typed λ-calculus with general recursion (concretely, it adds a fixed point operator Y). Because the recursion may be non-terminating, some λY-terms t : Tree Σ represent infinite trees 106 (though only countably many infinite trees over Σ -so not all of them -can be generated this way).

One can then ask, given t and a formula ϕ of MSO ( §1.3.1) over infinite trees, whether the tree defined by t satisfies ϕ. This is the higher-order model checking problem, whose decidability was first proved in [START_REF] Ong | On Model-Checking Trees Generated by Higher-Order Recursion Schemes[END_REF] using game semantics, and then reproved several times with various different tools and stronger conclusions (e.g. in [START_REF] Christopher | Higherorder Recursion Schemes and Collapsible Pushdown Automata: Logical Properties[END_REF][START_REF] Parys | Higher-Order Model Checking Step by Step[END_REF]). The point is that t may represent the possible behaviors of some code written in a functional programming language. It is shown in [START_REF] Kobayashi | Model Checking Higher-Order Programs[END_REF]§3] that several examples of formal verification tasks on functional programs reduce to higher-order model checking, and this has led to actual implementations of verification tools for subsets of the OCaml language, cf. [START_REF] Kobayashi | 10 Years of the Higher-Order Model Checking Project (Extended Abstract)[END_REF].

But the idea is much older than that, going back to the 1970s. Initially, it was formulated in terms of tree-generating grammars called (higher-order) recursion schemes; 107 for a survey of the early history of recursion schemes, we refer the reader to [START_REF] De Miranda | Structures generated by higher-order grammars and the safety constraint[END_REF]§2.6]. This point of view is equivalent to the one we started our exposition with: an infinite tree can be generated by a recursion scheme if and only if it can be defined by a λY-term (see e.g. [START_REF] Salvati | Simply typed fixpoint calculus and collapsible pushdown automata[END_REF]§3]).

A third equivalent way to define infinite trees is using an automaton model (with no input and a tree output): collapsible pushdown automata (see e.g. [START_REF]Handbook of Automata Theory[END_REF]Chapter 35]). They were designed by adding a "collapse" operation to higher-order pushdown automata (HOPDA)automata with stacks of stacks … of stacks (with a bounded nesting) -which were already known to correspond to the recursion schemes enjoying a certain safety property [START_REF] Knapik | Higher-Order Pushdown Trees Are Easy[END_REF]. Completing this picture, there is also a "safe λY-calculus" [SW16, §4.4] whose terms of type Tree Σ correspond to trees over Σ generated by HOPDA. Its type system imposes constraints on the allowed applications and λ-abstractions depending on the (functionality) order of simple types -a notion that will also appear in §1.3.6, defined as

ord(o) = 0 ord(σ → τ ) = max(ord(σ) + 1, ord(τ ))
Going back to the aforementioned work of Grellois and Melliès, it is also related to another major theme of this dissertation, viz. linear logic: one of the results presented in [START_REF] Grellois | Semantics of linear logic and higher-order model-checking[END_REF] is a decision procedure for higher-order model checking that uses evaluation in a finite semantics of the λY-calculus derived from denotational models of linear logic (in fact, a variant of the semantics used by [START_REF] Terui | Semantic Evaluation, Intersection Types and Complexity of Simply Typed Lambda Calculus[END_REF], cf. §1.1.7). The complexity of model checking for variants of the λY-calculus with linear types has also been studied recently [CGM17; CM19].

106 This is similar to how infinite lists can be defined recursively in Haskell thanks to lazy evaluation.

For example, different ways to code the list of all prime numbers in increasing order are given in [START_REF] O'neill | The Genuine Sieve of Eratosthenes[END_REF].

107 One should be aware of a naming collision here: what Haskell programmers call "recursion schemes" are higher-order functions that abstract common patterns for recursive function definitions. For example, the "fold" function on lists captures such a pattern (f ([x0, x1, . . . ]) = g(x0, f ([x1, . . . ]))); its generalizations to other algebraic data types are called "catamorphisms" (and the principle of Church encodings is to represent a datum by a catamorphism over it!). (Another terminological clash: in the title of the founding paper on this kind of recursion scheme [START_REF] Meijer | Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire[END_REF], the word "lens" refers to a piece of notation, which differs from the current usage of "lens" in the Haskell community -see Footnote 58 for the latter.)

1.3.5. Simply typed λ-definability over Church encodings. We did not mention all those notions -recursion schemes, pushdown automata and the safety restriction -merely because they are part of a topic involving both automata and λ-calculi. They have an actual direct relevance to our work in progress on the simply typed λ-calculus which will be discussed in §1.4.1. To give some context for this work, we recall here some classical facts.

It is well-known that there exists a simply typed λ-term exp : Nat Remark 1.3.1. However, the heterogeneity of its input and output types prevents exp from being iterated by a Church numeral (recall that the Church encoding of

n ∈ N is morally the iterator f → f • . . . (n times) • • • • f ).
Iterating n → 2 n would indeed give rise to a tower of exponentials of variable height, which is known to be inexpressible by any Nat[τ ] → Nat.

By contrast, without type substitutions:

Theorem 1.3.2 (Schwichtenberg [Sch75]). The functions N k → N defined by closed simply typed λ-terms of type Nat → • • • → Nat are exactly the extended (multivariate) polynomials, generated from 0, 1, +, × and a conditional if n = 0 then p else q.

The above theorem can be suitably generalized to strings [START_REF] Zaionc | Word operation definable in the typed λ-calculus[END_REF] and trees [Zai91; Lei93] (both as inputs and outputs). However, no analogous result is known for Nat[τ ] → Nat: Question 1.3.3. Characterize (without reference to the λ-calculus) the functions N → N definable by closed simply typed λ-terms of type Nat[τ ] → Nat for some type τ .

There are well-known negative results (attributed to Statman in the discussion that follows [FLO83, Theorem 4.4.3]) suggesting at first sight that there might be no satisfying answer (though, of course, it will be our goal in §1.4.1 to argue that this pessimism is unwarranted): while towers of exponentials are expressible, many simple functions of tame growth are not, for example n → √ n . If we look at functions of two variables, there is a striking example: subtraction cannot be defined by any simply typed λ-term of type

Nat[σ] → (Nat[τ ] → Nat), no matter what types σ, τ are chosen.
When it comes to predicates, however, the situation is better understood: a subset of N k can be defined by a simply typed λ-term of type Nat

[τ 1 ] → • • • → Nat[τ k ] → Bool if
and only if it is ultimately periodic. This has been shown by Joly 108 [Jol01, Proposition 5], and the case k = 1 is a special case of Theorem 1.1.4 since unary regular languages correspond to ultimately periodic subsets of N via N ∼ = {a} * . The λ-undefinability of equality and of subtraction follow immediately from this characterization. 1.3.6. Remarks on complexity in the simply typed λ-calculus and light logics. We wrap up this "related themes" section with something that has no relation to automata. As our last clarification concerning the state of the art on the computational power of the simply typed λ-calculus, we wish to drive home the following slogan: it is a "calculus of elementary complexity" in the same way that Light Linear Logic is often said to be a "logic of 108 The same paper [START_REF] Joly | Constant time parallel computations in λ-calculus[END_REF] contains a result that explains the parenthetical clause in Question 1.3.3: a characterization of the functions defined by terms of type Nat[τ ] → Nat (which applies more generally to arbitrary free algebras, not just N). It is formulated using untyped λ-terms subject to a kind of complexity constraint in an unrealistic (by Joly's own admission) cost model. polynomial time". 109 In fact the closest comparison would be with LLL's cousin, Elementary Linear Logic, 110 which is also considered to be a "logic of ELEMENTARY".

Of course, we have already mentioned Hillebrand et al.'s use of simply typed λ-terms to characterize ELEMENTARY in §1.1.4, so what we are saying is just that it realizes the full potential of this type system in terms of expressive power. But some readers might wonder: an old result of Statman [START_REF] Statman | The typed λ-calculus is not elementary recursive[END_REF] says that normalization in the simply typed λ-calculus is non-elementary; is that not a sign that it should be able to express non-elementary functions, and that we are still being bridled by our input representations, just as we were with Church encodings and Theorem 1.1.4? The truth is that Hillebrand et al.'s result implies Statman's theorem. To see why, suppose for the sake of contradiction that there were a normalization algorithm with elementary complexity. Then its time complexity would be a tower of exponentials of height h ∈ N. This would entail algorithms in time "tower of height h" for all functions that are definable according to the specification of [START_REF] Gerd | Database Query Languages Embedded in the Typed Lambda Calculus[END_REF]: take the λ-term defining the function, apply it to the representation of the input, and normalize. But the time hierarchy theorem implies that there are functions in ELEMENTARY whose complexity is higher than this tower of fixed height!

In fact, one key to the result of [START_REF] Gerd | Database Query Languages Embedded in the Typed Lambda Calculus[END_REF] is that any simply typed λ-term t has an associated parameter f (t) ∈ N such that the complexity of normalizing t is a tower of exponentials whose height depends only on f (t). This parameter f (t) is the maximum order of a subterm of t, where the order of a term is the order of its type ( §1.3.4). This is also the parameter that is controlled in order to capture each level of the k-EXPTIME / k-EXPSPACE hierarchy in [START_REF] Gerd | On the Expressive Power of Simply Typed and Let-Polymorphic Lambda Calculi[END_REF] (cf. §1.1.7). And the results of [START_REF] Terui | Semantic Evaluation, Intersection Types and Complexity of Simply Typed Lambda Calculus[END_REF] (also mentioned in §1.1.7) state that, for any o ∈ N, the normalization problem for simply typed λ-terms of type Bool whose subterms have order at most o is complete for one of the classes in the same k-EXPTIME / k-EXPSPACE hierarchy.

To substantiate our comparison with ELL and LLL, note that they also have a parameter -the box depth -which is used to bound the time complexity of normalization. 111 Moreover, a unification is realized by Linear Logic by Levels (L 3 ) [BM10], another system which characterizes ELEMENTARY: it is an extension of ELL, admits a translation from the simply typed λ-calculus [START_REF] Gaboardi | A By-Level Analysis of Multiplicative Exponential Linear Logic[END_REF], and both ELL box depth and simply typed order are mapped to L 3 "levels". 112 (This observation on unified phenomena does not seem to have been explicitly written in [BM10; GRV09].)

A final remark: the aforementioned implicit complexity results of [HKM96; HK96] use encodings of relational structures (cf. Sections 1.3.1 and 1.3.2) as inputs. Further connections with database theory are discussed in [START_REF] Gerd | Database Query Languages Embedded in the Typed Lambda Calculus[END_REF].

Work in progress

We now outline several ideas for further research. Those are mostly in the form of concrete mathematical statements, of two kinds: "Claims" are assertions for which we already have plausible proof strategies, and believe that only routine details remain to be worked out and properly written up; "Conjectures" are more challenging open problems.

109 This usual motto for LLL is subject to some subtleties, see [START_REF] Møller | LAL is square: representation and expressiveness in light affine logic[END_REF]. The "moral of the story" concerning input encodings could also apply to ELL and to the simply typed λ-calculus.

110

First mentioned in Footnote 75. 111 It controls the height of a tower of exponentials for ELL and the degree of a polynomial for LLL. 112 More precisely, the paper [START_REF] Gaboardi | A By-Level Analysis of Multiplicative Exponential Linear Logic[END_REF] gives a translation of the multiplicative-exponential fragment of linear logic (meLL) into L 3 , which sends the !-depth of meLL formulas to the level in L 3 . We compose this with the standard call-by-name translation of the simply typed λ-calculus into meLL (T (σ → τ ) = !T (σ) T (τ )) which maps the order to the !-depth.

3).

This suggests looking into classes of regularity-preserving tree transductions, especially ones with hyperexponential growth since towers of exponentials can be defined by terms of type Nat[τ ] → Nat. There is a function class E 113 that fits these requirements and seems particularly robust. Its equivalent definitions include:

• two machine models whose equivalence is proved in [START_REF] Engelfriet | High Level Tree Transducers and Iterated Pushdown Tree Transducers[END_REF]:

high level tree transducers; iterated pushdown tree transducers; • three characterizations of the form "the composition closure of the functions computed by the transducer model T ", shown to be equivalent in [START_REF] Engelfriet | A comparison of pebble tree transducers with macro tree transducers[END_REF]:

-T = macro tree transducers; 114 -T = tree-walking transducers; -T = pebble tree transducers. (The equivalence between iterated pushdown tree transducers and the composition closure of macro tree transducers is one of the results of [START_REF] Engelfriet | Pushdown Machines for the Macro Tree Transducer[END_REF] which is the earliest paper that we know of to consider this class E.) The restriction of E to unary alphabets (which is relevant to our Question 1.3.3 on functions N → N), called the k-computable sequences, has been studied in detail by Fratani and Sénizergues [START_REF] Fratani | Iterated pushdown automata and sequences of rational numbers[END_REF], who show that they generalize some integer sequences of interest (e.g. polynomial recurrence equations). Sénizergues has also claimed in an invited paper without proofs 115 [Sén07] that the restriction of E to strings -which he calls the "k-computable mappings" -can be characterized as the composition closure of HDT0L transductions (cf. §1.2.4).

It is not hard to translate, say, macro tree transducers into simply typed λ-terms. In fact the range of the translation is included in the safe λ-calculus 116 [START_REF] Blum | The Safe Lambda Calculus[END_REF], which is to the simply typed λ-calculus what the safe λY-calculus of [START_REF] Salvati | Simply typed fixpoint calculus and collapsible pushdown automata[END_REF] is to the λY-calculus (cf. §1.3.4). Since the "safely λ-definable tree functions" are closed under composition, they contain the class E. We have strong reasons to believe that the converse also holds: Claim 1.4.2. E is the class of functions definable by some safe λ-term t :

Tree Γ [τ ] → Tree Σ .
The conceptual reason for the claim requires some background on higher-order model checking (which was recalled in §1.3.4). Iterated pushdown transducers are very close to HOPDA, while high level transducers are presented in [START_REF] Engelfriet | High Level Tree Transducers and Iterated Pushdown Tree Transducers[END_REF] as safe recursion schemes 113 I am not aware of a standard name for this class, so I am calling it E here in honor of Joost Engelfriet who is the common coauthor of [EV88; EV86; EM03a].

114 Already mentioned in Footnote 66, and discussed further at the start of Chapter 6.

115 Some of the claims in [START_REF] Sénizergues | Sequences of Level 1[END_REF] were proved in subsequent papers [START_REF] Ferté | Word-Mappings of Level 2[END_REF][START_REF] Cadilhac | On Polynomial Recursive Sequences[END_REF], but as far as we know, it is not yet the case for those concerning compositions of HDT0L transductions. 116 One result of [START_REF] Blum | The Safe Lambda Calculus[END_REF] characterizes the functions definable by safe λ-terms of type StrΓ → StrΣ, that is, without type substitution in the input. In the case of natural numbers, the functions N k → N definable in this way are exactly the multivariate polynomials in N[X1, . . . , X k ]; compare with Theorem 1.3.2.

where the application of rules is controlled by 117 an input tree. We therefore believe that we should be able to translate safe λ-terms defining tree functions to high level tree transducers by adapting the usual translation from safe λY-terms to safe recursion schemes. 118 The analogy with higher-order model checking then suggests the following "unsafe" counterpart of the above claim: tree functions definable in the simply typed λ-calculus using Church encodings should correspond to high level tree transducers without the safety restriction. We expect this to be routine, but a more interesting result would be to prove the unsafe version of the equivalence from [START_REF] Engelfriet | High Level Tree Transducers and Iterated Pushdown Tree Transducers[END_REF]; combining the two would give: Conjecture 1.4.3. There exists a tree transducer counterpart of collapsible pushdown automata (whose stack is initialized with the input tree) that can compute exactly the functions definable by simply typed λ-terms of type Tree Γ [τ ] → Tree Σ for some τ .

Note that this would provide an answer to Question 1.3.3. If this works out, the next step would be to seek alternative characterizations of this function class -typically, as the composition closure of a nice basis of simple enough transducers -and to understand whether the inclusion of E in it is strict.

More anecdotally, while the functions defined in the simply typed λ-calculus without type substitution (i.e. by some t : Str Γ → Str Σ ) are already well-understood (again, see [START_REF] Zaionc | Word operation definable in the typed λ-calculus[END_REF]), we make the following observation which is new as far as we know: Claim 1.4.4. A language can be defined by a simply typed λ-term of type Str Σ → Bool if and only if it can be expressed as a boolean combination of languages of the form ϕ -1 (P ) for ϕ ∈ Hom(Σ * , U 2 ) and P ⊆ U 2 where 119 U 2 = {1, a, b} with 1x = x, ax = a and bx = b.

For a fixed Σ, there are finitely many such languages. The argument for "only if" is semantic evaluation in Scott domains, with o = {⊥, } where

⊥ < so that o → o ∼ = U 2 .
Note that all our results on the simply typed λ-calculus also apply to the λ ⊕& -calculus where we use the simple type of Church-encoded strings

Str ! Σ = (o → o) → • • • → (o → o) → o →
o rather than its linearized variant Str Σ , and do not impose any constraint on the type substitution in the input. We propose the following speculation on something that sits between those hyperexponential λ-definable functions and the regular functions in Theorem 1.2.3: Conjecture 1.4.5. A function can be defined by a λ ⊕& -term of type

Str ! Γ [τ ]
Str Σ for some purely linear τ if and only if it is an HDT0L transduction.

The mismatch between the input and output types would correspond to the fact that HDT0L transductions are not closed under composition. As for Str ! Γ [τ ] → Str Σ with τ purely linear, we have no idea as to what that would correspond to.

Affine types without additives, FO transductions & tree-walking automata.

As we said towards the end of §1.2.2, a natural question is whether all regular functions are still expressible if we remove the additive connectives ⊕/& from the λ ⊕& -calculus. We also explained that to compensate, the linearity condition should be relaxed to affineness. 117 In fact, each rule application "consumes" an input node, so the recursion scheme cannot be unfolded indefinitely. This is why such transducers map finite input trees to finite output trees, whereas trees generated by recursion schemes can be infinite. 118 The recursion schemes used in [START_REF] Engelfriet | High Level Tree Transducers and Iterated Pushdown Tree Transducers[END_REF] actually obey a slightly stronger restriction than safety coming from [START_REF] Damm | The IO-and OI-Hierarchies[END_REF] and called "Damm-safety" in modern terminology, cf. Claim 1.4.6. We have the following implicit characterizations of transduction classes in λ-calculi without additives (where τ is a purely affine type that may be chosen depending on the string-to-string functions that we want to express):

Str Γ [τ ] Str Σ Str Γ [τ ]
→ Str Σ affine commutative regular functions comparison-free polyregular functions affine non-commutative FO transductions first-order cfp functions 120

In other words, our claim is that we get the same characterizations of string transductions as in the λ ⊕& -calculus, and that we also capture the corresponding first-order/aperiodic function classes by adding non-commutativity. By contrast, Theorem 1.2.1 does not hold if additives are added to the λ ℘-calculus, as we will see at the start of Chapter 7.

In [NP20, §4], we showed how to use the Krohn-Rhodes decomposition to code all sequential functions (our proof of Theorem 1.2.1 here involves something very similar) as affine λ-terms of type

Str Γ [τ ]
Str Σ , and we also showed how to express all aperiodic sequential functions in an affine non-commutative λ-calculus. To extend this to regular functions, one possible strategy is to use the following decomposition theorem: Theorem 1.4.7 (Bojańczyk et al. 121 ). The composition closure of the class composed of • sequential functions (resp. aperiodic sequential functions)

• and mapReverse Σ , mapDuplicate Σ : (Σ ∪ {#}) * → (Σ ∪ {#}) * for # / ∈ Σ, defined as ∀w 1 , . . . , w n ∈ Σ * , mapReverse Σ (w 1 # . . . #w n ) = rev(w 1 )# • • • #rev(w n ) mapDuplicate Σ (w 1 # . . . #w n ) = w 1 w 1 # • • • #w n w n

is exactly the class of regular functions (resp. first-order transductions).

As for functions taking trees as input, we claim that the removal of additive connectives hurts expressivity. This could be suspected for tree transductions given the fact that the additive conjunction corresponds to an important feature of BRTTs (as we said in §1.2.2), but we have a stronger argument that also applies to languages: Claim 1.4.8. Any tree language defined by an affine λ-term of type Tree Σ [τ ] Bool without additive connectives can be recognized by some tree-walking automaton.

Tree-walking automata are a natural extension to trees of two-way automata, that can recognize a strict subclass of regular tree languages, which does not even contain all the first-order tree languages (the difficult proof of the separation result can be found in [START_REF] Bojańczyk | Tree-walking automata do not recognize all regular languages[END_REF]). We do not have a proof of the converse, nor do we have strong reasons to believe that it holds for now, so the following is an open-ended problem: Question 1.4.9. What is the class of tree languages definable by such λ-terms?

One thing we can already claim, however, is that the output languages of the affine λ-terms of type Tree Γ [τ ] Str Σ are the same as those of tree-walking tree-to-string transducers. This should follow from the results of [START_REF] Salvati | Encoding second order string ACG with Deterministic Tree Walking Transducers[END_REF].

To explain our argument for Claim 1.4.8, we need to talk about geometry of interaction and its relationship with tree-walking automata.

120 While this notion has not been defined properly in this dissertation, its definition is simple: replace regular functions by first-order transductions in the definition of comparison-free polyregular functions that uses "composition by substitution" (cf. Footnote 71). This definition was suggested in [START_REF] Thành | Comparison-Free Polyregular Functions[END_REF][START_REF] Bessey | A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World[END_REF] as part of a model-theoretic conjecture that has since then been refuted (see the start of Chapter 3).

121 The non-aperiodic case is a special case of a published result [BS20, Theorem 18] on automata over nominal sets (cf. §1.4.4). The aperiodic case is not entirely explicit in the literature, but it can be recovered from the results of [START_REF] Bojańczyk | Regular and First-Order List Functions[END_REF] (mentioned in §1.3.3).

Geometry of interaction, categorical tree automata and planar transducers.

Recall from Section 1.1.9 that the central idea of a paper of Hines [START_REF] Hines | A Categorical Framework For Finite State Machines[END_REF] can be reformulated as follows: automata over the category Int(PFSet) are the same thing as two-way automata (2DFA). It turns out that tree automata over the same category correspond to none other than tree-walking automata. Furthermore, 2DFTs and tree-walking tree-to-string transducers can be rephrased as (tree) automata over a certain category Int(PFSet Σ ). 122 Finally, reversible 2DFA (resp. 2DFT) [START_REF] Dartois | On Reversible Transducers[END_REF] are automata over Int(PFInj) (resp. Int(PFInj Σ )) where PFInj is the category of partial injections between finite sets. The Int-construction is also a general way to build denotational models of the purely linear λ-calculus [START_REF] Abramsky | Retracing Some Paths in Process Algebra[END_REF]. Those models belong to a family of works grouped under the umbrella of "geometry of interaction" (GoI), sharing a common origin in Girard's attempts to give a sort of "dynamic semantics" for linear logic that would reflect the process of computation while being more mathematically structured 123 than usual operational semantics [START_REF] Girard | Towards a Geometry of Interaction[END_REF][START_REF] Girard | Geometry of Interaction 1: Interpretation of System F[END_REF]. The task of summarizing the wide variety of GoI-related lines of work 124 (such as context semantics (cf. [START_REF] Harry | From Hilbert Spaces to Dilbert Spaces: Context Semantics Made Simple[END_REF]), token machines (see [START_REF] Chardonnet | Geometry of Interaction for ZX-Diagrams[END_REF] for a recent example), etc.) and their diverging points of view is daunting, and we will not attempt it here.

The point is that this allows us to prove Claim 1.4.8 for linear λ-terms using a semantic evaluation argument. However this does not work immediately in the affine case. Fortunately, there are known ways to overcome this technical obstacle. One of them is to leverage the close connection between GoI and the history-free game semantics of the purely affine λ-calculus; this is done for instance in [START_REF] Clairambault | On the Expressivity of Linear Recursion Schemes[END_REF] for an affine version of the λY-calculus (cf. §1.3.4).

It is also worth noting that the purely linear non-commutative λ-calculus admits a GoI-style semantics in a category of planar 125 diagrams [Abr07], with "planarity" defined as the lack of crossings in a standard graphical representation of PFSet-morphisms ( §1.1.9). This representation coincides with the drawings for 2DFA behaviors that often appear in the literature (e.g. [Boj18, p. 45], see also Figure 1.1.1 in this manuscript). Hines [START_REF] Hines | Temperley-Lieb Algebras as two-way automata[END_REF] has suggested looking at the corresponding "two-way automata with planar behaviors" but he did not have any result on their expressive power. In an upcoming paper, we will show: Claim 1.4.10 ([Ngu21]). The languages (resp. functions) recognized by planar two-way automata (resp. transducers) are exactly the star-free languages (resp. FO transductions). Moreover, adding a reversibility restriction keeps their expressive power intact.

These are the obvious conjectures given Theorem 1.2.1 and Claim 1.4.6; we establish along the way that monoids of planar behaviors are aperiodic, which gives us an alternative semantic proof for one direction of Theorem 1.2.1. 126 A semantic evaluation argument could perhaps to applied to the bottom row of Claim 1.4.6 as well by devising a corresponding "planar game semantics" for the purely affine non-commutative λ-calculus (also called the "λ℘-calculus" in [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF]); Aurore Alcolei, Cécilia Pradic and I had begun to think about this but we have not had the time to delve seriously into it.

122 Obj(PFSetΣ) consists of finite sets, Hom PFSet Σ (X, Y ) = (Y × Σ * ) X , and composition of morphisms concatenates the "annotations" in Σ * .

123 About this (ab)use of the word "geometry" to conjure this connotation, see Footnote 42.

124 While Girard's first results [START_REF] Girard | Geometry of Interaction 1: Interpretation of System F[END_REF] took place in operator algebras (from functional analysis), most later works transferred the insights gained from [START_REF] Girard | Geometry of Interaction 1: Interpretation of System F[END_REF] to much more mathematically elementary settings, involving mainly finite combinatorics. In fact a folklore observation is that the operators on a separable Hilbert space H that appear in [START_REF] Girard | Geometry of Interaction 1: Interpretation of System F[END_REF] are just partial injections N N on a fixed basis of H. But Girard later returned to more sophisticated operator-algebraic GoI semantics [START_REF] Girard | Geometry of Interaction V: Logic in the hyperfinite factor[END_REF], cf. Footnote 93. 125 The relationship between planarity and non-commutativity was first discussed in Footnote 33. 126 Our proof of the former is also more conceptually satisfying than the brute-force syntactic argument we gave for the latter in [NP20]: we characterize Green's relations ≤L and ≤R in the monoid of all planar behaviors over a given finite set of states, from which we quickly deduce its H-triviality i.e. aperiodicity.

We conclude this subsection with two remarks on the equivalence between 2DFTs and copyless SSTs in the light of the geometry of interaction. The first one is a technical claim: there is a functor127 PFSet Σ → (SR ˚)⊕ where SR ˚is the counterpart for strings of the category T R ˚from Chapter 6, which induces a translation from 2DFTs to a machine model which resembles single-use-restricted BRTTs but for strings. (Indeed, (SR ˚)⊕ and (SR & ) ⊕ are quite close.) Thus we can give a categorical account of one direction of the equivalence.

The second remark is more high-level: morally, 2DFTs and copyless SSTs make different space-time tradeoffs (no registers vs single-pass processing). This should be compared with the effectiveness of GoI techniques for space-bounded evaluation of λ-terms, 128 as demonstrated for instance in implicit characterizations of logarithmic space complexity based on linear logic [Sch07; DS16; Maz15].

Automata and transducers over infinite alphabets (nominal sets).

One extension that we can consider to our characterization of regular string functions is to work over an infinite alphabet. Following [START_REF] Colcombet | Logics with rigidly guarded data tests[END_REF], let us work with alphabets of the form Σ × A where Σ is finite and A is a countable infinite set of "atoms". A string in (Σ × A) * will then be represented by a term of type

Str A Σ = (Atom → (o o)) → • • • → (Atom → (o o)) |Σ| times → o → o
in some λ-calculus with both unrestricted and affine function arrows, as well as a primitive type Atom and, for each a ∈ A, a corresponding constant a : Atom. The next question is: what operations will be allowed on the type Atom within our chosen λ-calculus? A simple possibility is to have as the only primitive operation an equality test 129 eq τ : Atom Atom (τ & τ ) τ : the only kind of information on atoms that we can inspect is whether two given atoms are equal. Then definable languages in P((Σ × A) * ) are invariant under the natural action of the permutation group S(A) of A, and definable functions (Γ × A) * → (Σ × A) * "commute" with this action.

There is a whole theory of nominal sets concerned with certain sets endowed with an action of S(A). Interestingly, it comes from programming language theory. The initial motivation was to handle syntax with variable renaming (see e.g. [START_REF] Pitts | Nominal techniques[END_REF]) 130 so the idea was not to add atoms to a λ-calculus as we do above, but to manipulate variables in usual λ-terms as permutable atoms. Later on, there has been a lot of work on computability and automata over nominal sets, see [START_REF] Bojańczyk | Slightly Infinite Sets[END_REF].

As we said in Section 1.1.5, the notion of copylessness 131 has recently been demonstrated to be important for automata over nominal sets [START_REF] Bojańczyk | Single-Use Automata and Transducers for Infinite Alphabets[END_REF]: copyless register automata (with finitely many atom-valued registers) recognize a robust class of languages, and copyless SSTs with atoms have good properties such as a decomposition theorem in the style of Krohn-Rhodes and Theorem 1.4.7. Thus one could expect that working in a linear or affine through the change of base induced by Hom(I, -) : (SR ˚)⊕ → Set. This encapsulates in a precise technical way the idea that 2DFT behaviors are composed of a finite state plus finitely many labels; the precise choice of category (SR ˚)⊕ reflects the linearity properties of composition of morphisms with respect to those labels.

128 It was also conjectured for a long time that a GoI token machine for the untyped λ-calculus could satisfy the invariance thesis (Footnote 3) for space, but it now seems that this is probably wrong [START_REF] Accattoli | Interacting Seems Unreasonable, in Time and Space[END_REF]. 129 We do not take the obvious choice eq : Atom Atom I ⊕ I because we want to restrict to negative connectives in order to make syntactic manipulations easier -see the discussion at the start of Chapter 5. 130 Pitts and Gabbay were given the 2019 Alonzo Church Award for Outstanding Contributions to Logic and Computation for introducing nominal sets, see https://archive.md/DLWbA. 131 The paper [START_REF] Bojańczyk | Single-Use Automata and Transducers for Infinite Alphabets[END_REF] uses "single use" to mean "copyless"; this should not be confused with the more permissive "single use restrictions" found in [EM99; AD17].

λ-calculus, we could extend our implicit characterization of regular functions to infinite alphabets. Clovis Eberhart, Cécilia Pradic and I have indeed convinced ourselves that:

Claim 1.4.11. The languages (resp. functions) definable by affine λ-terms (with additives) of type

Str A Σ [τ ] Bool (resp. Str A Γ [τ ] Str A Σ )
for some purely affine τ (where Atom counts as affine) correspond to those studied in [START_REF] Bojańczyk | Single-Use Automata and Transducers for Infinite Alphabets[END_REF].

When we want to generalize to a broader class of alphabets treated in [START_REF] Bojańczyk | Single-Use Automata and Transducers for Infinite Alphabets[END_REF]: the "polynomial orbit-finite sets", which have the form

A n 1 + • • • + A n k (we recover the case Σ × A for n 1 = • • • = n k = 1 and k = |Σ|)
, the situation becomes less satisfying. While the Church-like encoding Str A Σ admits a straightforward generalization, we have only managed to get a characterization where the input and output types do not quite match; specializing it to the case of functions (Γ × A) * → (Σ × A) * , we would characterize those definable by copyless SSTs with atoms by terms of type

Str A Γ (Atom (o o)) → • • • → (Atom (o o)) |Σ| times, note the use of instead of → → o → o
This is a consequence of the details of the copylessness policy in SSTs with atoms, and it might be inevitable. An open question is whether Claim 1.4.11 can be generalized to trees. For instance, one of the equivalent characterizations of recognizability by copyless register automata involves the "rigid MSO" logic from [START_REF] Colcombet | Logics with rigidly guarded data tests[END_REF]. Since this logic does not depend much on the relational structure, and trees with atoms also admit a Church-like encoding, we can ask: Question 1.4.12. For tree languages, is definability in rigid MSO equivalent to expressibility by an affine λ-term of type Tree

A Σ [τ ]
Bool for some purely linear τ ?

Before tackling this, it might seem prudent to first develop the theory of copyless tree automata and tree transducers with atoms, which does not exist yet at the time of writing. But if we keep in mind that copylessness is too restrictive to capture regular tree functions ( §1.2), we can expect the extension of register automata to trees to require more permissive notions of single use restriction. And there is a new difficulty in designing such a notion, compared to usual SSTs over finite (ranked) alphabets: while the contents of registers in SSTs without atoms does not influence the control flow (in other words, they are just potential output pieces that are shuffled around blindly), the whole point of atom-valued registers is to be subjected to equality tests that select conditional branches. This is incompatible with the idea of the ⊕-completion ( §1.2.3) that adds a layer of finite-state control on top of a base category that cannot influence this control. So maybe it could be better to start from λ-terms and only later try to devise equivalent automata models.

Let us also mention that the above-mentioned issue with the ⊕-completion has so far prevented us from finding a suitable denotational model 132 of the purely affine λ-calculus with atoms which would yield Claim 1.4.11 by semantic evaluation. Our current proof idea for this claim uses somewhat ad-hoc syntactic methods. 1.4.5. Polyregular functions in a parsimonious λ-calculus. One of the ICC results capturing logarithmic space that were mentioned at the end of §1.4.3 takes place in Mazza's parsimonious λ-calculus [START_REF] Mazza | Simple Parsimonious Types and Logarithmic Space[END_REF] and uses Church-encoded strings as input. The type system introduced in [Maz15] is monomorphic, so according to the general principle outlined in Section 1.2.1, one would expect to get the regular languages instead. What allows the 132 But the category of nominal sets, without any "single use" or "orbit-finiteness" condition (the languages studied in [START_REF] Bojańczyk | Single-Use Automata and Transducers for Infinite Alphabets[END_REF] are recognized by orbit-finite monoids), is a semantics of the simply typed λ-calculus, and even of higher-order intuitionistic logic, called the Schanuel topos [START_REF] Pitts | Nominal techniques[END_REF]§3].

parsimonious λ-calculus to escape this limitation is that unlike the calculi considered in this dissertation, it does not admit a forgetful functor to the simply typed λ-calculus, because of a non-standard feature 133 that it supports. (Another contrasting example is that Light Linear Logic admits a forgetful functor to usual linear logic.)

The most salient property of the parsimonious λ-calculus, a kind of restriction on nonlinearity that Mazza calls "parsimony", is orthogonal to the above-mentioned non-standard feature. Therefore, if we remove the latter, the resulting system might still be interesting; let us call it the "fully uniform" 134 parsimonious λ-calculus. Its definable languages are indeed the regular languages, with the consequence that the definable string-to-string functions preserve regular languages by preimage. Thus, those functions probably correspond to some transduction class. At this point, let us remind the reader of two facts from §1.2.4:

• parsimony is very similar to layering in SSTs (which led to our reinvention of the latter);

• the class of polyregular functions is the composition closure of layered SSTs. Thanks to this, we can easily translate layered SSTs into fully uniform parsimonious λ-terms and compose those terms to express any polyregular function. The converse seems plausible but it appears to be a difficult problem, which Damiano Mazza, Gabriele Vanoni and I tried unsuccessfully to attack with GoI-like token machines (cf. §1.4.3, see also [START_REF] Accattoli | The (In)Efficiency of interaction[END_REF]).

Conjecture 1.4.13. A function f : Γ * → Σ * is polyregular if and only if it can be expressed by a fully uniform parsimonious λ-term of type

Str Γ [τ ]
Str Σ for some arbitrary type τ .

Note that we do not impose any linearity condition on τ in the above statement. In the λ ⊕& -calculus, if we did not have such a restriction, then we would have access to the full power of the simply typed λ-calculus since linearity only applies when the linear function arrow is used. However, in the parsimonious λ-calculus, all non-linear functions must obey the parsimony condition, which is imposed globally by the type system. 1.4.6. Maximality of (poly)regular functions. Perhaps the right way to see the unproven part ("if") of the above conjecture is not as a property specific to the parsimonious λ-calculus, but as a consequence of something much stronger: Conjecture 1.4.14. If a string function is definable in the simply typed λ-calculus (in the sense of Conjecture 1.4.3) and has polynomial growth, then it is polyregular.

(The connection with Conjecture 1.4.13 is that since the "parsimoniously λ-definable" functions are computable in logarithmic space, they have polynomial growth.) Our main reason for believing this conjecture is that the polyregular functions are the largest "seemingly canonical" class of polynomial growth transductions known today. Similarly, among the existing well-studied string transduction classes with linear growth, regular functions are the largest one. In fact, concerning regular functions, the following property is known:

Theorem 1.4.

([EIM21]). Every string function in E (cf. Section 1.4.1) with linear growth is regular.

133 A first-class type !τ of "ultimately constant streams of elements of type τ " thanks to which n ∈ N can be represented as the stream [true, . . . , true, false, false, . . . ] : !Bool with n times true. In usual linear λ-calculi where the exponential modality '!' appears, !τ is the type of "duplicable data of type τ ", so an inhabitant of type !τ is morally not too different from "infinitely many copies of some inhabitant of τ " or in other words a constant stream. (Such λ-calculi would encode σ → τ as !σ τ , cf. Footnote 112.) 134 The Taylor expansion (Footnote 46) of parsimonious λ-terms with non-constant streams (Footnote 133) is "non-uniform" in the sense of [START_REF] Ehrhard | Uniformity and the Taylor expansion of ordinary lambda-terms[END_REF]. However "non-uniform parsimonious λ-calculus" refers to another system which is "even less uniform" in this sense: streams do not even need to be ultimately constant. It was introduced in [MT15] and the actual reason for its name is that it serves to characterize the circuit complexity class L/poly which is considered the "non-uniform" version of logarithmic space in complexity theory. There are two notions of uniformity involved here, which are morally related but not identical.

It is similar to the above conjecture, especially if Claim 1.4.2 is taken into account. It also entails, as a special case, that polyregular functions with linear growth are regularthis non-trivial fact can also be derived from the MSO dimension minimization theorem of 135 [Boj22a; KNP23], and the comparison-free case will be proved in Chapter 3. This means that our conjecture would imply that string functions definable in the simply typed λ-calculus with linear growth are regular.

1.4.7. Automata and complexity in the polymorphic elementary affine λ-calculus. Coming back to typed λ-calculi, my first application 136 of the ideas from Hillebrand and Kanellakis's Theorem 1.1.4 was to solve a minor open problem from "standard" implicit complexity, concerning a characterization of polynomial time by Baillot et al. 137 [BDR18] that makes use of Church encodings. It takes place in a variant of Elementary Linear Logic which they call the elementary affine λ-calculus; we will refer to it as µEAλ here, following my paper [START_REF] Thành | On the Elementary Affine Lambda-Calculus with and Without Fixed Points[END_REF]. The µ stands for a fixed point operator on types, which means that µEAλ supports recursive types. 138 The question was whether this feature was necessary for the result of [START_REF] Baillot | Characterizing polynomial and exponential complexity classes in elementary lambda-calculus[END_REF]; it turns out that it is, for similar reasons to the necessity of something non-standard in the parsimonious characterization of logarithmic space (see §1.4.5). 139 We call EAλ the system defined by removing recursive types from µEAλ, again following [START_REF] Thành | On the Elementary Affine Lambda-Calculus with and Without Fixed Points[END_REF]. In the statement below, the shape of the first item corresponds to the result on polynomial time in µEAλ.

Theorem 1.4.16 [START_REF] Thành | On the Elementary Affine Lambda-Calculus with and Without Fixed Points[END_REF]). Let L ⊆ Σ * . The following are equivalent:

• L is definable by an EAλ-term of type !Str EAλ Σ !!Bool EAλ . • L is definable by an EAλ-term of type Str EAλ Σ !Bool EAλ . • L is regular.
Here '!' denotes an "exponential modality" 140 which plays a key role in controlling complexity in variants of Elementary Linear Logic. The type Str EAλ Σ differs from our usual linearized Church encoding in two ways. First, it uses '!' in a way that is compatible with a certain "stratification" property of EAλ. Second, it incorporates a quantification over types which allows us to state the above without any type substitution in the input; the type system of EAλ indeed supports polymorphism. The above theorem is proved by combining the syntactic stratification property with a semantic evaluation argument. The latter relies on the following fact (compare with our proof sketch for Theorem 1.1.4): Claim 1.4.17. There exists a finite denotational semantics of the purely affine polymorphic λ-calculus which is non-trivial in the sense that true = false . Such a semantics has also been sketched by Laird [START_REF] Laird | Game semantics for a polymorphic programming language[END_REF], as a stepping stone towards another game semantics for an extension of the usual (non-linear) polymorphic λ-calculus. 141 The finiteness property is explicitly noted at the beginning of [Lai13, §7] (without proof, but it is not hard to check). 135 References edited in March 2023, as explained in the preface. 136 Previously alluded to in Footnote 104. 137 Reformulating the earlier [START_REF] Baillot | On the expressivity of elementary linear logic: Characterizing Ptime and an exponential time hierarchy[END_REF] that took place in a slightly less user-friendly system. 138 We already saw recursive types / fixed points appear in §1.3.3 in relation with circular proofs. But there is a difference: µEAλ supports arbitrary recursive types, whereas logics with fixed points that admit circular proof systems generally have positivity restrictions on recursion (one can define τ = τ ⊕ σ but not τ = τ σ because the left of a function arrow is a "negative" position).

139

Once again, this is evidence for our point that connections with automata sometimes arise more "naturally" than with complexity when studying typed λ-calculi.

140 See also Footnote 133.

141 Also known as System F and previously mentioned in Footnote 37. ). (We can even formulate for k ∈ N a characterization of cfp functions of rank k, i.e. using k + 1 pebbles. 142 ) The proof idea is to extend Laird's game semantics by annotating each move in a strategy with a string in Σ * . This should give a category admitting a functor to the category (SR ˚)⊕ mentioned in §1.4.3. 143 I also discovered that the properties stated in Claim 1.4.17 are also fulfilled by a semantics based on coherence spaces (combining the treatment of affineness in [Mel09, §8.1] and that of polymorphism in [GTL89, Appendix A]). This work has not yet been written up in a satisfactory way due to foundational issues, 144 but it has been applied to sub-polynomial ICC in a prematurely published 146 joint work with Pradic [START_REF] Thành | From normal functors to logarithmic space queries[END_REF]. Since EAλ only recognizes regular languages over Church-encoded strings, we took the idea to take relational structures as inputs instead from [HKM96; HK96] (cf. §1.3.6). We gathered some evidence suggesting 143 Just as for Int(PFSetΣ), we expect this functor to be induced by an underlying enriched category structure over (SR ˚)⊕ (see Footnote 127).

Baillot et al. [BDR18] also give a characterization of string-to-string functions computable in polynomial time

144

For instance there is no precise definition of a categorical semantics of the purely affine (or linear) polymorphic λ-calculus in the literature. Such a definition, and the accompanying soundness result for its interpretation of λ-terms, is expected to be routine, but this work should still be done as a matter of principle! 145 Then there is the question of whether the above-mentioned semantics really do satisfy the categorical axioms. In the case of the coherence space semantics of the polymorphic λ-calculus, this verification has been carried out in [START_REF] Emilia | Some aspects of the categorical semantics for the polymorphic λ-calculus[END_REF], and it is known that Girard's original paper [START_REF] Girard | The system F of variable types, fifteen years later[END_REF] contains a major gap: it does not check that a certain uniformity condition required on morphisms is closed under composition, which is non-trivial (I first rediscovered this for myself, and then learned from Thomas Ehrhard that this was folklore). In general I tend to believe that categorical axiomatics is an important hygienic precaution for anything that pretends to be a denotational semantics; for instance, the axioms for the exponentials of linear logic sometimes fail surprisingly, see [Mel09, §8.7] for a discussion of a historical example and [Rib20, §1.3] for a more recent one. Another important example of a "semantics" that isn't an actual semantics is the so-called "Blass problem" [START_REF] Abramsky | Sequentiality vs. Concurrency In Games And Logic[END_REF].

145

More generally, the "obviousness" of this kind of metatheoretic result relating syntax and semantics has been heavily disputed in the dependent type theory community, particularly by Voevodsky, as discussed in the introduction to [START_REF] De | A Proof and Formalization of the Initiality Conjecture of Dependent Type Theory[END_REF].

146 Its reliance on an unfinished preprint is not the only issue with rigor in this paper; I take full responsibility for this (it really was my fault, not Cécilia's!). I will not dwell on the details of those mistakes of youth here, but my present thoughts on the general phenomenon of "premature publishing" are well reflected by the following quote from Katrin Wehrheim's MIT Women in Mathematics profile (https://archive.md/xwYVr): "'We don't write good papers anymore', she says. Many proofs are published with gaps or unnecessarily complicated logic, as if the author didn't have the time or patience to explain the idea. She likes to use a mountain metaphor: 'It's like if some really well trained climber made it to the mountain top. But they didn't leave any hooks along the way, so someone with less training will have no way of following it without having to find the route for themselves.'" that this gives a characterization of deterministic logarithmic space, though the upper bound that we manage to "prove" in [START_REF] Thành | From normal functors to logarithmic space queries[END_REF] is weaker (but still strictly below P assuming widely believed complexity-theoretic conjectures). Unfortunately, the GoI approach used for previous ICC results [Sch07; DS16; Maz15] on logarithmic space using linear types (mentioned at the end of §1.4.3) does not appear to apply to our setting; instead, we have been exploring an approach using hypercoherences [START_REF] Ehrhard | Hypercoherences: A Strongly Stable Model of Linear Logic[END_REF], but its success might require some difficult algorithmics. 147

Chapter-by-chapter outline

The last role that this introduction needs to fulfill is to explain the plan of the manuscript. The order of chapters is different from the order of exposition of results in this introduction, since it follows logical dependencies. Each chapter starts with a plan detailing its division into sections. Chapters 3 and 7 are based on the publications [START_REF] Thành | Comparison-Free Polyregular Functions[END_REF] and [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF] respectively, while Chapter 2 draws from both of them; those papers were published in the proceedings of the International Colloquium on Automata, Languages and Programming (ICALP). The rest has not yet been subject to peer review. 148 The notations used throughout the dissertation are recapitulated in Section 2.1. In the rest of Chapter 2, we recall all the preexisting material on automata and transducers that will be useful in subsequent chapters, and we prove a few results that did not appear before in the literature 149 (such as the one concerning layered SSTs mentioned in §1.2.4).

The next two chapters contain almost no trace of λ-terms. In Chapter 3 we introduce and study the class of comparison-free polyregular functions ( §1.2.4) from a purely automatatheoretic perspective. This is followed by Chapter 4, which is dedicated to the constructions and results in categorical automata theory announced in §1.2.3.

The remainder of the dissertation is concerned with "implicit automata". Chapter 5 defines the λ ⊕& -calculus and uses the aforementioned category-theoretic material to prove the part of Theorem 1.2.3 that concerns string-to-string functions. In Chapter 6, we extend some results of Chapter 4 to trees in order to finish proving Theorem 1.2.3. Finally, the main subject of Chapter 7 is Theorem 1.2.1 on star-free languages in the λ ℘-calculus, but it also explains why linear (as opposed to affine) λ-calculi without additives are not suitable to characterize transduction classes.

147 See the slides https://nguyentito.eu/2021-01-cgcafe.pdf.

148 Some of it comes from a submission to a journal that was desk-rejected for excessive length.

149

Excluding our own paper [START_REF] Thành | Comparison-Free Polyregular Functions[END_REF] from which most of this material is lifted.

CHAPTER 2

Preliminaries: notations and automata models

This chapter starts with some notations used throughout the entire dissertation, which we put in Section 2.1 for ease of lookup. (Since categories does not appear until Chapter 4 (except for the informal overview in Chapter 1), we have delayed the introduction of their dedicated notation to Section 4.1.1.) After that, it covers many of the function classes and transducer models that we will encounter:

• Sequential transducers ( §2.2) are a very simple machine model whose purpose is mostly illustrative… until Chapter 7 where their Krohn-Rhodes decomposition ( §2.2.1) will play an important technical role. • Streaming string transducers (SSTs), introduced in Section 2.3, are more important since their copyless version ( §2.3.2) define regular functions, one of the classes that we will later characterize using the λ ⊕& -calculus. We introduce some technical tools to work with SSTs in Section 2.3.4, where a special case of the wreath product construction (also used in Krohn-Rhodes) makes an appearance. • Copyful ( §2.3.1) and layered ( §2.3.3) SSTs also admit alternative characterizations in terms of HDT0L systems, which we present in Section 2.4. • Section 2.5 introduces polyregular functions.

• Finally, in Section 2.6, we start with a high-level discussion of how to extend copyless SSTs in order to handle trees, then recall a machine model for regular tree functions.

Almost none of this is an original contribution; the definition of "layered HDT0L system" and the associated Theorem 2.4.5 might be an exception, though it is neither hard nor surprising. We also give some proofs that we could not find in the literature, but which might be folklore.

Notations & elementary definitions

2.1.1. Sets. We follow the convention that natural numbers start at 0, that is, N = {0, 1, . . . }. The cardinality of a set X is written |X|. We sometimes consider a family (x i ) i∈I as a map i → x i , which amounts to treating i∈I X i as a dependent product. Consistently with this, we make use of the dependent sum operation

i∈I X i = {(i, x) | i ∈ I, x ∈ X i }
Recall also that the binary coproduct of sets is the tagged union

X + Y = {in 1 (x) | x ∈ X} ∪ {in 2 (y) | y ∈ Y }
The injection in 1 /in 2 may be omitted by abuse of notation when it is clear from the context, that is, for x ∈ X, we allow ourselves to write x for in 1 (x) when it is understood that this refers to an element of X + Y .

We also write π i : 2.1.2. Strings (a.k.a. words). Alphabets designate finite sets and are written using the variable names Σ, Γ, Π. The set of strings over an alphabet Σ is denoted by Σ * . We write |w| for the length of a word w ∈ Σ * and either w i or w[i] for its i-th letter (i ∈ {1, . . . , |w|}); given a letter c ∈ Σ, the notation |w| c refers to the number of occurrences of c in w.

X 1 × X 2 → X i for the i-th projection of a product (i ∈ {1, 2}).
The concatenation of two strings u, v ∈ Σ * is written uv (or sometimes u • v for clarity); recall that Σ * endowed with this operation is the free monoid over the set of generators Σ, and its identity element is the empty string ε. Given monoids M and N , Hom(M, N ) is the set of monoid morphisms.

Finally, we write Σ = {a | a ∈ Σ} for a disjoint copy of the alphabet Σ made of "underlined" letters.

2.1.3. Ranked trees. Ranked alphabets are pairs (Σ, ar) such that Σ is an alphabet and the arity ar is a family of finite sets1 indexed by Σ; they are written using Σ, Γ. We may write {a 1 : A 1 , . . . , a n : A n } for the ranked alphabet ({a 1 , . . . , a n }, ar) with ar(a i ) = A i .

Given a ranked alphabet Σ, the set Tree(Σ) of trees/terms over a ranked alphabet Σ is defined as usual: if a is a letter of arity X in Σ and t a family of Σ-trees, we write a(t) for the corresponding tree. Examples of such trees are pictured in Figure 2.1.1.

Remark 2.1.1. Given an alphabet Σ, define Σ to be the ranked alphabet (Σ + {ε}, ar) such that ar(in 1 (a)) = { * } and ar(in 2 (ε)) = ∅. This gives a isomorphism Tree(Σ) Σ * , illustrated on the right of Figure 2.1.1.

Sequential transducers

Sequential transducers are among the simplest models of automata with output. They are deterministic finite automata which can append a word to their output at each transition, and at the end, they can add a suffix to the output depending on the final state. A possible reference is [Sak09, Chapter V]. Definition 2.2.1. A sequential transducer with input alphabet Σ and output alphabet Π consists of a set of states Q, a transition function δ :

Q × Σ → Q × Π * , an initial state q I ∈ Q, and a final output function F : Q → Π * . We abbreviate δ st = π 1 • δ and δ out = π 1 • δ.
Given an input string w = w[1] . . . w[n] ∈ Σ * , the run of the transducer over w is the sequence of states q 0 = q I , q 1 = δ st (q 0 , w[1]), …, q n = δ st (q n-1 , w[n]). Its output is obtained as the concatenation δ out (q 0 , w A schematic representation of a sequential transducer whose formal definition is Q = {q a , q b }, δ(q, a) = (q a , a) and δ(q, b) = (q b , bb) for q ∈ Q, q I = q a , F (q a ) = ab and F (q b ) = bbb.

[1]) • . . . • δ out (q n-1 , w[n]) • F (q n ).
A sequential function is a function Σ * → Π * computed as described above by some sequential transducer. Definition 2.2.2. The transition monoid of a sequential transducer is the submonoid of Q → Q (endowed with reverse function composition: f g = g • f ) generated by the maps {δ st (-, c) | c ∈ Σ} (where δ st (-, c) stands for q → δ st (q, c)).

A sequential transducer is said to be aperiodic when its transition monoid is aperiodic (cf. Definition 1.1.2 in §1.1.2). A function that can be computed by such a transducer is called an aperiodic sequential function.

Example 2.2.3. The transducer in Figure 2

.2.1 computes f : w ∈ {a, b} * → a • ψ(w) • b
where ψ is the monoid morphism that doubles every b: ψ(a) = a and ψ(b) = bb. Its transition monoid T is generated by G = {(δ st (-, a) : q → q a ), (δ st (-, b) : q → q b )}; one can verify that T = G ∪ {id} and therefore ∀h ∈ T, h • h = h. Thus, f is an aperiodic sequential function.

2.2.1. The Krohn-Rhodes decomposition and wreath products of monoids. One of the fundamental results of automata theory is a kind of "prime factorization" of sequential functions, which we state below. (Such factorization theorems are also important for larger classes of transductions, see e.g. [START_REF] Bojańczyk | First-order tree-to-tree functions[END_REF], Theorem 1.4.7 and Definition 2.5.1.) Theorem 2.2.4 (Krohn-Rhodes). Any sequential function f : Γ * → Σ * can be realized as a composition

f = f 1 • . . . • f n (with f i : Π * i → Π * i-1 , Π 0 = Σ and Π n = Γ)
where each function f i is computed by: • either a flip-flop transducer, i.e. an aperiodic sequential transducer with 2 states; • or a sequential transducer whose transition monoid is a group.

Note that the example of sequential transducer in Figure 2.2.1 has two states. It is also aperiodic (Example 2.2.3), so it is a flip-flop.

Theorem 2.2.4 is not the standard way to state the Krohn-Rhodes decomposition, though one may find it in the literature, usually without proof (e.g. [Boj18, §1.1]). Usual statements involve either a special case of sequential transducers called Mealy machines (Remark 2.3.10) or, more often, finite monoids (both appear in the original paper2 [KR65]). Here we show how the algebraic formulation can be shown to imply Theorem 2.2.4; this material is well-known among practitioners of automata theory. Definition 2.2.5. A transformation monoid (X, M ) consists of a set X, a monoid M and a right action of M on X (kept implicit in the notation (X, M ), and denoted by (x, m) → x•m). It is finite when both X and M are finite.

Typical transformation monoids are obtained by considering pairs (Q, T ) such that Q is the state space of some transducer (Q, δ, q I , F ) and T is its transition monoid, acting on Q via function application. Next, we recall the algebraic construction that corresponds to composition of sequential functions. Definition 2.2.6. Let (X, M ) and (Y, N ) be two transformation monoids. Their wreath product is a transformation monoid (X, M ) (Y, N ) = (X × Y, W ) where:

• the underlying set of the monoid W is M Y × N ; • the right action of (f, n) ∈ W = M Y ×N on (x, y) ∈ X ×Y is (x, y)•(f, n) = (x•f (y), y •n); • the multiplication on W is (f, n)(g, k) = ((y → f (y)g(y • n)), nk) -it is chosen so that the
above item is a legitimate monoid action.

Proposition 2.2.7. The wreath product of transformation monoids is associative up to canonical3 isomorphism.

Proof sketch. We give a direct description of (X, M ) (Y, N ) (Z, P ) = (X ×Y ×Z, W ):

• the underlying set of the monoid W is M Y ×Z × N Z × P -note that it is canonically isomorphic to (M Y × N ) Z × P ; • the right action is (x, y, z) • (f, g, p) = (x • f (y, z), y • g(z), z • p); • the multiplication on W is (f, g, p)(f , g , p ) = (((y, z) → f (y, z)f (y • n, z • p)), (z → g(z)g (z • p)), pp ).
Definition 2.2.8. A transformation monoid (X, M ) strongly divides (Y, N ) if there exists a submonoid N ≤ N , a surjective morphism ϕ : N M and a surjection s : Y X such that for all y ∈ Y and n ∈ N , s(y

• n ) = s(y) • ϕ(n ). A monoid M divides N if M is the homomorphic image of a submonoid of N .
Proposition 2.2.9. A finite monoid is aperiodic if and only if there are no non-trivial groups that divide it.

Proof. Let M be a finite monoid. Suppose that for x ∈ M , there is no n ∈ N such that x n = x n+1 ; then by finiteness, (x i ) i∈N must be ultimately periodic with period k ≥ 2, and one can define a surjective morphism from the submonoid generated by x to the cyclic group of order k by sending x to the latter's generator. The converse follows a similar reasoning (recall that every non-trivial group contains a non-trivial cyclic subgroup).

Theorem 2.2.10 (Krohn-Rhodes with strong divisors [DKS12, Theorem 4.1]). Every finite transformation monoid (X, M ) strongly divides some wreath product

(Y 1 , N 1 ) . . . (Y n , N n ) where each (Y k , N k ) is either: • the flip-flop (Y k , N k ) = ({1, 2}, {id {1,2} , (x → 1), (x → 2)}) (with the action x • f = f (x)
and the monoid multiplication f g = g • f ); • a finite group G dividing M acting on itself by right multiplication. In particular, if M is aperiodic, (X, M ) strongly divides a wreath product of several copies of the flip-flop transformation monoid.

Remark 2.2.11. The flip-flop transformation monoid is precisely the transition monoid of the transducer of Example 2.2.3 endowed with its action on the set of states.

Remark 2.2.12. We can also require G above to be a simple group. This is the statement given in [START_REF] Volker Diekert | The Krohn-Rhodes Theorem and Local Divisors[END_REF], but group simplicity is not needed for our purposes. (To be more precise, every finite group divides a wreath product of its Jordan-Hölder factors.)

Remark 2.2.13. Let (Y, N ) = (Y 1 , N 1 ) . . . (Y n , N n ).
In both the flip-flop and group cases, the action of N k on Y k is faithful, i.e. two distinct elements of N k act differently on at least one element of Y k . Furthermore, the wreath product of faithful transformation monoids is faithful. Therefore, one can safely identify N with a submonoid of Y → Y . Now let us relate this wreath product operation to sequential functions. This is sufficient to derive Theorem 2.2.4 as a corollary of Theorem 2.2.10. Proposition 2.2.14. Let (Q, δ, q I , F ) be a sequential transducter with transition monoid T describing a function f : Γ * → Σ * . Suppose that (Q, T ) strongly divides some faithful transformation monoid (X, M ) (Y, N ). Then there is an alphabet Π and transducers

(X, δ X , x I , F X ) : Γ * → Π * and (Y, δ Y , y I , F Y ) : Π * → Σ * such that • the sequential functions f X : Γ * → Π * and f Y : Π * → Σ * that they respectively compute verify f = f X • f Y ;
• there are injective homomorphisms T X → M and T Y → N from their respective transition monoids.

Proof. Let (Q, δ, q I , F ) be the transducer under scrutiny.

Let K ⊆ M Y × N such that ϕ : K T , s : X × Y Q be the maps witnessing that (Q, T ) strongly divides (X, M ) (Y, N ).
We choose a pair (x I , y I ) such that s(x I , y I ) = q I and, for each a ∈ Γ, we choose an element

(g a , n a ) ∈ M Y × N which is mapped by ϕ to δ st (-, a) ∈ T . Set Π = (Γ { * }) × Y , (x I , y I ) = s -1 (x, y) and F Y (y) = ( * , y) F X (x) = δ Y (y, a) = (y • m a , y) δ X (x, (a, y)) = (x • g a (y), δ out (s(x), a)) δ X (x, ( * , y)) = (x, F (s(x, y)))
We leave checking that this defines transducers with the expected properties to the reader.

This generalizes to n-fold wreath products in the expected way.

Proposition 2.2.15. Let T be the transition monoid of a sequential transducer with state space Q computing the function f : Γ * → Σ * . Suppose that (Q, T ) strongly divides some wreath product

(X, M ) = (X 1 , M 1 ) . . . (X n , M n ) of faithful transformation monoids. Then f admits a decomposition f = f 1 • . . . • f n (with f i : Π * i → Π * i-1 , Π 0 = Σ and Π n = Γ
) such that for each i ∈ {1, . . . , n}, f i is computed by a sequential transducer whose transformation monoid embeds in M i and with state space X i .

Proof. By induction starting from n = 1.

• For n = 1, let ϕ : K T and s : X Q be the maps witnessing that (Q, T ) strongly divides (X, M ). Let x I be such that s(x I ) = q I , and, for each a ∈ Γ, pick an element m a ∈ K such that ϕ(m a ) = δ st (-, a). Then, letting (Q, δ, q I , F ) being the transducer under scrutiny, a suitable transducer (X, δ , x I , F ) is defined by setting δ (x, a) = (x • m a , δ out (s(x), a)) and F (x) = F (s(x)).

• For n > 1, use Proposition 2.2.14 and the induction hypothesis.

Proof of Theorem 2.2.4. Let (Q, δ, q I , F ) be a transducter computing a certain sequential function f : Γ * → Σ * and let T be its transition monoid. By Theorem 2.2.10, there is a transformation monoid (Y, N ) which can be written as a wreath product (Y, N ) = (Y 1 , N 1 ) . . . (Y k , N k ) such that (Q, T ) strongly divides (Y, N ), and the (Y i , N i ) are either flipflops or groups. By applying Proposition 2.2.15, we may obtain transducers T i implementing sequential functions

f i : Π * i → Π * i+1 such that Π 0 = Γ, Π k = Σ and f = f k-1 • . . . • f 0 .
Furthermore, we know that the state space of T i is Y i and that the corresponding transition monoid T i embeds into N i . Recalling that "being aperiodic" and "being a finite subgroup" are properties stable under homomorphic embeddings, we know that either Y i has cardinality 2 and T i is aperiodic with two states or T i is a group (a trivial group if T was aperiodic, according to Proposition 2.2.9), thus we may conclude.

Streaming string transducers (SSTs)

Following Section 1.1.3, the next classical transduction class after sequential functions would be rational functions. However, we do not have any use for them in this manuscript, so we will skip directly to regular functions. As we have said many times in Chapter 1, we take copyless streaming string transducers (SSTs) as their reference definition. Let us start by recalling the copyful version; the copylessness restriction will be defined later. (This is a bit anachronistic: Alur and Černý first introduced copyless SSTs [AČ10], and only later were copyful SSTs studied by Filiot and Reynier [FR21].) 2.3.1. Copyful SSTs. An SST is an automaton whose internal memory contains, in addition to its control state, a finite number of string-valued registers. It processes its input in a single left-to-right pass. Each time a letter is read, the contents of the registers may be recombined by concatenation to determine the new register values. Formally: Definition 2.3.1. Fix a finite alphabet Σ. Let R and S be two finite sets disjoint from Σ; we shall consider their elements to be "register variables".

For any word ω ∈ (Σ ∪ R) * , we write ω † : (Σ * ) R → Σ * for the map that sends (u r ) r∈R to ω in which every occurrence of a register variable r ∈ R is replaced by u r -formally, we apply to ω the morphism

(Σ ∪ R) * → Σ * that maps c ∈ Σ to itself and r ∈ R to u r . A register assignment α from R to S (over Σ) is a map α : S → (Σ ∪ R) * . It induces the action α † : u ∈ (Σ * ) R → (α(s) † ( u)) s∈S ∈ (Σ * ) S (which indeed goes "from R to S").
For instance, t : Z → aXbY is a register assignment from {X, Y } to {Z} over the alphabet {a, b} and t † (X → b, Y → aa) = (Z → abbaa).

Remark 2.3.2. Some papers e.g. [AFT12; DJR18] call register assignments substitutions. We avoid this name since it differs from its meaning in the context of our "composition by substitution" operation (next chapter) or of the λ-calculus (in the rest of the manuscript).

We will also use the name register transition later for a slight variant of the above definition that is more convenient for our category-theoretic developments (Definition 4.2.10).

Definition 2.3.3 ([FR21]

). A (deterministic copyful) streaming string transducer (SST) with input alphabet Γ and output alphabet Σ is a tuple T = (Q, q 0 , R, δ, u I , F ) where • Q is a finite set of states and q 0 ∈ Q is the initial state; • R is a finite set of register variables, that we require to be disjoint from Σ;

• δ : Q × Γ → Q × (R → (Σ ∪ R) * ) is the transition function -we abbreviate δ st = π 1 • δ and δ reg = π 2 • δ; • u I ∈ (Σ * ) R describes the initial register values; • F : Q → (Σ ∪ R) * describes
how to recombine the final values of the registers, depending on the final state, to produce the output. The function

Γ * → Σ * computed by T is w 1 . . . w n → F (q n ) † • δ reg (q n-1 , w n ) † • . . . • δ reg (q 0 , w 1 ) † ( u I )
where the sequence of states (q i ) 0≤i≤n (sometimes called the run of the transducer over the input word) is inductively defined, starting from the fixed initial state q 0 , by q i = δ st (q i-1 , w i ). An example of SST with 2 states is given in Figure 2.3.1. We also provide below an example of a single-state SST (recall the underlined alphabet notation from Section 2.1).

X ← ε Y ← ε Y ε X ← ε Y ← Y X a ∈ Σ X ← aX Y ← Y X ← ε Y ← XY a ∈ Σ X ← Xa Y ← Y (Σ { }) * → Σ * (w i ∈ Σ * , (Σ { }) * ∼ = Σ * ( Σ * ) * ) w 0 → ε w 0 . . . w 2k → reverse(w 2k-1 )reverse(w 2k-3 ) . . . reverse(w 1 )w 0 w 2 . . . w 2k-2 w 0 . . . w 2k+1 → ε
Example 2.3.4. Let Σ = Γ ∪ Γ. We consider a SST T with Q = {q}, R = {X, Y } and u I = (ε) r∈R F (q) = Y ∀c ∈ Γ, δ(q, c) = (q, (X → cX, Y → cXY ))
If we write (v, w) for the family (u r ) r∈R with u X = v and u Y = w, then the action of the register assignments may be described as

(X → cX, Y → cXY ) † (v, w) = (c • v, c • v • w).
Let 1, 2, 3, 4 ∈ Γ. After reading 1234 ∈ Γ * , the values stored in the registers of T are

(X → 4X, Y → 4XY ) † • . . . • (X → 1X, Y → 1XY ) † (ε, ε) = (4321, 4321321211) Since F (q) = Y ,

Definition 2.3.5 ([AČ10]

). A register assignment α : S → (Σ ∪ R) * from R to S is said to be copyless when each r ∈ R occurs at most once among all the strings α(s) for s ∈ S, i.e. it does not occur at least twice in some α(s), nor at least once in α(s) and at least once in α(s ) for some s = s . (This restriction does not apply to the letters in Σ.) A streaming string transducer is copyless if all the assignments in the image of its transition function are copyless. In this dissertation, we take computability by copyless SSTs as the definition of regular functions (but see Theorem 3.2.3 for another standard definition).

Remark 2.3.6. The SST of Example 2.3.4 is not copyless: in a transition α = δ reg (q, c), the register X appears twice, once in α(X) = cX and once in α(Y ) = cXY ; in other words, its value is duplicated by the action α † . In fact, it computes a function whose output size is quadratic in the input size, while regular functions have linearly bounded output.

Example 2.3.7 (Iterated reverse). The following single-state SST is copyless:

Γ = Σ with # ∈ Σ Q = {q} R = {X, Y } u I = (ε) r∈R F (q) = XY δ(q, #) = (q, (X → XY #, Y → ε)) ∀c ∈ Σ \ {#}, δ(q, c) = (q, (X → X, Y → cY )) For u 1 , . . . , u n ∈ (Σ \ {#}) * , it maps u 1 # . . . #u n to reverse(u 1 )# . . . #reverse(u n ). (This function is taken from [Boj18, p. 1].)
The concrete SSTs (copyless or not) that we have seen for now are all single-state, except for Figure 2.3.1. A source of stateful copyless SSTs is the following: Proposition 2.3.8. Every sequential function is regular.

Proof idea. Any sequential transducer can be translated into a copyless SST with the same set of states and a single register.

In fact, states are strictly necessary for this, as the example below shows.

Proposition 2.3.9. The sequential (and therefore regular) function defined by the aperiodic sequential transducer below cannot be computed by a single-state copyless SST.

1 2 a|a, c|a b|a b|b, c|b a|a

We did not find Proposition 2.3.9 stated the literature, though it is probably well-known among experts; we will give a proof at the end of Section 2.3.4 once we have recalled the necessary algebraic machinery.

Remark 2.3.10. Compared to Figure 2.2.1, the transducer of Proposition 2.3.9 has the particularity of being letter-to-letter: each transition outputs exactly one letter, and the final output word is empty. Letter-to-letter sequential transducers are also known as a Mealy machines, and the functions computed by aperiodic Mealy machines form one of the weakest classical transduction classes.

Finally, let us recall some basic properties of regular functions: Proposition 2.3.11 (folklore, e.g. [AČ10, Proposition 2]). Let f, g : Γ * → Σ * be regular functions and L ⊆ Γ * be a regular language. The function that coincides with f on L and with g on Γ * \ L is regular, and so is w → f (w) • g(w).

Proof. Both are easy exercises involving a "product construction" on SSTs: if f and g are computed by copyless SSTs with states Q f , Q g and register variables R f , R g , and L is recognized by some finite monoid M , then the "regular conditional" is computed by a copyless SST with states

Q f × Q g × M and registers R f + R g , while the concatenation is computed by an SST with states Q f × Q g and registers R f + R g .
Proposition 2.3.12 (special case of Theorem 2.3.14(i)). Every regular function f has a linearly bounded output length: |f (w)| = O(|w|).

Layered SSTs. An intermediate machine model between copyful and copyless SSTs

-where duplication is controlled, but not outright forbidden -has been recently introduced by Douéneau-Tabot et al. [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF]. Its interest is justified by Theorem 2.3.14 below; for now let us recall its definition.

Definition 2.3.13 ([DFG20]). Let k ∈ N and α : R → (Σ ∪ R) * . The register assignment α is k-layered with respect to a partition R = R 0 . . . R k when for 0 ≤ i ≤ k, • for r ∈ R i , we have α(r) ∈ (Σ ∪ R 0 ∪ . . . ∪ R i ) * ;
• each register variable in R i appears at most once among all the α(r) for r ∈ R i (however, those from R 0 . . . R i-1 may appear an arbitrary number of times).

A streaming string transducer is k-layered if its registers can be partitioned in such a way that all assignments in the transitions of the SST are k-layered w.r.t. that partition.

Beware: with this definition, the registers of a k-layered SST are actually divided into k + 1 layers, not k. For instance, the transducer of Example 2.3.4 is 1-layered with R 0 = {X} and R 1 = {Y }, and copyless SSTs are the same thing as 0-layered SSTs.

There also exist register assignments that cannot be made k-layered no matter the choice of partition, such as X → XX. Using such assignments, one can indeed build SSTs that compute functions f such that e.g. |f (w)| = 2 |w| . This kind of superpolynomial growth turns out to be the only obstruction to the existence of an equivalent layered SST, according to the following result.

Theorem 2.3.14 [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF]). Let f : Γ * → Σ * and k ∈ N. The following are equivalent:

(i) f is computed by a copyful SST and |f (w)| = O(|w| k+1 ); (ii) f is computed by some k-layered SST;
(iii) f is computed by some k-marble transducer -an automata model introduced in [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF] and mentioned in §1.2.4, that we will not use it in the rest of this dissertation.

Remark 2.3.15. This use of a syntactic "layering" condition to characterize the polynomially growing functions computable by SSTs arguably has an old precursor: Schützenberger's theorem on polynomially bounded Z-rational series, which dates back to the 1960s (see for instance [BR10, Chapter 9, Section 2] -the preface of the same book describes this theorem as "one of the most difficult results in the area"). Let us give a brief exposition. For a semiring S, a function f : Σ * → S is sometimes called a "series" because it can be seen as formal power series in several non-commuting indeterminates (or variables). Indeed, each letter of Σ can be seen as an indeterminate, and a word in Σ * is then considered as a formal product, i.e. a monomial. Then the function f corresponds to the coefficients of

w∈Σ * f (w) • w A Z-rational series f : Σ * → Z is a function of the form f : w ∈ Σ * → X T • Φ(w) • Y where X, Y ∈ Z R
and Φ is a morphism from Σ * to the multiplicative monoid of R-indexed square matrices over Z, for some finite set R. (For more on rational series over any semiring, and how they can be seen as generalizations of regular languages, see [START_REF] Sakarovitch | Elements of Automata Theory[END_REF]Chapter III].) This data (X, Φ, Y ) has a clear interpretation as a "simple SST" (a single-state SST with an additional condition, cf. Remark 2.4.3) with register set R, whose register values are integers rather than strings. Schützenberger's theorem says that any Z-rational series f with polynomial growth (i.e. |f (w)| = |w| O(1) where | • | on the left is the absolute value) can be written as f : w → X T • Φ(w) • Y where (i) the image of Φ has a block triangular structure; (ii) the projection of this image on each diagonal block is a finite monoid.

The first item gives us a partition of the register into layers where each layer "depends" only on the ones below them. The finiteness condition in the second item is equivalent to having bounded coefficients, which means that the register assignments within each layer are bounded-copy, while in a layered SST, they would be copyless instead -but bounded-copy SSTs are known to be equivalent to copyless SSTs4 (see e.g. [AFT12; DJR18]). The theorem also states a relationship between the number of blocks and the growth rate.

Via the canonical isomorphism {a} * ∼ = N, streaming string transducers with unary output alphabet compute N-rational series. The counterpart of Schützenberger's theorem over N is thus a corollary of the results of [DFG20] on layered SSTs. 2.3.4. Transition monoids of (copyless) SSTs. We now recall a central tool to study streaming string transducers, that also prefigures their category-theoretic treatment: the monoid structure on register assignments (see e.g. [AFT12, §III.C]).

Definition 2.3.16. Let M R,Σ = R → (Σ ∪ R) * for R ∩ Σ = ∅.
We endow it with the following composition operation, that makes it into a monoid:

α • β = α • β where α ∈ Hom((Σ ∪ R) * , (Σ ∪ R) * ), α (x) = α(x) for x ∈ R x for x ∈ Σ
The monoid M R,Σ thus defined is isomorphic to a submonoid of Hom((Σ ∪ R) * , (Σ ∪ R) * ) with function composition. It admits a submonoid of copyless assignments. Definition 2.3.17. We write M cl R,Σ for the set of all α ∈ M R,Σ such that each letter r ∈ R occurs at most once among all the α(r ) for r ∈ R.

Proposition 2.3.18. M cl R,Σ is a submonoid of M R,Σ .
In other words, copylessness is preserved by composition (and the identity assignment is copyless).

The following proposition ensures that this composition does what we expect. Recall from Definition 2.3.1 that (-) † interprets register assignments as functions on tuples of strings, i.e. it sends M R,Σ to

(Σ * ) R → (Σ * ) R . Proposition 2.3.19. For all α, β ∈ M R,Σ , we have (α • β) † = β † • α † . In other words, (-) † is a monoid morphism if we endow (Σ * ) R → (Σ * ) R with reverse function composition (just as we did for Q → Q in Definition 2.

2.2).

To incorporate information concerning the states of an SST, we use a construction that can be seen as special case of the wreath product of transformation monoids (Definition 2.2.6): the reader may check that the monoid denoted by M Q below is canonically isomorphic to the wreath product (M, M ) (Q, Q → Q) (which justifies our notation for the former).

Definition 2.3.20. Let M be a monoid; let m • m denote the multiplication of m, m ∈ M . We define M Q as the monoid whose set of elements is Q → Q × M and whose multiplication is, for µ, µ : Q → Q×M , (writing π 1 : Q×M → Q and π 2 : Q×M → M for the projections)

(µ • µ ) : q → (π 1 • µ • π 1 • µ(q), (π 2 • µ(q)) • (π 2 • µ • π 1 • µ(q))) Proposition 2.3.21. Let (Q, q 0 , R, δ, u I , F ) be an SST that computes f : Γ * → Σ * (using the notations of Definition 2.3.3). For all c ∈ Γ, we have δ(-, c) ∈ M R,Σ Q, and the SST is copyless if and only if {δ(-, c) | c ∈ Γ} ⊆ M cl R,Σ Q. Furthermore, for all w 1 . . . w n ∈ Γ * , f (w 1 . . . w n ) = F (g(q 0 )) † (α † ( v)) where (g, α) = δ(-, w 1 ) • • • • • δ(-, w n )
Finally, it can be useful to consider assignments over an empty output alphabet. This allows us to keep track of how the registers are shuffled around by transitions.

Proposition 2.3.22. Let R and Σ be disjoint finite sets. There is a monoid morphism

M R,Σ → M R,∅ , that sends the submonoid M cl R,Σ to M cl R,∅ . For any Q, this extends to a morphism M R,Σ Q → M R,∅ Q that sends M cl R,Σ Q to M cl R,∅ Q.
We shall use the name erase Σ for both morphisms (R and Q being inferred from the context). Proof of Proposition 2.3.9. Consider any single-state copyless SST computing some g : {a, b, c} * → {a, b} * with a set of registers R. We wish to show g does not coincide with the function computed by the sequential transducer of Proposition 2.3.9.

Let ω ∈ ({a, b} ∪ R) * be the image of the single state by the output function, and for each letter x ∈ {a, b, c}, let α x : R → ({a, b} ∪ R) * be the copyless assignment performed by the SST when it reads x (that is, using the notations of Definition 2.3.3, ω = F (q) and α x = δ reg (q, x) with Q = {q}). Let u be the initial register contents. Then

∀x ∈ {a, b, c} * , ∀n ∈ N, g(x • c n ) = ω † • (α † c ) n • α † x ( u) Let ω n = (α c
) n (ω), using the notation (-) from Definition 2.3.16; in particular ω 0 = ω. One can check that, for all n ∈ N:

• ω † n = ω † • (α † c ) n ; • since α c is copyless, |ω n | r ≤ |ω| r for all r ∈ R, writing |w| x for the number of occurrences of x in w ∈ Σ * for x ∈ Σ. Let (v x,r ) r∈R = α † x ( u) for x ∈ {a, b, c}; that is, v x,
r the value stored in the register r ∈ R after the SST has read the single letter x. We can rewrite the above equation as

∀x ∈ {a, b, c} * , ∀n ∈ N, g(x • c n ) = ω † n ((v x,r ) r∈R ) and derive a numerical (in)equality ∀x ∈ {a, b, c} * , ∀n ∈ N, |g(x • c n )| a = |ω n | a + r∈R |ω n | r |v x,r | a = n→+∞ |ω n | a + O(1)
using the fact that |ω n | r , as a non-negative quantity lower than the constant |ω| r , is O(1).

From this, it follows that as n increases, the difference between |g(a • c n )| a and |g(b • c n )| a stays bounded. This property distinguishes g from the f : {a, b, c} * → {a, b} * computed by the transducer given in Proposition 2.3.9, since

∀n ∈ N, |f (a • c n )| a = a n+1 a = n + 1 and |f (b • c n )| a = b n+1 a = 0 2.4. HDT0L transductions
Filiot and Reynier [START_REF] Filiot | Copyful Streaming String Transducers[END_REF] characterized the expressive power of copyful SSTs using some kind of L-systems. The latter were originally introduced by Lindenmayer [START_REF] Lindenmayer | Mathematical models for cellular interactions in development II. Simple and branching filaments with two-sided inputs[END_REF] in the 1960s as a way to generate formal languages, with motivations from biology. While this language-centric view is still predominant, the idea of considering variants of L-systems as specifications for string-to-string functions -whose range are the corresponding languagesseems to be old. For instance, in a paper from 1980 [START_REF] Engelfriet | Tree Transducers, L Systems, and Two-Way Machines[END_REF], one can find (multi-valued) string functions defined by some flavor of L-systems called "ET0L". For SSTs, the right notion is the following: Definition 2.4.1 (following [START_REF] Filiot | Copyful Streaming String Transducers[END_REF]). A HDT0L system consists of:

• an input alphabet Γ, an output alphabet Σ, and a working alphabet ∆ (all finite);

• an initial word d ∈ ∆ * ; • for each c ∈ Γ, a monoid morphism h c ∈ Hom(∆ * , ∆ * ); • a final morphism h ∈ Hom(∆ * , Σ * ). It defines the transduction taking w = w 1 . . . w n ∈ Γ * to h • h w 1 • . . . • h wn (d) ∈ Σ * .
Theorem 2.4.2 ([FR21]). A function Γ * → Σ * can be computed by a copyful streaming string transducer ( §2.3.1) if and only if it can be specified by an HDT0L system.

Other equivalent ways to define this class of functions, which we call HDT0L transductions, include catenative recurrent equations, higher-order pushdown transducers of level 2 (both by Ferté, Marin and Sénizergues [FMS14]5 ) and unbounded marble transducers [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF].

Remark 2.4.3. As observed in [FR21, Lemma 3.3], there is a natural translation from HDT0L systems to SSTs whose range is composed precisely of the single-state SSTs whose transitions and final output function do not access the letters of their output alphabet -those are called simple SSTs in [DFG20, §5.1]. This involves a kind of reversal: the initial register values correspond to the final morphisms, while the final output function corresponds to the initial word. Thus, Theorem 2.4.2 is essentially a state elimination result; a direct translation from SSTs to single-state SSTs6 has also been given in Benedikt et al.'s paper on polynomial automata 7 [Ben+17, Proposition 8]. However, it does not preserve the subclass of copyless SSTs (this would contradict Proposition 2.3.9).

In more detail, an HDT0L system (Γ, Σ, ∆, d, (h c ) c∈Γ , h ) is equivalent to the streaming string transducer specified by the following data:

• a singleton set of states: Q = {q}; • the working alphabet as the set of registers: R = ∆ (minor technicality: if ∆ ∩ Σ = ∅, one should take R to be a copy of ∆ that is disjoint from Σ);

• h c ∈ Hom(∆ * , ∆ * ) ∼ = (∆ → ∆ * ) ⊆ (∆ → (Σ ∪ ∆) * )
as the register assignment associated to an input letter c ∈ Γ -in other words, the transition function is δ : (q, c) → (q, (h c ) ∆ ); • (h (r)) r∈∆ ∈ (Σ * ) R as the initial register values;

• F : q → d as the final output function (d ∈ ∆ * ⊆ (Σ ∪ ∆) * ).
The cases of the transition and output functions involve a codomain extension from ∆ * to (Σ ∪ ∆) * . This reflects the intuition that a HDT0L system "cannot access the output alphabet" (except in the initial register contents).

To prove the equivalence, the key observation is that h c is turned into δ(-, c) by a morphism from Hom(∆ * , ∆ * ) to M ∆,∅ {q} ⊂ M ∆,Σ {q}, using the notations from Section 2.3.4. We leave the details to the reader. 2.4.1. Layered HDT0L systems. Let us transpose the layering condition ( §2.3.3) from streaming string transducers to HDT0L systems. The hierarchy of models that we get corresponds with an offset to layered SSTs.

Definition 2.4.4. A HDT0L system (Γ, Σ, ∆, d, (h c ) c∈Γ , h ) is k-layered if its working alphabet can be partitioned as ∆ = ∆ 0 • • • ∆ k such that, for all c ∈ Γ and i ∈ {0, . . . , k}: • for r ∈ ∆ i , we have h c (r) ∈ (∆ 0 • • • ∆ i ) * ;
The lookahead elimination theorem for macro tree transducers [EV85, Theorem 4.21] arguably generalizes this to trees. Indeed, lookahead in MTTs corresponds to bottom-up states in register transducers according to the duality sketched at the beginning of Chapter 6. • each letter in ∆ i appears at most once among all the h c (r) for r ∈ ∆ i (but those in ∆ 0 • • • ∆ i-1 may appear an arbitrary number of times).

Theorem 2.4.5. For k ∈ N, a function can be computed by a k-layered SST if and only if it can be specified by a (k + 1)-layered HDT0L system. In particular, regular functions correspond to 1-layered HDT0L systems.

Proof of (⇒). The translation from SSTs to HDT0L systems in [FR21, Lemma 3.5] turns out to work. It is also formulated in terms of "simple SSTs" (isomorphic to HDT0L systems, cf. Remark 2.4.3) in [DFG20, §5.1], where the authors remark that it "does not preserve copylessness nor k-layeredness": indeed, what we show is that it increments the number of layers by one! For the sake of clarity, we give an alternative presentation that decomposes it into two steps.

Let Γ be the input alphabet and Σ be the output alphabet. Let T be a streaming string transducer with a k-layered set of register variables R = R 0 • • • R k . First, we build a (k + 1)-layered SST T that computes the same function, with the set of registers

R = Σ ∪ R = R 0 • • • R k+1 R 0 = Σ ∀i ∈ {1, . . . , k + 1}, R i = R i-1
assuming Σ ∩ R = ∅, and whose register assignments are without fresh letters: the range of every α : R → (Σ ∪ R ) * is included in R * , which allows us to write α : R → R * . This already brings us closer to the definition of HDT0L systems, since

(R → R * ) ∼ = Hom(R * , R * ).
Similarly, we will ensure that the range of the output function of

T is included in R . Let underline Σ ∈ Hom((Σ ∪ R) * , (Σ ∪ R) *
) be defined in the expected way, and note that its codomain is equal to R * . We specify T as follows (and leave it to the reader to check that this works):

• the state space Q, initial state and state transitions are the same as those of T ;

• the initial value of r ∈ R is the same as for T if r ∈ R, or the single letter c if r = c ∈ Σ; • every assignment α : R → (Σ ∪ R) that appears in some transition of T becomes, in T ,

α : R * → R * α : c ∈ Σ → c α : r ∈ R → underline Σ (α(r))
• its output function is F = underline Σ • F where F is the output function of T .

Thus, the idea is to store a copy of c ∈ Σ in the register c. Since this register may feed in a copyful way all other registers (in a SST, there are no restrictions on the use of output alphabet letters), it must sit at the lowest layer, hence R 0 = Σ and the resulting offset. Next, we turn T into an equivalent HDT0L system with (k +1)-layered working alphabet

∆ = R × Q = ∆ 0 . . . ∆ k+1 ∀i ∈ {0, . . . , k + 1}, ∆ i = R i × Q For q ∈ Q, let pair q ∈ Hom(R * , ∆ * ) be such that pair q (r ) = (r , q) for r ∈ R . Let Q = {q (1) , .
. . , q (n) } be the states of T (which are also those of T ), with q (1) being its initial state8 . Using the fact that T is without fresh letters, let F : Q → R * be its final output function. The initial word of our HDT0L system is then

d = pair q (1) F q (1) • . . . • pair q (n) F q (n) ∈ ∆ *
From the initial register values (u I,r ) r ∈R ∈ (Σ * ) R of T , we define the final morphism:

h ∈ Hom(∆ * , Σ * ) ∀r ∈ R , h r , q (1) = u I,r and ∀q = q (1) , h (r , q) = ε Finally, let δ st : Q → Q and δ reg : Q → (R → R * ) be the components of the transition function of T . The morphisms h c ∈ Hom(∆ * , ∆ * ) for c ∈ Γ send (r , q) ∈ ∆ to h c (r , q) = pair q (i 1 ) (δ reg (q (i 1 ) , c)(r )) • . . . • pair q (im) (δ reg (q (im) , c)(r ))
where i 1 < . . . < i m and {q (i 1 ) , . . . , q (im) } = {q (?) ∈ Q | δ st (q (?) , c) = q}.

Checking that this HDT0L system computes the right function is a matter of mechanical verification, that has already been carried out in [START_REF] Filiot | Copyful Streaming String Transducers[END_REF]. To wrap up the proof, we must justify that it is (k + 1)-layered. To do so, let us fix a letter c ∈ Γ and two layer indices i, j ∈ {0, . . . , k + 1}, and count the number N r ,q of occurrences of (r , q) ∈ ∆ i among all the h c (r , q) for (r , q) ∈ ∆ j . The letter (r , q) can only appear in h c (r , q) when q = δ(q, c), and in that case, its occurrences (if any) are in the substring pair q (δ reg (q, c)(r )). So N r ,q counts the occurrences of r ∈ R i among the δ reg (q, c)(r ) for r ∈ R j . Since T is a (k + 1)-layered SST, we are done.

Proof of (⇐). The translation from HDT0L systems to single-state SSTs mentioned in Remark 2.4.3 is not enough: starting from a (k + 1)-layered HDT0L system, it gives us a (k + 1)-layered SST. But we can bring this down to k layers by adding states.

Let

(Γ, Σ, ∆, d, (h c ) c∈Γ , h ) be a HDT0L system (d ∈ ∆ * , h c ∈ Hom(∆ * , ∆ * ) for c ∈ Γ, and h ∈ Hom(∆ * , Σ * )). Suppose that it is (k + 1)-layered with ∆ = ∆ 0 • • • ∆ k+1 . This entails that h c (∆ 0 ) ⊆ ∆ *
0 , and furthermore that (h c ) ∆ 0 : ∆ 0 → ∆ * 0 satisfies a copylessness condition, that may succinctly be written as (h c ) ∆ 0 ∈ M cl ∆ 0 ,∅ (cf. Definition 2.3.17). We define a k-layered SST with: • M cl ∆ 0 ,∅ as the set of states (finite by Proposition 2.3.24), with the identity element of the monoid as its initial state;

• the set of registers R = ∆ \ ∆ 0 = ∆ 1 • • • ∆ k+1 , whose i-th layer is the (i + 1)-th layer
of the original HDT0L system (0 ≤ i ≤ k); • the initial register contents (h (r)) r∈R -recall that h is the final morphism;

• the transition function (α, c) → (α • (h c ) ∆ 0 , (h ∆ * 0 • α) • (h c ) R ) where (-) extends functions ∆ 0 → Σ * into morphisms in Hom((∆ ∪ Σ) * , (R ∪ Σ) * ) that map each letter in R ∪ Σ to itself (since ∆ = ∆ 0 R, the domain of these morphisms is (∆ 0 R Σ) * ); • the final output function α → (h ∆ * 0 • α) (d).
The layering condition for this SST is inherited from the layering of the original HDT0L system, and one can check the functions computed by the two are the same.

Corollary 2.4.6. Every regular function can be computed by a single-state 1-layered SST.

Proof. Any regular function is definable by some copyless SST, i.e. 0-layered SST. By Theorem 2.4.5, it can be turned into a 1-layered HDT0L system. The latter can be translated to a single-state SST by the naive construction of Remark 2.4.3. As can readily be seen from the definitions, this construction preserves the 1-layered property.

The converse does not hold: the single-state 1-layered SST of Example 2.3.4 computes a function which is not regular (cf. Remark 2.3.6). However, 1-layered HDT0L systems -or equivalently 1-layered "simple SSTs", cf. Remark 2.4.3 -do characterize regular functions according to Theorem 2.4.5. Thus, there is a one-way transducer model for regular functions that does not use an explicit control state. This is in contrast with copyless SSTs, whose expressivity critically depends on the states (unlike copyful SSTs), cf. Proposition 2.3.9.

Polyregular functions

Let us now recall the penultimate class of string transductions that we will considerthe last one will be, of course, the new one that we will introduce in Chapter 3. Definition 2.5.1 (Bojańczyk [Boj18]). The class of polyregular functions is the smallest class of string-to-string functions closed under composition containing:

• the sequential functions ( §2.2); • the "iterated reverse" function of Example 2.3.7, over any finite alphabet containing #;

• the "squaring with underlining" functions squaring Γ : Γ * → (Γ ∪ Γ) * , for any finite alphabet Γ, illustrated by squaring Γ (1234) = 1234123412341234.

We can state a variant of Definition 2.5.1 which is a bit more convenient for us.

Proposition 2.5.2. Polyregular functions are the smallest class closed under composition that contains the regular functions and the squaring with underlining functions squaring Γ .

Proof. One direction of the equivalence follows from the fact that all regular functions are polyregular. This is stated in the introduction to [START_REF] Bojańczyk | Polyregular Functions[END_REF] and can also be recovered from Proposition 2.5.4 below (since copyless SST are 0-layered). For the converse, observe that:

• sequential functions are regular (Proposition 2.3.8);

• since the SST of Example 2.3.7 is copyless, the iterated reverse function is regular.

The name "polyregular" is justified by: Proposition 2.5.3. Every polyregular function f has a polynomially bounded output:

|f (w)| = |w| O(1)
Proof. This property is preserved by composition and satisfied by both regular functions (that are linearly bounded) and squaring (which has quadratic growth). Proof. We have already alluded to the simplest way to see this in §1.2.4, and it goes through machine models that we have not properly introduced: it is asserted in [DFG20, §6] -and the reader familiar with the definitions can easily check this -that k-marble transducers (mentioned in Theorem 2.3.14), which are equivalent to k-layered SSTs, can be seen as a special case of pebble transducers [Boj18, §6] (see also Section 3.2), a device that computes polyregular functions.

Combining this with Theorem 2.3.14(i) and Proposition 2.5.3, we have:

Corollary 2.5.5. A string-to-string function can be computed by a layered SST if and only if it is both a polyregular function and an HDT0L transduction.

The two conditions are not redundant: we have already seen that there exist exponentially growing HDT0L transductions, that cannot be polyregular; conversely, we shall see in the next chapter (to be precise, in Theorem 3.5.1) that some polyregular functions are not HDT0L. Thus, the functions computed by layered SST do not coincide with either of those classes. However, if we take their composition closure, then we get: Theorem 2.5.6. Let f : Γ * → Σ * . The following are equivalent:

(i) f is polyregular;

(ii) f can be obtained as a composition of layered SSTs;

(iii) f can be obtained as a composition of single-state 1-layered SSTs.

As an immediate consequence:

Corollary 2.5.7 (claimed in [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF]§6]). Layered SSTs are not closed under composition.

Proof of Theorem 2.5.6 (i) ⇒ (iii). Thanks to Proposition 2.5.2, we know that any polyregular functions can be written as a composition of a sequence of functions, each of which is either regular or equal to squaring Γ for some finite alphabet Γ. It suffices to show that each function in the sequence can in turn be expressed as a composition of single-state 1-layered SSTs. We decompose squaring Γ as

1234 → 4321321211 → 1234123412341234
The first step is performed by the SST of Example 2.3.4, which has a single state and, as mentioned in Section 2.5, is 1-layered. The second step can be implemented using a SST with a single state q (that we omit below for readability), two registers X (at layer 0) and Y (at layer 1) with empty initial values, an output function F (q) = Y , and

∀c ∈ Γ, δ(c) = (X → X, Y → cY ) and δ(c) = (X → cX, Y → cXY )
As for regular functions, Corollary 2.4.6 takes care of them.

Proof of Theorem 2.5.6 (iii) ⇒ (ii). Immediate by definition.

Proof of Theorem 2.5.6 (ii) ⇒ (i). Proposition 2.5.4 applies in particular to singlestate 1-layered SSTs. Therefore, their composition is also polyregular (indeed, according to Definition 2.5.1, polyregular functions are closed under composition).

Polynomial list functions.

Let us also report briefly on the functional formalism for polyregular functions [Boj18, Section 4] that we mentioned in Section 1.3.3. The explanation is geared towards a reader familiar with typed λ-calculi.

The λ-terms defining the polynomial list functions are generated by the grammar of simply typed λ-terms enriched with constants, whose meaning can be specified by extending the naive set-theoretic semantics from Section 1.1.7 (one can also extend the β-reduction rules correspondingly). For instance, given a finite set S and a ∈ S, every element of S can be used as a constant, another allowed constant is is S a and we have

is S a t = true if a = t is a t = false if t ∈ S \ {a}
The grammar of simple types and the typing rules are also extended accordingly. For instance, any finite set S induces a type also written S, such that every element a ∈ S corresponds to a term a : S of this type with a = a. There are also operations expressing the cartesian product (×) and disjoint union (+) of two types; and, for any type τ , there is a type τ * of lists whose elements are in τ . So the constant is S a receives the type is S a : S → {true} + {false} for any finite set S See [Boj18, §4] for the other primitive operations that are added to the simply typed λ-calculus in order to define polynomial list functions; we make use of is, case, map and concat here. The map combinator, whose name follows the usual functional programming conventions,9 expresses the functoriality of the type constructor (-) * as follows:

map f t = [ f (x 1 ), . . . , f (x n )] when t = [x 1 , . . . , x n ]
Bojańczyk's result is that if Γ and Σ are finite sets, then the polynomial list functions of type Γ * → Σ * correspond exactly the polyregular functions.

2.5.3. More on the "map" combinator. The higher-order function map above also admits an obvious counterpart as an operator on string-to-string functions. First, note that given a word w ∈ (Γ ∪ {#}) * and assuming that # / ∈ Γ, there exists a unique decomposition w = w 1 # . . . #w n where w 1 , . . . , w n ∈ Γ * Definition 2.5.8. Let f : Γ * → Σ * and suppose that # / ∈ Γ ∪ Σ. We define the function

map(f ) : w 1 # . . . #w n ∈ (Γ ∪ {#}) * → f (w 1 )# . . . #f (w n ) ∈ (Σ ∪ {#}) *
Proposition 2.5.9. If f is an HDT0L transduction, then so is map(f ). For each k ≥ 1, the functions that can be computed by k-layered HDT0L systems are also closed under map.

Proof. Let (Γ, Σ, ∆, d, (h c ) c∈Γ , h ) be a HDT0L system computing f : Γ * → Σ * . We define below a HDT0L system that computes map(f

) : (Γ ∪ {#}) * → (Σ ∪ {#}) * . • The intermediate alphabet is ∆ = ∆ ∪ Σ ∪ {#, X}, assuming w.l.o.g. that # / ∈ ∆ ∪ Σ, where X / ∈ ∆ ∪ Σ ∪ {#} is an arbitrarily chosen fresh letter. • The starting word is Xd ∈ ∆ * . • For c ∈ Γ, we extend h c into h c ∈ Hom(∆ * , ∆ * ) by setting h c (x) = x for x ∈ Σ ∪ {#, X}.
Since the input alphabet is now Γ ∪ {#}, we also define the morphism h # as the extension of h (using

Σ ⊂ ∆) such that h # (X) = Xd# and h # (x) = x for x ∈ Σ ∪ {#}. • The final morphism h extends h with h (X) = ε and h (x) = x for x ∈ Σ ∪ {#}.
This shows that HDT0L transductions are closed under map.

We now prove that for any k ∈ N ≥1 , this closure property holds for k-layered HDT0L transductions (so, in particular, for regular functions by taking k = 1). Suppose that f is computed by a k-layered HDT0L system with intermediate alphabet ∆ and initial word d ∈ ∆ * . One can build a k-layered HDT0L system which computes the same function f and such that the initial word contains at most one occurrence of each letter; the idea is to replace ∆ and d = d 1 . . . d n by ∆ × {1, . . . , n} and (d 1 , 1), . . . , (d n , n) where n = |d|, and to adapt the morphisms accordingly. Applying the above construction then results in a k-layered HDT0L system that computes map(f ); note that if we did not have this property for the inital word, we would get a (k + 1)-layering instead.

Corollary 2.5.10. Regular and polyregular functions are both closed under map.

Proof. For regular functions, apply Proposition 2.5.9 with k = 0. For polyregular functions, use Theorem 2.5.6 and the elementary property map(f

•g) = map(f )•map(g).
Of course, this is also a consequence of the fact that the map combinator appears in polynomial list functions ( §2.5.2) as well as in the regular list functions [START_REF] Bojańczyk | Regular and First-Order List Functions[END_REF]. Conversely, if a class of string-to-string functions is not closed under map, then this means that one probably cannot hope to capture it using this kind of list functions formalism. We will see in the next chapter that this will be the case for comparison-free polyregular functions.

Tree transducers

The notion of regular tree-to-tree function is defined by generalizing the characterization of regular string functions by Monadic Second-Order Logic [EM99; BE00; EH01], in a way that is compatible with the isomorphism of Remark 2.1.1. There are two orthogonal difficulties that have to be overcome to extend copyless streaming string transducers ( §2.3.2) to a machine model for regular tree functions: one comes from producing trees as output, while the other comes from taking trees as input.

BRTTs [START_REF] Alur | Streaming Tree Transducers[END_REF] (and the similar model of register tree transducers in [BD20, §4]) provide solutions for both. To explain the acronym: the name "streaming tree transducer" is used in [START_REF] Alur | Streaming Tree Transducers[END_REF] for a transducer model operating over unranked trees (in which the number of children of a node is not determined by its label, and might in fact be arbitrarily large); bottom-up ranked tree transducers are proposed in the same paper as a simpler, equally expressive variant for the special case of ranked trees. In this dissertation it might be more fitting to think of "BRTT" as standing for "bottom-up register tree transducer", as the title of Section 2.6.3 suggests.

In the next two subsections, we give a high-level overview of the challenges posed by trees, while Section 2.6.3 describes BRTTs more formally.

2.6.1. Trees as output. String-to-tree regular functions require a modification of the kind of data stored in the registers of an SST. Tree-valued registers are not enough, for the following reasons: to recover the flexibility of string concatenation, one should be able to perform operations such as grafting the root of some tree to a leaf of another tree; but then the latter should be a tree with a distinguished leaf, serving as a "hole" waiting to be substituted by a tree. (This is fundamental in the theory of forest algebras, which proposes various counterparts for trees to the monoid of strings with concatenation, see [Pin21a, Chapter 22].) By allowing both trees and "one-hole trees" as register values, with the appropriate notion of copyless register assignment, one gets the copyless streaming string-to-tree transducers, whose expressive power corresponds exactly to the regular tree functions [AD17, Theorem 3.16].

Trees as input.

To compute tree-to-tree regular functions, the first idea would be to blend the notion of copyless SST with the classical bottom-up tree automata. One would then get copyless bottom-up ranked tree transducers. However, this model is believed to be too weak to express all regular tree functions (even in the case of tree-to-string functions). An explicit counterexample is conjectured in [AD17, §2.3], in the case of regular functions on unranked trees; we adapt it here into a function from ranked trees to strings.

In the example below, for a ranked letter a of arity 2 = { , }, we use the abbreviation a(t, u) for a( → t, → u).

f (a(t, u)) = f (u) • a • f (t)
f (t) = inorder(t) if t doesn't match the previous pattern where inorder prints the nodes of t following a depth-first in-order traversal. In other words, f = inorder • g where g(a(t, u)) = a(g(u), g(t)) and g(t) = t otherwise (i.e. when the root of t is either b or c).

Conjecture 2.6.2 (adapted from [AD17, §2.3]). The above f cannot be computed by a copyless BRTT.

One must then allow more register assignments than the copyless ones. This cannot be done haphazardly, for arbitrary assignments would lead to a much larger class of functions than regular tree functions (as the case of copyful SST already witnesses, cf. §2.3.1). Alur and D'Antoni call their relaxed condition [START_REF] Alur | Streaming Tree Transducers[END_REF] the single use restriction; the following single-state BRTT for f provides a typical example of the new possibilities allowed.

Example 2.6.3 (Non-copyless BRTT for conditional swap). Take R = {x, y}, initialized at the c-labeled leaves with (x → c, y → c). At a subtree a(u, v), we need to combine the registers x , y (resp. x , y ) coming from the left (resp. right) child u (resp. v) to produce the values of the registers x, y at this node: this is performed by a register assignment

t a ∈ [{x , y , x , y } → SR {x, y}] t a (x) = x ax t a (y) = y ay
The idea is that the register values produced by processing a subtree u are f (u) for x and inorder(u) for y. The register transition for a b-labeled node is then

t b (x) = t b (y) = y by , reflecting the fact that f (b(u, v)) = inorder(b(u, v)).
This t b is not copyless since y occurs twice: once in t b (x) and once in t b (y). The observation at the heart of the single use restriction is that the values of x and y for a given subtree can never be combined in the same expression in the remainder of the BRTT's run, so that allowing this duplication of y will never lead to having two copies of y inside the value of a single register. 2.6.3. Bottom-up (ranked|register) tree transducers. We give here a self-contained definition of the notion of BRTT corresponding to regular tree functions, as they were designed in [START_REF] Alur | Streaming Tree Transducers[END_REF]. Since the paper [AD17] is mainly concerned with transducers over unranked trees, the information concerning the definition of BRTTs is spread over its sections 2.1, 3.7 and 3.8. There is also a difference with our general formalism for ranked trees: BRTTs are only defined over binary trees in [START_REF] Alur | Streaming Tree Transducers[END_REF] -but the extension to ranked trees is obvious, and we will perform it in Chapter 6 when we give a categorical account of BRTTs. For now, we stay faithful to our source by working with binary trees. Definition 2.6.4 ([AD17, p. 31:36]). The set BinTree(Σ) of binary trees over the alphabet Σ, and the set ∂BinTree(Σ) of one-hole binary trees are generated by the respective grammars

T, U ::= • | a T, U (a ∈ Σ) T , U ::= | a T , U | a T, U (a ∈ Σ)
That is, BinTree(Σ) consists of binary trees whose leaves are all equal to and whose nodes are labeled with letters in Σ. As for ∂BinTree(Σ), it contains trees with exactly one leaf labeled instead of • . This "hole" is intended to be substituted by a tree: for T ∈ ∂BinTree(Σ) and U ∈ BinTree(Σ), T [U ] denotes T where has been replaced by U . Definition 2.6.5 ([AD17, p. 31:40]). The binary tree expressions (E, F below, forming the set ExprBT(Σ, V, V )) and one-hole binary tree expressions (E , F below, forming the set Expr∂BT(Σ, V, V )) over the variable sets V and V are generated by the grammar (with x ∈ V , x ∈ V and a ∈ Σ)

E, F ::= • | x | a E, F | E [F ] E , F := | x | a E , F | a E, F | E [F ]
Given ρ : V → BinTree(Σ) and ρ : V → ∂BinTree(Σ), one defines E(ρ, ρ ) ∈ BinTree(Σ) for E ∈ ExprBT(Σ) and E (ρ, ρ ) ∈ ∂BinTree(Σ) for E ∈ Expr∂BT(Σ) in the obvious way.

Definition 2.6.6 ([AD17, §3.7]). Let us fix an input alphabet Γ and output alphabet Σ. The set of register assignments over two disjoint sets R, R , whose elements are called registers, is

A(Σ, R, R ) = ExprBT(Σ, R , R ) R × Expr∂BT(Σ, R , R ) R where R = R × { , }
A register tree transducer consists of a finite set Q of states with an initial state q I ∈ Q, two disjoint finite sets R, R of registers, a transition function δ : Q×Q×Γ → Q×A(Σ, R, R ) and an output function

F : Q → ExprBT(Σ, R, R ). To each tree T ∈ BinTree(Γ), it associates inductively a configuration Conf(T ) ∈ Q × BinTree(Σ) R × ∂BinTree(Σ) R : • The base case is Conf( • ) = (q I , (r → • ), (r → )).
• When Conf(T ) = (q , ρ , ρ ), Conf(U ) = (q , ρ , ρ ) and δ(c, q , q ) = (q, (ε, ε )), we set Conf(c T, U ) = (q, (r → ε(r)(ρ, ρ )), (r → ε (r )(ρ, ρ ))) where ρ(r, d) = ρ d (r) for (r, d) ∈ R × { , } and similarly for ρ . The function defined by the transducer is T ∈ BinTree(Γ) → F (q fin (T ))(ρ fin (T ), ρ fin (T )) where (q fin (T ), ρ fin (T ), ρ fin (T )) = Conf(T ) (recall that F is the output function).

Example 2.6.7 (illustrated by Figure 2.6.1). Let us consider a transducer over the alphabets Γ = Σ = {a, b}, with a single state (|Q| = 1) and two registers, both tree-valued (so R = {r 1 , r 2 } and R = ∅). This simplifies the transition function δ into a function Γ → ExprBT(Σ, R , ∅) R -equivalently, we will consider δ : Γ × R → ExprBT(Σ, R , ∅). We take δ(c, r 1 ) = c (r 1 ) , (r 1 ) and δ(c, r 2 ) = c (r 2 ) , (r 2 ) for c ∈ {a, b}, where r is a notation for (r, ) ∈ R = R × { , }. If we write ri (T ) (i ∈ {1, 2}) for the contents of the register r i at the end of a run of the transducer on T ∈ BT(Γ), then this δ translates into:

r1 (c T, U ) = c r1 (T ), r1 (U ) r2 (c T, U ) = c r2 (U ), r2 (T ) (c ∈ {a, b})
And the initial condition is r1 ( • ) = r2 ( • ) = • . Therefore r1 (T ) = T and r2 (T ) is T "mirrored" by exchanging left and right; let us write r2 (T ) = reverse(T ).

The output function F is also simplified into an expression in ExprBT(Σ, R, ∅). By taking F = a r 1 , r 2 , we define a transducer computing the regular function T → a T, reverse(T ) .

The "single use restriction" that must be imposed on the register assignments is not intrinsic: it depends on an additional piece of data, namely a binary relation between the registers called conflict. Definition 2.6.8 ([AD17, §2.1]). A conflict relation is a reflexive and symmetric relation.

An expression E ∈ ExprBT(Σ, V, V ) ∪ Expr∂BT(Σ, V, V ) is said to be consistent with a conflict relation ˚over V ∪ V when each variable in V ∪ V appears at most once in E, and for all x, y ∈ V ∪ V , if x = y and x ˚y, then E does not contain both x and y.

A register assignment (ε, ε ) ∈ A(Σ, R, R ) is single use restricted with respect to a conflict relation ˚over R ∪ R when: • all ε(r) for r ∈ R and all ε (r ) for r ∈ R are consistent with ˚;

• if x 1 , x 2 , y 1 , y 2 ∈ R ∪ R , x 1 ˚x2 and, for some d ∈ { , }, (x 1 , d) appears in 10 (ε ∪ ε )(y 1 )
and (x 2 , d) appears in (ε ∪ ε )(y 2 ), then y 1 ˚y2 (note that this includes the case x 1 = x 2 ).

Definition 2.6.9. A bottom-up ranked tree transducer (BRTT) is a register tree transducer (Q, q I , R, R , δ, F ) endowed with a conflict relation ˚on R ∪ R , such that F (q) is consistent with ˚and all register assignments in the image of δ are single use restricted w.r.t. ˚. A regular tree function is a function computed by a BRTT. When the conflict relation is trivial (i.e. coincides with equality), we say that the BRTT is copyless. We also say that a register tree transducer is copyless if it becomes a BRTT when endowed with a trivial conflict relation.

CHAPTER 3

Comparison-free polyregular functions

We shall now introduce the new class of comparison-free string-to-string functions (or, for short, "cfp functions"). As we said in Section 1.2.4, it first appeared to us through the study of linear λ-calculi, but can retrospectively be motivated by pedestrian automata-theoretic considerations; there will be no λ-terms in this chapter.

The simplest way to define cfp functions is to start from the regular functions and combine them using a "composition by substitution" (CbS) operation ( §3.1). In order to relate this to the preexisting literature, we give a machine model for this function class ( §3.2), obtained by putting a restriction on pebble transducers which compute polyregular functions (cf. §2.5).

After this, we give two more difficult characterizations of cfp functions in Section 3.3. The first one is analogous to Proposition 2.5.2, and part of the statement is that cfp functions are closed under composition -a property that was a major focus of the discussion in §1.2.4.) The second one characterizes comparison-free polyregular functions of growth O(n k ) for each k ∈ N with k ≥ 1; we will say more about this below. We also prove in Section 3.4 a "closed form" description of cfp functions with unary inputs.

Finally, we apply many of those previous results to obtain separation results between cfp functions and some other transduction classes described in Chapter 2. With those results, the known relationships between the function classes with superlinear growth studied in this manuscript are as follows: One of the properties that we prove on cfp functions of growth O(n k ) is that they can always be computed by comparison-free pebble transducers with k pebbles. This is a pebble minimization result, in the vein of those proved by Douéneau-Tabot et al. [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF] for marble transducers (cf. Theorem 2.3.14) and by Lhote [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF] for general pebble transducers. But the latter is actually wrong; counterexamples with proofs may be found in 2 [Boj22a; KNP23]. That said, Lhote's approach is far from worthless: we were able to reuse it for our proof of the comparison-free pebble minimization theorem. In fact, the familiarity that we 1 We write C * for the composition closure of the class C. Inclusions denoted by ⊂ are strict, and ⊃ ⊂ means that there is no inclusion either way.

2 Edited in March 2023, as explained in the preface, where we also mentioned that the name "polyblind" has become the common way to refer to comparison-free polyregular functions.

acquired with [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF] in the process of adapting its arguments later helped us discover this mistake. Incidentally, the counterexample to pebble minimization also refutes the logical characterization of cfp functions conjectured in [NNP21, §10], as explained in [START_REF] Kiefer | Revisiting the growth of polyregular functions: output languages, weighted automata and unary inputs[END_REF].

(Since the conjecture turned out to be false, we do not reproduce its statement here.)

3.1. Composition by substitution Definition 3.1.1. Let f : Γ * → I * , and for each i ∈ I, let g i : Γ * → Σ * . The composition by substitution of f with the family (g i ) i∈I is the function

CbS(f, (g i ) i∈I ) : w → g i 1 (w) . . . g i k (w) where i 1 . . . i k = f (w)
That is, we first apply f to the input, then every letter i in the result of f is substituted by the image of the original input by g i . Thus, CbS(f,

(g i ) i∈I ) is a function Γ * → Σ * .
Definition 3.1.2. The smallest class of string-to-string functions closed under CbS and containing all regular functions is called the class of comparison-free polyregular functions.

Example 3.1.3. The following variant of "squaring with underlining" (cf. Definition 2.5.1) is comparison-free polyregular:

cfsquaring Γ : 123 ∈ Γ * → 112321233123 ∈ (Γ ∪ Γ) * .
Indeed, it can be expressed as cfsquaring Γ = CbS(f, (g i ) i∈I ) where I = Γ ∪ {#}, the function f : w 1 . . . w n → w 1 # . . . w n # is regular (more than that, a morphism between free monoids) and g # = id, g c : w → c for c ∈ Γ are also regular. Its growth rate is quadratic, while regular functions have at most linear growth. Other examples that also require a single composition by substitution are given in Theorem 3.5.1.

We can already justify the latter half of the name of our new class. Proof of Proposition 3.1.4. We use polynomial list functions (Section 2.5.2), though for-transducers [Boj18, §3] could also be used for an easy proof.

First, we claim that for any I = {i 1 , . . . , i |I| }, there exists a polynomial list function match I,τ : I → τ → . . . → τ → τ that returns its (k + 1)-th argument when its first argument is i k . This can be shown by induction on |I|, using is I i (i ∈ I) and case {true},{false},τ . Next, let f : Γ * → I * , and for i ∈ I, g i : Γ * → Σ * be polyregular functions. Assuming that f and g i (i ∈ I) are defined by polynomial list functions of the same name, the λ-term λw. concat Σ (map I,Σ * (λi. match I,Σ * i (g i 1 w) . . .

(g i |I| w)) (f w)) computes CbS(f, (g i ) i∈I ).
Fundamentally, Definition 3.1.2 is inductive: it considers the functions generated from the base case of regular functions by applying compositions by substitution. The variant below with more restricted generators is sometimes convenient.3 Definition 3.1.6. A string-to-string function is said to be:

• of rank at most 0 if it is regular;

• of rank at most k + 1 (for k ∈ N) if it can be written as CbS(f, (g i ) i∈I ) where f : Γ * → I * is regular and each g i : Γ * → Σ * is of rank at most k.

Proposition 3.1.7. A function f is comparison-free polyregular if and only if there exists some k ∈ N such that f has rank at most k. In that case, we write rk(f ) for the least such k and call it the rank of f . If (g i ) i∈I is a family of comparison-free polyregular functions,

rk(CbS(f, (g i ) i∈I )) ≤ 1 + rk(f ) + max i∈I rk(g i )
Proof. This is equivalent to claiming that the smallest class C of functions such that • every regular function is in C, • and CbS(f, (g i ) i∈I ) ∈ C for any regular f : Γ * → I * and any (g i : Γ * → Σ * ) i∈I ∈ C I , contains all comparison-free polyregular functions. It suffices to show that C is closed under composition by substitution, which can be done by induction using the equation

CbS(CbS(f, (g i ) i ), (h j ) j ) = CbS(f, (CbS(g i , (h j ) j )) i )
The same equation explains the inequality on the rank that we claim in the proposition.

A straightforward consequence of this definition is that, just like regular functions (see Proposition 2.3.11), cfp functions are closed under regular conditionals and concatenation. Proposition 3.1.8. Let f, g : Γ * → Σ * be comparison-free polyregular functions and L ⊆ Γ * be a regular language. The function that coincides with f on L and with g on Γ * \ L is cfp, and so is w ∈ Γ * → f (w) • g(w); both have rank at most max(rk(f ), rk(g)).

Proof. Let f, g : Γ * → Σ * be cfp with max(rk(f ), rk(g)) = k ≥ 1 (otherwise, we just apply Proposition 2.3.11). It means that we have regular functions f and g , as well as families of functions (f i ) i∈I and (g j ) j∈J of rank at most k -1 such that

f = CbS(f , (f i ) i∈I ) and g = CbS(g , (g j ) j∈J )
Assume without loss of generality that I ∩ J = ∅.

Let us first treat regular conditionals. Using Proposition 2.3.11 applied to the functions f , g : Γ * → (I ∪ J) * , the function h : Γ * → (I ∪ J) * that coincides with f over L and g over L \ Γ * is regular. Setting (h k ) k∈I∪J to be the family of functions such that h i = f i for i ∈ I and h j = g j for j ∈ J, we obtain a cfp function h = CbS(h , (h k ) k∈I∪J ) corresponding to the desired conditional. Since all the h k are of rank at most k -1, we also get the result on the rank.

Concerning concatenation, one check that the pointwise concatenation f • g is equal to CbS(f • g , (h k ) k∈I∪J ), which is cfp since f • g is regular (by Proposition 2.3.11 again).

Comparison-free pebble transducers

We now characterize our function class by a machine model that will explain our choice of the adjective "comparison-free", as well as the operational meaning of the notion of rank we just defined. However, the definition using composition by substitution will remain our tool of choice to prove further properties, so the next sections do not depend on this one. Definition 3.2.1. Let k ∈ N with k ≥ 1. Let Γ, Σ be finite alphabets and , / ∈ Γ. A k-pebble stack on an input string w ∈ Γ * consists of a list of p positions in the string w (i.e. of p integers between 1 and |w| + 2) for some p ∈ {1, . . . , k}. We therefore write

Stack k = N 0 ∪ N 1 ∪ • • • ∪ N k ,
keeping in mind that given an input w, we will be interested in "legal" values bounded by |w| + 2.

A comparison-free k-pebble transducer (k-CFPT) consists of a finite set of states Q, an initial state q I ∈ Q and a family of transition functions

Q × (Γ ∪ { , }) p → Q × (N p → Stack k ) × Σ * for 1 ≤ p ≤ k
where the N p on the left is considered as a subset of Stack k . For a given state and given letters (c 1 , . . . , c p ) ∈ (Γ ∪ { , }) p , the allowed values for the stack update function N p → Stack k returned by the transition function are:

(identity) (i 1 , . . . , i p ) → (i 1 , . . . , i p ) ∈ N p (move left, only allowed when c p = ) (i 1 , . . . , i p ) → (i 1 , . . . , i p -1) ∈ N p (move right, only allowed when c p = ) (i 1 , . . . , i p ) → (i 1 , . . . , i p + 1) ∈ N p (push, only allowed when p ≤ k -1) (i 1 , . . . , i p ) → (i 1 , . . . , i p , 1) ∈ N p+1 (pop, only allowed when p ≥ 1) (i 1 , . . . , i p ) → (i 1 , . . . , i p-1 ) ∈ N p-1 (Note that the codomains of all these functions are indeed subsets of Stack k .)

The run of a CFPT over an input string w ∈ Γ * starts in the initial configuration comprising the initial state q I , the initial k-pebble stack (1) ∈ N 1 , and the empty string as an initial output log. As long as the current stack is non-empty, a new configuration is computed by applying the transition function to q and to (( w )[i 1 ], . . . , ( w )[i p ]) where (i 1 , . . . , i p ) is the current stack; the resulting stack update function is applied to (i 1 , . . . , i p ) to get the new stack, and the resulting output string in Σ * is appended to the right of the current output log. If the CFPT ever terminates by producing an empty stack, the output associated to w is the final value of the output log.

This amounts to restricting in two ways 4 the pebble transducers from [Boj18, §2]: • in a general pebble transducer, one can compare positions, i.e. given a stack (i 1 , . . . , i p ), the choice of transition can take into account whether 5 i j ≤ i j (for any 1 ≤ j, j ≤ p); • in a "push", new pebbles are initialized to the leftmost position ( ) for a CFPT, instead of starting at the same position as the previous top of the stack (the latter would ensure the equality of two positions at some point; it is therefore an implicit comparison that we must relinquish to be truly "comparison-free"). This limitation is similar to (but goes a bit further than) the "invisibility" of pebbles in a transducer model introduced by Engelfriet et al. [START_REF] Engelfriet | XML navigation and transformation by tree-walking automata and transducers with visible and invisible pebbles[END_REF] (another difference, unrelated to comparisons, is that their transducers use an unbounded number of invisible pebbles).

Remark 3.2.2. Our definition guarantees that "out-of-bounds errors" cannot happen during the run of a comparison-free pebble transducer. The sequence of successive configurations is therefore always well-defined. But it may be infinite, that is, it may happen that the final state is never reached. Thus, a CFPT defines a partial function.

That said, the set of inputs for which a given pebble tree transducer does not terminate is always a regular language [MSV03, Theorem 4.7]. This applies a fortiori to CFPTs. Using this, it is possible 6 to extend any partial function f : Γ * Σ * computed by a k-CFPT into a total function f : Γ * → Σ * computed by another k-CFPT for the same k ∈ N, such that f (x) = f (x) for x in the domain of f and f (x) = ε otherwise. This allows us to only consider CFPTs computing total functions in the remainder of the paper.

A special case of particular interest is k = 1: the transducer has a single reading head, push and pop are always disallowed. 4 There is also an inessential difference: the definition given in [START_REF] Bojańczyk | Polyregular Functions[END_REF] does not involve end markers and handles the edge case of an empty input string separately. This has no influence on the expressiveness of the transducer model. Our use of end markers follows [EH01; Lho20].

5 One would get the same computational power, with the same stack size, by only testing whether ij = ip for j ≤ p -1 as in [START_REF] Milo | Typechecking for XML transformers[END_REF] (this is also essentially what happens in the nested transducers of [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF]). 6 Proof idea: do a first left-to-right pass to determine whether the input leads to non-termination of the original CFPT; if so, terminate immediately with an empty output; otherwise, move the first pebble back to the leftmost position and execute the original CFPT's behavior. This can be implemented by adding finitely many states, including those for a DFA recognizing non-terminating inputs.

Theorem 3.2.3 ([AČ10]

). Copyless SSTs and 1-CFPTs -which are more commonly called two-way (deterministic) finite transducers (2DFTs) -are equally expressive.

Since we took copyless SSTs as our reference definition of regular functions, this means that 2DFTs characterize regular functions. But putting it this way is historically backwards: the equivalence between 2DFTs and MSO transductions came first [START_REF] Engelfriet | MSO definable string transductions and two-way finite-state transducers[END_REF] and made this class deserving of the name "regular functions" before the introduction of copyless SSTs.

Let us now show the equivalence with Definition 3.1.2. The reason for this is similar to the reason why k-pebble transducers are equivalent to the k-nested transducers 7 of [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF], which is deemed "trivial" and left to the reader in [Lho20, Remark 6]. Proposition 3.2.4. If f is computed by a k-CFPT, and the g i are computed by l-CFPTs, then CbS(f, (g i ) i∈I ) is computed by a (k + l)-CFPT.

Proof. First note that any k-CFPT can be transformed into an equivalent k-CFPT whose transition functions δ :

Q × (Γ ∪ { , }) p → Q × (N p → Stack k ) × Σ * are
such that, for every input (q, b), we have either π 3 (δ(q, b)) = ε (in which case we call δ(q, b) a silent transition) or π 3 (δ(q, b)) ∈ Σ and π 2 (δ(q, b)) is the identity. So, without loss of generality, suppose that we have a k-CFPT T f implementing f is of this shape, with state space Q f and transition function δ f Similarly, we may assume without loss of generality that the current height of the stack is tracked by the state of CFPTs if we allow multiple final states; assume that we have such height-tracking l-CFPT and that we have l-CFPTs T i implementing g i with state spaces Q i and transition functions δ i .

We combine these CFPTs into a single k + l CFPT T with state space

Q = Q f Q f × i∈I Q i
The initial and final states are those of T f . The high-level idea is that T behaves as T f until it produces an output i ∈ I; in such a case it "performs a call" to T i that might spawn additional heads to perform its computations. At the end of the execution of T i , we return the control to T f . Formally speaking, the transition function δ of T behaves as follows:

• δ (q, b) = δ f (q, b) if q ∈ Q f and δ f (q, b) is silent.
• otherwise we take, we have π 3 (δ f (q, b)) = i for some i ∈ I. Calling r i the initial state of T i , we set π 1 (δ (q, b)) = (q, r i ) and π 2 (δ (q, b)) corresponds to push a new pebble onto the stack. We make δ (q, b) silent in such a case. • δ ((q, r), b b ) then corresponds to δ i (r, b ) if we are not in the situation where the stack height is 1 and the stack update function is pop. • otherwise we take π 1 (δ ((q, r), bb )) = π 1 (δ f (q, b)), π 2 (δ (q, n + 1, bb )) to be a pop action and π 3 (δ ((q, r), bb )) = π 3 (δ i ((q, r), bb )).

Theorem 3.2.5. If f : Γ * → Σ * is computed by a k-CFPT, for k ≥ 2, then there exist a finite alphabet I, a regular function h : Γ * → I * and a family (g i ) i∈I computed by (k -1)-CFPTs such that f = CbS(h, (g i ) i∈I ).

Proof. Assume we have f : Γ * → Σ * computed by a k-CFPT T with state space Q and transition function δ that we assume to be disjoint from Σ. For each q ∈ Q, we describe a k -1 CFPT T q with the same state space, initial state q and transition function δ q such that, for every b ∈ N, b ∈ Stack l for l ≤ k -1 and q ∈ Q, δ(q , b b) and δ q (q , b) coincide on the first and last component; on the second component, we require they also coincide up to the difference in stack size. If we fix r ∈ Q, by [MSV03, Theorem 4.7], the language consisting of those w ∈ Γ * such that T q halts on r is regular. Since regular languages are closed under intersection, for any map γ ∈ Q Q , the language L γ ⊆ Γ * of those words w such that T q halts on γ(q) is regular. Now fix γ ∈ Q Q and let us describe a 1-CFPT transducer T γ intended to implement the restriction of a function h : Γ * → (Σ ∪ Q) * to L γ . T γ has the same state space and initial state as T , but has a transition function δ γ defined by

δ γ (q, b) = δ(q, b) if π 2 (δ(q, b)) is not a push (γ(r), (p → p), r) otherwise, for r = π 1 (δ(q, b)) Since Γ * = γ∈Q Q L γ ,
by applying repeatedly Proposition 2.3.11, this determines the regular function h : Γ * → (Σ ∪ Q) * . We can then check that f = CbS(h, (g i ) i∈Σ∪Q ) where g a is the constant function outputting the one-letter word a for a ∈ Σ (certainly, some 1-CFPT implements it) and g q is the function Γ * → Σ * implemented by the (k -1)-CFPT T q . Corollary 3.2.6. For all k ∈ N, the functions computed by (k + 1)-CFPTs are exactly the comparison-free polyregular functions of rank at most k.

Proof. The proof goes by induction over k ∈ N. The result holds for k = 0 by Theorem 3.2.3; let us detail each direction of the inductive case k > 0:

• for the left-to-right inclusion, assume we are given a (k + 1)-CFPT computing f and apply Theorem 3.2.5 to obtain h and g i s such that f = CbS(h, (g i ) i∈I ) with h regular and the g i s computable by k-CFPTs. The induction hypothesis implies that the g i s have rank < k, and thus f has rank ≤ k. • conversely, if f has rank k, it can be written as CbS(h, (g i ) i∈I ) with h regular and the g i s with rank < k; the induction hypothesis implies that the g i s can be computed by k-CFPTs. By Theorem 3.2.3, h is computable by a 1-CFPT, so by Proposition 3.2.4, f is computed by a (k + 1)-CFPT.

Key properties of comparison-free polyregular functions

Now that we have both a technically workable definition of cfp functions and a natural model for them, let us study some of their properties. Those that we cover in this section arguably have the most complicated proofs in this chapter.

The first important property is that this function class is closed under composition (Theorem 3.3.3). This is the hard part in establishing the third equivalent definition of cfp functions, which consists in swapping out squaring Γ for some other function in the characterization of polyregular functions from Proposition 2.5.2:

Theorem 3.3.

The class of comparison-free polyregular functions is the smallest class closed under usual function composition and containing both all regular functions and the functions cfsquaring Γ (cf. Example 3.1.3) for all finite alphabets Γ.

Our next result incorporates the comparison-free pebble minimization theorem announced at the beginning of this chapter. Our proof techniques mainly draw inspiration from [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF]; in particular, one classical tool that we use is Ramsey's theorem specialized to monoid-valued colorings.

(0) Γ : w ∈ Γ * → ε ∈ (∅ × Γ) * and cfpow (n+1) Γ : w → (n, w 1 ) • cfpow (n) Γ (w) • . . . • (n, w |w| ) • cfpow (n) Γ (w) To make (ii) =⇒ (i) more precise, if f is cfp with rk(f ) ≥ 1, then it admits a sequence of inputs w 0 , w 1 , . . . ∈ Γ * such that |w n | → +∞ and |f (w n )| = Ω(|w n | rk(f )+1 ).

Note that cfpow

(2) Γ and cfsquaring Γ are the same up to a bijection {0, 1} × Γ ∼ = Γ ∪ Γ. We have combined those two theorems into the same section because we have found a way to conveniently share some work between their respective proofs -though this sharing concerns only the easier parts. In Section 3.3.1 we show most of Theorem 3.3.1, and in Section 3.3.2 we show most of Theorem 3.3.2. Finally in Section 3.3.3 we finish proving both. Remark 3.3.4. As mentioned in the introduction, this will also be an immediate consequence (cf. Proposition 5.1.16) of our characterization of these functions in the λ ⊕& -calculus. But we give here a direct proof without this detour outside automata theory.

Consider the composition of two cfp functions. First, by induction on the rank of the left-hand side of the composition, we can reduce to the case where that side is a mere regular function, using the straightforward identity

CbS(f, (g i ) i∈I ) • h = CbS(f • h, (g i • h) i∈I )
We then treat this case by another induction, this time on the rank of the right-hand side. The base case is handled by invoking the closure under composition of regular functions (for which we shall give a self-contained proof using our category-theoretic technology in Section 4.7). Therefore, what remains is the following inductive case. Lemma 3.3.5. Let f : Γ * → I * be a regular function and let (g i ) i∈I be a family of comparison-free polyregular functions Γ * → Σ * . Suppose that for all regular h : Σ * → ∆ * and all i ∈ I, the composite h • g i is comparison-free polyregular.

Then, for all regular h : Σ

* → ∆ * , h • CbS(f, (g i ) i∈I ) is comparison-free polyregular.
Our proof of this lemma relies on some properties of the transition monoids introduced in §2.3.4. At a high level, the idea is to exploit the following combinatorial phenomenon: in a copyless SST, a transition acting on the state and registers can be specified by • a "shape" described the finite monoid M cl R,∅ (Proposition 2.3.24); • plus finitely many "labels" in Σ * (where Σ is the output alphabet) describing the constant factors that will be concatenated with the old register contents to give the new ones. This technique is often applied to the study of copyless SSTs (see [BC18, Chapter 13] for instance). It will also be central to our later categorical developments (cf. §4.3.3). Not coincidentally, those categorical tools also appear in our proof of the aforementioned λ ⊕& -calculus characterization of cfp functions. Proposition 3.3.6. Let β ∈ M cl R,∆ . For each r ∈ R, one can write β(r) = w 0 r 1 w 1 . . . r n w n with w 0 , . . . , w n ∈ ∆ * and r 1 . . .

r n = erase ∆ (β)(r) ∈ R * (cf. Proposition 2.3.22). Hence M cl R,∆ ∼ = α, α ∈ M cl R,∅ , ∈ r∈R (∆ * ) |α(r)|+1
In other words, register assignments in M cl R,∆ can be decomposed into a "shape" in M cl R,∅ plus finitely many string labels. Through this bijection, erase ∆ ∈ Hom(M cl R,∆ Q, M cl R,∅ Q) can be seen as simply removing the labels, i.e. the component. Lemma 3.3.7. Let δ be the transition function of some copyless SST Σ * → ∆ * whose sets of states and registers are Q and R respectively, so that δ(-, c) ,c)

∈ M cl R,∆ Q for c ∈ Σ. Let ψ δ ∈ Hom(Σ * , M cl R,∆ Q) such that ∀c ∈ Σ, ψ δ (c) = δ(-
and ϕ δ = erase ∆ • ψ δ as in Remark 2.3.23, q ∈ Q, r ∈ R, α ∈ M cl
R,∅ and j ∈ {0, . . . , |α(r)|}. Then the following function Σ * → ∆ * , defined thanks to Proposition 3.3.6, is regular:

s → w j where π 2 (ψ δ (s)(q))(r) = w 0 r 1 w 1 . . . r n w n if π 2 (ϕ δ (s)(q)) = α ε otherwise (recall that π 2 : Q × M → M is the second projection and M Q = Q → Q × M ).
Proof. We consider during this proof that the names q, r, α and j introduced in the above statement are not in scope, so that we can use those variable names for generic elements of Q, R, M cl R,∅ and N instead. Those data will be given other names when we need them.

We build a copyless SST whose set of states is Q × M cl R,∅ . This is made possible by the finiteness of M cl R,∅ (Proposition 2.3.24). As for the set of registers, we would like it to vary depending on the current state for the sake of conceptual clarity, i.e. to have a family of finite sets indexed by Q × M cl R,∅ ; when the SST moves from state (q, α) to (q , α ), it would perform a register assignment from R q,α to R q ,α (described by a map R q ,α → (∆ ∪ R q,α ) * ). Such devices will be called state-dependent memory copyless SSTs later ( §4.3.2) and they are clearly equivalent in expressive power to usual copyless SSTs.

The idea is that we want the configuration (current state plus register contents) of our new SST, after reading s = s 1 . . . s n , to faithfully represent

ψ δ (s)(q 0 ) = (δ(-, s 1 ) • • • • • δ(-, s n ))(q 0 ) ∈ Q × M cl R,∆
where δ and ψ δ are given in the lemma statement, and q 0 is the given state that was called q in that statement. Following Proposition 3.3.6, since we already have the "shape" stored in the second component M cl ∆,∅ of the set Q × M cl ∆,∅ of new states, it makes sense to use the register to store the "labels", hence R q,α = R α with

R α = {(r, j) | r ∈ R, j ∈ {0, . . . , |α(r)|}} so that (∆ * ) Rα ∼ = r∈R (∆ * ) |α(r)|+1
The configurations of our SST are thus in bijection with Q × M cl R,∆ via Proposition 3.3.6, and we would like the transition performed when reading c ∈ Σ to correspond through this bijection to (using the notations of Definition 2.3.3)

(q, β) ∈ Q × M cl R,∆ → (δ st (q), β • δ reg (q)) For a fixed β ∈ M cl R,∆ , let us consider the right multiplication β → β • β in M cl R,∆ . Since erase ∆ : M cl R,∆ → M cl R,
∅ is a morphism, the "shape" of β • β can be obtained from the "shape" of β by multiplying by α = erase ∆ (β ). The important point is to show that we can obtain the new labels from the old ones by a copyless assignment -formally speaking, that for any α ∈ M cl R,∆ there exists a copyless

γ α,β : R α•α → (∆ ∪ R α ) *
such that for any β ∈ M cl R,∆ such that erase ∆ (β) = α, which therefore corresponds to α, for some

∈ (∆ * ) Rα ∼ = r∈R (∆ * ) |α(r)|+1
the shape-label pair that corresponds to

β • β is (α • α , γ † α,β (
)) (cf. Definition 2.3.1). Our next task is to analyze the composite assignment β • β in order to derive a γ α,β that works. Let r ∈ R. First, if α (r ) = r 1 . . . r n ∈ R * , then β (r ) = w 0 r 1 w 1 . . . r n w n for some w 0 , . . . , w n ∈ ∆ * and by applying the unique morphism β ∈ Hom((∆ ∪ R) * , (∆ ∪ R) * ) that extends β and sends letters of ∆ to themselves, we have

(β • β )(r ) = β (β (r)) = w 0 • β(r 1 ) • w 1 • . . . • β(r n ) • w n
Let us decompose further, for i ∈ {1, . . . , n}: β(r i ) = w i,0 r i,1 w i,1 . . . w i,n i r n i for some w i,0 , . . . , w i,n i ∈ ∆ * By plugging this into the previous equation, we have (β • β )(r ) = w 0 r 1 w 1 . . . r m w m where {r 1 , . . . , r m } = n i=1 {r i,1 , . . . , r i,n i } Furthermore, each w k for k ∈ {0, . . . , m} is a concatenation of some w i and some w i,j , and from the formal expression of w k depending on these w i and w i,j -which only depends on the shape α and α -we can derive a definition of γ α,β (r , k). For instance,

w 42 = w 3,2 w 3 w 4,0 γ(r , 42) = (r 3 , 2) • w 3 • (r 4 , 0) ∈ (∆ ∪ R α•α ) *
Observe that this does not refer to the w i,j ; therefore, γ α,β does not depend on β, as required.

One can check that defined this way, γ α,β is indeed a copyless assignment and that the desired property of γ † α,β holds. What we have just seen is the heart of the proof. We leave it to the reader to finish the construction of the copyless SST.

With this done, we can move on to proving Lemma 3.3.5, which suffices to finish the proof of Theorem 3.3.3.

Proof of Lemma 3.3.5. Let w ∈ Γ * be an input string. In the composition, we feed to a copyless SST T h that computes h the word CbS(f, (g i ) i∈I )(w) = g i 1 (w) . . . g i k (w) where f (w) = i 1 . . . i k . A first idea is therefore to tweak T h into a new copyless SST that takes I * as input and which executes, when it reads i ∈ I, the transition of T h induced by g i (w). If we call h w the regular function computed by this new SST, we would then have

h w (f (w)) = h • CbS(f, (g i ) i∈I )(w).
The issue is of course that h w depends on the input w.

More precisely, the data that h w depends on is the family of transitions

(ψ δ • g i (w)) i∈I ∈ (M cl R,∆ Q) I (see Lemma 3.3.7 for ψ δ )
where Q, R and δ are respectively the set of states, the set of registers and the transition function of T h . We will be able to disentangle this dependency by working with

(ϕ δ • g i (w)) i∈I = (erase ∆ • ψ δ • g i (w)) i∈I ∈ (M cl R,∅ Q) I Concretely: Claim 3.3.8. For each µ ∈ (M cl R,∅ Q) I , there exist: • a finite alphabet Λ µ equipped with a function ι µ : Λ µ → I; • a regular function h µ : I * → (∆ ∪ Λ µ ) * ;
• and regular functions l λ : Σ * → ∆ * for λ ∈ Λ; such that for i 1 . . . i n ∈ I * and w

∈ Γ * , if (ϕ δ • g i (w)) i∈I = µ, then h(g i 1 (w) • . . . • g in (w)) = replace each λ ∈ Λ µ in h µ (i 1 . . . i n ) by l λ • g ι(λ) (w)
Subproof of the claim. Proposition 3.3.6 says that every

β = ψ δ (g i (w)) ∈ M cl R,∆
can be decomposed into a shape α = erase ∆ (β) ∈ M cl R,∅ and a finite family of strings in ∆ * . Each β(r) for r ∈ R can then be reconstituted as an interleaving of letters in α(r) with labels in , a process that can be decomposed into two steps:

• first, interleave the letters of α(r) with placeholder letters, taken from an alphabet disjoint from both ∆ and R; • then substitute the labels for those letters. Roughly speaking, this will allow us to manipulate an assignment with placeholders without knowing the labels, and then add the labels afterwards.

Let µ ∈ (M cl R,∅ Q) I . We define a copyless SST T µ with the same sets of states and registers as T h , namely Q and R. Its initial register values and final output function are also the same. It computes a function I * → (∆ ∪ Λ µ ) * , and its transition function is

δ µ : (q, i) → π 1 • µ i (q), r → interleave λ q,i,r 0 . . . λ q,i,r |π 2 (µ i (q))(r)| , π 2 (µ i (q))(r) where interleave(u 0 . . . u n , v 1 . . . v n ) = u 0 v 1 u 1 . . . v n u n for letters u 0 , . . . , u n , v 1 , . . . , v n over some alphabet (recall also that µ i : Q → Q × M cl R,∅ for i ∈ I)
. Thus, we take

Λ µ = λ q,i,r j q ∈ Q, i ∈ I, r ∈ R, j ∈ {0, . . . , |π 2 (µ i (q))(r)|} ι(λ q,i,r j ) = i
and h µ to be the function computed by T µ . (Note that although δ µ does not involve letters from ∆, the final output function and the initial register contents do.) Finally, given λ = λ q,i,r j ∈ Λ µ , we define l λ to be the regular function provided by Lemma 3.3.7 for the transition function δ of T h , the state q 0 (which is the initial state of both T h and T µ ), the register r, the assignment shape α = π 2 (µ i (q)) and the position j ∈ {0, . . . , |α(r)|}.

Let w ∈ Γ * be such that (ϕ δ • g i (w)) i∈I = µ. Consider χ w ∈ Hom((∆ ∪ Λ µ ) * , ∆ * ) which maps each letter of ∆ to itself and each λ ∈ Λ µ to l λ • g ι(λ) (w). It lifts to a morphism

χ w ∈ Hom(M cl R,∆∪Λ µ , M cl R,∆
), and we have χ w (δ µ (-, i)) = ψ δ • g i (w). This leads to the following invariant: the configuration of T h after reading g i 1 (w) • . . . • g in (w) is, in a suitable sense, the "image by χ w " of the configuration of T µ after reading i 1 . . . i n . (In other words, the "image of the SST T µ by χ w " is the copyless SST computing h w that we sketched at the very beginning of this proof of Lemma 3.3.5.) This directly implies the property relating h, h µ and (l λ ) λ∈Λ µ that we wanted. (End of subproof.)

Let us finish proving Lemma 3.3.5 using the fact we just proved. First of all, since the letters of Λ µ only serve as placeholders to be eventually substituted, they can be renamed at our convenience. That means that we can take the Λ µ to be disjoint for µ ∈ (M cl R,∅ Q) I , and define Λ to be their disjoint union. We also take ι : Λ → I to be the unique common extension of the ι µ . In the same spirit, we glue together the functions h µ • f into

H : w ∈ Γ * → h (ϕ δ •g i (w)|i∈I) (f (w)) ∈ (∆ ∪ Λ) *
From the above equation on h µ , one can then deduce for all w ∈ Γ * without condition that

h(CbS(f, (g i ) i∈I )(w)) = CbS(H, (l λ • g ι(λ) ) λ∈Λ )(w)
(strictly speaking, one should have a family indexed by ∆ ∪ Λ on the right-hand side -to comply with that, just extend the family with constant functions equal to x for each x ∈ ∆).

Using the above equation, we can rephrase our goal: we want to prove that the function CbS(H, (l λ •g ι(λ) ) λ∈Λ ) is comparison-free polyregular. This class of functions is -by definition -closed under composition by substitution, so we can reduce this to the following subgoals:

• H is comparison-free polyregular: in fact, it is regular, because regular functions are closed under composition and regular conditionals (Proposition 2.3.11). This argument relies on the finiteness of the indexing set (M cl R,∅ Q) I -a consequence of Proposition 2.3.24 -and on the regularity of the language {w ∈ Γ * | (ϕ δ • g i (w)) i∈I = µ} for any µ. The reasons for the latter are as follows:

-ϕ δ is a morphism whose codomain M cl R,∅ Q is finite, so ϕ -1 δ ({µ i })
is regular for i ∈ I; the functions g i for i ∈ I are assumed to be cfp, so they preserve regular languages by inverse image, as all polyregular functions do [START_REF] Bojańczyk | Polyregular Functions[END_REF]; regular languages are closed under finite intersections, and I is finite.

• l λ • g ι(λ) is comparison-free polyregular for all λ ∈ Λ: because our main existence claim states that l λ is regular for all λ ∈ Λ, and one of our assumptions is that any g i (for i ∈ I) postcomposed with any regular function gives us a cfp function.

3.3.2.

A lower bound on growth from the rank. In this section, we prove a statement that directly implies the last claim of Theorem 3.3.2:

Theorem 3.3.9. Let f : Γ * → Σ * be comparison-free polyregular of rank at least 1. Then there exists a sequence of inputs

(s n ) n∈N ∈ (Γ * ) N such that |s n | = O(n) and |f (s n )| ≥ n rk(f )+1 .
Let us recall a few tools inspired from [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF]. First, a notation: for s ∈ Σ * and Π ⊆ Σ, we shall write |s| Π for the number of occurrences of letters from Π in s.

Lhote's paper [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF] also makes a heavy use of factorizations of strings that depend on a morphism to a finite monoid. This is the case for our proof as well, but we use a slightly different kind of factorization in order to fix what seems to be a bug in [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF].

An 1-split of a string s ∈ Γ * according to a morphism ϕ : Γ * → M is a factorization s = uvw with the middle factor v nonempty, such that ϕ(u) = ϕ(uv) and ϕ(vw) = ϕ(w). We shall also work with a more general notion (though the case r = 1 will often occur): Definition 3.3.10. An r-split of a string s ∈ Γ * according to a morphism ϕ : Γ * → M is a tuple (u, v 1 , . . . , v r , w) ∈ (Γ * ) r+2 such that: • s = uv 1 . . . v r w with v i non-empty for all i ∈ {1, . . . , r};

• ϕ(u) = ϕ(uv 1 ) = • • • = ϕ(uv 1 . . . v r ); • ϕ(w) = ϕ(v r w) = • • • = ϕ(v 1 . . . v r w).
Proposition 3.3.11 (immediate from the definition). (u, v 1 , . . . , v r , w) is an r-split if and only if, for all i ∈ {1, . . . , r}, (uv

1 . . . v i-1 , v i , v i+1 . . . v r w) is a 1-split.
Remark 3.3.12. The difference with the (1, r)-factorizations of [Lho20, Definition 19] is that we have replaced the equality and idempotency requirements on ϕ(v 1 ), . . . , ϕ(v n ) by the "boundary conditions" involving ϕ(u) and ϕ(w) (actually, (1, r + 2)-factorizations induce r-splits). We will see in Remark 3.3.17 how this change is helpful.

The point of r-splits is that given a split of an input string according to the morphism that sends it to the corresponding transition in a SST, we have some control over what happens to the output of the SST if we pump a middle factor in the split. Furthermore, it suffices to consider a quotient of the transition monoid which is finite when the SST is copyless (this is similar to Proposition 2.3.24). More precisely, we have the key lemma below, which is used pervasively throughout our proof of Theorem 3.3.9: Lemma 3.3.13. Let f : Γ * → Σ * be a regular function. There exist a morphism to a finite monoid ν f : Γ * → N (f ) and, for each c ∈ Σ, a set of producing triples P (f, c) ⊆ N (f ) 3 such that, for any 1-split according to ν f composed of u, v, w ∈ Γ * -i.e. ν f (uv) = ν f (u) and ν f (vw) = ν f (w) -we have:

• if (ν f (u), ν f (v), ν f (w)) ∈ P (f, c), then |f (uvw)| c > |f (uw)| c ; • otherwise (when the triple is not producing), |f (uvw)| c = |f (uw)| c .
Furthermore, in the producing case, we get as a consequence that ∀n ∈ N, |f (uv n w)| c ≥ n.

Something like this (but not exactly) appears in the proof of [Lho20, Lemma 18].

Proof idea. We reuse an idea from [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF], but instead of using transition monoids of two-way transducers, we rely on monoids of copyless register assignments. We shall use the notations introduced in Section 2.3.4 for these monoids and the operations they support.

Let R and Σ be finite alphabets. First, we factor erase Σ :

M cl R,Σ → M cl R,∅ into two surjective morphisms M cl R,Σ → M cl01 R,Σ → M cl R,∅
, going through a new monoid which keeps some information about the letters of Σ but is still finite. To do so, we define an equivalence relation on register assignments as follows: for α, β ∈ M cl R,Σ , we say that α ∼ β when • erase Σ (α) = erase Σ (β); • for each r ∈ R, the sets of letters from Σ that appear in α(r) and β(r) are equal. One can show that ∼ is a congruence, so we may form the quotient monoid M cl01 R,Σ = M cl R,Σ / ∼. Thanks to the first clause in the definition of ∼, the morphism erase Σ factors through the canonical projection. The quotient is finite since each equivalence class has a representative α such that |α(r)| ≤ |R| + |Σ| for all r ∈ R: essentially, ∼ only takes into account the presence or absence of each letter in Σ, not their multiplicity (hence the notation "01").

Next, let f : Γ * → Σ * be computed by some copyless SST (Q, q 0 , R, δ, u I , F ). We take

N (f ) = M cl01 R,Σ Q and define ν f as a composition Γ * → M cl R,Σ Q → N (f )
where the first morphism -which we may call ψ δ , as in Lemma 3.3.7 -maps c ∈ Γ to δ(-, c) and the second morphism is the canonical projection.

What we need to show now is that, given a 1-split (u, v, w) ∈ (Γ * ) 3 with respect to ν f , the comparison between |f (uvw)| and |f (uw)| depends only on ν f (x) for x ∈ {u, v, w}.

Let q and u I be the state and register values of the SST after reading u; to be more formal, ψ δ (u)(q 0 ) = (q , α) and α † ( u I ) = u I . Note that q is also the first component of the pair ν f (u)(q 0 ); since ν f (uv) = ν f (u) (by definition of 1-split), the SST reaches the state q after reading uv as well: ψ δ (q , v) = (q , β) for some β ∈ M cl R,Σ . Let ψ δ (w)(q ) = (q , γ). Then

f (uvw) = F (q ) † • (β • γ) † ( u I ) f (uw) = F (q ) † • γ † ( u I ) Since ν f (vw) = ν f (w), we have erase Σ (β • γ) = erase Σ (γ). Therefore, ω = (β • γ) (F (q ))
and ω = γ (F (q )) have the same letters from R with the same multiplicities (and appearing in the same order, although this does not matter for us here): |ω| r = |ω | r for all r ∈ R. This is why the two sums over R cancel out in the following computation (writing u I = (u r ) r∈R ):

∀c ∈ Σ, |f (uvw)| c -|f (uw)| c = |ω † ( u I )| c -|(ω ) † ( u I )| c = |ω| c + r∈R |ω| r • |u r | c -|ω | c - r∈R |ω | r • |u r | c = |ω| c -|ω | c
From now on, let c ∈ Σ. From the definition of β , we have

|ω| c = |β (ω )| c = |ω | c + r∈R |ω | r • |β(r)| c
So we get the dichotomy of the lemma statement:

• if there exists some r ∈ R such that |ω | r > 0 and |β(r)| c > 0, then |f (uvw)| > |f (uw)|; • otherwise, |f (uvw)| = |f (uw)|.
For each r ∈ R, the condition |ω | r > 0 can be checked from q and ν f (w); in turn, q depends only on ν f (u). As for |β(r)| c > 0, since it is a condition on the presence or not of a certain letter from Σ in β(r), without considering its precise multiplicity, it depends only on ν f (v): this is the information that ν f was designed to encode. This gives us the definition of the set of producing triples P (f, c).

There remains a final claim to prove in the lemma statement, concerning |f (uv n w)| c when (u, v, w) ∈ P (f, c) and n ∈ N. Using µ(uv) = µ(u), one can show that for all m ∈ N, the triple (uv m , v, w) is also a producing 1-split. So we have

|f (uv n w)| c > |f (uv n-1 w)| c > • • • > |f (uw)| c
and since all elements of this sequence are natural numbers, |f (uv n w)| c ≥ n. Definition 3.3.14. We fix once and for all a choice of N (f ), ν f and P (f, c) for each regular function f : Γ * → Σ * and letter c ∈ Σ. We say that a 1-split (u, v, w) is producing with respect to (f, c) when (ν f (u), ν f (v), ν f (w)) ∈ P (f, c). For Π ⊆ Σ, we also set

P (f, Π) = c∈Π P (f, c)
Lemma 3.3.15 (Rank 0 dichotomy). Let f : Γ * → Σ * be a regular function, M be a finite monoid and ϕ : Γ * → M be a morphism. Suppose that there exists another morphism

π : M → N (f ) such that π • ϕ = ν f . Let r ≥ 1 and Π ⊆ Σ.
We define L(f, Π, ϕ, r) to be the set of strings that admit an r-split s = uv 1 . . . v r w according to ϕ such that all the triples (uv 1 . . . v i-1 , v i , v i+1 . . . v r w) are producing with respect to (f, Π) -let us call this a producing r-split with respect to (f, Π, ϕ).

Then L(f, Π, ϕ, r) is a regular language, and sup{|f (s

)| Π | s ∈ Γ * \ L(f, Π, ϕ, r)} < ∞.
To prove this, we first recall a standard Ramsey argument. The statement below is a bit stronger than necessary for the purpose of showing the above lemma, but it will be reused in the proof of Theorem 3.5.3. Proposition 3.3.16 (analogous to [Lho20, Claim 20]). Let Γ be an alphabet, M be a finite monoid, ϕ : Γ * → M be a morphism and r ≥ 1. There exists N ∈ N such that any string s = uvw ∈ Γ * such that |v| ≥ N admits an r-split s = u v 1 . . . v r w according to ϕ in which u is a prefix of u and w is a suffix of w .

Proof. By the finite Ramsey theorem for pairs, there exists R ∈ N such that every complete undirected graph with at least R vertices whose edges are colored using |M | colors contains a monochromatic clique with r + 3 vertices. We take N = R -1.

Let s = uvw ∈ Γ * with |v| ≥ N . Let us write s[i . . . j] for the substring of s between two positions i, j ∈ {0, . . . , |s|}. Those indices are considered as positions in-between letters, so, for instance, s = s[0 . . . |s|], while s[(i -1) . . . i] is the i-th letter of s; note also that s

[i . . . j] • s[j . . . k] = s[i . . . k]. In particular, we have v = s[|u| . . . |uv|].
Consider the following coloring of the complete graph over V = {|u|, . . . , |uv|}: the edge (i, j) ∈ V 2 with i < j is given the color ϕ(s[i . . . j]). Since |V | ≥ N + 1 = R, there exists a monochromatic clique {i 0 , . . . , i r+2 } ⊆ V with i 0 < • • • < i r+2 .

We now define u = s[0 . . . i 1 ] and w = s[i r+1 . . . |s|], which ensures that u is a prefix of u and w is a suffix of w since i 1 and i r+1 are positions in v. For m ∈ {1, . . . , r}, we also

take v m = s[i m . . . i m+1 ] = ε (because |v m | = i m+1 -i m ≥ 1). Then s = u v 1 . . . v r w , and ϕ(u v 1 . . . v m ) = ϕ(s[0 . . . i m+1 ]) = ϕ(s[0 . . . i 0 ])ϕ(s[i 0 . . . i m+1 ]) = ϕ(s[0 . . . i 0 ])ϕ(s[i 0 . . . i 1 ]) by monochromaticity = ϕ(s[0 . . . i 1 ]) = ϕ(u )
and similarly, ϕ(v m . . . v 1 w ) = ϕ(w ). Thus, by definition, we have an r-split of s.

Proof of Lemma 3.3.15. L(f, Π, ϕ, r) can be recognized by a non-deterministic automaton that guesses an adequate r-split and computes ϕ(u), ϕ(v 1 ), . . . , ϕ(v r ), ϕ(w). The hard part is showing that |f (-)| Π is bounded on the complement of this language.

By the previous proposition, there exists some N ∈ N such that any string s ∈ Γ * of length at least N admits an r-split according to ϕ. Thanks to the existence of π, it is also an r-split according to ν f . So if this long string is in Γ * \ L(f, Π, ϕ, r), then it is of the form s = uv 1 . . . v r w where, for some i ∈ {1, . . . , r}, (uv

1 . . . v i-1 , v i , v i+1 . . . v r w) is not producing. Therefore, |f (uv 1 . . . v i-1 v i+1 . . . v r w)| Π = |f (uv 1 . . . v r w)| Π .
The important part is that the argument in the left-hand side is strictly shorter (the definition of r-split contains v i = ε). Furthermore, we claim that s = uv 1 . . . v i-1 v i+1 . . . v r w ∈ Γ * \ L(f, Π, ϕ, r). Once this is established, a strong induction on the length suffices to show that |f (-)| Π restricted to Γ * \ L(f, Π, ϕ, r) reaches its maximum at some string of length smaller than N , and thus to conclude the proof.

It remains to show that s / ∈ L(f, Π, ϕ, r). If this were false, then by definition we would have a producing r-split s = u v 1 . . . v r w . Assuming this, we will lift this split to a producing r-split of s in order to contradict s / ∈ L(f, Π, ϕ, r). We give notations to the components of our non-producing triple:

û = uv 1 . . . v i-1 , v = v i , ŵ = v i+1 . . . v r w.
Suppose that for some j ∈ {1, . . . , r} and x ∈ Γ * , we have û = u v 1 . . . v j-1 x and |x| ≤ |v j |. Then there must exist a unique y ∈ Γ * such that v j = xy and ŵ = yv j+1 . . . v r w . What we want to show now is that (u , v 1 , . . . , v j-1 , xvy, v j+1 , . . . , v r , w ) is a producing r-split of s.

• First, the concatenation of this sequence of length r + 2 is indeed equal to ûv ŵ = s.

• Next, we have ϕ(u v 1 . . . v j-1 (xvy)) = ϕ(ûvy) = ϕ(ûv)ϕ(y) = ϕ(û)ϕ(y) since (û, v, ŵ) is a 1-split of s, and ϕ(û)ϕ(y) = ϕ(ûy) = ϕ(u v 1 . . . v j ). For k ≥ j, by multiplying by ϕ(v j+1 . . . v k ) on the right, we get

ϕ(u v 1 . . . v j-1 (xvy)v j+1 . . . v k ) = ϕ(u v 1 . . . v k ).
Similarly, for k ≤ j, we have ϕ(v k . . . v j-1 (xvy)v j+1 . . . v r w ) = ϕ(v k . . . v r w ). • Combining the above with the fact that (u , v 1 , . . . , v r , w ) is an r-split of s gives us directly from the definitions that our new (r + 2)-tuple with xvy is an r-split of s. • Finally, we must check that it is producing.

-

Let k ≤ j -1. We must show that (u v 1 . . . v k-1 , v k , v k+1 . . . v j-1 (xvy)v j+1 . . . v r w
) is producing with respect to (f, Π). We have seen previously that the componentwise image by ϕ of this triple is the same as the one for

(u v 1 . . . v k-1 , v k , v k+1 . . . v r w ).
The latter is producing (since it comes from an r-split chosen to be producing), and therefore so is the former, because thanks to ν f = π • ϕ, the image by ϕ suffices to determine whether a triple is producing. -The case k ≥ j + 1 is symmetrical.

-The remaining case is (u v 1 . . . v j-1 , xvy, v j+1 . . . v r w ). It would be convenient if xvy and v j had the same image by ϕ, but this is not guaranteed. Instead, we come back to the dichotomy concerning what happens when we remove the substring xvy in s. This can be done in two steps: first remove v in s, which gives us s , then remove xy = v j from s , resulting in s = u v 1 . . . v j-1 v j+1 . . . v r w . Using the fact that the r-split of s is producing while (û, v, ŵ) is not, we have |f (s

)| Π = |f (s )| Π > |f (s )| Π .
This means that the 1-split containing xvy must be producing. If the (j, x) chosen previously does not exist, then either u is a prefix of û or w is a suffix of ŵ. In those cases, there is an analogous lifting procedure, and its proof of correctness is simpler; we leave this to the reader. Remark 3.3.17. It is not clear whether the above reasoning can be made to work if we require idempotency in the definition of r-split, as is the case for the (k, r)-factorizations in [Lho20] (cf. Remark 3.3.12). An analogous argument is made in the first paragraph of the proof of the original Dichotomy Lemma in [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF], but we were unable to check that s / ∈ L(f, Π, ϕ, r) when forcing the central elements of producing triples to be idempotent. (This is an arguably minor bug and does not constitute the main reason for the failure of the proof strategy of [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF] in the case of general pebble transducers.) Thankfully, idempotency does not seem to be required to carry out further arguments leading to a proof of Theorem 3.3.9. Lemma 3.3.18. Let f : Γ * → Σ * be comparison-free polyregular. There exist a morphism to a finite monoid ν f : Γ * → N (f ) such that, for any 1-split according to ν f composed of u, v, w ∈ Γ * and any c ∈ Σ * , the sequence (|f (uv n w)| c ) n∈N is non-decreasing.

Proof. By straightforward induction on rk(f ), using Lemma 3.3.13: for g regular and h i comparison-free, we take N (CbS(g, (h

i ) i∈I )) = N (g) × i∈I N (h i ).
Lemma 3.3.19. Let g : Γ * → I * be a regular function and, for each i ∈ I, let h i : Γ * → Σ * be comparison-free polyregular of rank at most k. Suppose that sup

s∈Γ * |g(s)| J < ∞ where J = {i ∈ I | rk(h i ) = k} when k ≥ 1 {i ∈ I | |h i (Γ * )| = ∞} when k = 0
(Morally, regular functions with finite range play the role of "comparison-free polyregular functions of rank -1".) Then rk(CbS(g, (h i ) i∈I )) ≤ k.

Remark 3.3.20. This is analogous to [Lho20, Claim 22], but it also seems to be related to the way the "nested transducer" R k+1 is defined in the proof of the dichotomy lemma in [START_REF] Lhote | Pebble Minimization of Polyregular Functions[END_REF]: indeed, R k+1 can call either a k-nested subroutine or a (k -1)-nested one.

Proof. We write f = CbS(g, (h i ) i∈I ).

First, let us consider the case k = 0. For convenience, we assume w.l.o.g. that I ∩ Σ = ∅. Let N = sup{|g(s)| J | s ∈ Γ * } -in the degenerate case J = ∅, this leads to N = 0and ι n (s) be the n-th letter of J in g(s) if it exists, or else ε. Then we use the equation g(s) = ρ 0 (s)ι 1 (s)ρ 1 (s) . . . ι N (s)ρ N (s) to define uniquely ρ 0 , . . . , ρ N : Γ * → (I \ J) * . One can build for each n ∈ {0, . . . , N } a sequential transducer whose composition with g yields ρ n ; therefore, since g is regular, so is ρ n . We define ψ n (s) next as h ιn(s) (s) when ι n (s) ∈ J, and ε otherwise. For any n ∈ {1, . . . , N }, since the languages g -1 (((I \ J) * J) n-1 (I \ J) * iI * ) are regular for all i ∈ J, this defines ψ n as a combination of {s → ε} ∪ {h i | i ∈ J} by regular conditionals, so ψ n is regular. Finally, we set f (s) = ρ 0 (s)ψ 1 (s)ρ 1 (s) . . . ψ N (s)ρ N (s) ∈ (Σ ∪ I \ J) * ; the function f thus defined is regular by closure under concatenation (use a product construction on copyless SSTs). Observe that f (s) is obtained by substituting each occurrence of a letter i ∈ J in g(s) by h i (s) (thus, it is equal to g(s) when J = ∅, and to f (s) when J = I).

What remains to do is to substitute the letters of I \ J to get f . To do so, let us define

L w = {s ∈ Γ * | ∀i ∈ I \ J, h i (s) = w i } for w = (w i ) i∈I\J ∈ i∈I\J h i (Γ * ).
The function f coincides on L w with f postcomposed with the morphism that replaces each i ∈ I \ J by w i ; this is regular by closure under composition. Furthermore, the factors of i∈I\J h i (Γ * ) are finite by definition of J, and I \ J itself is a subset of the finite alphabet I. So there are finitely many L w , and they partition Σ * ; they are also all regular, as finite intersections of preimages of singletons by regular functions. Therefore, f is obtained by combining regular functions by a regular conditional, so it is regular, i.e. rk(f ) = 0 as we wanted.

This being done, let us move on to the case k ≥ 1. For i ∈ J, let h i = CbS(g i , (h i,x ) x∈X i ) where all the g i are regular and the h i,x are of rank at most k -1, choosing the X i to be pairwise disjoint as well as disjoint from I. Let f (s) be obtained from g(s) by substituting each occurrence of a letter i ∈ J by g i (s). For the same reasons as those exposed in the first paragraph of the case k = 0, this defines a regular function f . By taking its composition by substitution with the disjoint union of the families (h i ) i∈I\J and (h i,x ) x∈X i for i ∈ J, we recover f . Since the functions involved in this union family are all of rank at most k -1 (by definition of J), this means that rk(f ) ≤ k. Lemma 3.3.21. Let f : Γ * → Σ * be a comparison-free polyregular function. Let ϕ : Γ * → M be a morphism to a finite monoid and let r ≥ 1. Then there exists a regular language L(f, ϕ, r) ⊆ Γ * such that:

• the function which maps L(f, ϕ, r) to ε and coincides with f on Γ * \ L(f, ϕ, r)

is regular and takes finitely many values if rk(f ) = 0 i.e. f is regular; is comparison-free polyregular with rank strictly lower than rk(f ) otherwise; • for any s ∈ L(f, ϕ, r), there exist k = rk(f ) + 1 r-splits according to ϕ -let us write them as

s = u (m) v (m) 1 . . . v (m)
r w (m) for m ∈ {1, . . . , k} -such that, for any factorization s = α 0 β 1 α 1 . . . β k α k where, for some permutation σ of {1, . . . , k}, each β m coincides with some v (σ(m)) l (in the sense that their positions as substrings of s are equal), we have

∀n ∈ N, |f (α 0 β n 1 α 1 . . . β n k α k )| ≥ n k (note
that in general, such factorizations s = α 0 β 1 α 1 . . . β k α k might not exist, for instance when r = 1 and all the substrings v (m) 1

overlap)

Proof. We proceed by induction on rk(f ).

Base case: rk(f ) = 0. In this case, f is regular. Let ψ : Γ * → M × N (f ) be the monoid morphism obtained by pairing ϕ (given in the lemma statement) with ν f (given in Lemma 3.3.15). Then, using Lemma 3.3.15, one can see that taking L(f, ϕ, r) = L(f, Σ, ψ, r) works.

Inductive case: rk(f ) ≥ 1. In this case, f = CbS(g, (h i ) i∈I ) for some regular g : Γ * → I * and some comparison-free polyregular h i : Γ * → Σ * with rk(h i ) ≤ rk(f ) -1 for all i ∈ I. Let ϕ and r be as given in the lemma statement. Let J be defined as in Lemma 3.3.19:

J = {i ∈ I | rk(h i ) = rk(f ) -1} when rk(f ) ≥ 2 {i ∈ I | |h i (Γ * )| = ∞} when rk(f ) = 1
For i ∈ J, let ψ i : Γ * → M × N (g) × N (h i ) be obtained by combining ϕ with the morphisms given by Lemmas 3.3.13 and 3.3.18. We shall consider the regular languages L(h i , ψ i , r) provided by the inductive hypothesis.

Let us take a copy J = {i | i ∈ J} of J such that J ∩ I = ∅. We define the regular function g : Γ * → (I ∪ J) * as follows: for any input s ∈ Γ * , to build the output g (s), we start from g(s) and then, for each i ∈ J such that s / ∈ L(h i , ψ i , r), we replace all the occurrences of i by i. For i ∈ J, we also define h i to be the function which maps L(h i , ψ i , r) to ε and coincides with h i on Γ * \ L(h i , ψ i , r). By construction, f = CbS(g , (h i ) i∈I∪J ). Note that g is regular: it is indeed generated from g using regular conditionals and postcomposition by letter-to-letter morphisms. We can therefore build a morphism

χ : Γ * → M × N (g ) × i∈J N (h i )
in the expected way, and define the language provided by the lemma statement as L(f, ϕ, r) = L(g , J, χ, r)

According to Lemma 3.3.15, it is indeed a regular language. Concerning the first item of the lemma statement, the function that it considers can be expressed as CbS(g , (h i ) i∈I∪J ) where g : s → ε when s ∈ L(g , J, χ, r) g (s) otherwise

We want to show that rk(CbS(g , (h i ) i∈I∪J )) ≤ rk(f ) -1. The shape of this statement fits with the conclusion of Lemma 3.3.19, so we just have to check the corresponding assumptions.

• g is regular, by closure of regular functions under regular conditionals.

• for i ∈ I ∪ J, the function h i is comparison-free polyregular of rank at most rk(f ) -1:

for i ∈ I, this was required in our choice of expression for f = CbS(g, (h i ) i∈I ) (and such a choice was possible by definition of rank); for i = j ∈ J, we get this by applying the first item of the inductive hypothesis to h j (indeed, the function introduced by this item is none other than h j = h i ). • We also get that, with the same J as before,

J = {i ∈ I ∪ J | rk(h i ) = rk(f ) -1} when rk(f ) ≥ 2 i.e. ∀i ∈ J, rk(h i ) ≥ 1 {i ∈ I ∪ J | |h i (Γ * )| = ∞} when rk(f ) = 1 i.e. ∀i ∈ J, rk(h i ) = 0
using again the first item of the inductive hypothesis to handle the case of indices in J. • Finally, by definition of g and by Lemma 3.3.15, using the convention sup ∅ = 0,

sup s∈Γ * |g (s)| J = sup{|g (s)| J | s ∈ Γ * \ L(g , J, χ, r)} < ∞
Let us now check the second item concerning splits and factorizations. Let s ∈ L(f, ϕ, r). By definition, there exists i ∈ J such that s ∈ L(g , i, χ, r). In particular, |g (s)| i ≥ 1, which entails that s ∈ L(h i , ψ i , r) by definition of g . The inductive hypothesis gives us a family of r-splits s

= u (m) v (m) 1 . . . v (m) r w (m) according to ψ for m ∈ {1, . . . , k -1} -recall that rk(h i ) + 1 = rk(f ) = k -1. We complete it by taking (u (k) , v (k) 1 , . . . , v (k)
r , w (k) ) to be a producing r-split of s with respect to (g , i, χ), whose existence is guaranteed by definition of L(g , i, χ, r). Since ϕ factors through both ψ i and χ by construction, this indeed gives us a family of k r-splits according to ϕ. Now, let s = α 0 β 1 α 1 . . . β k α k be a factorization and σ be a permutation of {1, . . . , k} such each β m coincides with some v (σ(m)) l for some l. Note that from the original expression of f as a composition by substitution, we have

∀s ∈ Γ * , |f (s )| ≥ |g(s )| i • |h i (s )|
Therefore, our desired inequality will follow once we prove the ones below:

∀n ∈ N, |g(α 0 β n 1 α 1 . . . β n k α k )| i ≥ n and |h i (α 0 β n 1 α 1 . . . β n k α k )| ≥ n k-1
To illustrate the idea, we assume σ(k) = k, so that

β k = v (k) l
for some l, and we invite the reader to convince themself that this is merely a matter of notational convenience for the rest of the proof.

Let us start with h i . Since ν h i factors through χ, the triple

(α 0 β 1 . . . β k-1 α k-1 , β k , α k ) = (u (k) v (k) 1 . . . v (k) l-1 , v (k) l , v (k) l+1 . . . v (k) r w (k)
) is a 1-split according to ν h i . Using the fact that ν h i factors through ψ i , one can show that

(α 0 β n 1 . . . β n k-1 α k-1 , β k , α k ) is still a 1-split according to ν h i . Therefore, for n ∈ N, |h i (α 0 β n 1 . . . β n k-1 α k-1 β n k α k )| ≥ |h i (α 0 β n 1 . . . β n k-1 α k-1 β k α k )| ≥ n k-1
where β k is not raised to the n-th power in the middle; the left inequality comes from Lemma 3.3.18, while the right inequality is part of the induction hypothesis applied to h i .

The case of g requires an additional step. We know that (α 0 β 1 . . . β k-1 α k-1 , β k , α k ) is a producing triple with respect to (g , i, χ); therefore, by Lemma 3.3.13,

∀n ∈ N, |g (α 0 β 1 . . . β k-1 α k-1 β n k α k )| i ≥ n
To replace g by g in the above inequality, recall that by definition of g , since i ∈ J,

∀s ∈ Γ * , |g (s )| i = 0 =⇒ |g (s )| i = |g(s )| i
One can then conclude by Proposition 3.3.22 below, taking l = k -1. There is a subtlety here: our definitions ensure that ν g factors through ψ i , but this might not be the case for ν g (because ψ i had to be defined before g ). So for this final step, we must work with the function g, whereas to leverage the producing triple, we had to use g .

The following proposition, which we used at the end of the above proof, will also be useful to prove Theorem 3.5.3. Proposition 3.3.22. Let g : Γ * → Σ * be a regular function and s = α 0 β 1 α 1 . . . β l α l ∈ Γ * such that every triple (α 0 β 1 . . . α m , β m+1 , α m+1 β m+2 . . . α l ) is a 1-split according to ν g . Then for every c ∈ Σ, the function (n 1 , . . . , n l ) → |g(α 0 β n 1 1 α 1 . . . β n l l α l )| c is monotone according to the product partial order on N l . Proof idea. In order to apply Lemma 3.3.15, the key observation is that the triple

(α 0 β n 1 1 . . . α m β n m+1 m+1 , β m+1 , α m+1 β n m+2
m+2 . . . α l ) is also a 1-split. This is because we have, by definition of 1-split, ν g (α

0 β n 1 1 ) = ν g (α 0 β 1 ), then ν g (α 0 β 1 α 1 β n 2 2 ) = ν g (α 0 β 1 α 1 β 2 ), etc.
, and similarly on the right side. After having established Lemma 3.3.21, we can use it to finally wrap up this section.

Proof of Theorem 3.3.9. We apply Lemma 3.3.21 to get a language L(f, ϕ, rk(f )+1) where ϕ does not matter (take for instance the morphism from Γ * to the trivial monoid). It must be non-empty (or else we would have the contradiction rk(f ) < rk(f )), so we can choose an arbitrary element s ∈ L(f, ϕ, rk(f ) + 1).

Let k = rk(f

) + 1. Lemma 3.3.21 gives us k factorizations s = u (m) v (m) 1 . . . v (m)
k w (m) satisfying certain properties. Note that k plays two roles here that were distinct in the lemma. We claim that thanks to this, there exists a factorization s = α 0 β 1 α 1 . . . β k α k as described in Lemma 3.3.21. This entails that setting s n = α 0 β n 1 α 1 . . . β n k α k proves the theorem. Our task is therefore to select one element in each of the k sets {v (m) l | l ∈ {1, . . . , k}} of substrings of s for m ∈ {1, . . . , k}, such that the selected substrings are pairwise nonoverlapping. There is a strategy for this which is similar to the classical greedy algorithm for computing a maximum independent set in an interval graph. We take β 1 to be the substring of s among the v (m) 1 whose right endpoint is leftmost. One can check that β 1 cannot overlap with any v (m) l for l ≥ 2. Thus, by discarding the set to which β 1 belongs, as well as each v (m) 1 in the other sets, we reduce the remainder of the task to our original goal with k being decremented by 1. At this stage, an induction suffices to conclude the proof.

3.3.3. Proofs of Theorems 3.3.1 and 3.3.2. Now that we have shown that cfp functions are closed under composition and that their asymptotic growth are tightly linked to their ranks, we have the essential ingredients to prove Theorems 3.3.1 and 3.3.2. There are a couple of preliminary lemmas helpful for both that we first prove here. Lemma 3.3.23. For any comparison-free polyregular function f : Γ * → Σ * and k ≥ rk(f ), there exists a regular function f : ({0, . . . , rk(f

)} × Γ) * → Σ * such that f = f • cfpow (k+1) Γ .
Proof. By induction on rk(f ) (with an inductive hypothesis that quantifies over k).

Base case (f regular).

Consider the unique ϕ ∈ Hom(({0, . . . , rk(f )} × Γ) * , Γ * ) such that for every c ∈ Γ, ϕ(k, c) = c and ϕ(m, c) = ε when m < k. Since regular functions are closed under composition, f = f • ϕ is regular, and the desired equation follows from the fact that ϕ • cfpow

(k+1) Γ = id Γ * .
Inductive case. Let f = CbS(g, (h i ) i∈I ) with g : Γ * → I * regular and h i : Γ * → Σ * cfp such that rk(h i ) ≤ rk(f ) -1 for all i ∈ I. Using the inductive hypothesis, we know that

h i = h i • cfpow (k)
Γ for some family of regular functions (h i ) i∈I . Thus, let us assume we are given 2DFTs T and (T i ) i∈I corresponding to g and the family (h i ) i∈I . Without loss of generality, let us assume further that T always output at most one letter at each transition, never outputs a letter upon reading , and that the T i always terminate on the marker by a transition that does not move the reading head. With these assumptions, let us describe informally a 2DFT T corresponding to the function f such that CbS(g, (h i • cfpow

(k) Γ ) i∈I ) = f • CbS(g, (h i ) i∈I ) • cfpow (k+1) Γ
Assuming that the state space of T is Q and the state space of T i is Q i , with Q and the Q i s all pairwise disjoint, we take the state space of T to be

Q = Q × {L, R, S} × {•} i∈I Q i × {L, R, S}
with initial state (q 0 , R, •), if q 0 is the initial state of T and final states the triples (q f , M, •) such that q f is a final state of T . To guide intuitions, the elements L, R and S should be respectively read as "left", "right" and "stay". With this in mind, the high-level description of computations carried out by T over words pow (k) Γ is as follows.

• When in a state (q 0 , M, •), T essentially acts as T on letters of the shape (k, a) or end-markers and ignores letters (l, a) for l < k; the central component M then determines whether to seek the next relevant position to the left or to the right when reading such an irrelevant letter. This continues up until upon reading a letter (k, a) in state (q, M, •) such that T would ouput i when reading a in q, T moves into the state (r, M , (q 0,i , R)) where q 0,i is the initial state of T i and (r, M ) is determined by the transition in T . • When in a state (q, M, (q i , M )) for q i ∈ Q i , T behaves exactly as T i as long as the current transition does not reach the final state, treating letters outside of its input alphabets as end markers; this is possible because of the component M of the state, that we use to keep track of the last move of the reading head. Meanwhile the components q ∈ Q and M are untouched. When a final transition is taken, by our assumption we return control to T by going to state (q, M, •) and moving in the direction prescribed by M (recall that, by assumption, we are moving away from (or staying in) the position at which T i started running). We leave formalizing this definition and checking that T has a desirable behaviour to the reader.

Lemma 3.3.24. For every k ∈ N, cfpow

Γ is equal to a a composition of sequential functions and squaring functions cfsquaring ∆ .

Proof. We proceed by induction over k. The cases of k = 0, 1, 2 are immediate as cfpow (k) Γ then corresponds, up to isomorphism of output alphabet, to a constant function, the identity and cfsquaring Γ respectively, so we focus on the inductive step. To achieve the desired result, it suffices to show that there exists a sequential function

f : (({0, . . . , k} × Γ) ∪ ({0, . . . , k} × Γ)) * → ({0, . . . , k + 1} × Γ) * such that cfpow (k+1) Γ = f • cfsquaring {0,...,k}×Γ • cfpow (k+1) Γ
. In fact, the sequential transducer pictured below computes such an f :

o i (k, a) | (k + 1, a) (k, a) | (k, a) (m, a) | (m, a) (m, a) | ε (m, a) | ε (k, a) | ε (m, a) | ε (k, a) | (k + 1, a) ε ε
where m designates any element of {0, . . . , k -1}.

Now we turn to the proofs of our main theorems.

Proof of Theorem 3.3.1. The direct implication is obtained by combining the two lemmas above: every cfp function can be written as a composition f • cfpow (k) Γ for some k ∈ N and f regular by Lemma 3.3.23, and Lemma 3.3.24 guarantees that in turn, cfpow (k) Γ is a composition of sequential (and a fortiori regular) functions and squarings. Conversely, that cfp functions are closed under composition is proven in Section 3.3.1, which is enough to conclude as regular functions and cfsquaring Γ are cfp.

Proof of Theorem 3.3.2. We prove the circle of implications (i) ⇒ (iii) ⇒ (ii) ⇒ (i). (The claim after this equivalence has already been established in Theorem 3.3.9.)

The first implication (i) ⇒ (iii) corresponds exactly to Lemma 3.3.23 we just proved. The implication (iii) ⇒ (ii) is also relatively easy: cfpow

Γ is comparison-free polyregular (this is a consequence of Lemma 3.3.24 and Theorem 3.3.1, although cfpow

Comparison-free polyregular sequences

Now that we have given general characterizations of cfp functions, it can be interesting to consider degenerate cases. We shall look here at functions with unary input alphabet. (Dually, Douéneau-Tabot has recently studied polynomial growth transductions -including cfp functions -with unary output [START_REF] Douéneau-Tabot | Pebble Transducers with Unary Output[END_REF].) By identifying N with the set of words {a} * , via the canonical isomorphism n → a n , functions {a} * → Γ * can be seen as sequences.

We shall perform this identification implicitly and speak freely, for instance, of word sequences N → Γ * that are comparison-free polyregular. It turns out that the latter admit a characterization as finite combinations of what we call "poly-pumping sequences". The star-height of a polynomial word expression is defined in the usual way.

Theorem 3.4.2. Let s : N → Σ * and k ∈ N. The sequence s is comparison-free polyregular with rk(s) ≤ k if and only if there exists p > 0 such that, for any m < p, there is a polynomial word expression e of star-height at most k + 1 such that ∀n ∈ N, s((n + 1)p + m) = e (n).

In short, the comparison-free polyregular sequences are exactly the ultimately periodic combinations of poly-pumping sequences. Our proof strategy is an induction on k. The base case k = 0 characterizes regular sequences as ultimately periodic combinations: Lemma 3.4.3. A sequence of words s : N → Σ * is regular if and only if there is m > 0 such that for every k < m, there are words u 0 , . . . , v l , v 1 , . . . , v l such that for every n ∈ N, we have

∀n ∈ N, s((n + 1)m + k) = u 0 (v 1 ) n . . . (v l ) n u l
A result that is essentially equivalent to the above lemma is stated with a proof sketch using 2DFTs by Choffrut in [Cho17, p. 90]; 8 we propose an alternative proof using copyless SSTs. (Non-deterministic two-way transducers (2NFTs) taking unary inputs have also been studied [START_REF] Guillon | Input-or output-unary sweeping transducers are weaker than their 2-way counterparts[END_REF]; furthermore, the notion of "k-iterative language" that appears in a pumping lemma for general 2NFTs [START_REF] Smith | A Pumping Lemma for Two-Way Finite Transducers[END_REF] (which actually dates back to [START_REF] Rozoy | Outils et résultats pour les transducteurs boustrophédons[END_REF]) is related to the shape of the above pumping sequences.)

The proof of the base case of Theorem 3.4.2 concentrates the bulk of the reasoning. To make the inductive step go through, it is enough to synchronize the periods of the different poly-pumping sequences involved and to observe that CbS( e , ( e i ) i∈I ) is realized by an expression obtained by substituting the e i for i in e.

Thanks to Theorem 3.4.2, we can perform induction over expressions to work with cfp sequences. One example of application, involving the map operation from §2.5.3, is the following (contrast with our later Corollary 3.5.5):

Corollary 3.4.4. If f : Γ * → Σ * and s : N → (Γ ∪ {#}) * are cfp, so is map(f ) • s.
Theorem 3.4.2 will also be applied later in §3.5 to prove a separation result. Before that, the next 3 subsections prove Lemma 3.4.3, Theorem 3.4.2 and Corollary 3.4.4 respectively. 3.4.1. Proof of Lemma 3.4.3. The "if" direction is straightforward, so we only prove the "only if" part of the statement. To keep notations harmonized, let us work with f : {a} * → Σ * such that s(n) = f (a n ) for every n ∈ N and fix a copyless SST computing f whose set of states, set of registers and transition function we call Q, R and δ respectively. We use 8 In [START_REF] Choffrut | Sequences of words defined by two-way transducers[END_REF], the result is attributed to "Eugenia", a hobbyist Italian researcher with a day job at a software company. Disappointingly, she is actually a fictional character (personal communication from Christian Choffrut, relayed by Charles Paperman).

the monoid M cl R,∅ Q introduced in Section 2.3.4, which contains µ = erase Σ (δ(-, a)). Since M cl R,∅ Q is finite (Proposition 2.3.24), there is an exponent m ∈ N \ {0} such that µ •m = µ • . . . (m times) . . . • µ is idempotent, i.e. µ •m = µ •2m
. This m is the one put forth in the lemma statement.

Let us fix k < m. Let (q, α) = µ •m (q 0 ) where q 0 is the initial state of the SST. We have µ

•(m+k) • µ •m = µ •(2m+k) = µ •k • µ •2m = µ •k • µ •m = µ •(m+k) as usual. Therefore, µ •m (q) = (q, β) with α • β = α and β • β = β (the latter is because of µ •2m = µ •m
). Thus, q is the state reached by the SST after reading a m(n+1)+k for any n ∈ N. We also have (δ(-, a)) •m (q) = (q, γ) with γ ∈ M cl R,Σ and erase Σ (γ) = β. Given r ∈ R, we distinguish two cases.

• First, suppose that β(r) = ε or equivalently that γ(r) ∈ Σ * (in general, the codomain of γ is (Σ ∪ R) * ). When the SST is in state q and reads a m , it executes the assignment γ; when β(r) = ε, the new value of the register r is this γ(r) ∈ Σ * which does not depend on the old value of any register. Therefore, for all n ∈ N, the content of the register r after having read a m(n+1)+k (starting from the initial configuration) is the constant γ(r). Let us study in general the situation β * (ρ) = β(r) = ε for ρ ∈ R * . A first observation is that the letters in β(r) cannot be found in any other β(r ) for r ∈ R \ {r} because β is copyless, so ρ / ∈ (R \ {r}) * . We therefore have n ≥ 1 occurrences of r in ρ, so ρ = ρ 0 r . . . rρ n with ρ 0 , . . . , ρ n / ∈ (R \ {r}) * . By coming back to β * (ρ) = β(r), into which we plug this expression for ρ, and using the fact that β(r) has non-zero length, we can see that n = 1 and β * (ρ 0 ) = β * (ρ 1 ) = ε.

Let us apply this to ρ = β(r) = erase Σ (γ)(r) and lift the result to γ(r): γ(r) = u r rv r for some u r , v r ∈ (Σ ∪ β -1 ({ε})) *

In the previous case (β(r ) = ε for r ∈ R), we saw that γ(β -1 ({ε})) ⊆ Σ * . Therefore γ (u r ), γ (v r ) ∈ Σ * , where γ ∈ Hom((Σ ∪ R) * , (Σ ∪ R) * ) extends γ : R → (Σ ∪ R) * by being the identity on Σ. Since Σ * is fixed by γ , when we iterate, we obtain

γ •(n+1) (r) = (γ ) n • γ(r) = (γ (u r )) n • u r rv r • (γ (v r )) n
Now, let F be the final output function of the SST that computes f , and w m+k be the register values after it has read a prefix a m+k . Then after reading a m(n+1)+k , the new register values are (γ •(n+1) ) † ( w m+k ). More precisely, the register r contains:

• γ(r) ∈ Σ * if β(r) = ε; • (γ (u r )) n • ((u r rv r ) † ( w m+k )) • (γ (v r )) n otherwise.
These values are combined by F (q) † -where q is the recurrent state we have been working with all along, and F is the final output function -to produce the output f (a m(n+1)+k ). This yields the desired shape: an interleaved concatenation of finitely many factors that are either constant, (γ (u r )) n or (γ (v r )) n for some r ∈ R.

3.4.2. Proof of Theorem 3.4.2. We proceed by induction on the rank of the sequence s : N → Σ * under consideration. If the rank of s is 0, it is regular and we apply Lemma 3.4.3 and the desired polynomial word expression is of the shape

u 0 • (v 1 ) * . . . (v l ) * • u l .
If the rank of s is k + 1, thanks to the induction hypothesis and the base case above, it can be written as CbS( e , ( e i ) i∈I ) where e is an expression over the alphabet I with star-height at most one and the e i s expressions over Σ with star-height at most k. Without loss of generality, we may assume that that terminal nodes of polynomial word expressions are words of length at most one. For such an expression over alphabet I, one may define inductively the following substitution operation to obtain an expression of Σ * : For the rest of this subsection, we write S for the successor function n → n + 1 over N. We will use the fact that s is a cfp sequence iff s • S also is.

j[(e i ) i∈I ] = e j ε[(e i ) i∈I ] = ε (f • f )[(e i ) i∈I ] = f [(e i ) i∈I ] • f [(e i ) i∈I ] f * [(e i ) i∈I ] = (f [(e i ) i∈I ]) *
Proof. We first note that if the separator # does not occur at any leaf of e, then the result is immediate as we would have map(f ) • e = f • e . We thus focus on the cases when it does occur, and proceed inductively over e.

• If e = w ∈ (Γ ∪ {#}) * , then map(f ) • e is a constant sequence, which is obviously cfp.

• If e = (e ) * , with # occuring in e , let h l , h r : N → Γ * and h c :

N → (Γ {#}) * be the sequences such that e • S • S = h l • # • h c • # • h r
with h l (n) being the largest #-free prefix of e (n + 2) and h r (n) the largest #-free suffix of e (n + 2). There is a regular function

f : (Γ {#}) * → (Γ {#}) * w 0 #w 1 # . . . w n-1 #w n → w 1 # . . . w n-1 (w 0 , . . . , w n ∈ (Γ Γ) * )
stripping away the first and last component of its input, so that it satisfies

f • map(f ) • e • S • S = map(f ) • h c
By the inductive hypothesis, we know that map(f ) • e is comparison-free polyregular. We may therefore conclude by composition (cf. Theorem 3.3.1) that map(f ) • h c is cfp. One can check analogously that h l and h r are also cfp. Then observe that

( e • S • S)(n) = (h l • # • h c • # • h r )(n) n+2 = (h l • (# • h c • # • h r • h l ) n+1 • # • h c • # • h r )(n) which means that map(f ) • e • S • S =                      (f • h l ) • (# • (map(f ) • h c ) • # • (f • (h r • h l ))) * • # • (map(f ) • h c ) • # • (f • (h r • h l )) • # • (map(f ) • h c ) • # • (f • h r )
Thanks again to the closure under composition, each component of this expression is cfp, so map(f ) • e • S • S is also cfp. Hence, so is map(f ) • e .

• The last case where e = e • e is handled similarly after a case analysis determining whether # occurs only in e , e or in both; we leave it to the reader.

To finish proving Corollary 3.4.4, suppose that we are given cfp functions f : Γ * → Σ * and s : N → (Γ ∪ {#}) * . By Theorem 3.4.2, there are m > 0 and some expressions e 0 , . . . , e m-1 such that s(m(n + 1) + k) = e k (n) for every k < m. By Lemma 3.4.5, every map(f ) • e k is cfp. The set L k = {m(n + 1) + k | n ∈ N} is semi-linear, i.e., corresponds to a regular language, and there are regular sequences r k : N → N such that r k (m(n + 1) + k) = n. Further, N = {n | n < m} ∪ k<m L k , so we may use the regular conditional provided by Proposition 3.1.8 to show that the combination of the map(f ) • e k • r k and the first m values of map(f ) • s, which corresponds exactly to map(f ) • s, is indeed cfp.

Separation results

Let us now give concrete functions that witness the separations claimed at the beginning of the chapter: the class of comparison-free polyregular functions is incomparable with the class of HDT0L transductions and is a strict subclass of polyregular functions.

Theorem 3.5.1. There exist comparison-free polyregular functions which are not HDT0L:

(i)

a n ∈ {a} * → (a n b) n+1 ∈ {a, b} * for a = b; (ii) w ∈ Σ * → w |w| for |Σ| ≥ 2 (a simplification of Example 3.1.3); (iii) a n #w ∈ Σ * → (w#) n for a, # ∈ Σ, a = # (from [DFG20, Section 6])
Note that in the last example, we have not fully specified the function, but we claim that a function that obeys this condition cannot be an HDT0L transduction, and that there exists a cfp function that satisfies it. Remark 3.5.2. The first example in [START_REF] Douéneau-Tabot | Register Transducers Are Marble Transducers[END_REF]§5] shows that a n → a n×n is HDT0L (via the equivalent model of marble transducers), hence the necessity of |Σ| ≥ 2 above. More generally, Douéneau-Tabot has shown very recently that every polyregular function with unary output is HDT0L [START_REF] Douéneau-Tabot | Pebble Transducers with Unary Output[END_REF]. So polyregular functions with unary output coincide with polynomial growth N-rational series (cf. Remark 2.3.15), and the latter admit several algebraic characterizations in the literature (see [START_REF] Reutenauer | Sur les séries associées à certains systèmes de Lindenmayer[END_REF] and [BR10, Chapter 9, Exercise 1.2]).

Theorem 3.5.3. Some HDT0L transductions are polyregular but not comparison-free:

(i) f : a n ∈ {a} * → ba n-1 b . . . baabab (with f (ε) = ε and f (a) = b); (ii) map(a n → a n×n ) : a n 1 # . . . #a n k → a n 1 ×n 1 # . . . #a n k ×n k (cf. Definition 2.5.8).
Remark 3.5.4. The function a n 1 # . . . #a n k → a n 1 ×n 1 +•••+n k ×n k obtained by erasing the #s in the output of map(a n → a n×n ) is also not comparison-free. This result implies the second item of Theorem 3.5.3 by composition with the erasing morphism; we do not prove it here, but it appears in Douéneau-Tabot's aforementioned paper [START_REF] Douéneau-Tabot | Pebble Transducers with Unary Output[END_REF]. Therefore, according to [START_REF] Douéneau-Tabot | Pebble Transducers with Unary Output[END_REF], not every polyregular function with unary output is comparison-free.

To see why the first of the two functions in Theorem 3.5.3 is HDT0L, observe that it is Example 2.3.4 for Γ = {a} (taking b = a); as for the second one, combine Remark 3.5.2 and Proposition 2.5.9.

The non-membership parts of Theorems 3.5.1 and 3.5.3 require more work. For the former, we use pumping arguments on HDT0L systems; the proofs are detailed in Section 3.5.1. Item (ii) of Theorem 3.5.3 is handled in §3.5.2 by first appealing to Theorem 3.3.2 to reduce to showing that map(a n → a n×n ) = CbS(g, (h i ) i∈I ) when g and all the h i are regular functions; a combination of pumping and of a combinatorial argument then shows that inputs with |I| occurrences of # suffice to discriminate the two sides of the inequality. This result also has the following immediate consequence: Corollary 3.5.5. Comparison-free polyregular functions are not closed under map.

Compare with Corollary 3.4.4, and see the end of Section 2.5.3 for a discussion of the significance of this fact.

As for item (i) of Theorem 3.5.3, we apply our characterization of cfp sequences from the previous section. We show that a n → ba n-1 b . . . bab is not comparison-free polyregular by proving that its subsequences are not poly-pumping: for every poly-pumping sequence s : N → {a, b} * , there is a uniform bound on the number of distinct contiguous subwords of the shape baa . . . ab occuring in each s(n) for n ∈ N. Let us formalize this. Definition 3.5.6. Let Σ be a finite alphabet and c ∈ Σ. Call β c : Σ * → P(N) the function assigning to a word w the set of lengths of its maximal factors lying in {c} * (including ε):

β c (w) = {k ∈ N | w ∈ (Σ * \ (Σ * • c)) • c k • (Σ * \ (c • Σ * ))}
We say that a sequence s : N → Σ * is poly-uniform if for every c ∈ Σ there exists a finite set of polynomials A s,c ⊆ Q[X] such that, for every n ∈ N,

β c (s(n)) ⊆ A s,c (n) = {P (n) | P ∈ A s,c } Lemma 3.5.7

. Every comparison-free polyregular sequence is poly-uniform.

Proof. First, observe that any ultimately periodic combination of poly-uniform sequences is poly-uniform. Indeed, assume that we have such a sequence s and m > 0 so that n → s(m(n + 1) + k) is poly-uniform for every k, and finite sets

A k,c ⊆ Q[X] so that β c (s(m(n + 1) + k)) ⊆ A k,c (n).
Then the poly-uniformity of s is witnessed by

A s,c = l<m P X -l m | P ∈ A k,c ∪ β c (s(l))
Hence, by Theorem 3.4.2, it suffices to show that poly-pumping sequences are all polyuniform. We proceed by induction over polynomial word expressions e, defining suitable finite sets of polynomials A e,c for c ∈ Σ such that β c ( e (n)) ⊆ A e,c (n) and 0 ∈ A e,c :

A e•e ,c = {P + Q | (P, Q) ∈ A e,c × A e ,c } A w,c = β c (w) ∪ {0} A e * ,c
= A e,c ∪ {XP | P ∈ A e,c } Proof of Theorem 3.5.3 item (i). Observe that for f : a n → ba n-1 b . . . bab, the sequence of sets β c (f (a n )) = {0, . . . , n -1} had unbounded cardinality, and thus cannot be covered by a finite set of functions, let alone polynomials in Q[X].

As announced before, the rest of this section gives the remaning proofs.

Proof of Theorem 3.5.1.

These examples are comparison-free. We have seen in Example 3.1.3 that w → w |w| is a comparison-free polyregular function. For the other examples:

• (a n → (a n b) n+1 ) = CbS((a n → a n+1 ), (a n → a n b) i∈{a} )
is obtained as a composition by substitution of sequential functions (cf. Section 2.2), which are in particular regular; • for an alphabet Σ with a, # ∈ Σ, there exist sequential functions f : Σ * → {a} * and g : Σ * → Σ * such that f (a n #w) = a n and g(a n #w) = w# for n ∈ N and w ∈ Σ * , so that CbS(f, (g) i∈{a} )(a n #w) = (w#) n .

(i) is not HDT0L. Let us fix a HDT0L system ({a}, {a, b}, ∆, d, (h) i∈{a} , h ) and show that it does not compute a n → (a n b) n+1 . Let letters(w) be the set of letters occurring in the string w at least once. By the infinite pigeonhole principle, there exists an infinite X ⊆ N such that letters(h n (d)) has the same value ∆ for all n ∈ X. Let us do a case analysis:

• Suppose first that for some r ∈ ∆ and some m ∈ N, the letter b appears twice in h • h m (r); in other words, that the latter contains a factor ba k b for some k ∈ N. Then for all n ∈ X, h • h m+n (d) ∈ Σ * ba k bΣ * . Since X is infinite, this holds for some n such that m + n > k, so that this word -i.e. the output of the HDT0L system for a m+n -is different from (a m+n b) m+n+1 / ∈ Σ * ba k bΣ * . • Otherwise, for all r ∈ ∆ (that includes the degenerate case ∆ = ∅) and all m ∈ N, there is at most one occurrence of b in h • h m (r). Then for all m ∈ N, the length of h min(X) (d) bounds the number of occurrences of b in h • h m+min(X) (d), and this bound is independent of m. On the contrary, in the sequence ((a n b) n+1 ) n≥m+min(X) , the number of occurrences of b is unbounded.

(ii) is not HDT0L. The second counterexample, namely w → w |w| , reduces to the first one: indeed, (a n b) n+1 = (a n b) |a n b| for all n ∈ N, which can also be expressed as

(w → w |w| ) • (u ∈ {a} * → ub) = (a n → (a n b) n+1 )
Suppose for the sake of contradiction that there is a HDT0L system (Σ, Σ, ∆, d, (h c ) c∈Σ , h ) that computes w → w |w| with |Σ| ≥ 2; we may assume without loss of generality that a, b ∈ Σ. Then ({a}, {a, b}, ∆,

h b (d), (h a ) c∈{a} , h ) computes a n → (a n b) n+1 .
(iii) is not HDT0L. (This is claimed without proof in [DFG20, Section 6].) Let Σ ⊇ {a, #} be an alphabet and let (Σ, Σ, ∆, d, (h c ) c∈Σ , h ) be a HDT0L system. We reuse a similar argument to our treatment of the counterexample (i). Let the sets ∆ ⊆ ∆ and X ⊆ N with X infinite be such that letters(h n a (d)) = ∆ for all n ∈ X. • Suppose first that for some r ∈ ∆ and some m ∈ N, the string h • h m a • h # (r); contains a factor # • a k • # for some k ∈ N. Then for all n ∈ X, the given HDT0L system maps a m #a n to a string in Σ * • # • a k • # • Σ * . For n > k, this language does not contain (a n #) m ; such a n ∈ X exists because X is infinite.

• Otherwise, for any m ∈ N, since # occurs at most once in h • h m a • h # (r) for r ∈ ∆ , the output of the HDT0L system has at most |h min(X) (d)| occurrences of # on input a m #a min(X) . Therefore, for large enough m, this output is different from (a min(X) #) m .

Proof of Theorem 3.5.3 item (ii).

Suppose for the sake of contradiction that f = map(a n → a n×n ) is comparison-free. Using Theorem 3.3.2, it must then have rank 1 since |f (w)| = O(|w| 2 ). Thus, we may write f = CbS(g, (h i ) i∈I ) where g : {a, #} * → I * and all the h i : {a, #} * → {a, #} * are regular.

For each J ⊆ I and k ∈ {0, . . . , |I|} (though the definition would make sense for k ∈ N), let ρ J,k : {a * } → (I \ J) * be uniquely defined by the condition

∀w ∈ {a, #} * , ρ J,k (w) = s when g(w) ∈ ((I \ J) * J) k • s • ({ε} ∪ JI * ) ε when |g(w)| J < k (recall from Section 3.3.2 the notation | • | J ).
To put it plainly, ρ J,k (w) is the k-th block of letters from I \ J that appears in g(w) (the block may be the empty string if there are consecutive letters from J), or the empty string if this k-th block does not exist. The function ρ J,k is regular because it is the composition of a sequential function with g.

We reuse some tools from Section 3.3.2, especially the notion of producing 1-split from Lemma 3.3.15. There is a unique sensible way to combine the morphisms ν f : {a, #} * → N (f ) given by this lemma into a morphism

ϕ : {a, #} * → f ∈F N (f ) for F = {g} ∪ {h i | i ∈ I} ∪ {ρ J,k | J ⊆ I, k ∈ {0, . . . , |I|}}
Note that the codomain above is a finite monoid: this allows us to apply Proposition 3.3.16 to this morphism ϕ and r = 1, which gives us some N ∈ N. Let s = a N (#a N ) |I| . For each m ∈ {0, . . . , |I|}, we apply the proposition to the factorization s

= u k v k w k with u k = (a N #) k , v k = a N and w k = (#a N ) |I|-k to get a 1-split s = u k v k w k according to ϕ where u k is a prefix of u k and w k is a suffix of w k . Let p k = |v k | = 0 and q k = N -|v k |.
For f ∈ F (the finite set of functions introduced above), we then define

f : (n 0 , . . . , n |I| ) ∈ N |I|+1 → f a n 0 p 0 +q 0 # . . . #a n |I| p |I| +q |I|
Thanks to Proposition 3.3.22 and to the 1-split conditions that we made sure to get previously, we see that for each letter c in the codomain of f (either {a, #} or I), the map

| f | c : N |I|+1 → N is monotone for the product partial order. Since f = map(a → a n×n ) = CbS(g, (h i ) i∈I ), ∀x ∈ N |I|+1 , i∈I | g(x)| i • | h i (x)| # = | f (x)| # = |I| where f : (n 0 , . . . , n |I| ) ∈ N |I|+1 → f a n 0 p 0 +q 0 # . . . #a n |I| p |I| +q |I| = a (n 0 p 0 +q 0 ) 2 # . . . #a (n |I| p |I| +q |I| ) 2
Since | g| i and | h i | # are monotone for all i ∈ I, and N |I|+1 admits a minimum (0, . . . , 0), the fact that the above sum is constant means that, for each i ∈ I,

• either one of | g| i and | h i | # is constant equal to 0,

• or both are non-zero constant. Let J # ⊆ I be the set of indices that fit the second case. We claim that for i ∈ J # , the constant value taken by | h i | # must be 1. If this were not the case, then for all n ∈ N, there would be a substring of the form #a . . . a# in | h i (n, . . . , n)| # , and since f = CbS(g, (h i ) i∈I ) and | g(n, . . . , n)| i = 0, it would also be a substring of f (n, . . . , n) with length at most

| h i (n, . . . , n)| # = O(n) (since h i is regular)
. This is impossible: for k ∈ {0, . . . , |I|}, the k-th substring of this form in f (n, . . . , n) has length (np k + q k ) 2 + 2 = Θ(n 2 ).

Combining this with the above equation for | f | # , we see that | g| J # is the constant function equal to |I|. Let us abbreviate ρ k = ρ J # ,k ∈ F (recall that we defined it at the beginning of this proof) for k ∈ {0, . . . , |I|}; then

∀x ∈ N |I|+1 , ∃!ι 1 (x), . . . , ι |I| (x) ∈ J # : g(x) = ρ 0 (x)ι 1 (x) ρ 1 (x) . . . ι |I| (x) ρ |I| (x)
Using this, we define h k (x) = h ι k (x) (x) for x ∈ N |I|+1 and k ∈ {1, . . . , |I|}, plus two edge cases h 0 : x → ε and h |I|+1 : x → ε.

Let k ∈ {0, . . . , |I|}. Write e k = (0, . . . , 0, 1, 0, . . . , 0) ∈ N |I|+1 for the k-th vector of the canonical basis of Q |I|+1 . By looking again at the k-th substring of the form #a . . . a# in f (x), with x = n e k here, we get

∀n ∈ N, (np k + q k ) 2 + 2 ≤ |h k (n e k )| + i∈I | ρ k (n e k )| i • | h i (n e k )| + |h k+1 (n e k )|
Note that all the lengths involved in the right-hand side above are linearly bounded in n because of the regularity of the functions involved. So there must exist i k ∈ I such that both | ρ k (n e k )| i k and | h i k (n e k )| are unbounded: otherwise, the whole RHS would be O(n), contradicting the Ω(n 2 ) lower bound induced by the above inequality.

We thus get a finite sequence of indices i 0 , . . . , i |I| ∈ I. By the pigeonhole principle, there must exist k, l ∈ {0, . . . , |I|} such that k = l and i k = i l ; we call i this common value.

Let m ∈ N be such that | ρ k (m e k )| i ≥ 1. By monotonicity (since ρ k , h i ∈ F ): • | ρ k (m e k + n e l )| i ≥ 1 for all n ∈ N; • | h i (m e k + n e l )| is unbounded when n → +∞.
The product of those two quantities is a lower bound for the length of the k-th substring of the form #a . . . a# in f (m e k + n e l ), which contradicts the fact that this length does not depend on n (it is equal to (mp k + q k ) 2 + 2).

CHAPTER 4

Streaming transducers meet categorical semantics

This chapter is devoted to the material on categorical automata theory for which we gave a high-level overview in Section 1.2.3 of the introduction. Since it is the first place where category theory appears, it also contains some preliminaries on the topic ( §4.1).

We start by introducing in Section 4.2 a general notion of automaton over strings parameterized by a structure C that we call a (string) streaming setting and whose main component is a category C. From the point of view of expressiveness, C can be thought of as a gadget delimiting a class of transition monoids which may be used for computations on top of finite structure of what we call a C-SST -a name meant to 1 emphasize an intuition of these categorical automata as generalizations of streaming string transducers (C should then be thought of as the collection of possible memory updates). We give a few examples of streaming settings, including in §4.2.1 the one that corresponds to usual copyless SSTs, which we name SR (and we call SR its underlying category of string-valued registers).

Then, in Section 4.3, we study the free finite coproduct completion of categories (-) ⊕ , which readily extends to streaming settings. In particular, properties of SR ⊕ are explored. Section 4.4 deals with the dual construction (-) & , the free product completion. A tight link between the expressiveness of C & -SSTs and non-deterministic C-SSTs is established. Section 4.5 then combines those results to study the composition ((-) & ) ⊕ of those two completions (which we describe as a direct construction (-) ⊕& -the order ⊕& rather than &⊕ in the notation is deliberate). In particular, it is shown that the underlying category of SR ⊕& is monoidal closed; as already said in the introduction, this last property will turn out in the next chapter to be crucial to prove the characterizations of string transduction classes in the λ ⊕& -calculus.

The rest of this chapter deals with more technical material that our "implicit automata" results do not depend on, but which is interesting in itself from the standpoint of categorical automata theory. First, in Section 4.6 we give a kind of categorical justification of the definition of SR, by claiming a universal property and proving the existence part of this claim. The latter is a convenient technical tool that we apply in Section 4.7 to establish a general theorem on preservation by precomposition by regular functions. This was one of the two main illustrations of the relevance of monoidal closure for automata explained in Chapter 1 (see §1.2.3); the other one, a determinization (or more precisely uniformization) result, is the topic of the last section of the present chapter ( §4.8).

Categorical preliminaries

Our use of category theory, while absolutely essential, stays at a fairly elementary level. We assume familiarity with the notions of category, functor, natural transformation, (cartesian) product and coproduct (and their nullary cases, terminal and initial objects),

1 In retrospect, it would have been wiser to speak of C-automata and to make our definitions fully compatible with the previous work of Colcombet and Petrisan (cf. §1.1.9), which we were unaware of when we started working on this; see Remark 4.2.3 for the slight differences. Since this is merely a cosmetic concern, I have chosen here not to perform this harmonization in the limited time available to me to write this manuscript, but a future journal version of this chapter will probably incorporate this modification.

but not much more than that; the remaining categorical prerequisites are summed up here for convenience. The reader familiar with monoidal closed categories can safely skip directly to Section 4.1.4. We also wish to stress that while we motivate some definitions by referring to the λ ⊕& -calculus, which will only be formally introduced in Chapter 5, all the technical content can be followed while ignoring those justifications. 4.1.1. Notations on categories. Given a category C, we write Obj(C) for its class of objects and Hom C (A, B) for the set of arrows (or morphisms) from A to B (for A, B ∈ Obj(C)). The composition of two morphisms f ∈ Hom C (A, B) and g ∈ Hom C (B, C) is denoted by g • f . Following the traditional notations of linear logic, products and coproducts will be customarily written using '&' and '⊕' respectively -except in the category of sets where we use the notations '×' and '+' as usual -and we reserve for the terminal object. We sometimes use basic combinators such as -/[-] for pairing/copairing and π i /in i for projections/coprojections.

Finally, if we are given a binary operation over the objects of a category, we freely use the corresponding "I-ary" operation, with a notation of the form i∈I A i , over families indexed by a finite set I. Concretely speaking, this depends on a fixed total order over I = {i 1 < . . . < i |I| } to unfold as A i 1 (A i 2 (. . . A i |I| ) . . .) -for convenience, the reader may consider that a choice of such an order for every finite set is fixed once and for all for the rest of the manuscript. In practice, the particular order does not matter since we will deal with operations ∈ {⊕, &, ⊗, . . . } that are symmetric in a suitable sense. Those operations also have units (i.e. identity elements), giving a canonical meaning to

i∈∅ A i , ī∈∅ A i , etc.
Finally, as is usual when dealing with categories, we sometimes allow ourselves to implicitly use the axiom of choice for classes to pick objects determined by their universal properties to build functors (for instance, given an object A in a category C with cartesian products, we shall speak of the functor -& A without first mentioning that a choice of cartesian products X & A exists for for every X in C). This is merely for convenience; the reader may check that in all of our concrete examples of interest, canonical choices can be made without appealing to choice. 4.1.2. Monoidal categories, symmetry and functors. The idea of categorical semantics is to interpret the types of a programming language -in our case, the purely linear fragment of the λ ⊕& -calculus -as objects, and the programs (terms) as morphisms. (A formal statement tailored to our purposes will be given later in Lemma 5.2.6.) In this perspective, the additive conjunction '&' of the λ ⊕& -calculus is interpreted as a categorical cartesian product, while the additive disjunction '⊕' corresponds to a coproduct; this justifies our use of the notations &/⊕ for products/coproducts. We now define monoidal products, which are meant to interpret the multiplicative conjunction '⊗'.

(A ⊗ B) ⊗ (C ⊗ D) α A,B,C⊗D + + ((A ⊗ B) ⊗ C) ⊗ D α A⊗B,C,D 3 3 α A,B,C ⊗id D ' ' A ⊗ (B ⊗ (C ⊗ D)) (A ⊗ (B ⊗ C)) ⊗ D α A,B⊗C,D / / A ⊗ ((B ⊗ C) ⊗ D) id A ⊗α B,C,D 7 7 (A ⊗ I) ⊗ B ρ A ⊗id B & & α A,I,B / / A ⊗ (I ⊗ B) id A ⊗λ B x x A ⊗ B Figure 4.1.1. Coherence conditions for monoidal categories A ⊗ (B ⊗ C) γ A,B⊗C / / (B ⊗ C) ⊗ A α B,C,A " " (A ⊗ B) ⊗ C α A,B,C 2 2 γ A,B ⊗id C , , B ⊗ (C ⊗ A) (B ⊗ A) ⊗ C α B,A,C / / B ⊗ (A ⊗ C) id B ⊗γ A,C < < A ⊗ B γ A,B / / B ⊗ A γ B,A A ⊗ B Figure 4.1.2

. Coherence conditions for symmetries

In the sequel, we use the name (symmetric) monoidal category for a category C that comes equipped with a (symmetric) monoidal structure ⊗, I, . . . and write it (C, ⊗, I) for short.2 Of course, if a category C has binary products & and a terminal object , then (C, &, ) is a symmetric monoidal category, and similarly for coproducts and initial objects.

We shall sometimes need to refer to morphisms between monoidal categories, which are essentially functors together with natural transformations witnessing that the monoidal structure is preserved.

m 0 : I → F (I) m A,B : F (A) ⊗ F (B) → F (A ⊗ B)
making the following diagrams commute.

(F (A) ⊗ F (B)) ⊗ F (C) α F (A),F (B),F (C) / / m A,B ⊗id F (C) F (A) ⊗ (F (B) ⊗ F (C)) id F (A) ⊗m B,C F (A ⊗ B) ⊗ F (C) m A⊗B,C F (A) ⊗ F (B ⊗ C) m A,B⊗C F ((A ⊗ B) ⊗ C) F (α A,B,C ) / / F (A ⊗ (B ⊗ C)) F (A) ⊗ I ρ F (A) / / id F (A) ⊗m 0 F (A) F (A) ⊗ F (I) m A,I / / F (A ⊗ I) F (ρ A ) O O I ⊗ F (A) λ F (A) / / m 0 ⊗id F (A)
F (A)

F (I) ⊗ F (A) m I,A / / F (I ⊗ A) F (λ A ) O O
A lax monoidal functor is called strong monoidal if the natural transformations m 0 and m A,B are isomorphisms.

Let us note that while every concrete instance of monoidal functor in the paper is also going to be a symmetric monoidal functor (i.e., satisfy additional coherence diagrams involving γ), we do not make use of that fact.

(A B) ⊗ A ev A,B / / B C ⊗ A Λ(f )⊗id O O f 5 5
When there exists an internal homset for every pair objects in C, we say that (C, ⊗, I) is a (symmetric) monoidal closed category.

As for (co)products, internal homsets are determined up to unique isomorphism, so we may talk somewhat loosely about the internal homset later on. While we work with the universal property given in Definition 4.1.3 when the construction of an internal homset involves a bit of combinatorics, we will also sometimes use the following characterization. Proof. This is an instance of [Mac98, Chapter III, Section 2, Proposition 1].

4.1.4. Affineness and quasi-affineness. Given a monoidal product ⊗, morphisms from A to A ⊗ A need not exist in general; this accounts for the linearity constraints in λ ⊕& . But monoidal categories do not incorporate the ability of register transitions in SSTs to discard the content of a register, a behavior more aligned with the affine λ-calculi. This notion thus plays a role in our development, so we discuss its incarnation in categorical semantics. Most symmetric monoidal categories are not affine. However, there is a generic way of building an affine monoidal category from a monoidal category. Recall that if C is a category and X is an object of C, one may consider the slice category C X

• whose objects are morphisms A → X (A ∈ Obj(C)), • and such that Hom C X (f : A → X, g : B → X) = {h ∈ Hom C (A, B) | g • h = f }.
If C has a monoidal structure (⊗, I), this structure can be lifted to C I by taking the identity I → I as the unit and

A f / / I ⊗ B g / / I = A ⊗ B f ⊗g / / I ⊗ I λ I = ρ I / / I
as the monoidal product. This gives rise to an affine monoidal structure over C I , and a strong monoidal structure for the forgetful functor dom : C I → C.

In the converse direction, one can sometimes turn an object A from C into one of C I . This is the case when A admits a cartesian product with I, which may be written A & I (note that if C is affine, A itself is such a cartesian product). We are then led to consider the projection π 2 : A & I → I as an object of the slice category. --→ I ∈ Obj C I in any quasiaffine category, according to the above discussion. It turns out that it extends to a functor J which embeds C into this affine slice category; moreover, J is right adjoint to the forgetful functor dom. The interested reader may even check (although we will not make use of this) that the existence of a right adjoint to dom is equivalent to quasi-affineness. 4.1.5. Monoids. Since we are interested in string transductions, the free monoids Σ * are going to make an appearance. Let us thus conclude this section by recalling the notion of monoid internal to a monoidal category.

I ⊗ M η⊗id λ I / / M M ⊗ I ρ I o o id⊗η M ⊗ M µ : : M ⊗ M µ d d (M ⊗ M ) ⊗ M µ⊗id α M,M,M / / M ⊗ (M ⊗ M ) id⊗µ / / M ⊗ M µ M ⊗ M µ / / M
A useful example of this notion is the "internalization" of the monoid of endomorphisms of A when A is part of a monoidal closed category. Proposition 4.1.9. Let (C, ⊗, I) be a monoidal category. Any internal homset A A (with A ∈ Obj(C)) that exists in C has an internal monoid structure (A A, η, µ) such that

η = Λ (id A ) µ • (Λ (f ) ⊗ Λ (g)) • λ I = Λ (f • g) for f, g ∈ Hom C (A, A)
where Λ :

Hom C (A, A) ∼ -→ Hom C (I, A A) is defined as Λ : h → Λ(h • λ A )
from the curryfication Λ and the left unitor λ A .

Proof sketch. One can define the monoid multiplication

µ : (A A) ⊗ (A A) → (A A)
as the curryfication µ = Λ(app2) of the morphism app2 built by composing the sequence

((A A) ⊗ (A A)) ⊗ A α -→ (A A) ⊗ ((A A) ⊗ A) id⊗ev ---→ (A A) ⊗ A ev -→ A
and check that it satisfies the coherence diagrams for internal monoids (that also involve the unit η defined in the proposition statement) and the equation relating µ to Λ .

Let us conclude our categorical preliminaries on the following. The routine verification of the required commutations of diagrams is left to the reader.

Remark 4.1.11. Our applications of this proposition will take place in quasi-affine monoidal categories. For those, it admits a more conceptual proof: the right adjoint J : C I → C to the forgetful functor dom (cf. Remark 4.1.7) is lax monoidal, and therefore so is dom • J which maps A to A & I on objects; furthemore, the image of a monoid object by a lax monoidal functor is itself a monoid object in a canonical way [Mel09, Section 6.2].

A categorical framework for automata: streaming settings

We now introduce string streaming settings, which can be understood for our purposes as a sort of memory framework for transducers performing a single left-to-right pass over a word. (As we argued in the introduction ( §1.1.9), they are in fact more general than that since they can express two-way automata, but this is beyond our scope here.) This is the abstract notion that will allow us to generalize streaming string transducers: Definition 4.2.1. Let X be a set. A string streaming setting with output X is a tuple

C = (C, ' , ', -) where • C is a category • ' and ' are arbitrary objects of C • -is a set-theoretic map Hom C ( ' , ') → X
Since the properties of the underlying category of a streaming setting will turn out to be the most crucial thing in the sequel, we shall abusively apply adjectives befitting categories (such as "affine symmetric monoidal") to streaming settings in the sequel.

The notion of streaming setting is a convenient tool motivated by our subsequent development rather than our primary object of study. A closely related framework in which some of our abstract results can be formulated is defined in [START_REF] Colcombet | Automata Minimization: a Functorial Approach[END_REF] (see Remark 4.2.3).

For the rest of this section, we will refer to string streaming setting simply as streaming settings; we also fix two alphabets Σ and Γ for the rest of this section. Definition 4.2.2. Let C = (C, ' , ', -) be a streaming setting with output X. A C-SST with input alphabet Σ and output X is a tuple (Q, q 0 , R, δ, i, o) where

• Q is a finite set of states and q 0 ∈ Q • R is an object of C • δ is a function Σ × Q → Q × Hom C (R, R) • i ∈ Hom C ( ' , R) is an initialization morphism • (o q ) q∈Q ∈ Hom C (R, ')
Q is a family of output morphisms -alternatively, we will sometimes consider it as a map o :

Q → Hom C (R, ').
We write T : Σ * → C-SST X to mean that T is a C-SST with input alphabet Σ and output X (the latter depends only on C).

The corresponding function T : Σ * → X is then computed as for standard SSTs (cf. Definition 2.3.3): an input word w generates a sequence of states q 0 , . . . , q |w| ∈ Q and a sequence of morphisms f i : R → R in C, and the output is then

o q |w| • f |w| • • • • • f 1 • i ∈ X.
An important class of C-SSTs are those for which the set of states Q is a singleton, significantly simplifying the above data. They are called single-state C-SSTs.

Remark 4.2.3. Single-state C-SSTs are very close to the C-automata over words defined by Colcombet and Petrişan [CP20, Section 3], or more precisely (C, ' , ')-automata with our notations. The main difference is that the latter's output would just be an element of Hom C ( ' , '): there is no post-processing -to produce an output. As for the addition of finite states, ultimately, it does not increase the framework's expressive power: we shall see in Remark 4.3.13 that C-SSTs are equivalent to single-state SSTs over a modified category. We chose to incorporate states into our definition for convenience.

Example 4.2.4. Let Set X = (Set, {•}, X, -) where -is the canonical isomorphism between Hom Set ({•}, X) = X {•} and X. Then any function Σ * → X can be "computed" by a single-state Set X -SST by taking R = Σ * .

Example 4.2.5. Let Finset 2 = (FinSet, {•}, {0, 1}, -) with -the canonical isomorphism Hom FinSet ({•}, {0, 1}) ∼ = {0, 1}. Single-state Finset 2 -SST are essentially the usual notion of deterministic finite automata3 . Therefore, the functions they compute are none other than the indicator functions of regular languages.

Example 4.2.6. Consider the category POL Q whose objects are natural numbers, whose morphisms are tuples of multivariate polynomials over Q with matching arities (so that

Hom POL Q (n, k) = (Q[X 1 , . . . , X n ]) k
) and where composition is lifted from the composition of polynomials in the usual way, making POL Q into a category with (strict) cartesian products. Then, taking Pol Q = (POL Q , 0, 1, -) where -is the isomorphism identifying Q and polynomials without variables (n = 0), we can recover the definition of polynomial automata from [START_REF] Benedikt | Polynomial automata: Zeroness and applications[END_REF] as single-state Pol Q -SSTs.

Given two streaming settings C and D with a common output set X, C-SSTs are said to subsume D-SSTs if for every D-SST T there is a C-SST T with T = T . We say that C-SSTs and D-SSTs are equivalent if both classes subsume one another. There is also a straightforward notion of morphism of streaming settings with common output. Proof sketch. Given a C-SST (Q, q 0 , R, δ, i, (o q ) q∈Q ) (where we use the notations of Definition 4.2.2) and a morphism (F : C → D, i :

' D → F ( ' C ) and o : F (' C ) → ' D such that ∀f ∈ Hom C ( ' C , ' C ) , o • F (f ) • i D = f C
' D → F ( ' C ), o : F (' C ) → ' D )
of streaming settings, one builds a D-SST that computes the same function as follows. The set of states and initial state are unchanged (so our proof applies both to the stateful and the single-state case). The memory object becomes F (R), and the Hom C (R, R) component of the transition function δ is passed through the functor F to yield a D-endomorphism of F (R). The new initialization morphism is F (i) • i and the new output morphisms are

(o • F (o q )) q∈Q .
Remark 4.2.9. For any streaming setting C, the functor Hom C ( ' , -) is a morphism of streaming settings C → Set with i = id and o = -C .

In the sequel, we will omit giving the morphisms i :

' D → F ( ' C
) and o : F (' C ) → ' D most of the time, as they will be isomorphisms deducible from the context. 4.2.1. The category SR(Γ) of Γ-register transitions. We shall now formulate copyless streaming string transducers in our framework, using a category whose morphisms we call register transitions. Those are a variant of copyless register assignments (cf. §2.3) where we use a coproduct rather than a union in the formalism. This choice would have been more cumbersome for the proofs of Chapters 2 and 3, but it is better if we want to build a category whose objects are all finite sets. Definition 4.2.10. Fix a finite alphabet Γ and let R and S be finite sets.

A Γ-register transition from R to S is a function t : S → (Γ + R) * satisfying the following copylessness condition: for every r ∈ R, there is at most one occurrence of in 2 (r) among all the words t(s) for s ∈ S. (Compare with Definitions 2.3.1 and 2.3.5.)

We write [R → SR(Γ) S] for the set of Γ-register transitions from R to S, or [R → SR S] when Γ is clear from context. For any t ∈ [R → SR(Γ) S], we define t † : (Σ * ) R → (Σ * ) S by transposing the definition of (-) † in Definition 2.3.1 in the only sensible way.

To arrange register transitions into a category, we must be able to compose any two of them. Moreover, this composition should be compatible with the action of register transitions on tuples of strings, i.e. the latter should be functorial:

for t ∈ [R → SR(Γ) S] and t ∈ [S → SR(Γ) T ], we expect that (t • SR t) † = t † • t † .
In fact, we have already seen how to do this in Section 2.3.4 for the case R = S: composition then corresponds to the monoid multiplication of Definition 2.3.16, while functoriality is stated in Proposition 2.3.19. All this is extended below to an arbitrary choice of finite R and S. Definition 4.2.11. Let t ∈ [R → SR(Γ) S] and t ∈ [S → SR(Γ) T ]; recall that t and t are defined as maps between sets t : S → (Γ + R) * and t : T → (Γ + S) * .

We define the composition of register transitions t • SR t : T → (Γ + R) * to be the settheoretic composition t • t where t : (Γ + S) * → (Γ + R) * is the unique monoid morphism extending the copairing of in 1 and t (i.e. (in

1 (c) → in 1 (c), in 2 (s) → t(s)) : Γ + S → (Γ + R) * ).
(The notation (-) is consistent with the one used throughout previous chapters, see for instance Definition 2.3.16.) Proposition 4.2.12. There is a category SR(Γ) (given a finite alphabet Γ which we will often omit in the notation) whose objects are finite sets of registers, whose morphisms are register transitions -Hom SR(Γ) (R, S) = [R → SR(Γ) S] -and whose composition is given by the above definition. This means in particular that, with the above notations, t • SR(Γ) t ∈ [R → SR(Γ) T ], i.e. copylessness is preserved by composition. Furthermore: • This category admits the empty set of registers as the terminal object:

= ∅.

• The action of register transitions on tuples of strings gives rise to a functor (-)

† : SR → Set, with X † = (Γ * ) X on objects.
This can be verified purely mechanically from the definitions; basically, nothing new happens compared to what already appeared in the literature on usual SSTs (again, we refer to §2.3.4). Let us now introduce the streaming setting for copyless SSTs. Definition 4.2.13. We write SR(Γ) for (SR(Γ), Remark 4.2.15. The functor Hom C ( ' , -) mentioned in Remark 4.2.9 is, in the case C = SR, naturally isomorphic to (-) † . Therefore, the latter can be extended to a morphism SR → Set of string streaming settings. Proposition 4.2.16. The category SR can be endowed with a symmetric monoidal structure, where the monoidal product R ⊗ S is the disjoint union of register sets R + S and the unit is the empty set of registers. Since the latter is also the terminal object of SR, this defines an affine symmetric monoidal category.

' = = ∅, ' = {•}, -) where the map -: [∅ → SR(Γ) {•}] → Γ * is the canonical isomorphism ((Γ + ∅) * ) {•} ∼ = Γ * .
Note that given t ∈ [R → SR(Γ) S] and t ∈ [T → SR(Γ) U ], there is only one sensible way to define a set-theoretic map t ⊗ t : U + S → (Γ + (R + T )) * . The above proposition means, among other things, that t ⊗ t ∈ [R + T → SR(Γ) S + U ]. Checking this, as well as the requisite coherence diagrams for monoidal categories, is left to the reader.

This wraps up our initial presentation of SR(Γ). The next few sections will study the categories obtained from it by applying various completions, but we will return to the "naked" SR(Γ) in Section 4.6 where its definition will be motivated by intrinsic category-theoretic considerations (in other words, we shall argue that the connection with transducers is not strictly necessary to justify its existence).

The free coproduct completion (or finite states)

We give here an elementary definition of the free finite coproduct completion C ⊕ of a category C and some of its basic properties. We have said in the introduction that it amounts to adding finite states, but the true way to "freely add states" would actually be to consider a certain full subcategory of C ⊕ (cf. Remark 4.3.13). However, we will see that the coproduct completion leads to equivalently expressive streaming settings in most cases, while being better behaved -for instance, our monoidal closure result (Theorem 1.2.4) depends on having all finite coproducts.

The (-) ⊕ construction consists essentially in considering finite families of objects of C as "formal coproducts". (Alternatively, one could use finite lists as in e.g. [Gal20, Definition 3] to get an equivalent category.) Definition 4.3.1. Let C be a category. The free finite coproduct completion C ⊕ is the category defined as follows.

• An object of C ⊕ is a pair (U, (C u ) u∈U ) consisting of a finite set U and a family of objects of C over U . We write those as formal sums u∈U C u in the sequel.

• A morphism u∈U C u → v∈V C v is a U -indexed family of pairs (v u , g u ) u∈U with v u ∈ V and g u : C u → C vu in C. In short, Hom C ⊕ u∈U C u , v∈V C v = u∈U v∈V Hom C (C u , C v )
• The identity at object u∈U C u is the family (u, id Cu ) u∈U . Given two composable maps

(w v , h v ) v∈V : v∈V C v → w∈W C w and (v u , g u ) u∈U : u∈U C u → v∈V C v
the composite is defined to be the family

(w vu , h vu • g u ) : u∈U C u → w∈W C w
There is a full and faithful functor ι ⊕ : C → C ⊕ taking an object C ∈ Obj(C) to the one-element family 1 C ∈ Obj(C ⊕ ). Objects lying in the image of this functor will be called basic objects of C ⊕ . The formal sum notation reflects that families u∈U C u should really be understood as coproducts of those basic objects C u . More generally, it is straightforward to check that, for any finite set I and family u∈U i C u over i ∈ I, canonical coproducts in C ⊕ can be computed as follows

i∈I u∈U i C i,u = (i,u)∈ i∈I U i C i,u
Remark 4.3.2. Observe that here, we have two slightly different meanings for the operator:

u∈U i C i,u is a notation for a finite family of objects, and thus unambiguously refers to an object of C ⊕ , while i∈I (. . . ) is a coproduct in the usual sense, which is therefore defined only up to unique isomorphism. We will freely mix both uses in the rest of this chapter, as there is no harm risked by confusing the two.

As advertised, this is a free finite coproduct completion in the following sense: for any functor F : C → D to a category D with finite coproducts, there is an extension F : C ⊕ → D preserving finite coproducts making the following diagram commute:

C ι ⊕ F / / D C ⊕ F > >
and it is unique up to unique natural isomorphism under those conditions.

Finally, suppose that we have a monoidal structure on C. Then, it is possible to extend it to a monoidal structure over C ⊕ in a rather canonical way: we require that ⊗ distributes over ⊕, i.e., that

A ⊗ (B ⊕ C) ∼ = (A ⊗ B) ⊕ (A ⊗ C). Formally speaking, we set u∈U C u ⊗ v∈V C v = (u,v)∈U ×V C u ⊗ C v
If I is the unit of the tensor product in C, then the basic object 1 I is taken to be the unit of the tensor product in C ⊕ . An affine symmetric monoidal structure on C can be lifted in a satisfactory manner to this new tensor product (in particular ι ⊕ ( ) is still terminal).

Remark 4.3.3. For readers more familiar with the free cocompletion Set C op of C, note that the coproduct-preserving functor E determined by

C ι ⊕ z z y & & C ⊕ E / / Set C op
is full and faithful, as well as strong monoidal when Set C op is equipped with the Day convolution as monoidal product.

The following property, which is arguably obvious from the definition of C ⊕ , will turn out to be quite important later. Proposition 4.3.4. For any A, B ∈ Obj(C ⊕ ), there is a natural isomorphism

Hom C ⊕ (ι ⊕ (-), A ⊕ B) ∼ = Hom C ⊕ (ι ⊕ (-), A) + Hom C ⊕ (ι ⊕ (-), B)
Remark 4.3.5. The above is a sort of dual, in a restricted case, to the following natural isomorphism which holds for any category D and A, B ∈ Obj(D):

Hom D (A ⊕ B, -) ∼ = Hom D (A, -) × Hom D (B, -)
In fact, this characterizes the coproduct of A and B. Just like Proposition 4.1.4, this is an instance of a general equivalence between universal properties and natural bijections involving homsets. 4.3.1. Conservativity over affine monoidal settings. First, note that the coproduct completion can be lifted at the level of streaming settings.

(C ⊕ , ι ⊕ ( ' ), ι ⊕ ('), -C ⊕ )
where -C ⊕ is obtained by precomposing the canonical isomorphism (recalling that ι ⊕ is full and faithful)

Hom C ⊕ (ι ⊕ ( ' ), ι ⊕ (')) ∼ = Hom C ( ' , ')
Before moving on, let us make the following definition: an object A in a monoidal category (C, ⊗, I) is said to have unitary support 4 if there exists a map I → A. This is quite useful in affine categories for transductions, as it ensures the following. Lemma 4.3.7. Let C be a symmetric affine monoidal category. Then, for any pair of finite families (C u ) u∈U and (C v ) v∈V of objects of C such that all C u and C v have unitary support, we have a U × V -indexed family of embeddings

padwithjunk u,v : Hom C (C u , C v ) → Hom C u∈U C u , v∈V C v
The basic idea behind Lemma 4.3.7 can be pictured using string diagrams as in Fig- ure 4.3.1: a morphism C u → C v can be pictured as a single string, which is to be embedded in a diagram with U -many inputs and V -many outputs. The fact that C is affine allows us to cut all input strings for u = u using a weakening node, and unitary support allow us to create some "junk" strings with no input to connect to those v = v. This might fail for arbitrary symmetric affine monoidal categories: take for instance the category of finite sets and surjections between them, with the coproduct as a monoidal product.

We are now ready to state our first theorem asserting that, in those favorable circumstances, coproduct completions do not give rise to more expressive SSTs. Proof. Since ι ⊕ extends to a morphism of streaming settings, C ⊕ -SSTs subsume C-SSTs. Conversely, let T = Q, q 0 , u∈U C u , δ, i, o be a C ⊕ -SST with input Σ * and C u basic objects. Then, we construct a C-SST

T = Q × U, (q 0 , u 0 ), u∈U C u , δ , i u 0 , o such that T = T . We define successively (u 0 , i u 0 ), δ and o . • We have i ∈ Hom C ⊕ ι ⊕ ( ), i∈I C i which can be rewritten as a factorization ι ⊕ ( ) = 1 ' (inu 0 , * →id) / / U ' (id,u →iu) / / u∈U C u
for some u 0 ∈ U (the i u for u = u 0 are taken arbitrarily thanks to the assumption that the C u have unitary support). This u 0 is the second component of the initial state of T .

• We set δ (a, (q, u)) = (q , α u (f )) if δ(a, q) = (q , f ), where

(α u ) u∈U : u∈U Hom C ⊕ u∈U C u , u∈U C u → Hom C ⊕ u∈U C u , u∈U C u
is defined by taking the pointwise composite of

α u : Hom C ⊕ u∈U C u , u ∈U C u → u ∈U Hom C ⊕ (C u , C u ) β u : u ∈U Hom C ⊕ (C u , C u ) → U × Hom C ⊕ u∈U C u , u∈U C u π : U × Hom C ⊕ u∈U C u , u∈U C u → Hom C ⊕ u∈U C u , u∈U C u
where α u is obtained by evaluating its input f ∈ u∈U u ∈U Hom C ⊕ (C u , C u ) at u, β u = u padwithjunk u,u (with padwithjunk given as per Lemma 4.3.7) and π taken to be the second projection.

• Finally, we set o (q, u) ∈ Hom C v∈U C v , ' to o u ∈ Hom C (C u , ') precomposed with the projection π u ∈ Hom C v∈U C v , C u .
To conclude, one can check by induction that T (w) = T (w) for every w ∈ Σ * . Corollary 4.3.9. SR ⊕ -SSTs are equivalent to SR-SSTs.

Proof. All objects of SR have unitary support via an induction: tensor with the map ε : I → Γ * corresponding to the empty word at the recursive step.

State-dependent memory SSTs.

The free coproduct completion encourages us to define the notion of state-dependent memory SST, generalizing usual copyless SSTs as follows: instead of taking a single object C ∈ Obj(C) as an abstract infinitary memory, we allow to take a family (C q ) q∈Q ∈ Obj(C) Q indexed by the states of the SST. Definition 4.3.10. Let C = (C, ' , ', -) be a streaming setting with output X. A state-dependent memory C-SST (henceforth abbreviated sdm-C-SST or sdmSST when C is clear form context) with input Σ * is a tuple (Q, q 0 , (C q ) q∈Q , δ, i, o) where

• Q is a finite set of states • q 0 ∈ Q is some initial state • (C q ) q∈Q is a family of objects of C • δ : Σ → q∈Q r∈Q Hom C (C q , C r ) is a transition function • i ∈ Hom C ( ' , C q 0 ) is the initialization morphism • o ∈ q∈Q Hom C (C q , ')
is the output family of morphism It defines a function Σ * → X analogously to Definition 4.2.2.

In the sequel, we shall often use sdmSSTs because we find them convenient to give more elegant constructions that produce little "junk", as is encoded in Lemma 4.3.7. They essentially give the full power of coproducts in any given situation as shown below. Proof sketch. Given a C ⊕ -SST Q, q 0 , u∈U C u , δ, i, o where i( * ) = in u 0 (i ) one may check that the following sdm-C-SST computes the same function: Q × U, (q 0 , u 0 ), (C u ) (q,u)∈Q×U , δ , i , (o(q) u ) (q,u)∈Q×U where δ (a) q,u = ((r, u ), f ) if and only if δ(a, q) = (r, v) and v u = (u , f ).

Conversely, letting (Q, q 0 , (C q ) q∈Q , δ, i, o) be a sdm-C-SST, an equivalent C ⊕ -SST is given by (Q, q 0 , q∈Q C q , δ , in q 0 (i), o ), where it is sufficient to define o (q) as (o q ) q and to ensure that if δ (a, q) = (r, (r q , f q ) q ∈Q ), then δ(a) q = (r, f q ) and r q = r. This can be done.

Finally, let us remark that the notions of single-state, "normal" and state-dependent memory C-SSTs coincide if C has all coproducts. Lemma 4.3.12. If C is a streaming setting with coproducts, single-state C-SSTs are as expressive as general C-SSTs and sdm-C-SSTs.

Proof. Take a sdmSST (Q, q 0 , (C q ) q∈Q , δ, i, o) to the single-state SST

  {•}, •, q∈Q C q , δ , in q 0 • i, [o(q)] q∈Q  
where δ is defined from δ through the maps 4.3.3. Some function spaces in SR ⊕ . Now we study SR ⊕ in some more detail. This category is unfortunately not able to interpret even the ⊗/ fragment of λ ⊕& , because, like SR, it lacks internal homsets A B for every pair (A, B) ∈ Obj(SR ⊕ ) 2 . However, they exist when A lies in the image of ι ⊕ . This will turn out to be very useful later on.

  q∈Q r∈Q Hom C (C q , C r )   Σ / /   q∈Q Hom C   C q , r∈Q C r     Σ ∼ / /   Hom C   q∈Q C q , r∈Q C r
The reason this works is already present in the proof of Lemma 3.3.7: copyless register assignments may be effectively coded using a combination of finite state -given by the coproduct completion -and a larger set of registers, in such a way that certain operations on those assignments can be represented themselves as a copyless assignment combined with a function on states. What follows can be seen as a slight extension, using categorical terminology, of the arguments that we gave to prove Lemma 3.3.7.

Lemma 4.3.14. Let R ∈ Obj(SR) and B ∈ Obj(SR ⊕ ).

There is an internal homset ι ⊕ (R) B in SR ⊕ .

In Example 4.3.15, we work through the proof below in a concrete case.

Proof. First, note that it suffices to treat the case B = ι ⊕ (S) for S ∈ Obj(SR): this can be extended to arbitrary B through the natural isomorphism of Proposition 4.3.4.

Recalling that ι ⊕ is full and faithful, it is thus pertinent to focus our preliminary analysis on morphisms in SR. Recall that a register transition f : R → S, which is a set-theoretical map S → (Γ + R) * where for every r ≤ R, s∈S |f (s)| in 2 (r) ≤ 1 (i.e., it is copyless). Consider the map (Γ + R) * → R * erasing the letters of Γ. Then, the image of the induced map p : Hom SR (R, S) → [S → R * ] is clearly finite because of copylessness. In fact, letting LO(X) be the set of all total orders over some set X, we have an isomorphism between the image of Hom SR (R, S) under p and the following dependent sum

O(R, S) = f :R S s∈S LO( f -1 (s))
The intuition is that f tracks where register variables in R get affected and the additional data encode in which order they appear in an affectation. Once this crucial finitary information ( f, (< s ) s∈S ) is encoded in the internal homset using coproducts, it only remains to recover the information we erased with p, i.e. what words in Γ * located between occurrences of register variables. This information cannot be bounded by the size of R and S, but the number of intermediate words can; we may index them by S + dom( f ).

Putting everything together, it means that we take

ι ⊕ (R) ι ⊕ (S) = ( f,<)∈O(R,S) ι ⊕ (S + dom( f ))
Now, we need to define the evaluation map ev R,S :

[ι ⊕ (R) ι ⊕ (S)] ⊗ ι ⊕ (R) → ι ⊕ (S).
Recall that the tensor distributes over ⊕, so we really need to exhibit ev R,S in

Hom SR ⊕   ( f,<) ι ⊕ (S + dom( f ) + R), ι ⊕ (S)   ∼ = ( f,<) Hom SR S + dom( f ) + R, S
where the indices ( f, <) ranges over O(R, S) on both sides. Call ev R,S, f,< the corresponding family of SR-morphisms, whose members are set-theoretic maps S → (S + dom( f ) + R) * . Calling {r 1 , . . . , r k } the subset of dom( f ) ordered by r 1 < . . . < r k , we set ev R,S, f,< (s) = in 0 (s)in 2 (r 1 )in 1 (r 1 ) . . .

in 2 (r k )in 1 (r k )
This concludes the definition of ev. We now leave checking that this satisfies the required universal property to the reader.

Hom SR ⊕ (ι ⊕ ({x}), ι ⊕ ({y, z, u}) ι ⊕ ({r, s})) ∼ = f,< Hom SR {x}, {r, s} + dom( f )
such that ev • (Λ(f ) ⊗ id) = f . On its first component, we set f (y) = f (z) = r and leave it undefined on u; as for the order, we set z < r y. The last component corresponds to the register transition h depicted below on the left, where, for legibility, we write r, s, z and y for in 1 (r), in 1 (s), in 2 (z) and in 2 (y). Using the same notations, we also display on the right the relevant component of ev {y,z,u},{r,s}, f,< ∈ Hom SR (({r, s} + {z, y}) + {z, y}, {r, s}), so that the reader may convince themself that the composite ev {y,z,u},{r,s},

f,< • (h ⊗ id {y,z,u} ) is indeed f . r ← ε z ← axab y ← aa s ← bab r ← in 1 (r) z in 1 (z) y in 1 (y) s ← in 1 (s)

The product completion (or non-determinism)

Extending Lemma 4.3.14 to all homsets (i.e. allowing any object of SR ⊕ in the left-hand side) seems impossible: the lack of products prevents us from doing so. This point (among others) leads us to study the free finite product completion of streaming settings. As for coproducts, we first discuss the categorical construction before turning to the expressiveness. Here, the situation is more intricate as it turns out that sdm-C & -SSTs of interest will roughly have the power of non-deterministic sdm-C-SSTs. We make that connection precise.

Thankfully, a determinization theorem for usual copyless SSTs, i.e. SR-SSTs, exists in the literature [START_REF] Alur | Nondeterministic Streaming String Transducers[END_REF] (the proof in the given reference is indirect and goes through monadic second-order logic). It could be applied without difficulty to show that non-determinism does not increase the power of sdm-SR-SSTs. Nevertheless, to keep the exposition selfcontained and illustrate our framework, we give in Section 4.8 a direct determinization argument generalized to our setting by using, crucially, the concept of internal homsets (and Lemma 4.3.14 for the desired application).

Without further ado, let us formally introduce the product completion.

Definition 4.4.1. Let C be a category. Its free finite product completion is

C & = ((C op ) ⊕ ) op .
In other words, it is the "dual" of the coproduct completion. While conceptually immaculate, this definition merits a bit of unfolding. The objects of C & are still finite families (C x ) x∈X -in this context, we write them as formal products ˘x∈X C x . As for homsets, we have the dualized situation:

Hom C & x∈X C x , ȳ∈Y C y ∼ = y∈Y x∈X Hom C & (C x , C y )
We also have a full and faithful functor ι & : C → C & with a similar universal property as for the coproduct completion.

As with the coproduct completion, one may want to produce a tensor product in C ⊕ if the underlying category C has one. The very same recipe can be applied: we define the tensor so that the distributivity

A ⊗ (B & C) ∼ = (A ⊗ B) & (A ⊗ C) holds. x∈X C x ⊗ ȳ∈Y C y = (x,y)∈X×Y C x ⊗ C y
Remark 4.4.2. One might be disturbed by this distributivity of ⊗ over &, which goes against the non-linear intuition of thinking of & and ⊗ as "morally the same" This feeling may also be exacerbated by the familiar iso

Hom SR ⊕ ( , R ⊗ S) ∼ = Hom SR ⊕ ( , R) × Hom SR ⊕ ( , S)
This indeed becomes false when going from SR to SR & .

Remark 4.4.3. While C & inherits a monoidal product from C much like with the coproduct completion, it does not preserve the affineness of monoidal products. The product completion indeed adds a new terminal object, namely the empty family, which can never be isomorphic to the singleton family ι & ( ). More generally, ι & preserves colimits rather than limits.

It is also straightforward to extend the product completion to streaming settings.

4.4.1.

Relationship with non-determinism. At this juncture, our goal is to prove the equivalence between sdm-SR & -SSTs and sdm-SR-SSTs. One direction is trivial; for the other, we actually prove that sdm-SR & -SSTs are subsumed by sdm-SR ⊕ -SSTs. This result involves some non-trivial combinatorics. We prove it via uniformization of non-deterministic sdm-SR-SSTs, a mild generalization of determinization 5 .

Our non-deterministic devices make finitely branching choices, following the case of the usual non-deterministic SSTs [AD11, Section 2.2]. To express this, we use the notation P <∞ (X) for the set of finite subsets of a set X. (Note that if Q is some finite set of states, we have the simplification P(Q) = P <∞ (Q).) Definition 4.4.4. Let C be streaming setting with output X. A non-deterministic sdm-C-SST with input Σ * and output X is a tuple (Q, I, (C q ) q∈Q , ∆, i, o) where • Q is a finite set of states and

I ⊆ Q • (C q ) q∈Q is a family of objects of C • ∆ is a finite transition relation: ∆ ∈ P <∞   Σ × (q,r)∈Q 2 Hom C (C q , C r )   • i ∈ q 0 ∈I Hom C ( ' , C q 0
) is a family of input morphisms 5 We work with uniformization here because we find it slightly more convenient to handle. This choice of uniformization over determinization is rather inessential.

• o ∈ q∈Q (Hom C (C q , ') + 1) is a family of partial output morphisms A partial sdm-C-SST (Q, q 0 , (C q ) q∈Q , δ, i, o) has the same definition as a (deterministic) sdm-C-SST (Definition 4.3.10), except for the output o, which is allowed to be partial, just as in the last item above.

By transposing the usual notion of run of a non-deterministic finite automaton, one sees that a non-deterministic sdm-C-SST T gives rise to a function T : Σ * → P <∞ (X) (for an input alphabet Σ and output set X). Similarly, a partial sdm-C-SST T is interpreted as a partial function T : Σ * X.

Remark 4.4.5. In line with Remark 4.3.13, we may describe non-deterministic sdm-C-SSTs as single-state (deterministic) SSTs over an enriched streaming setting.

Let C = (C, ' C , ' C , -C )
, with output X. We first define the category NFA(C):

• its objects consist of a finite set Q with a family (C q ) q∈Q ∈ Obj(C) Q ; • its morphisms are Hom NFA(C) (C q ) q∈Q , (C r ) r∈R = P <∞   (q,r)∈Q×R Hom C (C q , C r )  
• the composition of morphisms extends that of binary relations:

ϕ • ψ = {(q, s, f • g) | (q, r, f : C q → C r ) ∈ ϕ, (r, s, g : C r → C s ) ∈ ψ}
To lift this to a construction NFA(C) on streaming settings, we take:

• ' NFA(C) and ' NFA(C) are the {•}-indexed families containing respectively ' C and ' C , so that Hom NFA(C) ' NFA(C) , ' NFA(C) = P <∞ ({(•, •)} × Hom C ( ' C , 'C)) • ϕ NFA(C) = { f C | (•, •, f ) ∈ ϕ} ⊆ X, so that the output set of a NFA(C)-SST is P <∞ (X).
There is a slight mismatch between the above definition of non-deterministic sdm-C-SSTs and single-state NFA(C)-SSTs: in the latter, two distinct input (resp. output) morphisms may correspond to the same initial (resp. final) state. However, the former can encode such situations by enlarging the set of states (to keep it finite, the use of P <∞ (-) in the definitions is crucial).

One can also give an analogous account of partial sdm-C-SSTs; we leave the interested reader to work out the details.

Coming back to our main point, we now state the slight variation of the determinization theorem for copyless SSTs [START_REF] Alur | Nondeterministic Streaming String Transducers[END_REF] that fits our purposes. Definition 4.4.6. Given an arbitrary function F : X → P(Y ), we say that f :

X Y uniformizes F if and only if dom(f ) = X \ F -1 (∅) and ∀x ∈ dom(f ). f (x) ∈ F (x).
Theorem 4.4.7 (variant of [START_REF] Alur | Nondeterministic Streaming String Transducers[END_REF] for state-dependent-memory copyless SSTs). For every non-derministic sdm-SR-SSTs T , there exists a partial deterministic sdm-SR-SST T such that T uniformizes T .

We now show that studying the uniformization property between classes of sdmSSTs parameterized by streaming setting C and D is morally the same as comparing the expressiveness of sdm-C & -SSTs and sdm-D-SSTs.

Lemma 4.4.8. Non-deterministic sdm-C-SSTs are uniformizable by partial sdm-D-SSTs if and only if sdm-D-SSTs subsume sdm-C & -SSTs.

Proof. First, let us assume that sdm-C-SSTs uniformize sdm-D-SSTs and let

T = (Q, q 0 , (A q ) q∈Q , δ, i, o) with A q = x∈Xq C q,x
be a C & -SST with input Σ. We first define a non-deterministic sdm-C-SST T by setting

T = I + Q , I, (C p(m) ) m∈I+Q , ∆, i , o where Q = q∈Q X q I = x∈Xq 0 {f | i * = (x, f )} p : I + Q → Q in 1 (x, f ) → (q 0 , x) in 2 (q, x) → (q, x) i in 1 (x,f ) = f o m = in 1 π 2 (o π 1 (p(m)) ) π 2 (p(m)) ∆ =      (a, ((m, in 2 (r, y)), f ) m ) ∀(x, q) ∈ Q .∀m ∈ p -1 (x, q). π 1 (δ(a) q ) = r ∧ π 2 (δ(a) q ) y = (x, f )     
Taking T to be a sdm-D-SST uniformizing T , we have {-} • T = T = {-} • T , so we are done.

For the converse, assume that sdm-D-SSTs subsume sdm-C & -SSTs and suppose we have some non-deterministic sdm-C-SST T = (Q, I, (A q ) q∈Q , ∆, i, o) to uniformize. Fix a total order over the morphisms of C occurring in ∆ (recall that there are finitely many of them). Consider a partial deterministic sdm-C & -SST T obtained from T by a powerset construction

T =   P(Q), I, r∈R A r R⊆Q , δ, i, o 
 where δ(a) R = (S, (r s , f s ) s∈S ) if and only if ∀s ∈ S (a, ((r s , s), f s )) ∈ ∆ ∀g.(a, ((r s , s), g)) ∈ ∆ ⇒ f s g
and o R = o r for some arbitrary r such that the right hand-side is defined; if there is no such r, o R is undefined and we call R a dead set of states. By padding o with some arbitrary values on such dead states, we may extend T to a non-partial deterministic C-SST T so that T ⊆ T . We may then consider a sdm-D-SST T = (Q , q 0 , (D q ) q∈Q , δ, i , o ) such that T (w) = T (w) = T (w) for w ∈ dom( T ). This T is almost our uniformizer; we only need to restrict the domain of its output function. This can be achieved by adding a P(Q) component to the state space corresponding to the set of states reached by T and forcing the output function to be undefined if this component contains a dead set of states.

Putting Lemma 4.4.8 together with Theorem 4.4.7 yields the desired result.

Theorem 4.4.9. sdm-SR & -SSTs are subsumed by sdm-SR-SSTs.

Note that, conversely, Theorem 4.4.9 also implies Theorem 4.4.7 through Lemma 4.4.8. We will provide a direct self-contained proof of a categorical generalization of Theorem 4.4.9 in Section 4.8.

The ⊕&-completion (a Dialectica-like construction)

We now consider the composition C → (C & ) ⊕ of the coproduct completion with the product completion. Unraveling the formal definition and distributing sums and products at the right spots, we define an isomorphic category C ⊕& which is a bit less cumbersome to manipulate in practice. (The proof is by mechanical unfolding of the definitions).

Theorem 4.5.1. Given an arbitrary category C, there is an isomorphism of categories (not just an equivalence) between (C & ) ⊕ and the category C ⊕& defined below.

• The objects of C ⊕& are triples (U, (X u ) u , (C u,x ) (u,x) ) where U is a finite set, (X u ) u∈U is a family of finite sets and C u,x is a family of objects of C indexed by (u, x) ∈ u∈U X u . We drop the first index u when it is determined by x ∈ X u from context and write those objects u∈U ˘x∈Xu C x for short. 4.5.1. The interesting steps of this computation are those involving v and y; since they are similar, let us focus on v. A map of the form

• Hom C ⊕& u∈U x∈Xu C x , v∈V ȳ∈Yv C y = u∈U v∈V y∈Yv x∈Xu Hom C (C x , C y ) • Its identities are maps u∈U u ∈U x ∈Xu x∈X u Hom C (C x , C x ) u → u , x → (x , id Cx ) • Composition is defined as in Figure
v∈V A v × v∈V B v -→ v∈V A v × B v (a v ) v∈V , (v , b) → (v , (a v , b))
is applied. This makes the two C ⊕& -morphisms interact (an interaction represented in Remark 4.5.2 below as a move in a game): the v provided by the right one selects a v among all the possibilities (a v ) v proposed by the left one.

The reader may notice that composition in C ⊕& is very similar to the interpretation of cuts in Gödel's Dialectica interpretation [START_REF] Gödel | Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes[END_REF] and/or composition in categories of polynomial functors [START_REF] Gambino | Polynomial functors and polynomial monads[END_REF][START_REF] Moss | Dialectica models of type theory[END_REF]. This intuition can be made formal. In particular, see [START_REF] Hofstra | The dialectica monad and its cousins[END_REF] for a decomposition of a general version of the categorical Dialectica construction into free completions with simple sums and products. In our context, the completion with simple coproducts would be the (-) ⊕const of Remark 4.3.13; conversely, a "dependent Dialectica" could be defined in the fibrational setting of [START_REF] Hofstra | The dialectica monad and its cousins[END_REF] analogously to our (-) ⊕& -completion by removing the simplicity restriction.

Remark 4.5.2. For the uninitiated, it can be helpful to compute this completion on the trivial category 1 with one object and only its identity morphism. In this case, objects consists of a pair of a finite set U together with a family (X u ) u∈U of finite sets that can be regarded as a two-move sequential game (with no outcome) between player ⊕ and &: first ⊕ plays some u ∈ U and then & plays some x ∈ X u . One can then consider simulation games between (U, (X u ) u ) (the "left hand-side") and (V, (Y v ) v ) (the "right hand-side") proceeding as follows:

• first, & plays some u ∈ U on the left • then, ⊕ plays some v ∈ V on the right • & answers with some y ∈ Y v on the right • finally ⊕ answers with x ∈ X u on the left. U , (X u ) u → V, (Y v ) v & u ⊕ v & y ⊕
x Morphisms in 1 ⊕& are ⊕-strategies in such games. Identities correspond to copycat strategies and composition is (a simple version) of an usual scheme in game semantics. As for C ⊕& , one may consider that once this simulation game is played, ⊕ needs to provide a datum in some Hom C (C x , C y ) which depends on the outcome of the game.

As the coproduct completion preserves limits, C ⊕& always boasts both binary cartesian products and coproducts. Concretely, products are computed by distributivity:

ī∈I j∈J i A j ∼ = f ∈ i∈I J i ī∈I A f (i)
If C has a symmetric monoidal structure (⊗, I), the lifting is computed in C ⊕& as

u∈U x∈Xu C x ⊗ v∈V ȳ∈Yv D y = (u,v)∈U ×V (x,y)∈Xu×Yv C x ⊗ D y
This reflects the distributivity of ⊗ over & in SR & (Remark 4.4.2) -which however does not hold in general in SR ⊕& , unlike the distribuvity of ⊗ over ⊕. Finally, we write ι ⊕& : C → C ⊕& for the functor sending an object C to 1 ˘1 C (it is a full and faithful embedding). 4.5.1. The monoidal closure theorem. Recall from the introduction ( §1.2.3) that a result of central importance in this dissertation is the fact that the category (SR & ) ⊕ is symmetric monoidal closed (Theorem 1.2.4). This will be a consequence of the general property below.

Theorem 4.5.3. Let (C, ⊗, I) be a symmetric monoidal category. Assume that its coproduct completion C ⊕ admits internal homsets ι ⊕ (A) ι ⊕ (B) for every A, B ∈ Obj(C). Then its Dialectica-like completion C ⊕& is monoidal closed. Indeed, since Lemma 4.3.14 gives us precisely the assumption on internal homsets in the above statement for C = SR, we immediately get: Corollary 4.5.4 (equivalent to Theorem 1.2.4). SR ⊕& is monoidal closed.

To prove Theorem 4.5.3, our strategy is to establish some isomorphism of the form Hom C ⊕& (C ⊗ A, B) ∼ = Hom C ⊕& (C, . . . ) which is natural in C. While we will not devote too much space to checking naturality down to low-level details, we have attempted to break down this verification into manageable chunks. In particular, our notations are going to stress the functoriality of the various intermediate expressions in our computation. Some lemmas will be useful for this. Lemma 4.5.5. We can lift every functor F :

C op → Set to a functor & F : (C & ) op → Set such that for (C i ) ∈ Obj(C) I , & F ī∈I C i = i∈I F (C i )
and in such a way that if F, G : C op → Set are naturally isomorphic, so are & F and & G.

Proof. Since (C & ) op = (C op ) ⊕ by duality, the existence of & F is simply the universal property of the coproduct completion! Concretely, consider a morphism

f = ϕ f : I → J, f i : C ϕ f (i) → C i i∈I ∈ Hom C & j∈J C j , ī∈I C i Its functorial image is given by & F (f ) : (i, x) ∈ i∈I F (C i ) → (ϕ f (i), F (f i )(x)) ∈ j∈J F (C j ) Using this explicit expression, one can check that if η X : F (X) ∼ --→ G(X) is a natural isomorphism (for X varying over C op ), then (i, x) ∈ i∈I F (C i ) → (i, η C i (x)) ∈ i∈I G(C i )
⊕ F u∈U x∈Xu C x = u∈U F x∈Xu C x Proof. Write C ⊕& ∼ = D ⊕ with D = C & .
The statement is a special case of a property that works for any category D; analogously (and dually) to the previous lemma, it corresponds to the universal property of the product completion.

Before we can state the next lemma, we first need a few definitions. Let

ι ⊕ & : C ⊕ → C ⊕& such that ι ⊕& = ι ⊕
& • ι ⊕ be the full and faithful embedding be obtained by applying the universal property of C ⊕ to the coproduct-preserving functor ι ⊕& . Furthermore, the isomorphism C ⊕& ∼ = (C & ) ⊕ entails the existence of another full and faithful functor

ι ⊕ : C & → C ⊕& such that ι ⊕& = ι ⊕ • ι & corresponding to the canonical embedding D → D ⊕ for D = C & .
Both those functors have straightforward explicit constructions, whose actions on objects are

ι ⊕ & i∈I C i = i∈I j ∈{ * } C i ι ⊕ ī∈I C i = j∈{ * } ī∈I C i
(where the (co)product notation is syntactic sugar for indexed families).

Lemma 4.5.7. For any D ∈ Obj(C ⊕ ), there is a natural isomorphism (with domain C & )

Hom C ⊕& ι ⊕ (-), ι ⊕ & (D) ∼ = & Hom C ⊕ (ι ⊕ (-), D) Proof. Let C = ī∈I C i and D = k∈K D k for C i , D k ∈ Obj(C). By definition, Hom C ⊕ ι ⊕ (C), ι ⊕ & (D) = p∈{ * } k∈K q∈{ * } i∈I Hom C (C i , D k ) ∼ = i∈I k∈K Hom C (C i , D k ) ∼ = i∈I Hom C ⊕ (ι ⊕ (C i ), D)
This establishes the isomorphism for each object of C & . The naturality condition can be recast as the commutation of the following diagram:

Hom C ⊕& ι ⊕ (C), ι ⊕ & (D) -•f i,k Hom C (C i , D k ) ∼ o o ∼ / / i∈I Hom C ⊕ (ι ⊕ (C i ), D) (i,g) →(ϕ f (i),g•f i ) Hom C ⊕& ι ⊕ (C ), ι ⊕ & (D) ∼ / / j,k Hom C C j , D k j∈J Hom C ⊕ ι ⊕ (C j ), D ∼ o o
Fortunately, it can be checked from the definition of composition in C ⊕ and C ⊕& that both paths in this diagrams denote the same map, namely

(i, k, h) → (ϕ f (i), k, h • f i ).
Proof of Theorem 4.5.3. Let A, B, C ∈ Obj(C ⊕& ). By definition, we can write

A = u∈U x∈Xu A x B = v∈V ȳ∈Yv B y C = w∈W z∈Zw C z where A x , B y , C z ∈ Obj(C).
Using the definition of ⊗ in C ⊕& and of Hom C ⊕& (-, -),

Hom C ⊕& (C ⊗ A, B) = Hom C ⊕&   (w,u)∈W ×U (z,x)∈Zw×Xu C z ⊗ A x , v∈V ȳ∈Yv B y   = w,u v∈V y∈Yv z,x Hom C (C z ⊗ A x , B y ) ∼ = w∈W u∈U v∈V y∈Yv x∈Xu z∈Zw Hom C (C z ⊗ A x , B y )
Using the operators from Lemmas 4.5.5 and 4.5.6, the last expression above can be turned into a functor in C, and the isomorphism is then natural in C, that is:

Hom C ⊕& (-⊗ A, B) ∼ = ⊕   u∈U v∈V y∈Yv x∈Xu & [Hom C (-⊗ A x , B y )]  
(Any reader who is not convinced that rearranging the indexing of sums/products is innocuous with respect to the morphisms in C ⊕& can check the naturality by a brute-force computation.) For any A , B ∈ Obj(C), we have a sequence of natural isomorphisms

Hom C -⊗ A , B ∼ = Hom C ⊕ ι ⊕ (-⊗ A ), ι ⊕ (B ) ∼ = Hom C ⊕ ι ⊕ (-) ⊗ ι ⊕ (A ), ι ⊕ (B ) ∼ = Hom C ⊕ ι ⊕ (-), ι ⊕ (A ) ι ⊕ (B )
by using the strong monoidality and full faithfulness of ι ⊕ as well as the assumption on internal homsets in C ⊕ . Lemma 4.5.5 allows us to lift natural isomorphisms through & ; combined with Lemma 4.5.7, this gives us

& Hom C -⊗ A , B ∼ = & Hom C ⊕ ι ⊕ (-), ι ⊕ (A ) ι ⊕ (B ) ∼ = Hom C ⊕& ι ⊕ (-), ι ⊕ & (ι ⊕ (A ) ι ⊕ (B ))
Let us introduce the abbreviation

A ⇒ B = ι ⊕ & (ι ⊕ (A ) ι ⊕ (B ))
. Using Proposition 4.3.4 and the dual of Remark 4.3.5 for products, we have

Hom C ⊕& (-⊗ A, B) ∼ = ⊕   u∈U v∈V y∈Yv x∈Xu Hom C ⊕& ι ⊕ (-), A x ⇒ B y   ∼ = ⊕   u∈U v∈V y∈Yv Hom C ⊕& ι ⊕ (-), x∈Xu A x ⇒ B y   ∼ = • • • ∼ = ⊕   HomC ⊕&   ι ⊕ (-), call this A B ū∈U v∈V ȳ∈Yv x∈Xu A x ⇒ B y      
Note that we get an expression for A B that mirrors the definition of Hom C ⊕& (-, -)!

To conclude, it suffices to show that the last functor in the above computation is naturally isomorphic to Hom C ⊕& (-, A B). The isomorphism can be seen as an instance of the universal property of the coproduct, cf. Remark 4.3.5 which unfortunately only states naturality in the "wrong" argument for our purposes. The remaining naturality condition can be verified routinely; we leave it to the reader. 4.5.2. Summary of equivalences between C-SSTs for completions of SR. As a finishing touch on the last three sections on free completions, we compile here different characterizations of regular functions. single-state SR ⊕& -SSTs Before covering the applications of Theorem 1.2.4 / Corollary 4.5.4 to the λ ⊕& -calculus in the next chapter, let us return to categorical automata theory for its own sake.

In this section, we fix a finite alphabet Γ and study the category SR(Γ) further. Observe that {•} ∈ Obj(SR(Γ)), representing a single register, can be equipped with the structure of an internal monoid

({•}, µ • , η • ) by setting η • (•) = ε and µ • (•) = in 2 (l)in 2 (r) where l = in 1 (•) and r = in 2 (•) so that µ • ∈ [{•} → SR(Γ) {•} ⊗ {•}] has the codomain Γ + ({•} + {•}) = Γ + {l,
r} when considered as a map between sets. This internal monoid is the key to giving an inductive characterization of SR (see Remark 4.6.2 below for an explanation of what we mean by "inductive"). Given a string w = w 1 . . . w n ∈ Γ * , let us write w ∈ [∅ → SR(Γ) {•}] for the register transition defined by the map w :

• → in 1 (w 1 ) . . . in 1 (w n ) ∈ (Γ + ∅) * .
Theorem 4.6.1. Let (C, ⊗, I) be an affine symmetric monoidal category. For any internal monoid (M, µ, η) of C and any family (m c ) c∈Γ ∈ Hom C (I, M ) of morphisms, there exists a strong monoidal functor F : SR(Γ) → C such that:

• F (∅) = I, F ({•}) = M and F ( c) = m c for every c ∈ Γ; • F (µ • ) = µ and F (η • ) = η with the above definitions (implying that F ({l, r}) = M ⊗ M ); • the isomorphisms I → F (∅) and F ({•}) ⊗ F ({•}) → F ({•} + {•}) that are part of the
strong monoidal structure for F are equal to id I and id M ⊗M respectively.

Note that since F is a monoidal functor, it transports the monoid object

({•}, µ • , η • ) to a structure of internal monoid over F ({•}) = M in a canonical way [Mel09, Section 6.2].
A fact that encapsulates the idea of the second item above -but which, strictly speaking, also depends on the third one -is that the result of this transport is precisely (M, µ, η). Remark 4.6.2. Informally speaking, we think of SR(Γ) as the affine symmetric monoidal category freely generated by an internalization of the free monoid Γ * . To truly express this, one would need to add to Theorem 4.6.1 the uniqueness of F up to natural isomorphism. This would imply, among other things, that the morphisms of SR are inductively given by • the identities id • the compositions • the structural morphisms associated to the tensor product

• the unique morphism {•} → ∅ • canonical morphisms c : → {•} for every individual letter c ∈ Γ • a canonical morphism η : → {•} corresponding to the empty word • a multiplication morphism µ : {•} ⊗ {•} → {•} corresponding to string concatenation.
However, we do not prove this inductive presentation, nor the uniqueness property, since they are not necessary for our purposes.

Handwaving argument for Theorem 4.6.1. Although the intuition of the proof is simple, its execution involves a significant amount of bureaucracy; in particular, it manipulates various canonical isomorphisms given by Mac Lane's coherence theorem for symmetric monoidal categories (cf. §4.6.1). For this reason, we will only illustrate the idea here in the concrete case of the cartesian category of sets; the full proof can be found in Section 4.6.2.

For (C, ⊗, I) = (Set, ×, { * }), we can reformulate the data given in the statement as a monoid M with a family of elements (m c ) c∈Γ ∈ M Γ , that can be identified with functions m c : { * } → M for c ∈ Γ. The functor that we build then maps an object R -a finite set of registers -to the set M R . The action on morphisms is best illustrated through an example: (t : z → axby) ∈ [{x, y} → SR({a,b}) {z}] (where in 1 /in 2 are omitted) becomes the map (u x , u y ) ∈ M {x,y} → m a u x m b u y ∈ M ∼ = M {z} . Note that when we apply this construction to M = Γ * with m c = c, we recover the functor (-) † : SR(Γ) → Set from Proposition 4.2.12.

Since the monoid object structure of internal homsets (Proposition 4.1.9) has a somewhat explicit description, Theorem 4.6.1 admits a specialized and simplified formulation for affine symmetric monoidal closed categories. For our applications (in particular the general preservation theorem of Section 4.7), it will be useful to give a version that also applies in the quasi-affine case.

Corollary 4.6.3. Let (C, ⊗, I) be a quasi-affine symmetric monoidal closed category and A be an object in C. For any family (f c ) c∈Γ ∈ Hom C (A, A) Γ of endomorphisms, there exists a strong monoidal functor F : SR(Γ) → C such that

F (∅) = I F ({•}) = (A A) & I ∀w ∈ Γ * , F ( w) = Λ f w[1] • • • • • f w[n] , id I
where we use the notations (-) from Theorem 4.6.1 and Λ (-) from Proposition 4.1.9.

Proof. Proposition 4.1.9 gives a canonical internal monoid structure to A A, which by Proposition 4.1.10 can be lifted to a monoid object

((A A) & I, µ, η). For f ∈ Hom C (A, A), let Λ (f ) = Λ (f ), id I : I → (A A) & I.
We apply Theorem 4.6.1 to the slice category C I -which satisfies the affineness assumption -with the internal monoid π 2 : (A A) & I → I (cf. Proposition 4.1.10 again) and the family (Λ (f c )) c∈Γ (each Λ (f ) is a morphism in the slice category from its unit id I to this π 2 since π 2 • Λ (f ) = id I ). We compose the resulting functor SR → C I with the forgetful functor dom :

C I → C to get F : SR → C such that F (∅) = I and F ({•}) = (A A) & I.
As a composition of strong monoidal functors, F is also strong monoidal. This takes care of all but one of the corollary's conclusions.

For the remaining one, we need to do some preliminary work. First, let us recall two commuting diagrams below. The left one comes from the naturality of the family of (iso)morphisms m R,S : F (R) ⊗ F (S) → F (R + S) that make F a (strong) monoidal functor, while the right one is among the coherence conditions in Definition 4.1.2.

I ⊗ I m∅,∅ / / F ( u)⊗F ( v) F (∅ + ∅) F ( u⊗ v) F ({•}) ⊗ F ({•}) m {•},{•} / / F ({•} + {•}) I ⊗ F (∅) λ F (∅) / / m 0 ⊗id F (∅) F (∅) F (∅) ⊗ F (∅) m∅,∅ / / F (∅ + ∅) F (λ∅) O O
Here, m 0 : I → F (∅) is also part of the strong monoidal structure of F and u, v ∈ Γ * . The construction of Theorem 4.6.1 gives us m 0 = id I and m {•},{•} = id F ({•}+{•}) ; furthermore, we have ∅ + ∅ = ∅ and λ ∅ = id ∅ in SR. Thus, in the end, we can combine the two equalities expressed by the above diagrams and simplify them to get

∀u, v ∈ Γ * , F ( u) ⊗ F ( v) = F ( u ⊗ v) • λ I Theorem 4.6.1 also guarantees that F (µ • ) = µ, F (η • ) = η and F ( c) = Λ (f c ) for all c ∈ Γ.
At the same time, by combining Propositions 4.1.9 and 4.1.10, one can derive

η = Λ (id A ) µ • (Λ (f ) ⊗ Λ (g)) • λ I = Λ (f • g) for f, g ∈ Hom C (A, A)
We use all the above in a proof by induction of the desired conclusion.

• The base case is

F ( ε) = F (η • ) = η = Λ (id A ) (indeed, ε = η • = (• → ε) by definition).
• For the inductive case, write any word of length n + 1 in Γ * as wc for w ∈ Γ * with |w| = n and c ∈ Γ, and suppose that by induction hypothesis F ( w) = Λ (w). A direct computation of register transitions suffices to check that wc = µ • • ( w ⊗ c). Then

F ( wc) = F (µ • ) • F ( w ⊗ c) = µ • (F ( w) ⊗ F ( c)) • λ I = µ • Λ f w[n] • • • • • f w[1] ⊗ Λ (f c ) • λ I = Λ f w[1] • • • • • f w[n] • f c
4.6.1. Reminders on coherence for symmetric monoidal categories. We now recall an important tool for the proof of Theorem 4.6.1. Let us fix a an symmetric monoidal category (C, ⊗, I) with an internal monoid (M, µ, η). We call the functors built from the monoidal structure on C "tensorial functors" since the monoidal product ⊗ is sometimes called a tensor product. They are more precisely defined as follows.

Definition 4.6.4. The tensorial expressions over a finite indexing set I are freely inductively generated as follows:

• I is a tensorial expression over ∅;

• i is a tensorial expression over {i};

• if e, e are tensorial expressions over I and I respectively, with I ∩ I = ∅, then (e ⊗ e ) is a tensorial expression over I ∪ I .

In other words, a tensorial expression over I is a binary tree whose leaves are labeled either by I or by i ∈ I, such that each element i appears exactly once.

A tensorial expression e over I induces a functor F e : C I → C in an obvious way. The functors thus obtained are called tensorial functors. A tensorial functor F e : C I → C is ordered when I is endowed with the total order that corresponds to the infix order on the I-labeled leaves of the expression e.

Of course, the basic intuition is that over a given totally ordered indexing set, two ordered tensorial functors express "the same thing" up to inessential bracketing, while two unordered tensorial functors should be morally the same "up to permutation". This is expressed formally as a natural isomorphism between functors, but Mac Lane's coherence theorem gives us something stronger: the natural isomorphisms can be chosen canonically. Theorem 4.6.5 (Coherence for SMCs [Mac98, §XI.1 (Theorem 1)]). There exists a map that sends each triple (I, e, e ), where e, e are tensorial expressions over the finite set I, to a natural isomorphism from the tensorial functor F e to F e , which we call a canonical isomorphism, such that: • identities, associators, unitors and symmetries are canonical isomorphisms;

• composing the image of (I, e, e ) by this map with the image of (I, e , e ) yields the image of (I, e, e ) -in other words, canonical isomorphisms are closed under composition; • canonical isomorphisms are also closed under monoidal product.

If F, G : C I → C are ordered tensorial functors for the same total order on I, the construction of the canonical isomorphism between F and G works in any monoidal category, not necessarily symmetric. Indeed, general monoidal categories enjoy a coherence theorem of their own [Mac98, §VII.2], which involves its own canonical isomorphisms; thanks to the uniqueness clauses in the coherence theorems with and without symmetry, one can check that the two notions of canonical isomorphism coincide for ordered tensorial functors. The ordered case is important for us because even though our monoidal category is symmetric, the internal monoid (M, µ, η) that we are given need not be commutative. What the axioms for monoid objects do state, however, is a suitable form of associativity, a consequence of which is that n-ary products are somehow "independent of bracketing". Formally speaking: Definition 4.6.6. To any tensorial expression e, we inductively associate a C-morphism µ (e) : F e ((M ) i∈I ) → M (meant to represent "e-fold monoid multiplication"):

µ (I) = η µ (i) = id for I = {i} µ (e⊗e ) = µ • µ (e) ⊗ µ (e )
Theorem 4.6.7 (General associativity law [Mac98, §VII.3]). Let I be a totally ordered finite set, F e , F e : C I → C be two ordered tensorial functors and Ξ : F e ⇒ F e be their canonical natural isomorphism. Then µ (e) = µ (e ) • Ξ M where M = (M ) i∈I .

We find it convenient to work directly with tensorial functors in the rest of this section, leaving the tensorial expressions that define them implicit. Therefore, we write µ (F ) instead of µ (e) when F = F e ; strictly speaking, two expressions could define the same functor for accidental reasons, but for our purposes, the right choice of e can always be inferred from the context. Similarly, we shall speak of the canonical isomorphism between two tensorial functors C I → C. In accordance with Section 4.1.1, we write

n i=1 Y i = (. . . (Y 1 ⊗ Y 2 ) ⊗ . . . ) ⊗ Y n M ⊗n = n i=1
M and this will be used to define ordered tensorial functors. Furthermore, for each finite set I, we fix an arbitrary choice of tensorial functor i∈I (-) : C I → C, and denote by i∈I Y i the image of (Y i ) i∈I by this functor.

4.6.2. Proof of Theorem 4.6.1. After these general preliminaries, let us focus on the specific study of the symmetric monoidal category SR(Γ) for a fixed finite alphabet Γ.

Definition 4.6.8. For t ∈ [R → SR R ] -recall that this implies t : R → (Γ + R) * , let ∂(t) ⊆ R be the set of register variables that do not occur in any t(r ) for r ∈ R .

Definition 4.6.9. Given w ∈ (Γ + R) * , we write

r w Y r = |w| i=1 I when w[i] ∈ in 1 (Γ) Y r when w[i] = in 2 (r) for r ∈ R and M w = r w M Lemma 4.6.10. For t ∈ [R → SR R ], we have a canonical isomorphism r∈R Y r ∼ = r∈∂(t) Y r ⊗ r ∈R r t(r ) Y r
Proof. To apply Mac Lane's coherence theorem, we just have to check that the righthand side defines a tensorial functor with indexing set R. This amounts to the equality

R = ∂(t) ∪ r ∈R {r | ∃i. t(r )[i] = in 2 (r)}
where, to ensure that no index in R is repeated, the union must be disjoint and the letters of t(r ) that are in in 2 (R) must all be distinct. Those conditions are consequences of copylessness, while the equality itself is essentially the definition of ∂(t).

We are now in a position to build the functor promised in Theorem 4.6.1. Following the statement of this theorem, we fix a family of morphisms (m c ) ∈ Hom C (I, M ) Γ , and assume that (C, ⊗, I) is affine. Thus, we may write A : A → I for the terminal morphism from A, omiting the subscript A when it can be inferred from the context. Definition 4.6.11. We define a map on objects F : R ∈ Obj(SR) → M ⊗R ∈ Obj(C).

As for morphisms, given a register transition t ∈ [R → SR R ], we set F (t) to be

F (R) = M ⊗R ∼ --→ M ⊗∂(t) ⊗ r ∈R |t(r )| i=1 X r ,i ⊗ F (t) -----→ I ⊗ M ⊗R ∼ --→ M ⊗R = F (R)
where the left arrow instantiates the canonical isomorphism of Lemma 4.6.10, with

X r ,i = I when t(r )[i] ∈ in 1 (Γ) M otherwise, i.e. t(r )[i] ∈ in 2 (R) so that |t(r )| i=1 X r ,i = M t(r )
and in the middle arrow, : M ⊗∂(t) → I is the terminal morphism and

F (t) = r ∈R   F (t) r : |t(r )| i=1 X r ,i i f r ,i ------→ |t(r )| i=1 M = M ⊗|t(r )| µ (|t(r )|) ------→ M  
where for i ∈ {1, . . . , |t(r )|}, we pick

f r ,i = m c when t(r )[i] = in 1 (c) for c ∈ Γ id M otherwise, i.e. t(r )[i] ∈ in 2 (R)
(recall that m c : I → M is the prescribed functorial image, by the F that we are defining, of the register transition c

∈ [∅ → SR {•}]).
The tedious part in proving Theorem 4.6.1 is checking that the above definition works. This fills the several pages remaining in this section. Proposition 4.6.12. The operation F introduced in Definition 4.6.11 is a functor.

Proof. Let t ∈ [R → SR R ] and t ∈ [R → SR R ]; we want to reason on F (t ) • F (t)
to show that it is equal to F (t • t). Beware: we write t • t for composition of (copyless) register transitions in the category SR, and will employ the notation t(r ) for set-theoretic application (t : R → (Γ + R) * ), but we do not have (t • t)(r ) = t (t(r )) -indeed, the two sides of the equality are not even well-defined for r

∈ R ! Since t • t is in [R → SR R ], it is a set-theoretic map R → (Γ + R) * . M ⊗R F (t) / / ∼ definition of F (t) M ⊗R F (t ) / / naturality M ⊗R M ⊗∂(t) ⊗ r ∈R M t(r ) bifunctoriality of ⊗ ⊗ F (t) / / I ⊗ M ⊗R I ⊗ F (t ) / / ∼ O O I ⊗ M ⊗R ∼ O O M ⊗∂(t) ⊗ r ∈R M t(r ) ∼ ⊗ (Lemma 4.6.13 / Figure 4.6.2) ⊗ (F (t ) • F (t)) / / I ⊗ M ⊗R M ⊗∂(t) ⊗ N ⊗ r ∈R M (t•t )(r )
∼ naturality of the associator

⊗ ( ⊗ F (t • t)) / / I ⊗ I ⊗ M ⊗R ∼ O O M ⊗∂(t) ⊗ N ⊗ r ∈R M (t•t )( r )
∼ I ⊗ I and I are terminal (affineness assumption)

( ⊗ ) ⊗ F (t • t) / / (I ⊗ I) ⊗ M ⊗R ∼ O O M ⊗∂(t •t) ⊗ r ∈R M (t•t )(r ) ⊗ F (t • t) / / I ⊗ M ⊗R ∼ O O Figure 4.6.1.
The commutativity of the outer square of this diagram establishes Proposition 4.6.12. The text in the inner squares explains why they commute; the proof text for Proposition 4.6.12 defines N and gives further justifications (in particular for the existence of the canonical isomorphisms denoted by ∼ --→).

To prove this, we first reduce our goal to Lemma 4.6.13, and then prove that lemma. The reduction is given by the commutative diagram of Figure 4.6.1 (with N to be defined later). Indeed, while the morphism on the top is F (t ) • F (t), the one defined by the three other sides of the outermost square is

M ⊗R ∼ --→ M ⊗∂(t •t) ⊗ r ∈R M (t •t)(r ) ⊗ F (t •t) -------→ I ⊗ M ⊗R ∼ --→ M ⊗R
thanks to the closure of canonical isomorphisms of tensorial functors under composition. Since these canonical isomorphisms are also unique, we can equate that with the expression for F (t • t) given in Definition 4.6.11, hence

F (t ) • F (t) = F (t • t).
The main justifications that are missing from Figure 4.6.1 are the commutation of one square treated in Lemma 4.6.13, and the existence of the various canonical isomorphisms involved. The ones in the right column are just unitors, so let us focus on the left column.

• The top left isomorphism is an instance of Lemma 4.6.10.

• The next one (skipping the equality) is provided by Lemma 4.6.13.

• Then the penultimate one is just the inverse of an associator (see §4.1.2), of the form

α -1 A,B,C : A ⊗ (B ⊗ C) → (A ⊗ B) ⊗ C • Finally, the last one reduces to M ⊗∂(t) ⊗ N ∼ = M ⊗∂(t •t) .
To prove the latter, we must first clarify it by defining N consistently with Lemma 4.6.13:

N = r ∈∂(t ) M t(r )
We then see that the canonical isomorphism that we are looking for is the instantiation to the constant family (M ) r∈∂(t •t) of the following natural isomorphism in Y r for r ∈ ∂(t • t):

r∈∂(t) Y r ⊗ r ∈∂(t ) r t(r ) Y r ∼ = r∈∂(t •t) Y r
This is a consequence of an elementary combinatorial fact:

∂(t) ∪ r ∈∂(t ) {r | ∃i ∈ {1, . . . , |t(r )|}. t(r )[i] = in 2 (r)} = ∂(t • t)
Informally speaking, this means that a register is thrown away by t • t if and only if is either thrown away by t, or used by t to compute a value that is then discarded by t . Furthermore, thanks to copylessness, the union is disjoint and for each r in the union over r ∈ ∂(t ), there is a single (r , i) such that t(r )[i] = in 2 (r); those properties are necessary to get the natural isomorphism. We leave a formal proof of this combinatorial identity to the reader.

This being done, all that remains to conclude our proof is to show Lemma 4.6.13 below.

Lemma 4.6.13. The diagram of Figure 4.6.2 commutes, with the following definitions:

N = r ∈∂(t ) M t(r ) O r = r t (r ) M t(r ) ψ r = r t (r ) F (t) r
Proof. In addition to the information already given in Figure 4.6.2, there are two things to justify about this figure: the top-left naturality square, and the commutativity of the bottom square. Let us tackle the former. Recall that Lemma 4.6.10 gives us the canonical isomorphism

r ∈R Y r ∼ = r ∈∂(t ) Y r ⊗ r ∈R r t (r ) Y r which is natural in Y r for r ∈ R . By instantiating with Y r = M t(r ) , we get r ∈R M t(r ) ∼ = r ∈∂(t ) M t(r ) ⊗ r ∈R r t (r ) M t(r ) = N ⊗ r ∈R O r
by definition of N and O r . Hence the vertical canonical isomorphism at the top left of Figure 4.6.2; as for the top middle, it is the instantiation of the same natural isomorphism with Y r = M , as already observed in Definition 4.6.11. To make the top-left square a naturality square, we should then have

(. . .) ⊗ r ∈R ψ r = r ∈∂(t ) F (t) r ⊗ r ∈R r t (r ) F (t) r
which is indeed the case with our definition of ψ r .

r ∈R M t(r ) ∼ F (t) = r ∈R F (t) r / /
naturality / Lemma 4.6.10

M ⊗R ∼ F (t ) / / definition of F (t ) M ⊗R N ⊗ r ∈R O r (. . .) ⊗ r ψ r / /
⊗ is a bifunctor and I is a terminal object

M ⊗∂(t ) ⊗ r ∈R M t (r ) ⊗ F (t ) / / I ⊗ M ⊗R ∼ O O N ⊗ r ∈R O r ∼ ⊗ r ∈R ( F (t ) r • ψ r ) / /
manipulations on monoid objects, explained in main text

I ⊗ M ⊗R N ⊗ r ∈R M (t•t )(r ) ⊗ r ∈R F (t • t) r = ⊗ F (t • t) / / I ⊗ M ⊗R
O r = r t (r ) M t(r ) ∼ F (t ) r • ψ r / / M M (t•t )(r ) F (t • t) r 5 5
for r ∈ R Let r ∈ R . To show that this indeed commutes, we start by writing out

F (t ) r • ψ r as r t (r ) M t(r ) r F (t) r -------→ M t (r ) = |t (r )| j=1 X r ,j j f r ,j ------→ M ⊗|t (r )| µ (|t (r )|) ------→ M
where, analogously to the X r ,i and f r ,i involved in the definition of F (t) r , we take

(X r ,j , (f r ,j : X r ,j → M )) = (I, m c ) when t (r )[j] = in 1 (c) for c ∈ Γ (M, id M ) otherwise, i.e. t (r )[j] ∈ in 2 (R )
The leftmost arrow in the above sequence is how we defined ψ r in the lemma statement, while the composition of the two others equals F (t ) r by definition.

To manipulate this, let us introduce a new notation:

foldMap w f = |w| i=1 f (w i )
for w = w 1 . . . w n and f a function Note that in general, this may lead to monoidal products with repeated factors: there is no a priori guarantee that this defines a tensorial functor. The function f will often be expressed as a copairing using the following notation:

f : in 1 (y) → f 1 (y) in 2 (z) → f 2 (z) ⇐⇒ f : x ∈ Y + Z → f 1 (y) when x = in 1 (y) for y ∈ Y f 2 (z) when x = in 2 (z) for z ∈ Z
In the case that we are interested in right now, we have by functoriality of ⊗:

F (t ) r • ψ r = µ (|t (r )|) • foldMap t (r )        in 1 (c) → m c in 2 (r ) → F (t) r = µ (|t(r )|) • foldMap t(r ) in 1 (a) → m a in 2 (r) → id M
To simplify this, we introduce the following tensorial functor:

L r ((Y p ) p∈P r ) = |t (r )| j=1        Y j,1 when t (r )[j] ∈ in 1 (Γ) |t(r )| i=1 Y j,i when t (r )[j] = in 2 (r ) where P r = |t (r )| j=1 {1} when t (r )[j] ∈ in 1 (Γ) {1, . . . , |t(r )|} when t (r )[j] = in 2 (r )
(using the dependent sum operation, cf. §2.1.1, so that P r ⊂ N 2 ). There is a unique total order on P r that makes L r into an ordered tensorial functor: the lexicographical order inherited from N 2 . Thus, we may meaningfully speak of µ (L r ) : L r ((M ) p∈P r ) → M , the L r -ary monoid multiplication, whose inductive definition leads to:

µ (L r ) = µ (|t (r )|) • foldMap t (r ) in 1 (c) → µ (1) = id M in 2 (r ) → µ (|t(r )|)
Now that this is defined, we can state the following equation, that directly follows by functoriality from the previous expressions of F (t ) r • ψ r and of µ (L r ) :

F (t ) r • ψ r = µ (L r ) • foldMap t (r )        in 1 (c) → m c in 2 (r ) → foldMap t(r ) in 1 (a) → m a in 2 (r) → id M
For the next step, recall that by Definition 4.2.11, (t • t)(r ) = t (t (r )) (which is not t (t(r )), as previously emphasized, since this '•' is composition in SR(Γ)), where t is the morphism of free monoids such that t † (in 1 (c)) = in 1 (c) and t † (in 2 (r )) = t(r ). Thus, the j-th term of the dependent sum above is equal to {1, . . . , |t † (t (r )[j])|}, and from the morphism property

(t • t)(r ) = t (t (r )) = t (t (r )[1]) • . . . • t (t (r )[|t (r )|])
we obtain an bijection ξ r : P r ∼ -→ {1, . . . , (t • t)(r )} such that for all (j, i) ∈ P r ,

(t • t)(r )[ξ(j, i)] = t (t (r )[j])[i] = in 1 (c) when t (r )[j] = in 1 (c) t(r )[i] when t (r )[j] = in 2 (r )
Thanks to this, we have

F (t ) r • ψ r = µ (L r ) • L r   m c when (t • t)(r )[ξ(p)] = in 1 (c) for c ∈ Γ id M otherwise, i.e. (t • t)(r )[ξ(p)] ∈ in 2 (R) p∈P r  
It is not hard to see that the bijection ξ is monotone (taking the lexicographical order on P r as we did earlier). Therefore, the natural isomorphism

Ξ (Yp) p∈P r : L (Y p ) p∈P r ∼ --→ |(t •t)(r )| k=1 Y ξ -1 (k)
induced by ξ is a canonical isomorphism of ordered tensorial functors (i.e. it only uses associators and unitors, not symmetries). Thus, we may apply the general associativity law for internal monoids (Theorem 4.6.7):

µ (L r ) = µ (|(t •t)(r )|)
• Ξ (we omit the subscript of Ξ for convenience). By naturality of Ξ, we then have

F (t ) r • ψ r = µ (|(t •t)(r )|) •   foldMap (t •t)(r ) in 1 (c) → m c in 2 (r) → id M   • Ξ By definition, this is equal to F (t • t) • Ξ,
which is what we needed to conclude the proof.

Proposition 4.6.14. The functor F is strong monoidal.

Proof. From the definition, we immediately get

F (R + R ) = M ⊗(R+R ) ∼ = M ⊗R ⊗ M ⊗R = F (R) ⊗ F (R )
as an instance of a canonical isomorphism

x∈R+R Y x ∼ = r∈R Y in 1 (r) ⊗ r ∈R Y in 2 (r )
which is natural in Y x for x ∈ R + R . One can then verify that this family of isomorphisms

F (R + R ) ∼ = F (R) ⊗ F (R ) is natural in R and R .
To finish proving Theorem 4.6.1, it suffices to carry out some short explicit computations to check that this functor F satisfies the claimed equalities. We leave this to the reader.

On closure under precomposition by regular functions

Our next categorical automata result is our first application of monoidal closure: Theorem 4.7.1. Let C be a string streaming setting with output set X. Suppose that the underlying category C is symmetric monoidal closed and quasi-affine. Furthermore, let us assume that ' C is equal to the monoidal unit I. Then for any f : Γ * → X computed by some C-SST, and any regular g : Σ * → Γ * , the function f • g : Σ * → X is computed by some (stateful) C-SST. In other words, the class of functions defined by C-SSTs is closed under precomposition by regular functions. Before proving the above theorem, let us check that it entails known preservation and composition properties.

Corollary 4.7.2. Let L ⊆ Γ * be a regular language and g : Σ * → Γ * be a regular function. Then the language g -1 (L) ⊆ Σ * is regular.

Proof. That L is regular is equivalent to its indicator function χ L : Γ * → {0, 1} being computed by some single-state Finset 2 -SST, see Example 4.2.5. The underlying category of finite sets is cartesian closed, and the monoidal structure given by a cartesian product is automatically symmetric and affine. According to Theorem 4.7.1, χ L • g can therefore be computed by some Finset 2 -SST. Observing that the category of finite sets has coproducts, and applying Lemma 4.3.12, we even have a single-state Finset 2 -SST for χ L • g. Finally, the latter is none other than the indicator function of g -1 (L).

Corollary 4.7.3. Let f : Γ * → ∆ * and g : Σ * → Γ * be regular functions. Then f • g is also a regular function.

Proof. This is just the application of Theorem 4.7.1 to SR ⊕& -SSTs. The functions that they can compute are exactly the regular functions (cf. §4.5.2). By Theorem 1.2.4 / Corollary 4.5.4, the underlying category SR ⊕& is symmetric monoidal closed. Finally, SR ⊕& is quasi-affine since it has all cartesian products by construction. Remark 4.7.4. As we shall see in Proposition 5.1.16, the closure under composition of regular functions also follows from our λ ⊕& -calculus characterization (Theorem 1.2.3). However, note that the latter relies on some non-trivial syntactic analysis of λ ⊕& -terms, as discussed at the start of Chapter 5. The argument we give in this section circumvents that difficulty. That said, it still shares some (non-syntactic) ingredients with our proof of Theorem 1.2.3, namely:

• the monoidal closure and quasi-affineness of SR ⊕& ;

• the fact that SR ⊕& -SSTs are no more expressive than SR-SSTs.

These results still require substantial developments -indeed, this composition property is quite non-trivial as mentioned in the introduction -but bypass the need of mentioning the λ ⊕& -calculus. Beyond this simplification, the main advantage of our approach here is that we get a more general theorem, that applies to many streaming settings; in particular, the final output does not have to be a string.

We now come to the proof of this generalized preservation theorem, which uses the universal property from the previous section (more specifically, its Corollary 4.6.3).

Proof of Theorem 4.7.1. We give below a proof assuming that f is defined by some single-state C-SST (but beware: the C-SST computing f • g will still be stateful!). The general case can be applied by considering the streaming setting C ⊕const -SST, as was briefly mentioned in Remark 4.3.13, and using the fact that single-state C ⊕const -SSTs, stateful C ⊕const -SSTs and stateful C-SSTs are equally expressive. We leave it to the reader to check that the symmetric monoidal structure and the cartesian products in C can be lifted to C ⊕const , making this generalization possible.

Therefore, we may assume without loss of generality that f is computed by a single-state

C-SST T f = ({•}, A f , δ f , i f , o f ) where A f is an object of C and δ f : Γ → Hom C (A f , A f ) i f ∈ Hom C ( ' , A f ) o f ∈ Hom C (A f , ')
Let T g = (Q, q 0 , R g , δ g , i g , o g ) be an usual copyless SST (i.e., a SR-SST) computing the regular function g, where Q and R g are finite sets and

q 0 ∈ Q δ g : Σ × Q → Q × [R g → SR R g ] i g ∈ [∅ → SR R g ] o g : Q → [R g → SR {•}]
We will write A = A f and R = R g for short.

We want to build from this data a C-SST T defining f • g. Since C is quasi-affine and symmetric monoidal closed, we can apply Corollary 4.6.3 to the object A A and to a family of morphisms ( δ f (c)) c∈Γ ∈ Hom C (A A, A A) Γ that will be defined later. This gives us a functor F δ f : SR → C, enjoying various properties that will be progressively recalled, which is at the heart of our construction.

The set of states of our new C-SST T is Q, with initial state q 0 , and its memory object is

F δ f (R). The initialization morphism is defined as i = F δ f (i g ) ∈ Hom C I, F δ f (R) -
: Σ × Q -→ Q × Hom C F δ f (R), F δ f (R) c , q → π 1 (δ g (c, q)) , F δ f (π 2 (δ g (c, q)))
Finally, using j f : F δ f ({•}) → A to be defined later, we take as our new output function

o : q ∈ Q → o f • j f • F δ f (o g (q)) ∈ Hom C F δ f (R), '
Let us now sketch the verification that this defines the intended function f • g : Σ * → X. In the process, we will fill the missing definitions to make everything work out.

Let w = w 1 . . . w n ∈ Σ * be an input string. The sequence q 0 , . . . , q n ∈ Q of states visited by both T g and T when fed this input is obtained by q i+1 = π 1 (δ g (w i , q i )) from the initial q 0 . By definition of the output of T g , we have:

g(w) = o g (q n ) • π 2 (δ g (w n , q n-1 )) • • • • • π 2 (δ g (w 1 , q 0 )) • i g where g(w) ∈ [∅ → SR(Γ) {•}]
corresponds to g(w) ∈ Γ * (cf. Theorem 4.6.1) and the '•' denotes a composition of register transitions (i.e. of SR-morphisms). Similarly, the output T (w) of the C-SST T that we built on the input w is defined as

T (w) = o(q n ) • F δ f (π 2 (δ g (w n , q n-1 ))) • • • • • F δ f (π 2 (δ g (w 1 , q 0 ))) • i
which, by unfolding the definitions of o and i, applying the functoriality of F δ f and comparing with the previous equality, one can simplify into

T (w) = o f • j f • F δ f g(w)
It is now time to define j f ∈ Hom C F δ f ({•}), A . To do so, let us first introduce

appto(ϕ) : B C ∼ --→ (B C) ⊗ I id⊗ϕ ----→ (B C) ⊗ B ev --→ C
where the last arrow is the evaluation map ev B,C , for any B, C ∈ Obj(C) and ϕ : I → B. An useful property, whose verification we leave to the reader, is

appto(ϕ) • Λ (ψ) = ψ • ϕ for any ψ : B → C
where Λ :

Hom C (B, C) ∼ -→ Hom C (I, B C
) is defined in Proposition 4.1.9. We then take

j f : F δ f ({•}) π 1 --→ (A A) (A A) appto(Λ (id A )) ---------→ A A appto(i f ) ------→ A
where π 1 is the left projection from

F δ f ({•}) = ((A A) (A A)
) & I (this equality is guaranteed by Corollary 4.6.3) and i f is the initialization morphism of T f . Using the equation

F δ f g(w) = Λ δ f (g(w) 1 ) • • • • • δ f (g(w) m ) , id I where m = |g(w)|
coming from Corollary 4.6.3, we then have

j f • F δ f g(w) = appto(i f ) • δ f (g(w) 1 ) • • • • • δ f (g(w) m ) • Λ (id A ) Next, we define δ f (c) = Λ(ev A,A • (id A A ⊗ δ f (c))) ∈ Hom C (A A, A A) for c ∈ Γ. In other words, δ f (c) is the curryfication of (A A) ⊗ A id⊗δ f (c) ------→ (A A) ⊗ A ev --→ A One can then check that δ f (c) • Λ (ψ) = Λ (ψ • (δ f (c))) for any ψ : A → A.
Putting everything together, we finally have

T (w) = o f • appto(i f ) • δ f (g(w) 1 ) • • • • • δ f (g(w) m ) • Λ (id A ) = o f • appto(i f ) • Λ (δ f (g(w) m ) • • • • • δ f (g(w) 1 )) = o f • δ f (g(w) m ) • • • • • δ f (g(w) 1 ) • i f
and this final expression is precisely the definition of the output of T f on g(w). Since T f computes f , we end up with T (w) = f (g(w)), as we wanted.

To conclude this section, let us note that an analogous result for precomposition by regular tree functions can be shown by leveraging the results of Chapter 6; we leave it as an exercise. An important subtlety: since the presence of the additive conjunction is important to compute regular tree functions (as we stressed in the introduction), one must consider tree streaming settings whose underlying categories have finite cartesian products (which entails quasi-affineness).

Uniformization through monoidal closure

Let us wrap up this chapter by recalling below the categorical uniformization theorem that we mentioned in Section 4.4 and providing its proof. (Recall that according to Lemma 4.4.8, the conclusion amounts to saying that non-deterministic sdm-C-SSTs are uniformizable by partial sdm-D-SSTs.) As promised at the end of Section 4.4, our technical development until now allows us to derive the equivalence between sdm-SR & -SSTs and sdm-SR-SSTs from the above result.

Proof of Theorem 4.4.9. We instantiate Theorem 4.8.1 with C = SR, D = SR ⊕ , and the functor ι ⊕ : SR → SR ⊕ . We have already seen that SR ⊕ is a symmetric monoidal affine category. The assumption on internal homsets is exactly Lemma 4.3.14. The theorem then tells us that sdm-SR & -SSTs are subsumed by sdm-SR ⊕ -SSTs, and the latter are no more expressive than sdm-SR-SSTs by Corollary 4.3.9. Not coincidentally, the idea for our proof of Theorem 4.8.1 is extracted from a direct determinization proof for copyless SSTs. Our main contribution is in recognizing that the latter implicitly involves internal homsets as one of its key components. (While the determinization argument in [START_REF] Alur | Nondeterministic Streaming String Transducers[END_REF] goes through MSO, the direct proof might be folklore, see e.g. [BC18, Problem 139 (p. 226)].)

We do not prove the statement in excruciating details, but provide key formal definitions so that a reader familiar with a modicum of automata theory and category theory should be able to reconstitute a fully formal argument with ease. Let us stress once again that all of the combinatorics may be regarded as adaptation of known arguments.

Our approach relies on a notion of transformation forest, a name that we borrow from [BC18, Chapter 13] for an extremely similar concept 6 . This gadget is also reminiscent 6 There are two formal differences between our notions, which are not very big but worth mentioning for readers of [START_REF] Bojańczyk | An automata toolbox[END_REF]. First, edges of a transformation forest are intended to be associated with (elements of) a monoid, while ours should be associated with ("elements of") internal homsets F (Cu) F (Cv). Were we trying to prove D-uniformization for C-SSTs, we would have necessarily Cu = Cv and the aforementioned of trees used in determinization procedures like the Muller-Schupp construction for automata over ω-words [START_REF] Muller | Simulating alternating tree automata by nondeterministic automata: New results and new proofs of the theorems of Rabin, McNaughton and Safra[END_REF] (another exposition can be found in [BC18, Chapter 1]), and of the sharing techniques used in the original paper on SSTs [AČ10, §5.2]. In determinization procedures, this constitutes an elaboration of powerset constructions recalling not only reachable states, but also crucial information on how those states are reached. Here, the vertices v of such forests will be labelled by objects C v of C and each edge (u, v) will be correspond to a "register containing a value of type F (C u ) F (C v )". We decompose this proof sketch in three parts: first, we introduce transformation forests, their semantic interpretation as families of maps in D; we explain how they may be composed and that maps in C & may be regarded as depth-1 transformation forests. Then, we explain how to reduce the size of transformation forests in a sound way (this is the crucial part ensuring that the resulting sdm-D-SSTs will have finitely many states). Finally, we explain how to put all of this together to uniformize sdm-C-SSTs.

Transformation forests and their semantics. A transformation forest is defined as

a tuple F = (V, E, O, (C v ) v∈V ) where • V is a non-empty finite set of vertices • E ⊆ V 2 is a set of directed edges, pointing from parents to children, such that (V, E) is a directed forest • O is a non-empty subset of V which we cal the set of output nodes • every C v is an object of C
When a transformation forest F is fixed, we call I F its set of roots (which we may sometimes call input nodes; we drop the subscript when there is no ambiguity). Given a transformation forest F = (V, E, (v o ) o∈O , (C v ) v∈V ), we assign the following object of D:

Ty(F) = (u,v)∈E F (C u ) F (C v )
An example of a transformation forest F and a computation of its type Ty(F) is pictured in Figure 4.8.1. To guide the intuition, one may note that there is an embedding 7 of a set of suitable labellings of the forest F into Hom D ( , Ty(F)).

(u,v)∈E

Hom D (F (C u ), F (C v ))
/ / Hom D ( , Ty(F))

We will now call abusively the input of F the object A = ˘i∈I C i and the output B = ˘o∈O C o ; we write F : A → B in the sequel. The justification for this notation is that there is a family of maps

F ∈ o∈O i∈I Hom D (Ty(F), F (C i ) F (C o ))
obtained by internalizing the composition of morphisms along branches of F, which we call the semantics of F. We also note that this allows to interpret arbitrary C & -morphisms: such a morphism f : A → B can be mapped to a pair (Grph(f ), f ) consisting of object would have a monoid structure internal to D, so this distinction is more an artefact of our settings rather than an essential one. Second, what [START_REF] Bojańczyk | An automata toolbox[END_REF] calls transformation forests refers to a class of forest with "no junk", such as dangling leaves not referring to an intended output or spurious internal nodes, while we allow those in an initial definition; we add the adjective "normalized" for those containing "no junk" as we shall see later, so this is merely a terminological detail.

7 This becomes an isomorphism when HomD ( , A ⊗ B) ∼ = HomD ( , A) × HomD ( , B); this is the case for our intended application D = SR⊕. • a depth-1 transformation forest Grph(f ) :

C 0 U C 2 C 3 C 1 V C 4 T ↧ S F (T ) ⊸ F (C 0 ) ⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ F (S) ⊸ F (U ) ⊗ F (U ) ⊸ F (C1) ⊗ F (U ) ⊸ F (V ) ⊗ F (V ) ⊸ F (C2) ⊗ F (V ) ⊸ F (C3) ⊗ F (U ) ⊸ F (C4)

Ty

ī∈I C i → ō∈O C o (cf. Figure 4.8.2) • a morphism f ∈ Hom D ( , Ty(F)) so that, if f = (i o , α o ) o∈O , we have Grph(f ) o • f = (i o , Λ(α o • ρ -1 )).
Given two forests F : A → B and F : B → C, there is a composition F • F obtained by gluing the input nodes of F along the output nodes of F. A crucial point is that the semantics of the composite -may be computed as follows

F • F (o) = F 1 ( F 1 (o )), F 2 (o ) • F 2 ( F 1 )
4.8.2. Reducing transformation forests. We now introduce two elementary transformations F → F over transformation forests, together with associated morphisms Ty(F) → Ty(F ): induced by the internal composition map

• Pruning: if v ∈ V F is
Hom D ([F (C p ) F (C v )] ⊗ [F (C v ) F (C c )], F (C p ) F (C c ))
The auxiliary maps prune and contract operations are compatible with the semantic map • in the sense that for every o ∈ O and suitable vertices u, v of F , we have

i = π 1 ( F (o)) = π 1 ( prune(F, u) (o)) = π 1 ( contract(F, v) (o))
and the following diagrams (using the above i) commute in D Ty(F)

F (o) / / prune(v) F (C i ) F (C o ) Ty(prune(F, v)) prune(F ,v) (o) 4 4
Ty(F)

F (o) / / contract(v) F (C i ) F (C o ) Ty(contract(F, v)) contract(F ,v) (o) 4 4
Consider the rewrite system over forests F : A → B induced by those two operations, and call = its reflexive closure and * the transitive closure of = . It can be shown that the reflexive closure = satisfies the diamond lemma, i.e., that for every F, F and F such that F = F and F = F , there exists F such that F = F and F = F . This ensures that is confluent. Furthermore, given a rewrite F * F , there is a map Ty(F) → Ty(F ) obtained by composing maps prune(v) and contract(v) (and identities for trivial rewrites F * F). It can be shown that this map does not depend on the rewrite path. This is done first by arguing that if we have a rewrite square for = , the associated diagram in D is commutative, and then proceed by induction over the rewrite paths using the diamond lemma. Defining the size of a forest as its number of vertices, it is clear that prune(F, u) and contract(F, v) have size strictly less than F, so the rewrite system is also terminating. With confluence, it means that for every forest F : A → B, there is a unique forest reduce(F) : A → B such that F * reduce(F) and there is no F such that reduce(F) F . We call reduce(F) the normal form of F; a forest F is called normal if reduce(F) = F. By the discussion above, there are canonical maps reduce F : Ty(F) → Ty(reduce(F)) coming from rewrites.

The last important thing to note is that, if the input A = ˘i∈I C i and output B = ˘o∈O C o are fixed, up to isomorphism, there are finitely many normal forests F : A → B as their size is bounded by 2(|I| + |O|). We write NF (A, B) for a finite set of representative for all normal forests A → B, and given F ∈ NF (B, C) and F ∈ NF (A, B), we write F • N F for the unique forest in NF (A, C) which is isomorphic to reduce(F • F ); an example of the full computation of a F • N F is given in Figure 4.8.3. Similarly, we assume that Grph(f ) ∈ NF (A, B) for every morphism f ∈ Hom C & (A, B). 4.8.3. Putting everything together. Let T = Q, q 0 , (A q ) q∈Q , δ, i, o be a sdm-C & -SST with input Σ * . We define the sdm-D-SST T =   q∈Q NF (A q 0 , A q ) , (q 0 , Grph(id)), (Ty(F)) q,F , δ , i o

  where δ : Σ → q,F r,F Hom D Ty(F), Ty(F ) i ∈ Hom D ( ' , Grph(id)) o ∈ q,F
Hom D (Ty(F), ')

are given as follows, assuming that

A q = x∈Xq C q,x
• Notice that Ty(Grph(id)) = x∈Xq 0 F (C q 0 ,x ) F (C q 0 ,x ); we simply take the constant map corresponding to the X q 0 -fold tensor of Λ(id Cq 0 ,x ) for i .

• Fix a ∈ Σ and recall that δ(a) is a family of pairs

(δ Q (a) q , δ C & (a) q ) q∈Q ∈ q∈Q r∈Q Hom C & (A q , A r )
δ is then defined by the equation

δ (a) q,F = δ Q (a) q , δ NF (a) q,F , δ D (a) q,F
where we set δ NF (a) q,F = Grph(δ C & (a) q ) • N F and δ D (a) q,F is obtained as in Figure 4.8.4 • Finally, for q, F ranging over states of T , we define o q,F . Recall that F determines a canonical family

F ∈ x∈Xq x 0 ∈Xq 0 Hom D (Ty(F), F (C q 0 ,x 0 ) F (C q,x ))
First, as

' C & = ι & (' C
), note that there is a unique x ∈ X q such that o q = (x, o C ) * for some o C ∈ Hom C C q,x , ' C . Writing the pair F x as (x 0 , f ), o q,F is depicted in Figure 4.8.4. δ D (a) q,F o q,F Ty(F)

∼ ⊗ Ty(F) δ C & (a)q⊗id Ty(Grph(δ C & (a) q )) ⊗ Ty(F) ∼ Ty(Grph(δ C & (a) q ) • F) reduce Ty(reduce(Grph(δ C & (a) q ) • F))
Ty(δ NF (a) q,F ) We omit the proof that T = T by induction over the length of an input word. While spelling it out may be a bit notation-heavy, there is no particular difficulty considering the remarks above linking -, the composition of transformation forests and their normal forms.

Ty(F) f F (C q 0 ,x 0 ) F (C q,x ) ∼ (F (C q 0 ,x 0 ) F (C q,x )) ⊗ ' (F (C q 0 ,x 0 ) F (C q,x )) ⊗ F ( ' ) id⊗F (ix 0 ) (F (C q 0 ,x 0 ) F (C q,x )) ⊗ F (C q 0 ,x 0 ) ev F (C q,x ) F (o C ) F (

CHAPTER 5

String transductions in a linear λ-calculus

Now that we are equipped with the categorical tools developed in the previous chapter, we can prove the parts of Theorem 1.2.3 pertaining to string functions, that is, the first two rows. That is the goal of this chapter. Some of our developments will also apply more generally to ranked trees, as a preparation for the next chapter where the final row of Theorem 1.2.3 (concerning regular tree functions) will be shown.

In Section 5.1, we introduce the equational theory and typing rules of the λ ⊕& -calculus, and explain how it can be used to define functions on strings and trees thanks to Church encodings, with a few examples. Section 5.2 uses a syntactic lemma to reframe our implicit characterization of regular functions as the equivalence between SR-SSTs and single-state L-SSTs -where L is a streaming setting made of purely linear λ ⊕& -terms -and then proves this categorical reformulation as an immediate application of Theorem 1.2.4 / Corollary 4.5.4. As for the part of Theorem 1.2.3 about comparison-free polyregular functions, it is tackled with a more ad-hoc argument in Section 5.3.

Both sections 5.2 and 5.3 depend on an analysis of the syntax of the λ ⊕& -calculus to prepare the groundwork for their semantic evaluation arguments. The required syntactic properties are encapsulated in concise lemmas whose proofs are deferred to the final section of this chapter ( §5.4). We expend considerable effort on those proofs -most of it spent on routine yet cumbersome bureaucracy, and some on actual technical subtleties -but the obstacles are unrelated to the various conceptual points concerning automata and semantics that we wished to stress. As we already summarized those points in the introduction ( §1.2), let us say a few words now about syntax. (This discussion can be safely skipped.)

The idea is that, since the string/tree function defined by a λ ⊕& -term depends only on its βη-equivalence class, we will pick a representative of this class whose shape is restricted (and thus can be exhaustively analyzed) depending on its type, called a normal form. Much of Section 5.4 is devoted to normalization results, i.e. "every λ ⊕& -term is βη-equivalent to a normal form". We prove this first for an "old-school" definition of normal and neutral terms, and then for a more refined notion of focused normal forms.

For our purposes, the naive notion of β-normal form is inadequate because of the positive connectives ⊗/⊕. (A term is β-normal if it does not admit any β-reduction, and the β-reduction relation is obtained by orienting some equations from Figure 5.1.2.) Our better notions of normal form can be reached by combining β-reductions with applications of well-chosen η-conversions (called extrusions) whose role to unlock new β-redexes. Similar issues arise in the literature concerned with deciding βη-equivalence in λ-calculi with positive connectives, e.g. [Lin07; Alt+01]; we refer to [START_REF] Scherer | Which types have a unique inhabitant? : Focusing on pure program equivalence[END_REF] for a comprehensive and pedagogical overview of this subject, including the application of focusing to canonical normal forms for simply typed λ-terms with sums. In our case, we are interested in normal forms only because they lend themselves to (lengthy) case analyses to understand the closed inhabitants of the types Tree Γ [τ ]

Tree Σ and Str Γ [τ ] → Str Σ . Our normal forms are not meant to serve as canonical representatives of βη-equivalence classes, nor do they provide a decision procedure for equivalence.

All these complications could have been avoided by restricting to the fragment of the λ ⊕& -calculus containing only the negative connectives → / /& and the corresponding type constructors, for which β-normal forms would have been sufficient -in fact, we might choose to do so in an upcoming journal version to avoid frightening readers. (Additionally, normalization for this negative fragment is immediate by a reduction-preserving translation to the simply typed λ-calculus with surjective pairing.) However, it was tempting to include those positive connectives in our work since our semantic tools can handle them without difficulty (our category SR ⊕& from the previous chapter can interpret ⊗/⊕). The choice made in this thesis is also an opportunity to demonstrate that the existing tools for working with the syntactic metatheory of typed λ-calculi are perfectly adequate for the job.

5.1. The λ ⊕& -calculus, Church encodings, and definability of functions 5.1.1. Types & terms. We consider a linear λ-calculus which we dub the λ ⊕& -calculus, based (via the proofs-as-programs correspondence) on propositional intuitionistic linear logic with both multiplicative and additive connectives (IMALL) together with a base type o. The grammar of types is as follows:

τ, σ ::= o | τ σ | τ ⊗ σ | I | τ → σ | τ & σ | τ ⊕ σ | | 0
A typing context Ψ is a finite set of declarations x 1 : τ i , . . . , x k : τ k where the x i are pairwise distinct variables (which constitute the set of free variables of Ψ) and the τ i are types. Typed λ ⊕& -terms are given in Figure 5.1.1 along with the inductive definition of the typing judgment Ψ; ∆ t : τ , where Ψ and ∆ are contexts (with disjoint sets of free variables), τ is a type and t is a term. In such a judgment, Ψ is called the non-linear context and ∆ the linear context; the basic idea is that variables in Ψ may be "used" arbitrarily many times, while those in ∆ must be "used" exactly once (for a notion of usage such that the additive pair x, x uses x once, whereas the multiplicative pair x ⊗ x uses x twice).

In the rules of Figure 5.1.1, a comma between linear contexts stands for a disjoint union: ∆ and ∆ must have no variable name in common to form the linear context ∆, ∆ . This is required to ensure that the variables are used once.

Remark 5.1.1. This is formally more restrictive than an affineness condition, i.e. than requiring variables in ∆ to be used at most once. In practice, λ ⊕& is not less expressive than its affine variant, which would be obtained by adjoining the following weakening rule:

Ψ; ∆ t : τ Ψ; ∆, ∆ t : τ
The basic idea is that the affineness can be encoded at the level of types by using the linear type τ & I instead of the affine type τ (as argued for instance in [Gir95, §1.2.1]).

The simply typed λ-calculus admits an embedding into λ ⊕& . Conversely, there is a mapping from λ ⊕& to the simply typed λ-calculus with products and sums by "forgetting linearity" (and replacing the tensorial product eliminator let x ⊗ y = t in u by the variant based on projections u[π 1 (t)/x, π 2 (t)/y]).

As usual, we identify λ ⊕& -terms up to renaming of bound variables (α-equivalence) and admit the standard definition of the capture-avoiding substitution. The computational meaning of terms is specified by their βη-equivalence (denoted by = βη ), generated by closing under contexts the equations in Figure 5.1.2. Note that those equations are implicitly typed and that typing is invariant under βη-equivalence.

As usual, a λ ⊕& -term is said to be closed when it does not contain any free variables, that is, when it is typed in the empty context. Finally, we isolate an important class of types and terms for the sequel. β:

Ψ; x : τ x : τ Ψ, x : τ ; • x : τ Ψ; ∆, x : τ t : σ Ψ; ∆ λx.t : τ σ Ψ; ∆ t : τ σ Ψ; ∆ u : τ Ψ; ∆, ∆ t u : σ Ψ, x : τ ; ∆ t : σ Ψ; ∆ λ ! x.t : τ → σ Ψ; ∆ t : τ → σ Ψ; • u : τ Ψ; ∆ t u : σ Ψ; ∆ t : τ Ψ; ∆ u : σ Ψ; ∆, ∆ t ⊗ u : τ ⊗ σ Ψ; ∆ u : τ ⊗ σ Ψ; ∆, x : τ, y : σ t : κ Ψ; ∆, ∆ let x ⊗ y = u in t : κ Ψ; • () : I Ψ; ∆ t : I Ψ; ∆ u : τ Ψ; ∆, ∆ let () = t in u : τ Ψ; ∆ t : τ Ψ; ∆ u : σ Ψ; ∆ t, u : τ & σ Ψ; ∆ t : τ & σ Ψ; ∆ π 1 (t) : τ Ψ; ∆ t : τ & σ Ψ; ∆ π 2 (t) : σ Ψ; ∆ t : τ Ψ; ∆ in 1 (t) : τ ⊕ σ Ψ; ∆ t : σ Ψ; ∆ in 2 (t) : τ ⊕ σ Ψ; ∆
(λx.t) u = β t[u/x] (λ ! x.t) u = β t[u/x] case(in 1 (t), x.u, x.v) = β u[t/x] π 1 ( t, u ) = β t case(in 2 (t), x.u, x.v) = β v[t/x] π 2 ( t, u ) = β u let x ⊗ y = t ⊗ u in v = β v[t/x][u/y] let () = () in t = β t η: λx.t x = η t λ ! x.t x = η t let x ⊗ y = t in u[x ⊗ y/z] = η u[t/z] π 1 (t), π 2 (t) = η t let x ⊗ y = t in v[u/z] = η v[let x ⊗ y = t in u/z] x = η let () = t in u[()/z] = η u[t/z] let () = t in v[u/z] = η v[let () = t in u/z] case(t, x.u[in 1 (x)/z], y.u[in 2 (y)/z]) = η u[t/z] abort(t) = η u Figure 5.1.2.
Equations for λ ⊕& -terms (relating terms that have matching types).

Definition 5.1.2. Recall from the introduction (Definition 1.2.2) that we call a type purely linear if it does not have any occurrence of the '→' connective. A λ ⊕& -term t is also said to be purely linear if the typing judgment Ψ; ∆ t : τ admits a derivation where all the types that occur are purely linear.

Remark 5.1.3. For any derivable typing judgment Ψ; ∆ t : τ , if the types occurring in Ψ and ∆, as well as τ , are purely linear, then t is βη-equivalent to some purely linear λ ⊕& -term. (This is a consequence of normalization.) 5.1.2. Church encodings of strings and trees. In order to discuss string-to-string (and tree-to-tree) functions in the λ ⊕& -calculus, we need to discuss how they are encoded. Recall from Section 1.1.6 that Church encodings provide a canonical way to encode algebraic data types in the simply typed λ-calculus. For instance, for natural numbers and strings over {a, b}, writing w for the Church encoding of w, we have

Nat ! = (o → o) → o → o Str ! {a,b} = (o → o) → (o → o) → o → o 3 = λ ! s.λ ! z.s (s (s z)) aab = λ ! a.λ ! b.λ ! ε.a (a (b ε))
Conversely, one may show that any closed simply typed λ-term of type Nat ! (resp. Str ! {a,b} ) is βη-equivalent to the Church encoding of some number (resp. string). In the rest of this dissertation, we will use a less common, but more precise λ ⊕& -type for Church encodings of strings of trees, first introduced in [Gir87, §5. The fundamental property of Church encodings is that they induce not just a map from trees in Tree(Σ) to λ ⊕& -terms of type Tree Σ in the empty context, but a bijective correspondence when the latter are considered up to βη-equivalence: The surjectivity part of this statement is a consequence of normalization. For this reason, we shall prove this in Section 5.4.3 after our normalization result. 5.1.3. Two ways to define functions over Church encodings. We are now ready to give our notions of computation for our string (and tree) functions. First, we need an operation of type substitution in λ ⊕& , which allow to substitute an arbitrary type κ for o.

o[κ] = κ (τ σ)[κ] = τ [κ] σ[κ] . . .
(This already made an appearance in Chapter 1, in particular §1.1.6.)

Remark 5.1.8. Type substitution extends in the obvious way to typing contexts as well, and even to typing derivations, so that

Ψ; ∆ t : τ ⇒ Ψ[κ]; ∆[κ] t : τ [κ]
In particular, it means that every t : Tree Σ is also of type Tree Σ [κ] for any type κ.

This remark ensures that the following notion of definable tree functions (strings being a special case) in the λ ⊕& -calculus makes sense. Definition 5.1.9. A function f : Tree(Σ) → Tree(Γ) is called λ ⊕& -definable when there exists a purely linear type κ together with a closed λ ⊕& -term

f : Tree Σ [κ]
Tree Γ such that f and f coincide up to Church encoding; i.e., for every tree t ∈ Tree(Σ)

f (t) = βη f t
In particular, a string function Σ * → Γ * is λ ⊕& -definable when the corresponding unary tree function Tree(Σ) → Tree(Γ) (cf. Remark 2.1.1) is. Note that by Remark 5.1.6, We will give another notion of definable string function in the λ ⊕& -calculus soon, but first, let us give some concrete examples of λ ⊕& -definable functions. They should illustrate a claim from Theorem 1.2.3 (that we will establish later): over both strings and trees, λ ⊕& -definable functions coincide with regular functions.

Tree Σ [κ] Tree Γ = Str Σ [κ]
δ a = λl.λr. π 1 (l) • a • π 1 (r), π 1 (r) • a • π 1 (l) : τ τ o o δ b = λl.λr. (λx. x, x ) (π 1 (l) • b • π 1 (r)) : τ τ o o
where f • g stands for the composition λz. f (g z). The conditional swap is then coded as

λt.λ ! a.λ ! b.λ ! c.λ ! ε. π 2 (t δ a δ b (λx. c x)) ε
Remark 5.1.14. Once again, our set-up, summarized in Definition 5.1.9, is biased toward characterizing regular functions; there are many non-equivalent alternatives which also make perfect sense. For instance, changing the following would be reasonable:

• allow κ to be arbitrary (i.e. to contain '→') or with some restrictions;

• change the type of Church encodings (recall the distinction Str ! Σ /Str Σ ). These alternatives share many good structural properties with our choice. Giving more automata-theoretic characterizations for those and comparing them lies beyond the scope of this dissertation, but would be interesting. In particular, arbitrary κ would correspond to definability in the simply typed λ-calculus; see Section 1.4.1.

(Let us mention that the pure linearity constraint on the type κ actually has a clear operational meaning: as mentioned in the introduction, it corresponds to single-use-restricted assignments.)

Another parameter that can be tweaked, and for which we do investigate the effects of the change, is the use of the linear arrow at the top level of the type Tree Σ [κ] Tree Γ . Morally, this corresponds to the fact that a streaming string transducer or bottom-up tree transducer traverses its input in a single pass. We shall consider replacing by the non-linear function arrow → in the case of strings: Definition 5.1.15. A function f : Σ * → Γ * is called (λ ⊕& , →)-definable when there exists a purely linear type κ together with a closed λ ⊕& -term

f : Str Σ [κ] → Str Γ such that for every string s ∈ Σ * , f (s) = βη f s
According to Theorem 1.2.3, this will provide our characterization of comparison-free polyregular functions. But even without knowing their relationship to automata theory yet, we can already deduce the following property of the above-defined function classes: Proposition 5.1.16. The class of λ ⊕& -definable is closed under composition, and so is the class of (λ ⊕& , →)-definable functions.

Proof. We prove the case of λ ⊕& -definitions; for (λ ⊕& , →)-definitions, the same argument where is replaced by → everywhere applies. Tree Π . The function computed by u is λ ⊕& -definable by definition since κ 2 [κ 1 ] is purely linear, and it is the composition of those computed by the λ ⊕& -terms t 1 and t 2 .

Regularity equals λ ⊕& -definability

Now we prove the first row of Theorem 1.2.3. • whose morphisms from τ to σ are λ ⊕& -terms t such that Γ; • t : τ σ, considered up to βη-equivalence;

• whose identity is given by λx.x and composition of f and g by λx. f (g x).

Remark 5.2.2. In the definition of morphisms, represented by λ ⊕& -terms, we only impose the pure linearity restriction on the types of the terms. Because λ ⊕& is normalizing (Theorem 5.4.1), we could have further assumed the λ ⊕& -terms to be normal and thus, to only contain subterms whose types are also purely linear (cf. Remark 5.1.3). Therefore, it makes sense to say that L( Γ) is about the purely linear fragment of λ ⊕& augmented with (inert) constants from Γ.

Similarly, for the equivalence relation we use to actually define the homsets, we use the full βη-equivalence, which could, on the face of it, require to go oustide of the purely linear fragment of λ ⊕& to establish certain equalities (for instance, consider the rather artificial derivation λx.x = βη λx.(λ ! y.y) x = βη λx.x). This is also unnecessary as it can be checked that the normalization argument relies on a reduction relation → βε which is confluent up to commutative conversions ≈ c (Theorem 5.4.4); since both → βε and ≈ c preserve the purely linear fragment, this is enough to conclude that we could ignore non-purely linear terms when defining = βη for the purely linear fragment. (This is a kind of conservativity property.)

L is a monoidal closed category with products and coproducts, which captures the expressiveness of purely linear λ ⊕& -terms enriched with constants for the "empty word" and prepending letters of Γ to the left of a "word" when regarding the type o being regarded as the type of such words. This leads to the expected notion of streaming setting (cf. §4.2). Our interest in L lies in the following lemma. (Recall that a C-SST is said to be single-state if its set of states is a singleton.) Lemma 5.2.4. A function Σ * → Γ * is computable by a single-state L-SSTs if and only if it is λ ⊕& -definable in the sense of Definition 5.1.9.

To prove one direction of this equivalence, we need a technical lemma on λ ⊕& -terms defining string functions. In order to state the lemma in the more general case of tree functions, so that it may be reused in Chapter 6, we extend the notation Γ above as follows: given a ranked alphabet Σ = {a 1 : A 1 , . . . , a n : A n } (recall the notation from §2.1), let The proof, by case analysis of the λ ⊕& -terms in normal form of type Tree Σ [κ] Tree Γ , will be provided in Section 5.4.4. For now, let us use this to establish the equivalence between λ ⊕& -definability and L-SSTs.

Proof of Lemma 5.2.4. Before beginning the proof, it should be noted that SSTs process strings from left to right while Church encodings work rather from right to left. This is not a big issue in the presence of higher-order functions.

L-SST ⊆ λ ⊕& Given a L-SST T = ({ * }, * , τ, δ, i, o), δ may be regarded as family of λ ⊕& terms (t a ) a∈Σ (with free variables in Γ). Suppose that Σ = {a 1 , . . . , a k } and recall that Example 5.1.11 provides a λ ⊕& -term rev :

Str Σ [o o]
Str Σ implementing the reversal of its input string. T is implemented by the following λ ⊕& -term:

λs. λ ! b 1 . . . . λ ! b n . λ ! ε. o (rev s t a 1 . . . t a k (i ())) : Str Σ [τ τ ] Str Γ λ ⊕& ⊆ L-SST Any λ ⊕& -term of type Str Σ [τ ] Str Γ is βη-equivalent to λs. λ ! b 1 . . . . λ ! b n . λ ! ε. t (s u 1 . . . u k v)
by Lemma 5.2.5, where t, v and the u i are some terms typable in Γ. The L-SST T = ({ * }, * , τ τ, δ, λx. x, λf. o (f i)) where δ(a i , * ) = ( * , λg.λx. a i (g x))

computes the same string function.

Lemma 5.2.4 therefore enables us to reframe the part of Theorem 1.2.3 about regular functions as a statement comparing the expressiveness of single-state L-SSTs and stateful SR-SSTs (indeed, the latter correspond to usual copyless SSTs which compute regular functions, cf. Section 4.2.1). This motivates our abstract development focused on comparing the expressiveness of various C-SSTs. In order to build morphisms from L to other streaming settings, we shall make use of the following fundamental property. Then there is a canonical morphism -: L → C of streaming settings such that o = '. Moreover the underlying functor is strong monoidal for ⊕, &, ⊗ and preserves .

Without spelling out the details, this lemma essentially states that L is initial among symmetric monoidal closed categories with products and coproducts (thought the uniqueness part of initiality has not been included in our statement). We do not offer a proof of this lemma, which we consider folklore. The interested reader may find a detailed treatment in [Bie94, Chapter 4] for the case of L(∅) (i.e., where the λ ⊕& -terms have no free variables). Let us note that, because of the specific way we defined L, the first step in this proof should invoke the conservativity of the congruence = βη over the purely linear fragment of the λ ⊕& -calculus (Remark 5.2.2). This is because the notion of symmetric monoidal closed category does not require the existence of an exponential modality '!' (that would allow encoding τ → σ as !τ σ), and thus, all the equations in the initial symmetic monoidal closed category with products and coproducts should only satisfy those equations mentioning those constructs. 5.2.2. L-SSTs compute regular functions. We can now give the proof of the first implicit characterization stated in Theorem 1.2.3. Thanks to Lemma 5.2.4 this amounts to the equivalence between single-state L-SSTs and regular functions.

The technically more difficult part is soundness: every single-state L-SST computes a regular function. But almost all the work has been done for this already. According to §4.5.2, single-state SR ⊕& -SSTs compute regular functions. Thanks to Lemma 4.2.8, this means we just have to build a morphism of streaming settings L → SR ⊕& . This is done by combining the initiality of the syntactic category (as stated for our specific purposes in Lemma 5.2.6) with the fact that SR ⊕& is monoidal closed (Corollary 4.5.4).

For the converse inclusion, we use the characterization of regular functions by stateful SR-SSTs. Since L has coproducts (given by the ⊕ type constructor), L-SSTs are equivalent to single-state L-SSTs. We then conclude using the following result.

Lemma 5.2.7. There is a morphism of streaming settings SR → L.

We build this morphism using the generic construction of Corollary 4.6.3 (which has already been applied in Section 4.7.). This is not strictly necessary; see Lemma 6.7.2 for a sketch of a "manual" definition of such a morphism in the case of trees. In fact, to prove that all λ ⊕& -definable string functions are regular, the level of abstraction that we are working with is largely overkill: it would suffice to encode copyless SSTs as λ ⊕& -terms, a programming exercise that is not particularly difficult.

Proof of Lemma 5.2.7. We first give the construction of the underlying functor. First, note that L has all cartesian products and internal homsets, given by the syntactic connectives on types with the same notations. Thus, it is symmetric monoidal closed and quasi-affine; we can therefore apply Corollary 4.6. Proof. Let the type κ and the following λ ⊕& -terms be given by Lemma 5.3.2 below:

cast 0 : Str Σ [κ] Str Σ [τ ] cast i : Str Σ [κ] Str Σ [σ i [o o]] for i ∈ I By Remark 5.1.8, we have u i : Str Σ [σ i [o o]] → Str Π [o o] for i ∈ I.
This allows us to define the following λ ⊕& -term that implements CbS(f, (g i ) i∈I ): Str Σ [τ j ] such that, for every w ∈ Σ * , we have cast j w = βη w.

λ ! s.λ ! h 1 . . . λ ! h |Π| .λ ! x
Proof. For the sake of simplicity, let us demonstrate the idea for J = {1, 2}. Take

κ = ((τ 1 τ 1 ) & I) ⊗ ((τ 2 τ 2 ) & I)
and define cast 1 as the λ ⊕& -term

λ ! s.λ ! h 1 . . . λ ! h |Σ| .λ ! x. let f ⊗ g = s u 1 . . . u |Σ| (v ⊗ v) in let () = π 2 g in (π 1 f ) x
where v = (λy. y), () and u i = λz. let f ⊗ g = z in (λy. h i ((π 1 f ) y)), () ⊗ g.

Outline of a semantic evaluation argument.

We would now like to prove the converse: every (λ ⊕& , →)-definable function is comparison-free polyregular. Again, this will be done using a combination of a syntactic analysis of normal forms for λ ⊕& -terms and semantic evaluation in the monoidal closed category SR ⊕& (cf. Section 4.5). We start here by presenting the general setup and how the pieces fit together to reach the desired conclusion; the semantic lemmas will be proved in the next subsections, while the syntactic aspects will be properly treated only towards the end of the chapter ( §5.4.6).

Let Σ be a finite alphabet. Recall that any A ∈ Obj(SR(Σ) ⊕& ) has the form

A = q∈Q(A) x∈X(A)q R(A) q,x
where ⊕ and & do not merely denote (co)products determined only up to isomorphism: the objects of SR(Σ) ⊕& are defined as formal coproducts of products of finite register sets. Therefore, A is uniquely identified by the data (Q(A), (X(A) q ) q∈Q , (R(A) q,x ) q∈Q,x∈X(A)q ), and we shall use the notations Q(A), X(A) and R(A) for the components of this triple in the rest of this section.

Since SR(Σ) ⊕& is isomorphic to a coproduct completion, it admits a canonical coproductpreserving forgetful functor to FinSet. We denote this functor by Q since the image of an object A in SR ⊕& is none other than the above-defined Q(A). We also write

A → Σ B = Hom SR ⊕& (Σ) (A, B) A Σ = I → Σ A
Proposition 5.3.3. Using the dependent sum operation on sets ( §2.1.1), we have

∀A ∈ Obj(SR ⊕& ), A Σ ∼ = q∈Q(A) (Σ * ) R(A)q where R(A) q = x∈X(A)q R(A) q,x
Proof. First, by definition of (-) ⊕& ,

A Σ ∼ = q∈Q(A) x∈X(A)q Hom SR (I, R(A) q,x ) ∼ = q∈Q(A) x∈X(A)q (Σ * ) R(A)q,x
To justify the last step, recall that in SR, the monoidal unit is I = ∅, and Hom SR (I, R(A) q,x ) consists of all the functions R(A) q,x → (Σ + ∅) * (the copylessness condition is vacuous when the source is ∅). We then conclude using the canonical bijection S T × S U ∼ = S T +U .

Definition 5.3.4. Let q ∈ Q(A), r ∈ R(A) q and f : Γ * → A Σ . We define L[f ] q ⊆ Γ * and ρ[f ] q,r : Γ * → Σ * as follows. Let w ∈ Γ * and let (q , (s r ) r ∈R(A) q ) correspond to f (w) by the bijection of the previous proposition. Then

w ∈ L[f ] q ⇐⇒ q = q ρ[f ] q,r = s r if q = q ε otherwise
We say that f is comparison-free polyregular when:

Finally, our last tool for proving Theorem 5.3.6 is a syntactic lemma whose proof is deferred to Section 5.4.6. Lemma 5.3.9. Let τ be a purely linear type. The set of βη-equivalence classes of λ ⊕& -terms t such that Σ, s : Str Γ [τ ]; • t : σ for some purely linear σ can be exhaustively generated by the following inductive rules: Proof of Theorem 5.3.6. Using the above lemma, we proceed by structural induction. In the base case, we have a term t such that the function |t| is constant, and therefore comparison-free polyregular. In the inductive case, we have

•
Σ, s : Str Γ [τ ]; • t = o s d 1 . . . d |Σ| d ε , () : σ and the induction hypothesis is that |d ε | , |d 1 | , . . . , d |σ| , |o| are cfp. For w ∈ Γ * , s d 1 . . . d |Σ| d ε (w) = w d 1 [w/s] . . . d |Σ| [w/s] d ε [w/s] = λ(). w d 1 [w/s] . . . d |Σ| [w/s] d ε [w/s] = d w[1] [w/s] • • • • • d w[|w|] [w/s] • (λ(). d ε [w/s]) = d w[1] [w/s] • • • • • d w[|w|] [w/s] • λ(). d ε [w/s] = Λ -( d w[1] [w/s] ) • • • • • Λ -( d w[|w|] [w/s] ) • d ε [w/s] = Λ -( d w[1] (w)) • • • • • Λ -( d w[|w|] (w)) • |d ε | (w)
The penultimate step is the preservation of the monoidal closed structure by the functor -; indeed, the canonical bijection Hom L (σ, σ) σ and p : τ → Σ τ & I is the canonical morphism pairing its input with (). We may thus conclude the argument by applying Lemma 5.3.8 three times. 5.3.3. Proof of Lemma 5.3.7. Let us fix q ∈ Q(A) and r ∈ R(A) q . First, we show that the language L[h] q is regular.

Proof. We have L[h] q = {w ∈ Γ * | Q(h(w))(•) = q} by definition.
Unraveling the definition of h and applying the functoriality of Q, we also have

Q(h(w)) = Q(Λ -(f w[n] (w))) • • • • • Q(Λ -(f w[1] (w))) • Q(g(w))
from which we can deduce that

L[h] q = q ∈Q(A) δ {w 1 . . . w n | δ(-, w n ) • • • • • δ(-, w 1 )(q ) = q} recognized by a DFA with transition function δ ∩ L[g] q ∩ c∈Γ L c,δ(-,c)
where δ ranges over functions Q(A) × Γ → Q(A) and

L c,η = {w | Q(Λ -(f c (w))) = η}
Since g was assumed to be cfp, L[g] q is regular for each q ∈ Q(A). For every c ∈ Γ and η : Q(A) → Q(A), we also have (using ev A,A : (A A) ⊗ A → Σ A from Definition 4.1.3)

L c,η = L[f c ] q q ∈ Q(A A) such that η = Q(ev A,A )(q , -)
and each L[f c ] q is regular by assumption, so L c,η is also regular. Since regular languages are closed under finite boolean operations, we are done.

This being done, we will now show the following claim, which entails the lemma statement by definition: the function ρ[h] q,r : Γ * → Σ * can be written as a composition by substitution CbS(h q,r , (γ i ) i∈I ) where

• I = q ∈Q(A) R(A) q Γ ×   q ∈Q(A A) R(A A) q   ;
• h q,r : Γ * → I * is a regular function;

• γ q ,r = ρ[g] q ,r for q ∈ Q(A) and r ∈ R(A) q ;

• γ c,q ,r = ρ[f c ] q ,r for c ∈ Γ, q ∈ Q(A A) and r ∈ R(A A) q .

Proof. We will show that for any q 0 ∈ Q(A) and (q c ) c∈Γ ∈ Q(A A) Γ , we can define using such a composition by substitution a function that coincides with ρ[h] q,r on the regular language L ⊆ Γ * defined as

L = L[g] q 0 ∩ c∈Γ L[f c ] qc
From this, one can derive the desired conclusion concerning ρ[h] q,r using the closure of regular functions under regular conditionals (Proposition 2.3.11): combine the functions obtained for every combinations of q 0 and (q c ) c , leveraging the fact that

CbS w → α(w) if w ∈ L β(w) otherwise , (γ i ) i∈I = w → CbS(α, (γ i ) i∈I )(w) if w ∈ L CbS(β, (γ i ) i∈I )(w) otherwise
We now fix q 0 and (q c ) c∈Γ . For w ∈ Γ * , let F w : SR(I) ⊕& → SR(Σ) ⊕& be the letter substitution functor induced by i → γ i (w) (this functor is the identity on objects). Let ζ ∈ A I correspond to (q 0 , ((q 0 , r )) r ∈R(A) q ) ∈ q ∈Q(A)

(I * ) R(A) q
We claim that if w ∈ L[g] q 0 , then F w (ζ) = g(w). This is because F w (ζ) corresponds to (q 0 , (γ q 0 ,r (w)) r ∈R(A) q ) = (q 0 , (ρ[g] q 0 ,r (w)) r ∈R(A) q ) ∈ q ∈Q(A)

(Σ * ) R(A) q
Similarly, for each c ∈ Γ, there exists ξ c ∈ A A I that depends on q c but not w such that for any w ∈ L[f ] qc , we have F w (ξ c ) = f c (w). The functor F w also preserves the monoidal closed structure on the nose, so we have

F w (Λ -(ξ c )) = Λ -(f c (w)).
By definition of L, all those conditions on w are implied by w ∈ L. By functoriality,

∀w = w[1] . . . w[n] ∈ L, F w (Λ -(ξ w[n] ) • • • • • Λ -(ξ w[1] ) • ζ) = h(w)
The action of F w on the "register contents" of an element of A I is to replace every i ∈ I by γ i (w). Comparing this with the definition of composition by substitution, we get: Proof of the first item. Since ⊗ is defined in SR ⊕& by distributivity over formal coproducts, we have

∀w ∈ L, CbS ρ[w[1] . . . w[n] → Λ -(ξ w[n] ) • • • • • Λ -(ξ w[1] ) • ζ] q,r , (γ i ) i∈I (w) = ρ[h] q,r (
Q(A ⊗ B) = Q(A) × Q(B). To check that L[f ⊗ g] (q,q ) is regular, observe that it is equal to L[f ] q ∩ L[g] q .
For r ∈ R(A) q , we have ρ[f ⊗ g] (q,q ),r = ρ[f ] q,r and for r ∈ R(B) q , we have ρ[f ⊗ g] (q,q ),r = ρ[g] q ,r ; hence, for every r ∈ R(A ⊗ B), we know that ρ[f ⊗ g] (q,q ),r is comparison-free polyregular, so we may conclude.

Proof sketch for the second item. Fix q ∈ Q(B). The following equality shows that L[h • • f ] q is regular:

L[h • • f ] q = L[f ] q q ∈ Q(A) such that Q(h)(q ) = q
Next, given r ∈ R(B) q , we wish to show that ρ[h • • f ] q,r is comparison-free polyregular. To do so, we rely on Proposition 3.1.8: cfp functions are closed under both concatenation and regular conditionals. The idea is as follows: for q ∈ Q(h) -1 (q), one can build a function that coincides with ρ[h • • f ] q,r on L[f ] q by concatenating a finite sequence of functions that are either constant or equal to ρ[f ] q ,r for some r ∈ R(A) q . (Without entering into cumbersome details, let us give a hint as to the provenance of the concatenation pattern: it comes from applying to r some register transition, i.e. SR-morphism, that is bundled as part of the SR ⊕& -morphism h.) A regular conditional can then be used to combine the finitely many possibilities for q and thus conclude the proof.

Syntactic bureaucracy

This section, which concludes the current chapter on string functions in the λ ⊕& -calculus, proves the boring syntactic lemmas that have been delayed until now. Recall that we have already discussed the high-level considerations regarding these syntactic aspects at the beginning of the chapter.

In Section 5.4.1 we show a first normalisation result. We then apply it in the three subsequent subsections to prove our claims on the structure of Church encodings and of λ ⊕& -terms of type Str Σ [τ ] Str Γ (where τ is purely linear). For Str Σ [τ ] → Str Γ , it is more convenient to use a refined notion of normal forms, which does not only eliminate all β-redexes, but also orders the use of eliminators (term applications t u, case, …) in a principled way according to a notion of polarity. In proof theory, this is called focusing. We establish the corresponding focused normalization theorem in Section 5.4.5 and then use it for the proof of our last syntactic lemma in Section 5.4.6. 5.4.1. Normalization of the λ ⊕& -calculus. We are going to prove that the λ ⊕& -calculus is normalizing. What it means is that any λ ⊕& -term t admitting a typing derivation Ψ; ∆ t : A can be shown to be βη-equivalent to a normal term u. The notion of normal (NF) and neutral (NE) are defined via the typing system presented in Figure 5.4.1. The intuition is that a normal term cannot be β-reduced further, and that neutral terms substituted in normal terms produce terms that stay normal. Our proof proceeds along the lines of [RR97, Appendix A.1], using reducibility candidates. All this is completely unsurprising; our only reason for including this routine material is that we are not aware of a text treating exactly λ ⊕& (e.g., incorporating additives, a native ⊗ and units).

To describe said reducibility candidates, we first need to give an oriented version of βη-equality. The β-reduction relation → β is obtained by closing the relations given in Figure 5.4.2 under contexts. We write → * β for the reflexive transitive closure relation. Much like with = β , we assume that terms related by → β have the same type in the same context.

As it is not the case that every typable term β-reduces to a normal form, we need to describe another set of reduction rules which involve = η . Those extrusion rules are Another crucial ingredient is the confluence of the reduction relation → βε (or Church-Rosser property). Alas, this does not hold for syntactic equality (up to α-equivalence). However, it holds up to commuting conversions, an equivalence relation ≈ c inductively defined by the clauses in Figure 5.4.4 and closure under contexts. We merely state the confluence property that we will use.

Ψ; ∆ NE t : τ Ψ; ∆ NF t : τ Ψ; x : τ NE x : τ Ψ, x : τ ; • NE x : τ Ψ; ∆, x : τ NF t : σ Ψ; ∆ NF λx.t : τ σ Ψ, x : τ ; ∆ NF t : σ Ψ; ∆ NF λ ! x.t : τ → σ Ψ; ∆ NE t : τ σ Ψ; ∆ NF u : τ Ψ; ∆, ∆ NE t u : σ Ψ; ∆ NF t : τ Ψ; ∆ NF u : σ Ψ; ∆, ∆ NF t ⊗ u : τ ⊗ σ Ψ; ∆ NE t : τ ⊗ σ Ψ; ∆, x : τ, y : σ X u : κ Ψ; ∆, ∆ X let x ⊗ y = t in u : κ Ψ; • NF () : I Ψ; ∆ NE t : I Ψ; ∆ X u : κ Ψ; ∆, ∆ X let () = t in u : κ Ψ; ∆ NF t : τ Ψ; ∆ NF u : σ Ψ; ∆ NF t, u : τ & σ Ψ; ∆ NE t : τ & σ Ψ; ∆ NE π 1 (t) : τ Ψ; ∆ NE t : τ & σ Ψ; ∆ NE π 2 (t) : σ Ψ; ∆ NF t : τ Ψ; ∆ NF in 1 (t) : τ ⊕ σ Ψ; ∆ NF t : σ Ψ; ∆ NF in 2 (t) : τ ⊕ σ Ψ; ∆ NE t : σ ⊕ τ Ψ; ∆ , x : σ X u : κ Ψ; ∆ , y : τ X v : κ Ψ; ∆, ∆ X case(t, x.u, y.v) : κ Ψ; ∆ NF : Ψ; ∆ NE t : 0 Ψ; ∆, ∆ NE abort(t) : τ
β-redexes (λx.t) u → β t[u/x] (λ ! x.t) u → β t[u/x] π 1 ( t, u ) → β t π 2 ( t, u ) → β u case(in 1 (t), x.u, x.v) → β u[t/x] case(in 2 (t), x.u, x.v) → β v[t/x] let x ⊗ y = t ⊗ u in v → β v[t/x][u/y] let () = () in t → β t Figure
(let p = t in u) v → ε let p = t in (u v) π i (let p = t in u) → ε let p = t in π i (u) let q = let p = t in u in v → ε let p = t in let q = u in v abort(let p = t in u) → ε let p = t in abort(u) case(let p = t in u, x.v, y.w) → ε let p = t in case(u, x.v, y.w) Nested 0 eliminator abort(t) u → ε abort(t) π i (abort(t)) → ε abort(t) let p = abort(t) in u → ε abort(t) abort(abort(t)) → ε abort(t) case(abort(t), x.u, y.v) → ε abort(t) Nested ⊕ eliminator case(t, x.u, y.v) w → ε case(t, x.u w, y.v w) π i (case(t, x.u, y.v)) → ε case(t, x.π i (u), y.π i (v)) let p = case(t, x.u, y.v) in w → ε case(t, x.let p = u in w, y.let p = v in w)
abort(case(t, x.u, y.v)) → ε case(t, x.abort(u), y.abort(v)) case(case(t, x.u, y.v), x .u , y .v ) → ε case(t, x.case(u, x .u , y .v ), y.case(v, x .u , y .v ))

Figure 5.4.3. The extrusion relation → ε (i = 1, 2 and p, q are patterns () or z ⊗ z ).

let q = u in let p = t in v ≈ c let p = t in let q = u in v let p = t in abort(u) ≈ c abort(let p = t in u) let p = t in case(u, x.v, y.w) ≈ c case(u, x.let p = t in v, y.let p = t in w) case(u, x.abort(t), y.abort(v)) ≈ c abort(case(u, x.t, y.v))
case(t, x.case(u, x .v, y .w), y.case(u, x .v , y .w ))

≈ c case(u, x .case(t, x.v, y.v ), y .case(t, x.w, y.w ))

.u λ ! x.u (u, v) u ⊗ v () in 1 (u) in 2 (u)
Proof. Trivial case-analysis.

Theorem 5.4.9. Suppose that Ψ; ∆ |= t : τ . Then the following hold:

v : κ κ Ψ; ∆ 2 v : κ Ψ; ∆ 1 , ∆ 2 v v : κ with δ 1 , δ 2 and ∆ 1 , ∆ 2 the
(λc.v)[γ, δ] v = (λc.v[γ, δ]) v → β v[γ, δ, v /c]
we may apply Theorem 5.4.9 to conclude that Ψ ; ∆ , ∆ |= (λc.v)[γ, δ] v : κ • The case of the non-linear λ-abstraction for → is similar.

• If the last rule applied is an introduction of ⊗, Ψ; ∆ 1 t : τ Ψ; ∆ 2 u : σ Ψ; ∆ 1 , ∆ 2 t ⊗ u : τ ⊗ σ call δ 1 ,
Ψ; ∆, ∆ NE t u : σ Ψ; ∆ NE t : τ ⊗ σ Ψ; ∆, x : τ, y : σ NE u : κ Ψ; ∆, ∆ NE let x ⊗ y = t in u : κ Ψ; ∆ NE t : τ & σ Ψ; ∆ NE π 1 (t) : τ Ψ; ∆ NE t : τ & σ Ψ; ∆ NE π 2 (t) : σ Ψ; ∆ NE t : σ ⊕ τ Ψ; ∆ , x : σ NE u : κ Ψ; ∆ , y : τ NE v : κ Ψ; ∆, ∆ NE case(t, x.u, y.v) : κ Ψ; ∆ NE t : I Ψ; ∆ X u : κ Ψ; ∆, ∆ X let () = t in u : κ Ψ; ∆ NE t : 0 Ψ ∆ NE abort(t) : τ
The treatment of & and I is rather straightforward and 0 is ruled out because Ψ; ∆ is assumed to be consistent, so we only explain the inductive step for , ⊗ and ⊕.

-If the last rule applied is the elimination of a linear arrow Ψ; ∆ NE t : τ σ Ψ; ∆ NF u : τ Ψ; ∆, ∆ NE t u : σ then the induction hypothesis applied to the first premise means that there is a variable x in Ψ; ∆ of type κ such that τ σ + κ, and we may conclude since σ + τ σ. -If the last rule applied is the elimination of a tensor product Ψ; ∆ NE t : τ ⊗ σ Ψ; ∆, x : τ, y : σ NE u : κ Ψ; ∆, ∆ NE let x ⊗ y = t in u : κ then the induction hypothesis applied to the first premise yields a variable z in Ψ; ∆, x : τ, y : σ of type ζ with κ + ζ. If z / ∈ {x, y}, then z occurs in Ψ; ∆ and we may conclude. Otherwise, suppose that z = x; applying the induction hypothesis to the second premise, we know that τ ⊗ σ + τ + ζ for a ζ being the type of some variable in ∆ or a ζ = !ζ with ζ being the type of some variable in Ψ. Therefore, we may conclude since κ + τ + τ ⊗ σ + ζ . The case of z = y is treated similarly. In the first case, we may directly conclude. Otherwise, the induction hypothesis applied to the first premise states that there is ζ with σ ⊕ τ + ζ so that ζ is a type of some variable in Ψ or ∆. Hence, we have κ + σ + σ ⊕ τ + ζ and we may conclude. For the sake of this proof, let us assume that ranked alphabets Σ are ordered. Recall that if t ∈ Tree(Σ), we write t : Tree Σ for its Church encoding. When Σ = {a 1 , . . . , a k }, t has shape λ ! a 1 . . . . .λ ! a k .t • . for some neutral term t • . Let us adopt this notation for a map t → t • , mapping trees t to terms Σ; • t • : o, and let us abbreviate the sequence of λ-abstractions λ ! a 1 . . . . .λ ! a k . as λ ! Σ for arbitrary (ordered) ranked alphabets Σ.

We use those conventions to show that the map t → t is surjective (where it is understood that the codomain consists of terms up to βη-equivalence.

Lemma 5.4.17. Fix a ranked alphabet Σ. For every typed normal term u, we have

(1) if Σ; • NF u : o, then there is t ∈ Tree(Σ) such that u = t • . (2) if Σ; • NE u : o . . . o
t ∈ Tree(Σ ⊗ Γ) such that u = βη λ ! Γ.t • .
Proof. First, we use Theorem 5.4.1 to suppose that u is under normal form, and we proceed by induction over the size of Γ. If it is empty, then the result follows from the first item of Lemma 5.4.17. Otherwise Γ = S ⊗ Γ for some singleton alphabet S with letter b. Then, a quick case analysis shows that, as in Lemma 5.4.17, most cases can be ignored due to the typing of u, and because of considerations based on Lemma 5.4.16. There is only one interesting case which is the non-linear λ-abstraction.

Σ, S; •

v : Tree Γ Σ; • λ ! b.v : Tree S⊗Γ
We may apply the induction hypothesis as Σ ⊗ S = Σ, S and get that u

= βη λ ! b.v = λ ! b.λ ! Γ.t • = λ ! S ⊗ Γ.t • .
By instantiating this latest lemma with Γ empty, we can thus deduce that the map t → t is surjective. We may also show that it is injective by exhibiting a left-inverse map, using a semantic interpretation of λ ⊕& into Set: with Σ fixed, use the cartesian-closed structure and coproducts to interpret λ ⊕& with the interpretation of o being Tree(Σ). This yields a map from terms t : Tree Σ to (Tree(Σ) → . . . → Tree(Σ)) → . . . → Tree(Σ), where the arguments correspond to the arity of tree constructors; feed the actual constructors to this function to recover a tree in Tree(Σ).

It is straightforward to check that this map is indeed a left inverse of t → t, by induction over t. Hence the map t → t is bijective.

; • o : κ σ Σ; • NF d i : κ i for i ∈ {1, . . . , k}
Proof. We proceed by induction over a derivation of Σ; s : τ NE t : σ. Note that to apply the induction hypothesis, we need to ensure that every context under consideration is consistent. We keep this check implicit as it always follows from Lemma 5.4.15.

• If the last rule applied is a variable lookup, then the term in question must be s itself.

Furthermore, we must have k = 0, so we may simply take o = λx.x to conclude. • Finally, since the context under consideration are assumed to be consistent, the last rule applied cannot be an elimination of 0.

Σ; • NE t : ζ 1 ⊕ ζ 2 Σ; s : τ, x : ζ 1 X u : σ Σ; y : ζ 2 X v : σ Σ; s : τ X case(t, x.u, y.v) : σ Σ; • NE t : ζ 1 ⊕ ζ 2 Σ; x : ζ 1 X u : σ Σ; s : τ, y : ζ 2 X v : σ Σ; s : τ X case(t, x.u, y.v) : σ • If
Lemma 5.4.21. Let Σ and Γ be ranked alphabets. If the context Γ; s : Tree Σ [κ] is inconsistent, then Tree(Σ) = ∅.

Proof. Let us write -for a semantic interpretation of λ ⊕& types as (classical) propositions following the usual type/proposition mapping (i.e., τ σ

= τ → σ = τ ⇒ σ , τ ⊗ σ = τ & σ = τ ∧ σ , 0 = ⊥, …) and such that o ⇔ Tree(Γ) = ∅
It is easy to check that, under the usual conjunctive interpretation of contexts, if Ψ; ∆ t : τ , then Ψ ∧ ∆ ⇒ τ holds. Further, our choice for o means that Γ holds, so, if our context Γ; s : Tree Σ [κ] is inconsistent, ¬ Tree Σ [κ] holds. Now, assume that Tree(Σ) has an inhabitant t. There is a corresponding Church encoding t of type Tree Σ , which has also type Tree Σ [κ]. Hence, Tree Σ [κ] also holds, leading to a contradiction.

We can now prove Lemma 5.2.5. Assume that we have a closed λ ⊕& -term t of type Tree Σ [κ]

Tree Γ with Tree(Σ) = ∅, so that we may safely assume Γ; s : Tree Σ [κ] to be consistent. By η-expansion, t is of the shape

t = βη λw.λ ! b 1 . . . . λ ! b k .t w b 1 . . . b k and Γ; s : Tree Σ [κ] t w b 1 . . . b k : o. By normalization of λ ⊕& , there is t such that t = βη t w b 1 . . . b k and Γ; s : Tree Σ [κ] NF t : o
For the latter, note that an easy case analysis shows that every (open) term of type o is in fact neutral, so we may conclude by applying Lemma 5.4.20 and the fact that = βη is a congruence over terms.

5.4.5. Focusing. We now introduce (partially) focused normal forms. These terms are split into three categories defined by mutual recursion:

• the general focused normal forms (NF f ). We write Ψ; ∆ NF f t : A to say that t is a focused normal form such that Ψ; ∆ t : A. • the focused neutral terms (NE f ). We write Ψ; ∆ NE f t : A to say that t is a focused neutral form such that Ψ; ∆ t : A. • the focused negative neutral terms (NE - f ). We write Ψ; ∆ NE - f t : A to say that t is a negative focused neutral form such that Ψ; ∆ t : A.

The inductive rules for building those normal forms are presented in Figure 5.4.5.

Theorem 5.4.22. Any typed term t is βη-equivalent to a term in focused normal form.

Proof sketch. We must prove that for every term t such that Ψ; ∆ t : τ , we have some βη-equivalent t such that Ψ; ∆ NF f t : τ .

Focusing and normalization can be done simultaneously, but let us sketch how to get focused forms from our previous notion of normal forms ( §5.4.1); this allows to conclude using the normalization theorem that we already have (Theorem 5.4.1). Suppose that we have Ψ; ∆ NF t : τ . We first claim that we have t such that t → * ε t and t → ε ; this can be shown by noticing that the following N-valued complexity measure -on λ ⊕& -terms is strictly decreasing along → ε :

Ψ; ∆ NE f t : τ Ψ; ∆ NF f t : τ Ψ; ∆, x : τ NF f t : σ Ψ; ∆ NF f λx.t : τ σ Ψ, x : τ ; ∆ NF f t : σ Ψ; ∆ NF f λ ! x.t : τ → σ Ψ; ∆ NF f t : τ Ψ; ∆ NF f u : σ Ψ; ∆, ∆ NF f t ⊗ u : τ ⊗ σ Ψ; ∆ NE - f t : τ ⊗ σ Ψ; ∆, x : τ, y : σ NF f u : κ Ψ; ∆, ∆ NF f let x ⊗ y = t in u : κ Ψ; • NF f () : I Ψ; ∆ NE - f t : I Ψ; ∆ NF f u : κ Ψ; ∆, ∆ NF f let () = t in u : κ Ψ; ∆ NF f t : τ Ψ; ∆ NF f u : σ Ψ; ∆ NF f t, u : τ & σ Ψ; ∆ NF f t : τ Ψ; ∆ NF f in 1 (t) : τ ⊕ σ Ψ; ∆ NF f t : σ Ψ; ∆ NF f in 2 (t) : τ ⊕ σ Ψ; ∆ NE - f t : σ ⊕ τ Ψ; ∆ , x : σ NF f u : κ Ψ; ∆ , y : τ NF f v : κ Ψ; ∆, ∆ NF f case(t, x.u, y.v) : κ Ψ; ∆ NF f : Ψ; ∆ NE - f t : τ Ψ; ∆ NE f t : τ Ψ; ∆ NE - f t : τ ⊗ σ Ψ; ∆, x : τ, y : σ NE f u : κ Ψ; ∆, ∆ NE f let x ⊗ y = t in u : κ Ψ; ∆ NE - f t : σ ⊕ τ Ψ; ∆ , x : σ NE f u : κ Ψ; ∆ , y : τ NE f v : κ Ψ; ∆, ∆ NE f case(t, x.u, y.v) : κ Ψ; ∆ NE - f t : 0 Ψ; ∆, ∆ NE f abort(t) : σ Ψ; ∆, x : τ NE - f x : τ Ψ, x : τ ; ∆ NE - f x : τ Ψ; ∆ NE - f t : τ & σ Ψ; ∆ NE - f π 1 (t) : τ Ψ; ∆ NE - f t : τ & σ Ψ; ∆ NE - f π 2 (t) : σ Ψ; ∆ NE - f t : τ σ Ψ; ∆ NF f u : τ Ψ; ∆, ∆ NE - f t u : σ Ψ; ∆ NE - f t : τ → σ Ψ; • NF f u : τ Ψ; ∆ NE - f t u : σ
x = 0 () = 0 = 0 in 1 (t) = t in 2 (t) = t π 1 (t) = t π 2 (t) = t t u = t + u t ⊗ u = t + u t, u = t + u abort(t) = 1 + 2 t let x ⊗ y = t in u = 1 + 2 t + u case(t, x.u, y.v) = 1 + 2 t + u + v
By Lemma 5.4.2, we have that Ψ; ∆ NF t : τ . This combined with the fact that we have t → ε allows to show that we have Ψ; ∆ NF f t : τ by induction on the derivation. 5.4.6. Proof of Lemma 5.3.9. This is the last thing that needs to be proved before we can be done with this chapter. Let t be a λ ⊕& -term with Σ, s : Str Γ [σ]; • t : σ for σ and σ purely linear. Since Lemma 5.3.9 depends only on the βη-equivalence class of t, we may replace it with a focused normal form. The following result shows that Lemma 5.3.9 can be established by a straightforward induction on the number of occurrences of s : Str Γ [σ] in ta parameter which is not invariant under = βη . Lemma 5.4.23. Let τ = κ 1 → . . . → κ k → κ be a type with κ purely linear and s a distinguished variable of type τ . Let ∆ and Ψ be purely linear contexts and t be a term such that Ψ, s : τ ; ∆ NF f t : σ for some purely linear σ. Suppose further that there is at least one occurrence of s in t. Proof idea. By induction over the derivation, much like Lemma 5.4.16. Note that we need not to assume that the context be consistent as the abort(t) is excluded by our restricting to negative neutral forms.

Lemma 5.4.25. Let τ = κ 1 → . . . → κ k → κ be a type and s a distinguished variable of type τ and l < k. Let Ψ; ∆ be a purely linear contexts such that and t be a term such that Ψ, s : τ ; ∆ NE - f t : σ l+1 → . . . → σ k → σ for some purely linear σ . Then σ = κ and σ i = κ i for i ≥ l there are d 1 , .

Regular tree functions

The goal of this chapter is now to prove the last remaining item in Theorem 1.2.3: a tree-to-tree function is λ ⊕& -definable (cf. Definition 5.1.9) if and only if it is regular. To do so, we follow a similar approach to Chapter 5 -which, in turn, relied on the material of Chapter 4. A lot of similar notions and theorems reappear, so we take the liberty of eliding certain proofs adapting statements proven in those previous chapters.

The obvious starting point is to extend the notion of "automaton parameterized by a category" to tree automata ( §6.1); this increased generality in inputs, however, requires some additional conditions on the category. We then present in Section 6.3 a basic multicategory (cf. §6.2) of registers T R m containing "trees with holes", and the corresponding streaming setting TR on top of a category T R. The usual restriction to registers containing "trees with at most one hole" is also discussed and shown to be no less expressive thanks to our basic results on the coproduct completion. This is followed by Section 6.4, which explains how the notion of single-use-restricted bottom-up (ranked|register) tree transducer (BRTT) introduced in [AD17] -cf. §2.6 -can be shown to have the same expressiveness as "stateful tree automata over TR & ". We shall call the latter TR & -BRTTs. Finally, in Section 6.5, we show that T R ⊕ has internal homsets ι ⊕ (R) ι ⊕ (S) and conclude that T R ⊕& is monoidal closed. After a few more general categorical considerations ( §6.6), we conclude the proof of our main theorem on trees in Section 6.7.

For the rest of this chapter, we fix a ranked alphabet Γ so that we may focus on outputs contained in Tree(Γ). Remark 6.0.1. We were drawn to work with BRTTs because of our previous success with SSTs and the title "Streaming tree transducers" of [AD17] (we already recalled the explanation for this title at the beginning of Section 2.6). But the much older model of macro tree transducers (MTTs) [START_REF] Engelfriet | Macro Tree Transducers[END_REF] can also be seen as a version of streaming string transducers for trees; it is actually rather similar to BRTTs. In fact, single-use-restricted MTTs with regular lookahead [START_REF] Engelfriet | Macro Tree Transducers, Attribute Grammars, and MSO Definable Tree Translations[END_REF], which compute regular tree functions, are much closer than single-use-restricted BRTTs to our categorical TR ⊕& -BRTTs! Had we worked with MTTs from the beginning, we would therefore have saved some efforts. But we had already written up a technical development relying on BRTTs before this realization; it still contains some interesting categorical constructions involving coherence spaces.

It was not immediately apparent to us that MTTs generalize SSTs to trees for the following reason: while MTTs can be reformulated as an isomorphic register-based machine model, they were originally introduced with rather different intuitions. What is called a "register" in an SST/BRTT corresponds, counterintuitively, to a "state" in an MTT, and the bottom-up recombination of registers is described instead as a top-down propagation of states. Furthermore, copyless MTTs (called "strongly single use restricted" in [EM99]) over unary trees (i.e. strings) actually do not compute all regular functions [EM99, Theorem 5.6], while copyless SSTs compute all regular string functions; this is due to a small detail (with dramatic consequences) regarding how the output is produced (an MTT has an initial state, not an initial combination of states, while the output function of an SST can combine multiple registers).

Tree streaming settings and C-BRTTs

We first define a generalized notion of BRTT parameterized by a category plus some auxiliary data, analogously to the C-SSTs for strings. To work with trees, a monoidal product will be necessary. Definition 6.1.1. Let X be a set. A tree streaming setting with output X is a tuple C = (C, ⊗, I, ', -) where

• (C, ⊗, I) is a symmetric monoidal category • ' is an object of C • -is a set-theoretic map Hom C (I, ') → X
In the rest of this chapter, we may omit the "tree" in when discussing streaming settings. This notion essentially differs by asking that the underlying category be equipped with a symmetric monoidal product, which is used in defining the semantics of C-BRTTs. The tensor product is used to fit the branching structure of trees and I is used for terminal nodes (so there is no need of a distinguished initial object ' as in string streaming settings).

Definition 6.1.2. Let C = (C, ⊗, I, ', -) be a tree streaming setting with output X. A C-BRTT with input (ranked) alphabet Σ and output X is a tuple

(Q, R, δ, o) where • Q is a finite set of states • R is an object of C • δ is a function a∈Σ   Q ar(a) → Q × Hom C   ar(a) R, R     • o ∈ Hom C (R, '
) is an output morphism Its semantics is a set-theoretic map Tree(Σ) → X defined as follows: writing δ Q (a, (t i ) i∈ar(a) ) for π 1 (δ(a, (t i ) i∈ar(a) )) and δ C (a, (t i ) i∈ar(a) ) for π 2 (δ(a, (t i ) i∈ar(a) )), define auxiliary functions δ * Q : Tree(Σ) → Q and δ * C : Tree(Σ) → Hom C (I, R) by iterating δ:

δ * Q a (t i ) i∈ar(a) = δ Q a, (δ * Q (t i )) i∈ar(a) δ * C a (t i ) i∈ar(a) = δ C a, (δ * Q (t i )) i∈ar(a) •   i∈ar(a) δ * C (t i )   • ϕ ar(a)
where ϕ ar(a) is the unique isomorphism I ∼ -→ i∈ar(a) I generated by the associator and unitors of (C, ⊗, I). The output function T : Tree(Σ) → X is defined as T = o • δ * C . Remark 6.1.3. Strictly speaking, we do not need the monoidal product to be symmetric for the notion to make sense, but it would require using a fixed order over the input ranked alphabet Σ. Although one could choose an arbitrary total order over Σ, different orders might define different classes of functions Tree(Σ) when the monoidal product is not symmetric. This is why we work in symmetric monoidal categories.

As with string streaming settings, it is convenient to define a notion of morphism of tree streaming settings to compare the expressiveness of classes of BRTTs.

(' C ) → ' D such that, for every f ∈ Hom C ( ' C , ' C ), we have o • F (f ) • i D = f C
where i : I D → F (I C ) is obtained as part of the lax monoidal functor structure over F .

Observe that we do not require those functors to commute with the symmetry morphisms for the monoidal products, as promised in Section 4.1. This is consistent with the fact that the symmetries are not really involved in computing the image of a tree by a C-BRTT, according to Remark 6.1.3: it is only their mere existence that matters. The point of the above definition is, of course: and show that δ * (t) = F (δ(t)) • m ∅ by induction over t ∈ Tree(Σ). So suppose that t = a((u x ) x∈ar(a) ) and that the inductive hypothesis holds (this also takes care of the base case: when ar(a) = ∅, the inductive hypothesis is vacuous). In such a case, let us show that each face in the following diagram commutes (where all tensor products have arity ar(a)):

I (b) m∅ ∼ ' ' δ * (t) ! ! (a) I m∅ x δ * (ux) ( (
F (I) (c) x F (δ * (ux)) / / m ar(a),I F (R) δ a / / m ar(a),R (e)
F (R)

F ( I) (d) F x δ * (ux) / / F ( R) F (δa) 7 7 F (I) (f) F (∼) O O F (δ * (t)) D D
1 Recall from Section 2.1 that an operation i∈I (-) -here, a functor -is associated to every finite indexing set I by choosing an arbitrary total order over I.

Faces (a) and (f) commute by definition of iterated transition functions and face (e) corresponds to the definition of δ . Face (d) commutes because of the naturality of m -,- and face (b) because of its compatibility with associators. Finally, face (c) corresponds to the inductive hypothesis. Therefore, the topmost and bottommost paths coincide, so we have δ * (t) = F (δ(t)) • m ∅ , which concludes our inductive argument. We can then conclude since we have, for every tree t,

T (t) = o • F (o) • (δ * (t)) D by definition = o • F (o) • F (δ * (t)) • m ∅ D inductive argument = o • F (o • δ * (t)) • m ∅ D by functoriality = o • (δ * (t)) C since (F, o ) is part of a morphism C → D = T (t)
by definition

Similarly as for strings, the coproduct completion of a category induces a morphism of tree streaming settings C → C ⊕ . Furthermore, the expressiveness of C and C ⊕ remain the same under similar hypotheses as Theorem 4.3.8. Theorem 6.1.6. Let C be a tree streaming setting whose monoidal product is affine and such that all objects of the underlying category have unitary support. Then C-BRTTs, C ⊕ -BRTTs and single-state C ⊕ -BRTTs are equi-expressive.

The proof is an unsurprising adaptation of the one of Theorem 4.3.8 and of the material on state-dependent memory SSTs (Section 4.3.2). We leave it to the interested reader.

Multicategorical preliminaries

Rather than starting from the category corresponding exactly to the BRTTs from [AD17], we will first study a more convenient streaming setting based on the idea of trees with multiple holes. For this, it will be convenient to introduce the notion of multicategory, which is essentially a notion of category where morphisms are allowed to have multiple input objects.

This section is therefore devoted to spelling out the formal definition of the notion of multicategory that we use, and to describing how to (freely) generate affine monoidal categories from multicategories. This material is rather dry and should maybe only be skimmed over at first reading. Definition 6.2.1. A (weak symmetric) multicategory M consists of • a class of objects Obj(M) • a class of multimorphisms going from pairs (I, (A i ) i∈I ) of a finite index set I and a family (A i ) i∈I of objects to objects B. We omit the first component of the source and write Hom M ((A i ) i∈I , B) for the set of these multimorphisms. • for every object A, a distinguished identity multimorphism id A ∈ Hom M ((A) * ∈1 , A).

• for every set-theoretic map f : I → J, families (A i ) i∈I , (B j ) j∈J and object C, a composition operation

Hom M ((B j ) j∈J , C) × j∈J Hom M (A i ) i∈f -1 (j) , B j -→ Hom M ((A i ) i∈I , C) α , (β j ) j∈J -→ α * f β
• for every bijection σ : I → I between finite sets, a family of actions σ * : Hom M ((A i ) i∈I , B) → Hom M (A σ(i ) ) i ∈I , B correspond to reindexing along symmetries. Furthermore, the above data is required to obey the following laws.

• The identity morphism be a neutral for composition: for any α ∈ Hom M ((A i ) i∈I , B),

id B * ! (α) * ∈1 = α = α * id I (id A i ) i∈I
• Composition is associative: for any finite sets I, J and K, functions f : K → J and g : J → I, families of objects (A k ) k∈K , (B j ) j∈J , (C i ) i∈I , D and families of morphisms

α ∈ j∈J Hom M (A k ) k∈f -1 (j) , B j β ∈ i∈I Hom M (B j ) j∈g -1 (i) , C i γ ∈ Hom M ((C i ) i∈I , D)
the following equation holds

γ * g (β * f α) = γ * g f -1 (j) β j * f α
• Permutations act functorially: for any (A i ) i∈I , B and bijections σ : I → I and σ : I → I , the following commute

Hom M ((A i ) i∈I , B) * * / / Hom M (A σ(i ) ) i ∈I , B Hom M (A σ(σ (i )) ) i ∈I , B and id * I : Hom M ((A i ) i∈I , B) → Hom M ((A i ) i∈I , B
) is the identity. • Composition is compatible with permutations: for every commuting square

J g / / I σ J f / / I
in FinSet such that the vertical arrows be bijections, note in particular that for every i ∈ I, there is a bijection σ i : g -1 (I ) → f -1 (I); we thus require that α * f β j∈f -1 (i) i∈I = σ * (α) * g σ * i β j∈f -1 (i) i∈I for every suitable α and β j s.

Every symmetric monoidal category C can be mapped to a multicategory C mcat by taking

Hom Cmcat ((A i ) i∈I , B) = Hom C i∈I A i , B
We may make this map functorial, provided we equip the class of multicategories and the class of symmetric monoidal categories with categorical structures. Definition 6.2.2. Given two weak multicategories M and N , a functor F : M → N consists of maps of objects F : Obj(M) → Obj(N ) and of multimorphisms

F : Hom M ((A i ) i∈I , B) -→ Hom N ((F (A i )) i∈I , F (B)) such that F (id A ) = id F (A) , F α * f (β j ) j∈f -1 (i) = F (α) * f (F (β j )) j∈f -1 (i) and F (σ * (α)) = σ * (F (α)
) for all suitable objects, index sets, set-theoretic functions and morphisms. Definition 6.2.2 gives a class of arrows for a large category MCat of multicategories. Calling Aff the category whose objects are symmetric affine monoidal categories and morphisms are strong monoidal functors, the map C → C mcat extends to a functor Aff → MCat. We are now interested in the inverse process of generating freely a symmetric affine monoidal category out of a weak multicategory. Definition 6.2.3. Let M be a weak multicategory. The free affine symmetric monoidal category generated by M is the category M aff such that • objects are pairs (I, (A i ) i∈I ) of a finite set I and a family of objects of M; write i∈I A i for such objects. • morphisms i∈I A i → j∈J B j are pairs (f, (α j ) j∈J ) where f is a partial function I J and α j is a M multimorphism

(A i ) i∈f -1 (J) → B j . • identities i∈I A i → i∈I A i are the pairs (id I , (id A i ) i∈I ). • the composition of (f, (α j ) j∈J ) : i∈I A i → j∈J B j and (g, (β k ) k∈K ) : j∈J B j → k∈K C k is g • f, β k * (α j ) j∈g -1 (k) k∈K .
For any bijection σ : I → I, we have canonical isomorphisms i∈I A i → i∈I A σ(i) . We take the binary tensor product to be

i∈I A i ⊗   j∈J B j   = x∈I+J A i if x = in 1 (i) B j if x = in 2 (j)
and the unit to be the terminal object, which is the nullary family ∅ . The associator and symmetries are induced by the isomorphisms (I + J) + K ∼ = I + (J + K) and I + J ∼ = J + I respectively, and the units by I + ∅ ∼ = I ∼ = ∅ + I. The axioms of weak symmetric multicategories then imply that this indeed endows M aff with a symmetric affine monoidal structure. We skip checking the details.

The combinatorial multicategory T R m

We are now ready to give a smooth definition of a category of register transitions for trees, generalizing Proposition 4.2.12. As announced, we find it more convenient to first give a multicategory T R m and then move to monoidal categories by taking T R = (T R m ) aff . We then discuss the restriction consisting of limiting the number of holes in the tree expressions stored in register to at most one and show that it is not limiting.

Notations Recall that we regard ranked alphabets R as pairs (R, ar) where R is a finite set of letters and (ar(a)) a∈R is a family R → FinSet of arities. Given two ranked alphabets R and S, we suggestively write R ⊗ S for the ranked alphabet (R + S, [ar, ar]). Given a finite set U , call O(U ) the ranked alphabet (U, (∅) u∈U ) consisting of |U |-many terminal letters and I(U ) for the ranked alphabet consisting of a single letter of arity U . Given a ranked alphabet Σ = (Σ, ar) and a subset X ⊆ Σ, we write Σ X for the restriction (X, ar X).

Before giving the definition of T R m , we first need to make formal a notion of trees with linearly many occurrences of certain constructors. Definition 6.3.1. Let R be a ranked alphabet. We define the set LTree Γ (R) of R-linear trees as the subset of Tree(Γ ⊗ R) comprising the trees where all constructors of R appear exactly once. • whose class of multimorphisms from (A i ) i∈I to B is the set of linear trees over the joint alphabet (I, A) ⊗ O(B) (recall that (I, A) can formally be regarded as a ranked alphabet: its set of letters is I and the arity of i ∈ I is A(i) = A i ).

Hom T R m ((A i ) i∈I , B) = LTree Γ ((I, A) ⊗ O(B))

• whose composition operations are given by substitution: given a map f : I → J and multimorphisms While the definition of composition of multimorphisms in T R m looks daunting, we claim it is rather natural. We now set T R = (T R m ) aff ; while objects of (T R m ) aff are supposed to be families of finite sets (A i ) i∈I , in the sequel, we sometimes identify them with the ranked alphabets (I, A) in T R for notational convenience. As such, the notation R ⊗ S corresponds to the expected tensorial product in T R.

We are now ready to define our first tree streaming setting. Definition 6.3.3. TR is the tree streaming setting (T R, ⊗, , I(∅), -), where -is the canonical isomorphism Hom T R ( , I(∅)) ∼ = Hom T R m (() ∅ , ∅) ∼ = LTree(∅) ∼ = Tree(Γ) (where () ∅ is the empty family).

Call T R m,≤1 the full submulticategory of T R m whose objects are empty or singleton sets, and T R ≤1 ∼ = T R m,≤1 aff to be the corresponding full subcategory of T R. The monoidal structure of T R restricts to T R ≤1 without any difficulty, and I(∅) is an object of T R ≤1 . This means that TR has a restriction to a streaming setting TR ≤1 .

While TR ≤1 turns out to be more elementary and a good building block toward the definition of usual BRTTs, it is easier to show the monoidal closure of TR ⊕& than TR ≤1 . Thankfully, it turns out that the expressiveness of BRTTs over TR and TR ≤1 is the same.

For one direction, there is a morphism TR ≤1 → TR corresponding to the embedding T R ≤1 → T R. For the other direction, we exploit Theorem 6.1.6. The proof involves some combinatorics, but nothing surprising as it amounts to the classical decomposition of multi-hole trees into families of single-hole trees as found in e.g. [AD17, §3.5]. Lemma 6.3.4. There is a morphism of streaming settings TR → TR ≤1 ⊕ .

Proof sketch. We focus on giving enough ingredients to define the underlying (strong) monoidal functor F : T R → T R ≤1 ⊕ , which is going to preserve ' (i.e., we will have F (I(∅)) ∼ = ι ⊕ (I(∅))).

Rather than giving a direct explicit construction of F (which is rather tedious over morphisms), we obtain it as a composition of two strong monoidal functors: the strong monoidal embedding

/ / I(R(A))

A A So we only need to define R(A) and A to obtain our functor R; once those are defined, we leave checking that the universal property holds to the reader. We first focus on the case where A = ι ⊕ (I(U )) for some finite set U . Recall that a single-letter alphabet I(U ), when seen as an object of T R, should be should be intuitively regarded as a register containing a tree with U -many holes. If |U | ≤ 1, we may simply take R(ι ⊕ (I(U ))) = ι ⊕ (I(U )). Otherwise, |U | ≥ 2 and I(U ) is not an object T R ≤1 ; in that case, we use the following A n with all A n = I(∅) or A n ∼ = I(1). It is always possible to build a suitable set PT(U ) simply because all objects of T R ≤1 ⊕ have this shape, but an intuitive definition of what one might call a set of partitioning trees over U is also possible for PT, and N (t) would then correspond to the nodes of the trees. We skip defining this notion formally, but note that the announced bijection would then match trees with U -many holes with pairs (t, (u i ) i∈N (t) ) of a partitioning tree t and a family of trees with at most one-hole (u i ) i∈N (t) . This bijective correspondence is pictured in Figure 6 Now, R is defined on objects of the shape ι ⊕ (I(U )), as well as , so we need to extend this to the whole category T R ⊕ . Recall that every object A of T R ⊕ can be written as A = v∈V j∈Ju ι ⊕ (I(U j )). In the end, the functor R is expected to be strong monoidal, and we may force it to preserve coproducts, so we set

R(A) = v∈V j∈Ju R(ι ⊕ (I(U j ))) A =
v∈V j∈Ju ι ⊕ (I(U j ))

TR & -BRTTs coincide with regular functions, via coherence spaces

We define a streaming setting TR ˚and its restriction TR ˚,≤1 (with respective underlying categories T R ˚, T R ˚,≤1 ) so that TR ˚,≤1 -BRTTs coincide with Alur and D'Antoni's notion of single-use-restricted BRTT [START_REF] Alur | Streaming Tree Transducers[END_REF], which they showed to characterize regular tree functions. We then show that there are morphisms TR & → TR ˚→ TR & of streaming settings and thus establish that TR & -BRTTs capture exactly regular tree functions.

Much like T R, the category T R ˚is obtained by applying a generic construction to T R m , taking weak symmetric multicategories to symmetric affine monoidal categories. In particular, objects of T R ˚will consist of formal tensor products of objects of T R m . The main difference is that morphisms of T R ˚will induce a dependency relation D ⊆ I × J over indexing sets, rather than a partial function J I. This corresponds to a relaxation of the copylessness condition. However, objects of T R ˚will also be equipped with a conflict relation ˚over their indexed sets, and D will be required to satisfy a linearity constraint. Calling ¨the dual coherence relation such that x ¨y is equivalent to x = y ∨ ¬(x ˚y), if we have (i, j) ∈ D and (i , j ) ∈ D, the linearity constraint enforces j ¨J j ⇒ i ¨I i and i ˚I i ⇒ j ˚J j

This corresponds to the single use restriction imposed on BRTTs [AD17, §2.1], whose introduction was motivated in Section 2.6.2.

Example 6.4.1. The BRTT that we gave in for the "conditional swap" function is singleuse-restricted according to the above by taking its two registers (i.e. objects of T R m ) to be in conflict.

But as our choice of notation and vocabulary suggests, this is also related to the category of (finite) coherence spaces, the first denotational model of linear logic [START_REF] Girard | Linear logic[END_REF] (predated by a similar semantics for system F [GTL89, Appendix A]). As far as we know, this observation is new (the conflict relation is denoted by η in [START_REF] Alur | Streaming Tree Transducers[END_REF], while ˚comes from the linear logic literature). The coherence semantics of the linear λ-calculus has been used in particular in [START_REF] Gallot | Linear High-Order Deterministic Tree Transducers with Regular Look-Ahead[END_REF] to analyze a top-down tree transducer model containing linear λ-terms. Unlike them, we do not use coherence spaces as a semantics here; what happens here is much closer to the use of a coherence/conflict relation to handle additive connectives -we will indeed show a connection with the &-completion -in proof nets, see [Gir96, Appendix A.1] and [START_REF] Hughes | Conflict nets: Efficient locally canonical MALL proof nets[END_REF]. Definition 6.4.2 (see e.g. [Gir95, §2.2.3]). A coherence space I is a pair ( I , ¨I ) of a set I , called the web, and a binary reflexive symmetric relation ¨I over I called the coherence relation. As usual, given a coherence relation ¨, we write ˚for the dual defined by i ˚i ⇔ (i = i ∨ ¬(i ¨i )). Finite coherence spaces are those coherence spaces whose webs are finite. A linear map of coherence spaces f : I → J is a relation f ⊆ I × J such that, whenever (i, j) ∈ f and (i , j ) ∈ f , we have i ¨I i ⇒ j ¨J j and j ˚J j ⇒ i ˚I i

Note that these are the converse implications of those stated above for BRTTs. The diagonal {(i, i) | i ∈ I } is a linear map I → I and the relational composition of two linear maps I → J → K is again a linear map, so that we have a category FinCoh whose objects are coherence spaces and morphisms are linear maps.

FinCoh, equipped with the tensorial product ( I , ¨I ) ⊗ ( J , ¨J ) = ( I × J , ¨I × ¨J ) and dualizing object (1, 1 × 1), is a well-studied * -autonomous category with cartesian products and coproducts. The latter may be defined pointwise as ( I , ¨I ) ⊕ ( J , ¨J ) = ( I + J , ¨I⊕J )

where ¨I⊕J is the smallest relation such that in 1 (i) ¨I⊕J in 1 (i ) when i ¨I i and in 2 (j) ¨I⊕J in 2 (j ) when j ¨J j

Dualizing an object corresponds to moving from ¨to ˚, i.e. ( I , ¨I ) ⊥ = ( I , ˚I ), and the product is

I & J = (I ⊥ ⊕ J ⊥ ) ⊥ .
With this in mind, we can describe how to turn a multicategory into an affine monoidal category where monoidal products may be indexed by coherence spaces. The construction has a vague family resemblance with the coherence completion of categories introduced by Hu and Joyal [START_REF] Hu | Coherence completions of categories[END_REF], but appears to have quite different properties. Definition 6.4.3. Let M be a weak symmetric multicategory. We define M coh to be the category • whose objects are pairs (X, (R x ) x∈ X ) where X is a finite coherence space and (R x ) x∈ X a family of objects of M. We suggestively write them x∈X R x . • whose morphisms Definition 6.4.4. We set T R ˚= (T R m ) coh and T R ˚,≤1 to be its full subcategory consisting of objects x∈X A x where each A x is either empty or a singleton (so that T R ˚,≤1 is isomorphic to (T R m,≤1 ) coh ). Proposition 6.4.5. BRTTs over the restricted tree streaming setting TR ˚,≤1 compute exactly the regular tree functions.

Proof. By virtue of being equivalent to Alur and D'Antoni's notion of single-userestricted BRTT [START_REF] Alur | Streaming Tree Transducers[END_REF]. We point the reader to Section 2.6.3 for a self-contained definition of those not involving categories, and leave it as an exercise to formally match those two descriptions. Although [START_REF] Alur | Streaming Tree Transducers[END_REF] and our Section 2.6.3 only consider BRTTs over binary trees, the proof of equivalence between the latter and regular tree functions goes through macro tree transducers (with regular look-ahead and single use restriction) which are known to compute regular functions for trees over arbitrary ranked alphabets [START_REF] Engelfriet | Macro Tree Transducers, Attribute Grammars, and MSO Definable Tree Translations[END_REF], so everything can be made to work out with arbitrary arities in the end. (See also Remark 6.0.1.) This being done, the remainder of this section does not depend on T R m ; the arguments apply to any weak symmetric multicategory M and designated object ' ∈ Obj(M).

Accordingly, fix such an M and a ' for the remainder of this section. Fix also a set O and a map -: Hom M ((•) ∅ , ') → O. Proposition 6.4.6. M coh has a terminal object, given by the unique family over the empty coherence space, and can be equipped with a symmetric monoidal affine structure (⊗, ) where

i∈I A i ⊗   j∈J B j   = x∈I&J A i if x = in 1 (i) B j if x = in 2 (j)
and I & J designates the cartesian product in FinCoh.

Proof. Left to the reader. Strictly speaking, later developments will depend on the precise structure itself and not merely on its existence, but there is a single sensible choice of bifunctorial action and structural morphisms making the above a monoidal product. Remark 6.4.7. To start making sense of the use of the cartesian product of FinCoh, there is a useful analogy with M aff here. There is a projection functor M aff → PartFinSet where PartFinSet is the category of finite sets and partial functions. The tensorial product of M aff required a coproduct at the level of indices. Here, we have a projection functor M coh → FinCoh op , and we again use a coproduct at the level of indices (which becomes a product due to the contravariance).

We call M aff the tree streaming setting based on M aff , ' and -), and M coh the corresponding tree streaming setting based on M coh . Proposition 6.4.8. There is a full and faithful strong monoidal functor M aff → M coh extending to a morphism of streaming setting M aff → M coh .

Proof. Call F this functor, and, for any set I, write ∆ for the functor PartFinSet → FinCoh taking a set I to the discrete coherence space ∆(I) = (I, {(i, i) | i ∈ I}). Note that we have ∆(I) ⊥ = (I, I × I), which may be regarded as the codiscrete coherence space generated by I. On objects of M aff , we define F as

F i∈I A i = i∈∆(I) ⊥ A i
For morphisms (f, (α j ) j∈J ) ∈ Hom M aff i∈I A i , j∈J B j , we set F (f, (α j ) j∈J ) = ({(j, i) | j = f (i)}, (α j ) j∈J )

It is rather straightforward to check that F is indeed full, faithful and strong monoidal, and the extension to a morphism M aff → M coh is immediate.

Proposition 6.4.9. M coh also has cartesian products, which may be defined as

i∈I A i &   j∈J B j   = x∈I⊕J A i if x = in 1 (i) B j if x = in 2 (j)
(The proof is left to the reader.) Therefore, we can extend Proposition 6.4.8:

Corollary 6.4.10. There is a functor E : (M aff ) & → M coh that is full, faithful and lax (but not strong) monoidal, extending to a morphism of streaming settings (M aff ) & → M coh .

In the following proof and the rest of this section, we write explicitly I coh for the monoidal unit of ⊗ in M coh and I aff& for the unit in (M aff ) & .

Proof idea. The universal property of the free product completion defines E as the unique product-preserving functor extending the functor of Proposition 6.4.8. It remains to equip it with a lax monoidal functor structure. The map m 0 : I coh → E(I aff& ) is an obvious isomorphism, while the natural transformation m 2 A,B : E(A) ⊗ E(B) → E(A ⊗ B) can be obtained via the canonical map

ī∈I A i ⊗ j∈J B j → (i,j)∈I×J A i ⊗ B j
in M coh (it exists in all monoidal categories with products).

We can now go the other way around. In particular, (1) implies that {x ∈ X | (y, x) ∈ R} is a clique; we take that to be S. (2), and the fact that y ¨Y y ∧ y ˚Y y ⇒ y = y , imply that R determines a (total) function S S , which we take to be f . Finally, once y ∈ S is fixed, we pick the component α y to complete the definition, which makes sense as f -1 (y) = {x ∈ S | (y, x) ∈ R} = {x ∈ X | (y, x) ∈ R)}. This completes the definition of F (R, α); we leave checking functoriality to the reader. Now, we turn to defining a morphism M coh → (M aff ) & from F . To this end, we first equip F with a strong monoidal structure (though a lax one would suffice for our definition of morphism of tree streaming settings). The key computation that allows this is as follows: We thus conclude this section by first specializing the above to the case M = T R ≤1 , and then making a final tangential observation. Lemma 6.4.12. There are morphisms of streaming settings TR ≤1 & → TR ˚,≤1 → TR ≤1 & . In particular, TR ≤1 & -BRTTs compute exactly the regular functions. Remark 6.4.13. One idea that one could take from Hu and Joyal's "coherence completion" of categories [START_REF] Hu | Coherence completions of categories[END_REF] -but that we do not explore further here -is to look at objects whose indexing coherence spaces are (up to isomorphism) generated from singletons by the &/⊕ operations of FinCoh. (Those are called "contractible" in [HJ99, Section 4], and considering coherence spaces as undirected graphs, this corresponds to the classical notion of cograph in combinatorics.)

In the case of the coherence completion of some category C, the full subcategory spanned by such objects turns out to be the free completion of C under finite products and coproducts (which differs from our (-) ⊕& in not making '&' distribute over '⊕'); this is formalized as a universal property in [HJ99, Theorem 4.3]. In the same vein, we conjecture that the full subcategory of M coh consisting of cograph-indexed objects -that is, of objects that are generated from those of M by means of the operations ⊗/& in M coh -is in some way the free affine symmetric monoidal category with products generated by the multicategory M.

T R ⊕& is monoidal closed

Now, we consider the category T R ⊕& . Much like for SR ⊕& ( §4.5), we have: Theorem 6.5.1. The category T R ⊕& has cartesian products, coproducts and a symmetric monoidal closed structure. Remark 6.5.2. Given the close relationship between the constructions ((-) aff ) & and (-) coh , it seems plausible that (T R coh ) ⊕ could be monoidal closed (we know that it has products, coproducts and a symmetric monoidal structure). We leave this question to further work. This structure over T R ⊕& is obtained in the same way as for strings: the monoidal product over T R is defined as distributing over formal sums and products and the usual products and coproducts are created by the (-) ⊕& completion. Similarly, monoidal closure can be obtained by applying the generic Theorem 4.5.3 once we show that the objects coming from T R have internal homsets T R ⊕ (echoing Lemma 4.3.14): Lemma 6.5.3. For any R, S ∈ Obj(T R), there is an internal hom ι ⊕ (R) ι ⊕ (S) in T R ⊕ .

The rest of this section is dedicated to proving this fact, whose proof relies on decomposing linear trees in a similar way as in Lemma 6.3.4.

Proof. First, we treat the special case where S = I(U ) for some finite set U . To make sense of the definition of ι ⊕ (R) ι ⊕ (I(U )) it is helpful to notice that it will ultimately induce an isomorphism so, recalling that objects of T R ⊕ are of the shape i∈I j∈J i I(V j ) for V j being finite sets, the operational intuition is that one may code trees with "holes with arity" into some bounded finitary data (which we may informally call a partitioning tree) plus finitely many trees containing holes "without arity"; this bijection is pictured in Figure 6.5.1. As with Lemma 6.3.4, we will not use this as our official definition for the internal homset, but rather use the following recursive definition: where R r I(W ) and R b I(W ) are auxiliary definitions which correspond to the following situations (recalling that morphisms can be regarded as trees):

ι ⊕ (I(V + 1)) ⊗ (R r I(W )) correspond to morphisms such that there is a unique minimal path leading from the root to a node labelled by a letter in R, and that letter is r. The second component R r I(W ) is meant to include the immediate subtrees of that node while the first ι ⊕ (I(V + 1)) contains the tree where a nullary node labeled is inserted instead of that node. The combination of both these data and r allows to recover the original morphism. -b∈Γ ι ⊕ (I(V + 1)) ⊗ R b I(W ) correspond to all the other morphisms. In such a case there is a topmost node labelled by some letter b of Γ with which has at least two distinct immediate subtrees which have at least one node of R each. Similarly to the first subcase, R b I(W ) is intended to include the immediate subtrees of that node labeled by b while ι ⊕ (I(V + 1)) contains the tree where a nullary node labeled is inserted instead of that node. The combination of these data and b allows to recover the original morphism. also by recursion over R.

• If R = , it is the identity.

• Otherwise, we need to provide maps

I(V + 1) ⊗ b∈Γ (R b I(W )) ⊕ r∈R (R r I(W )) ⊗ R -→ I(U )
for every decomposition U = V W , the intuition being that I(V + 1) is a context containing the top of the tree corresponding to the function we want to apply. Therefore, once we provide a map While the definition is a bit wordy, there is then little difficulty in checking that this yields the expected universal property.

ι ⊕ (R I(U )) ⊗ ι ⊕ (I(U )) / / ι ⊕ (I(U ))

A ⊗ ι ⊕ (R) Λ(h)⊗id O O h 3 3
One needs then to extend the definition for the general case where S is not necessarily I(U ); this is done using a similar approach as for strings, by using a coproduct over partial maps R S tracking which letter of the input participates in which letter of the output, and employing the particular case where there is one letter in the output 3 ι ⊕ (R) ι ⊕ (S) = f :R S s∈S ι ⊕ (R f -1 (s)) ι ⊕ (I(ar(s)))

The evaluation function can then be extended and the universal property accordingly lifted to the more general case.

Preservation properties of finite completions

We have now proven all of the combinatorial results leading to the main theorem for trees. At this stage, we only need to make explicit a few preservation properties of the completions (-) ⊕ and (-) & . We only state the minimal requirements that we need to proceed 4 . Lemma 6.6.1. Let ∈ {⊕, &, ⊕&} and C, D be streaming settings. Then if there is a morphism C → D, there is also a morphism C → C . 3 This could be factored out as a more general result concerning the existence of internal homsets in categories of the shape M aff for multicategories M. 4 The following, which would entail these requirements, should hold (but we have not checked it): the completions (-)⊕ and (-) & should behave as pseudo-monads over the 2-category of tree streaming settings, admitting a pseudo-distributive law ((-)⊕) & → ((-) & )⊕ giving rise to the pseudo-monad (-) ⊕& .

Proof idea. Let us only discuss the case = ⊕ and assume that we have a streaming setting morphism whose underlying lax monoidal functor is F : C → D. Then we consider F ⊕ : C ⊕ → D ⊕ defined using the universal property of C ⊕ from the functor ι ⊕ • F : C → D ⊕ such that

F ⊕ u∈U ι ⊕ (C u ) = u∈U ι ⊕ (F (C u ))
so that F ⊕ inherits a lax monoidal structure from F by lifting the relevant maps functorially. For instance, we have ι ⊕ (I) → ι ⊕ (F (I)) = F ⊕ (I) for the unit. We leave checking the coherence diagram, the case of the binary tensor to the reader, as well as checking that the rest of the structure of morphisms of streaming settings lift accordingly.

D C x∈X ι & u∈Ux ι ⊕ (C x,u ) = F ∈ x Ux ι ⊕ x∈X ι & (C x,u )
On the other hand, the functor M : C which is part of Mu C is obtained by using the universal property of (-) ⊕ so that

M u∈U ι ⊕ v∈V ι ⊕ (C u,v ) = (u,v)
ι ⊕ (C u,v ) 6.7. λ ⊕& -definable tree functions are regular

We will now finally prove our last result on the λ ⊕& -calculus, that is, the third row in Theorem 1.2.3 whose statement is recalled in the section title.

First, recall from Section 5.2.1 that if Γ = {a 1 : A 1 , . . . , a k : A k } is an output alphabet, we call Γ the context a 1 : o . . . o, . . . , a k : o . . . o where the type of a i has |A i | arguments. Let L( Γ) (or L for short when Γ is clear from context) be the syntactic category defined by replacing the alphabet Γ by a ranked alphabet Γ in Definition 5.2.1. Since L monoidal product, we may easily adapt Definition 5.2.3 to get a tree streaming setting L(Γ). Then we may relate λ ⊕& -definability to (single-state) L-BRTT. Lemma 6.7.1. Computability by single-state L-BRTTs and λ ⊕& -definability (Definition 5.1.9) are equivalent for functions Tree(Σ) → Tree(Γ).

Proof idea. Similar to Lemma 5.2.4, based on the syntactic Lemma 5.2.5. The proof is even more straightforward as there is no mismatch between the processing of trees by BRTTs and λ ⊕& -terms working with Church encodings, whereas SSTs operate top-down rather than bottom-up when regarding strings as unary trees.

We can now notice that L-BRTTs are more expressive than T R ≤1 -BRTTs, much like with strings (this generalizes Lemma 5.2.7). Lemma 6.7.2. There is a morphism of streaming settings TR → L.

Proof sketch. Let us focus on the underlying functor F : T R → L. For objects (which are finite sets), we put

F i∈I U i = i∈I o ⊗U i o & I A multimorphism f ∈ Hom T R m ((U i ) i∈I , V
) is an element of LTree Γ i∈I I(U i ) ⊗ O(V ) which has a Church encoding f which has a type isomorphic to i∈I o ⊗U i o o, and thus embeds into F i∈I U i through well-typed term ι. We take F (f aff ) = λx.ι f , and extend this definition to arbitrary morphisms (f, (α j ) j ) : i∈I U i → j∈J V j in T R by first using the second projection π 2 to restrict to the case where dom(f ) = I, and then by piecing together the F ((α j ) aff ). Corollary 6.7.3. There is a morphism of streaming settings TR ⊕& → L.

Proof idea. Starting from Lemma 6.7.2, we have a functor T R → L. Since L has all products and coproducts, the universal properties of the (-) & and (-) ⊕ completion yield a functor F : T R ⊕& → L. The monoidal structure of the initial functor T R → L can be lifted accordingly. For any finite family of objects (((A k ) k∈K j ) j∈J i ) i∈I sitting in a symmetric monoidal closed category with products and coproducts, there are canonical morphisms For the converse, we use Theorem 6.5.1, according to which T R ⊕& has all the categorical structure needed to model the purely linear fragment of the λ ⊕& -calculus. By a suitable adaptation of Lemma 5.2.6 to tree streaming settings, we then have: Corollary 6.7.4. There is a morphism of streaming settings L → TR ⊕& .

The proof of our main theorem for trees can now be summarized as Note that applying Theorem 6.1.6 in the last step requires that objects of T R ˚,≤1 have unitary support, which is easily checked for output alphabets Γ containing at least one letter of arity ∅. It remains to justify step ( †), i.e., that single-state L-BRTTs and TR ˚,≤1 ⊕ -BRTTs are equi-expressive. By Lemma 6.1.5, it suffices to have morphisms of streaming settings both ways L ↔ TR ˚,≤1 ⊕ to conclude. They may be obtained as the following composites (where we leave implicit the uses of Lemma 6.6.1 and some easily inferrable steps). 2) of certain monoids of λ-terms, we must therefore exclude flip, whose only action is to exchange the two arguments of its input f . Thus, we are led to require that functions use their arguments in the same order that they are given in. It is well-known that in order to make such a restriction behave well, one needs to restrict duplication in some way. Indeed, consider the β-reduction λf. λx. λy. (λa. f a a) (x y) -→ β λf. λx. λy. f (x y) (x y)

While the term on the left-hand side satisfies the non-commutativity condition, its reduct on the right-hand side does not, and this is due to the two copies of the subterm (x y). This led us to use a non-commutative affine λ-calculus in the paper [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF], upon which this chapter is largely based.

However, instead of merely copy-pasting the contents of [NP20], we have chosen here to work with linear rather than affine types. While this choice did not make much difference in the case of the λ ⊕& -calculus of the two previous chapters (cf. Remark 5.1.1), this was because the λ ⊕& -calculus features additive connectives ⊕/&. The latter must also be excluded to capture star-free languages: it is not hard to check that any regular language can be defined by a "non-commutative λ ⊕& -term" of type Str Σ [I ⊕ • • • ⊕ I] I ⊕ I (see also [NP20, §5.2] for an encoding using '&'). And without additives, it is much less obvious that the absence of weakening (the ability for functions to discard their arguments) does no harm to the expressive power.

In fact, we will show right now that this is wrong concerning string-to-string functions. In what follows, we speak of the λ -calculus to refer to the fragment of the λ ⊕& -calculus containing only the connectives 1 ' ' and '→' on types, and the corresponding term constructors. It is shown in [NP20, §5.1] that the affine variant of the λ -calculus can express all sequential functions ( §2.2); in fact, we will see in upcoming work that the functions that are "affine λ -definable" (in the sense of Definition 5.1.9, mutatis mutandis) are exactly the regular functions, as announced in Section 1.4.2 of the introduction. However: Proposition 7.0.1. The example of letter-to-letter aperiodic sequential function given in Proposition 2.3.9 is not λ -definable. 1 The exclusion of the tensor product has no effect on expressiveness here: we discuss at the end of Section 7.2 how to prove an upper bound in a way that accomodates ⊗; conversely, σ ⊗ τ can sometimes be simulated by (σ τ κ) κ for a judicious choice of κ (a trick that occurs in our definition of NBool). But only sometimes: see the discussion on P-completeness of normalization in the preface and in Section 1.2.2.

• If negation were definable by a λ ℘-term not : NBool NBool, then for t a = t b = not, the language decided by g would consist of words of odd length: a standard example of regular language that is not star-free. Thus, a corollary of Theorem 1.2.1 is that there is no such term not such that not true = βη false and not false = βη true. Remark 7.1.4. A point of utmost importance is that because of the heterogeneity of the input and output types, the term not : NBool [NBool] NBool from the previous subsection does not contradict our above observation and cannot be iterated by a Church-encoded string. Monomorphism is therefore crucial for us: if our type system had actual polymorphism, one could give not the type (∀α. NBool[α]) (∀α. NBool[α]), whose input and output types are equal, and then the words of odd length would be λ ℘-definable. (This is analogous to Remark 1.3.1 concerning the simply typed λ-calculus.) Yet our ersatz of polymorphism still allows for some form of compositionality (Lemma 7.1.2) that will prove useful in several places in our proof of expressiveness.

An upper bound via aperiodicity of purely linear λ ℘-monoids

A λ ℘-term not : NBool NBool defining boolean negation would generate the nonaperiodic monoid Z/(2) -similarly to the term flip discussed at the beginning of the chapter, which motivated the non-commutativity constraint. So, generalizing the inexistence of such a λ ℘-term not, we would like to make sure that certain monoids in the λ ℘-calculus are aperiodic. It turns out that aperiodicity is indeed a consequence of non-commutativity in the purely linear fragment of the λ ℘-calculus. As promised in Section 1.2.2, our upper bound on the expressiveness of the λ ℘-calculus (the "only if" part of Theorem 1.2.1) reduces to this property of the purely linear fragment: Corollary 7.2.2. A language L ⊆ Σ * can be defined by a λ ℘-term of type Str Σ [τ ] NBool for some purely linear type τ (that may depend on L) only if it is a star-free language.

Proof sketch. By performing an analysis of β-normal η-long forms (similar to what is done in Lemma 5.2.5, but again, simplified by the absence of positive connectives), one shows that such a λ ℘-definable language L is recognized by a morphism to the monoid of λ ℘-terms of type τ τ -see [NP20, Lemma 3.6]. This monoid being finite and aperiodic according to the above theorem, L is star-free (cf. Definition 1.1.2).

There remains to prove Theorem 7.2.1. Here, there are two approaches:

• In [NP20, §3], we give an elementary and purely syntactic proof by induction on the type τ and examination of the "flow of variables" in η-long forms. In the end, the main combinatorial component is that the monoid of non-decreasing functions from {1, . . . , k} to itself is aperiodic. This has the advantage of working for affine non-commutative λ-terms, see [NP20, Theorem 1.8] (one then needs to consider partial non-decreasing functions).

• Alternatively, we may use a semantic evaluation argument -similarly to Hillebrand and Kanellakis's [START_REF] Gerd | On the Expressive Power of Simply Typed and Let-Polymorphic Lambda Calculi[END_REF] proof of Theorem 1.1.4. The idea -mentioned in Section 1.4.3 of the introduction -is that the purely linear fragment of the λ ℘-calculus can be interpreted in a non-symmetric monoidal closed category of "planar diagrams" [START_REF] Abramsky | Temperley-Lieb Algebra: From Knot Theory to Logic and Computation via Quantum Mechanics[END_REF]; and the monoids of endomorphisms in this category are finite and aperiodic (a result of [START_REF] Thành | The planar geometry of first-order transductions[END_REF], which is key to proving Claim 1.4.10). As mentioned in Section 1.4.3, a drawback of this approach is that it does not extend immediately to the affine case (one would want to use a "planar game semantics" for this purpose). However, the proof of aperiodicity is arguably nicer, and one advantage is that it also works for non-commutative linear λ-terms with a multiplicative pair type ⊗ (cf. Footnote 1 in this chapter). It might be possible to extend the aforementioned syntactic proof of Theorem 7.2.1 to cover ⊗, but this would probably be cumbersome, since it is a positive connective.

Expressiveness of the λ ℘-calculus

Our goal is now to prove the remaining direction of Theorem 1.2.1, i.e. the converse of Theorem 7.2.1. In other words, we want to construct, for any star-free language, a closed λ ℘-term that defines this language, of type Str Σ [τ ] NBool for some purely linear τ . To do so, we take a detour through string-to-string transducers.

The λ ℘-calculus, which embeds into the strictly linear λ -calculus, does not allow us to do much with the type Str Σ [τ ]

Str Γ according to Theorem 7.0.2. This is why, in addition to the type Str, we will use a type of almost-strings as a helper: StrW Σ is of course not an adequate type of strings in general, since with the above interpretation of its first argument as an eraser, there are infinitely many terms of this type corresponding to a single string. But it will prove to be a useful trick here. StrW Γ for some purely linear type τ , in the following sense: if the term u w : StrW Σ corresponds to the string w ∈ Σ * (note that u w is not uniquely determined by w), then t u w : StrW Γ corresponds to f (w) ∈ Γ * .

For instance, in the case of Example 2.2.3, after reading a string s = s b, the transducer is in the state q b and has outputted2 w = a • ψ(s ), which we represent as (ζ, κ a•ψ(s ) ) (taking q a = 1 and q b = 2; ψ is described in Example 2.2.3). In general, some key observations are ) when δ st (-, c) : q → 2;

• The remaining case δ st (-, c) : q → 3 -q is excluded by aperiodicity. This point is crucial: this case would correspond to (h, g) → (g • κ δout(2,c) , h • κ δout(1,c) ) which morally "uses its arguments h, g in the wrong order".

Coming back to Example 2.2.3, let us say that after the transducer has read a prefix s = s b of its input string as we previously described, the next letter is a. In the presence of this non-linear context Ψ, the type S = o o morally serves as a purely linear type of strings, as mentioned before. Moreover this "contextual encoding of strings" supports concatenation (by function composition), leading us to represent the maps ζ and κ w as open terms of type T = S S that use non-linearly the variables f a for a ∈ Γ. We shall take the type τ , at which the input Str Σ is instantiated, to be τ = T T S, which is indeed purely linear as required by the theorem statement. This can be seen morally as a type of continuations taking pairs of type T ⊗ T (although our λ ℘-calculus has no actual ⊗ connective). Without further ado, let us program; the key new cases to handle strict linearity (as opposed to affineness) are given by:

• to implement ζ, we just use the "eraser" that the StrW Γ takes as the argument e: (it would become a fully η-expanded identity function if λg. and (e junk) were removed -note that h l l x : o), where one can take for junk any expression of type S = o o using g : τ τ exactly once e.g. junk = g (λj. λj . j (j (λy. y))) (λz. z) (λz. z)

The remaining cases were already strictly linear in [NP20], so are left unchanged:

• cat = λw. λw . λx. w (w x) : S S o o = S S S = S T plays the roles of both the concatenation operator and of w → κ w (thanks to currying) • u q : o o is the representation of the output word δ out (q, c) that corresponds to a given input letter c ∈ Σ and state q ∈ Q = {1, 2} • case δ st (q, c) = q: trans c = λk. λh. λg. k (λy. h (cat u 1 y)) (λz. g (cat u 2 z))

(if we wanted to handle the excluded case δ st (q, c) = 3 -q, we would write a similar term with the occurrences of h and g exchanged (λk. λh. λg. k (λy. g . . .) (λz. h . . .)), violating the non-commutativity requirement) • case δ st (q, c) = 1: trans c = λk. λh. λg. k (cat (cat (h u 1 ) (g u 2 ))) zeta • case δ st (q, c) = 2: trans c = λk. λh. λg. k zeta (cat (cat (h u 1 ) (g u 2 )))

• out = λj. j (λh. λg. cat (h v 1 ) (g v 2 )) (λx. x) zeta, where v q represents the output suffix F (q) for state q ∈ {1, 2}, assuming w.l.o.g. that the initial state is 1 (also, here λx. x represents κ ε since the latter is the identity on Γ * ) We leave it to the reader to check that these λ ℘-terms have the expected computational behavior.

Figure 1

 1 Figure 1.1.2. The Holy Trinity of JavaScript (widespread Internet meme).

Figure 1

 1 Figure 1.1.3. A commutative diagram hand-drawn by A. Grothendieck. Translation of the letter: "Witches' Kitchen 1971. Riemann-Roch Theorem: The final cry: The diagram […] is commutative! To give an approximate sense to the statement about f : X → Y , I had to abuse the listeners' patience for almost two hours. Black on white (in Springer lecture notes) it probably takes about 400, 500 pages. A gripping example of how our thirst for knowledge and discovery indulges itself more and more in a logical delirium far removed from life, while life itself is going to Hell in a thousand ways and is under the threat of final extermination. High time to change our course!" (Image and translation both from http://math.stanford.edu/~vakil/11-245/)

57

  For radically different alternatives, see e.g. [Alc19, Part II] or [Str11, Chapter 2].

  [o → o] → Natwhere Nat is the type of the Church encoding of natural numbers, or equivalently, of the Church encoding of unary strings -that codes the function n → 2 n . Since the composition of a term of type Nat[σ] → Nat and another of type Nat[τ ] → Nat can be given the type Nat[σ[τ ]] → Nat, towers of exponentials of any fixed height h can be expressed by a term of type Nat[τ h ] → Nat (where the type τ h becomes increasingly complicated as h → +∞).

1.4. 1 .

 1 Tree transducers in the simply typed (or safe) λ-calculus. Let us continue discussing Question 1.3.3 on Nat[τ ] → Nat right where we left off in Section 1.3.5. We have seen that the classical limitations of simply typed λ-definable functions N → N on Church encodings can be explained by a special case of Hillebrand and Kanellakis's Theorem 1.1.4. This suggests that to gain more insight into the question, we should generalize it to Str Γ → Str Σ . In fact, we will even consider Church-encoded ranked trees. From the obvious extension of Theorem 1.1.4 to trees, a simple necessary condition can be deduced: Corollary 1.4.1. Any function Tree(Γ) → Tree(Σ) definable by a simply typed λ-term of type Tree Γ [τ ] → Tree Σ preserves regular tree languages by preimage (cf. Definition 1.1.

  [START_REF] Parys | Homogeneity Without Loss of Generality[END_REF]. (The Damm-safe λ-calculus arises naturally from iterating the "clone" operation in universal algebra, see [Sal15, §2.3].) But safe schemes and Damm-safe schemes have the same expressive power (a direct translation is given in[START_REF] Parys | Homogeneity Without Loss of Generality[END_REF] §4]).119 U2 is called the flip-flop monoid. It appears in the algebraic version of Krohn-Rhodes (Theorem 2.2.10).

  in µEAλ, which I simplified in[START_REF] Thành | On the Elementary Affine Lambda-Calculus with and Without Fixed Points[END_REF] to the type !Str EAλ Γ !Str EAλ Γ . (The nice thing is that it reflects the fact that polynomial time functions are closed under composition.) The obvious question is: what happens without recursive types? The situation, we claim, is analogous to what happens in the λ ⊕& -calculus: Claim 1.4.18. A function Γ * → Σ * is regular (resp. comparison-free polyregular) if it can be defined by an EAλ-term of type Str EAλ Γ Str EAλ Σ (resp. !Str EAλ Γ !Str EAλ Σ

142Σ

  They are those definable by EAλ-terms of type !Str EAλ Γ !Str EAλ Σ that "use their argument k + 1 times", i.e. that are obtained by promotion and contraction from a term of type What makes this work is that the type Str EAλ Γ is similar to a call-by-value translation of the non-linear Church encoding, this choice being imposed by the stratification property of EAλ. The λ ⊕& -calculus cannot do this because the typing rules for its non-linear function arrow '→' correspond to a call-by-name translation (see Footnote 112 and Footnote 133).

Figure 2

 2 Figure 2.1.1. Graphical representations of the tree a(a(c, b(c)), c) over the ranked alphabet {a : {0, 1}, b : {0}, c : ∅} (left) and of the word aab ∈ {a, b} * seen as an element of Tree({a, b}) = Tree({a : { * }, b : { * }, ε : ∅}) (right).

  Figure 2.2.1.A schematic representation of a sequential transducer whose formal definition is Q = {q a , q b }, δ(q, a) = (q a , a) and δ(q, b) = (q b , bb) for q ∈ Q, q I = q a , F (q a ) = ab and F (q b ) = bbb.

Figure 2

 2 Figure 2.3.1. An informal depiction of a streaming string transducer and the induced map (Σ { }) * → Σ * .

  the function defined by T maps 1234 to 4321321211 ∈ (Γ ∪ Γ) * = Σ * . 2.3.2. Copyless SSTs and regular functions. The streaming string transducer of Figure 2.3.1 is in fact copyless; let us say precisely what this means.

  Remark 2.3.23. Consider an SST with a transition function δ. Let ϕ δ ∈ Hom(Γ * , M cl R,∅ Q) be defined by ϕ δ (c) = erase Σ (δ(-, c)) for c ∈ Γ. The range ϕ δ (Γ * ) is precisely the substitution transition monoid (STM) defined in [DJR18, Section 3].Proposition 2.3.24. For any finite R, the monoid M cl R,∅ is finite. As a consequence, the substitution transition monoid of any copyless SST is finite.Proof idea. For all α ∈ M cl R,∅ and r ∈ R, observe that |α(r)| ≤ |R|. Let us now show how these tools can be applied to prove an earlier claim from §2.3.2.

7

  See Example 4.2.6 for a definition of polynomial automata.

  2.5.1. Layered SSTs vs polyregular functions. Let us compare this function class with the transducer model that we have already seen in Section 2.3.3, which also computes functions with polynomial growth. Proposition 2.5.4. Every function computed by a layered SST is polyregular.

  Example 2.6.1 ("Conditional swap"). Define f : Tree({a : 2, b : 2, c : ∅}) → {a, b, c} * by

Figure 2

 2 Figure 2.6.1. Two consecutive steps of the run of the bottom-up ranked tree transducer of Example 2.6.7 over a tree whose alphabet of node labels isΣ = {•, •} ∼ = {a, b}.The configuration at each subtree is represented by two boxes; the top (resp. bottom) box displays the contents of r 1 (resp. r 2 ). (The single state is omitted from the visual representation of the configuration.)

Proposition 3.1. 4 .

 4 Polyregular functions are closed under composition by substitution. Corollary 3.1.5. Every comparison-free polyregular function is, indeed, polyregular.

7

  Remark: nested transducers should yield a machine-independent definition of polyregular functions as the closure of regular functions under a CbS-like operation that relies on origin semantics[START_REF] Muscholl | The Many Facets of String Transducers[END_REF] §5].

  Theorem 3.3.2. Let f : Γ * → Σ * and k ∈ N. The following are equivalent: (i) f is comparison-free polyregular with rank at most k; (ii) f is comparison-free polyregular and |f (w)| = O(|w| k+1 ); (iii) there exists a regular function g : ({0, . . . , k} × Γ) * → Σ * such that f = g • cfpow (k+1) Γ , with the following inductive definition: cfpow

3.3. 1 .

 1 Closure under composition. Let us prove the following. Theorem 3.3.3. Comparison-free polyregular functions are closed under composition.

  be shown to fit Definition 3.1.2 in a more elementary way) and so is f • cfpow

  3.1 for f regular. Furthermore, |cfpow (k+1) Γ (w)| = O(|w| k+1 ) and, since f is regular, |f (u)| = O(|u|), so we have, as expected, |(f • cfpow (k+1) Γ )(w)| = O(|w| k+1 ). The final implication (ii) ⇒ (i) is technically the hardest as it relies on Theorem 3.3.9. Let f : Γ * → Σ * be cfp and k ∈ N such that |f (w)| = O(|w| k+1 ). If f is regular, then rk(f ) = 0 ≤ k. Otherwise, by Theorem 3.3.9, there exists a sequence (w n ) n∈N of inputs such that |w n | = O(n) and |f (w n )| ≥ n rk(f )+1 . So n rk(f )+1 = O(n k+1 ), hence rk(f ) ≤ k.

  Definition 3.4.1. A poly-pumping sequence is a function of the form e : N → Σ * where • e is a polynomial word expression generated by e ::= w | e • e | e * where w ∈ Σ * ; • w (n) = w, e • e (n) = e (n) e (n) and e * (n) = ( e (n)) n .

•

  We now treat the case where β(r) is non-empty. By definition, β • β = β * • β where β * ∈ Hom(R * , R * ) extends β : R → R * . Since we know, as a consequence of the idempotency of µ •m , that β • β = β, we have β * (β(r)) = β(r) = ε.

  One can then check by induction on the structure of e that e[(e i ) i∈I ] = CbS( e , ( e i ) i∈I ) and that e[(e i ) i∈I ] has star-height bounded by k + 1. 3.4.3. Proof of Corollary 3.4.4. We first prove the result for poly-pumping sequences. Lemma 3.4.5. If e : N → (Γ ∪ {#}) * is a poly-pumping sequence and f : Γ * → Σ * is comparison-free polyregular, then map(f ) • e is a cfp sequence.

  Definition 4.1.1 ([Mel09, Sections 4.1 to 4.4]). Let C be a category. A monoidal product ⊗ over C is given by the combination of• a bifunctor -⊗ -: C × C → C • a distinguished object I • natural isomorphisms λ A : I ⊗ A → A (left unitor), ρ A : A ⊗ I → A (right unitor), and α A,B,C : (A ⊗ B) ⊗ C → A ⊗ (B ⊗ C) (associator)such that the diagrams in Figure4.1.1 commute. Such a monoidal product is said to be symmetric if it comes with a natural isomorphism (called the symmetry) γ A,B : A ⊗ B → B ⊗ A subject to the conditions of Figure4.1.2.

  Definition 4.1.2 ([Mel09, Section 5.1]). Let (C, ⊗, I) and (D, ⊗, I) be two monoidal categories. A lax monoidal functor is given by a functor F : C → D together with natural transformations

4.1. 3 .

 3 Function spaces and monoidal closure. Our next definition serves to interpret the linear function arrow ' '. (Since we will only need a semantics for the purely linear fragment of the λ ⊕& -calculus, we do not discuss the non-linear arrow '→' here.) Definition 4.1.3 ([Mel09, Sections 4.5 to 4.7]). Let (C, ⊗, I) be a (symmetric) monoidal category and A, B ∈ Obj(C). An internal homset from A to B is an object A B ∈ Obj(C) with a prescribed arrow ev A,B : (A B) ⊗ A → B (the evaluation map) such that, for every other arrow f : C ⊗ A → B, there is a unique map Λ(f ) (called the curryfication of f ) making the following diagram commute:

Proposition 4.1. 4 .

 4 The object A B is an internal homset for A, B ∈ Obj(C) if and only if there is a family of isomorphismsHom C (C ⊗ A, B) ∼ = Hom C (C, A B)which is natural in the parameter C varying contravariantly over C (in other words, if Hom C (-⊗ A, B) and Hom C (-, A B) are naturally isomorphic as functors C op → Set).

Definition 4 .

 4 1.5. A (symmetric) monoidal category (C, ⊗, I) is called affine if I is a terminal object of C. (Such categories are also sometimes called semi-cartesian [nLa20].)

  Definition 4.1.6. A (symmetric) monoidal category (C, ⊗, I) is called quasi-affine if every A ∈ Obj(C) has a cartesian product A & I with the monoidal unit. Remark 4.1.7. We have a map A ∈ Obj(C) → A & I π 2

  Definition 4.1.8 ([Mel09, Section 6.1]). Given a monoidal category (C, ⊗, I), an internal monoid (or a monoid object) is a triple (M, µ, η) where M ∈ Obj(C) and µ : M ⊗ M → M , η : I → M are morphisms making the following unitality and associativity diagrams commute

  Proposition 4.1.10. Let (C, ⊗, I) be a monoidal category and let M & I ∈ Obj(C) be a cartesian product of some M ∈ Obj(C) with the monoidal unit I. Suppose that (M, µ, η) is a monoid object. Then M & I has an internal monoid structure defined by µ • (π 1 ⊗ π 1 ), λ I • (π 2 ⊗ π 2 ) : (M & I) ⊗ (M & I) → M & I η, id I : I → M & I where π 1 : M & I → M and π 2 : M & I → I are the projections and -, -is the pairing given by the universal property of the cartesian product. Furthermore, this makes M & I π 2 --→ I ∈ Obj C I into a monoid object of C I .

  Definition 4.2.7. Let C = (C, ' C , ' C , -C ) and D = (D, ' D , ' D , -D ) be streaming settings with the same output set X. A morphism of streaming settings is given by a functor F : C → D and D-arrows i :

  This notion is useful to compare the expressiveness of classes of generalized SSTs because of the following lemma. Lemma 4.2.8. If there is a morphism of streaming settings C → D, then D-SSTs subsume C-SSTs and single-state D-SSTs subsume single-state C-SSTs.

Fact 4

 4 .2.14. Standard copyless SSTs Σ * → SST Γ * are the same thing as SR-SSTs Σ * → Γ * .

Definition 4.3. 6 .

 6 Given a streaming setting C = (C, ' , ', -C ), define C ⊕ as the tuple

Figure 4

 4 Figure 4.3.1. padwithjunk D,B : Hom C (D, C) → Hom C (A ⊗ B ⊗ C ⊗ D, A ⊗ B ⊗ C ⊗ D)

  Lemma 4.3.11. Let C be a streaming setting. State-dependent memory C-SSTs are exactly as expressive as C ⊕ -SSTs.

  The comparison between single-state, standard and state-dependent memory C-SSTs can be summed up in terms of completion with the following "equalities":C-SSTs = single-state C ⊕const -SSTs sdm-C-SSTs = single-state C ⊕ -SSTswhere C ⊕const designates the following restriction of C ⊕ : the category C ⊕ is restricted to the full subcategory C ⊕const whose objects are constant formal sums i∈I C for some C ∈ Obj(C).

Example 4.3. 15 .

 15 Let us illustrate this construction in a simple case. Consider the following register transition for the concrete base alphabet {a, b} and register names x, y, z, u, r, s: r ← zaxabyaa s ← bab Up to the evident isomorphism {x, y, z, u} ∼ = {x} ⊗ {y, z, u}, this determines a morphism f ∈ Hom SR ({x} ⊗ {y, z, u}, {r, s}). Let us describe the unique map Λ(f ) in

  defines a natural isomorphism between & F and & G.

Lemma 4.5. 6 .

 6 We can lift every functor F : (C & ) op → Set to ⊕ F : (C ⊕& ) op → Set in such a way that if F, G : (C & ) op → Set are naturally isomorphic, so are ⊕ F and ⊕ G, and with the action on objects

  Half of a universal property for SR

Figure 4

 4 Figure 4.6.2. Lemma 4.6.13 defines N , O r , and ψ r , and proves that this diagram commutes.

  we use the assumption ' = I, and the fact that F δ f (∅) = I (by Corollary 4.6.3). The transition function is δ

  Theorem 4.8.1. Let C and D be streaming settings such that there is a morphism of streaming settings C → D, whose underlying functor is F : C → D. Assume further that D carries a symmetric monoidal affine structure and has internal homsets F (C) F (C ) for every pair of objects C, C ∈ Obj(C). Then, sdm-C & -SSTs are subsumed by sdm-D-SSTs.

Figure 4 Figure 4

 44 Figure 4.8.1. A transformation forest F : T & S →

  a leaf which is not an output node in the forest F : A → B, call prune(F, v) : A → B the forest obtained by removing v and adjacent edges from F. This induces a canonical map prune(v) : Ty(F) → Ty(prune(F, v)) by using the weakening maps on the components corresponding to the deleted edges. • Contraction: If there is a vertex v with a unique child c and a (unique) parent p in the forest F : A → B, call contract(F, v) : A → B the forest obtained by replacing the edges (p, v) and (v, c) with a single edge (p, c) and removing v. There is a canonical map contract(v) : Ty(F) → Ty(contract(F, v))

  ) / / Ty(F )

Figure 4

 4 Figure 4.8.3. An example of composing normal transformation forests, where first the usual composition and then two big steps of reduction (that are respectively pruning and contracting) are carried out in succession.

') ' Figure 4

 '4 Figure 4.8.4. Definition of δ D (a) q,F and o q,F .

  Figure 5.1.1. Typing rules of λ ⊕& .

  3.3]. Definition 5.1.4. Let Σ be an alphabet. As already announced in §1.2.2, we define Str Σ as (o o) → . . . → (o o) → o → o where there are |Σ| occurrences of o o. Note in particular that thanks to the isomorphism 1 (A & B) → C ∼ = A → B → C (non-linear currying), we have Str Σ ∼ = ā∈Σ (o o) → o → o It can be checked that Str Σ has the same closed inhabitants (up to βη-equivalence) as the usual Str ! Σ presented above, but one should keep in mind that this choice is not entirely innocuous. It is in large part motivated by our main results, which might no longer hold when taking Str ! Σ instead of Str Σ . This situation generalizes to trees. For instance, the Church encoding of the tree depicted in Figure 2.1.1 is λ ! a.λ ! b.λ ! c. a (a c (b c)) c : (o → o → o) → (o → o) → o → o. Definition 5.1.5. Given a ranked alphabet Σ = (Σ, ar), the λ ⊕& type Tree Σ is defined as Tree Σ = (o . . . o) → . . . → (o . . . o) → o where there are |Σ| top-level arguments, and, within the component corresponding to the letter a ∈ Σ, there are |ar(a)|. In other words, we have the isomorphism Tree Σ ∼ = ā∈Σ (o ⊗ar(a) o) → o Remark 5.1.6. The isomorphism of Remark 2.1.1 translates to an equality Str Σ = Tree Σ .

δ

  = λa z. let (b, z ) = z in let (x, y) = z in if b then (tt, λu. π1(x) (a u), let () = π2(y) in π2(x) , y) else (ff, λu. a (π1(x) u), let () = π2(y) in π2(x) , y) δ = λz. let (b, z ) = z in let (x, y) = z in if b then (ff, λu.u, let () = π2(y) in π2(x) , λv.π1(y) (π1(x) u), let () = π1(x) in π2(y) ) else (tt, λu.u, let () = π2(y) in π2(x) , λv.π1(x) (π1(y) u), let () = π1(x) in π2(y) ) o = λε z. let (b, z ) = z (tt, λu.u, () , λu.u ) in let (x, y) = z in let () = π2(x) in if b then π1(y) ε else let () = π2(y) in ε

Figure 5

 5 Figure 5.1.3. Auxiliary λ ⊕& -terms for Example 5.1.12, where tt = in 1 (()), ff = in 2 (()), if t then u else v = case(t, x.let () = x in u, y.let () = y in v)).

  Proposition 5.1.7 has an important consequence: every closed λ ⊕& -term of type Tree Σ [κ]Tree Γ defines some function Tree(Σ) → Tree(Γ).

Example 5.1. 11 .

 11 The reverse function Σ * → Σ * is λ ⊕& -definable. (It was used previously for instance to define the "iterated reverse" in Example 2.3.7.) Supposing that we haveΣ = {a 1 , . . . , a k }, one λ ⊕& -term that implements it is λs.λ ! a 1 . . . . λ ! a k .λ ! ε. s (λx.λz.x (a 1 z)) . . . (λx. (a k z)) (λx.x) ε : Str Σ [o o] Str Σ Example 5.1.12. The copyless SST of Figure 2.3.1 is computed by a λ ⊕& -term of type Str Σ { } [τ ] Str Σ with τ = Bool ⊗ ((o o) & I) ⊗ ((o o) & I).Intuitively, Bool corresponds to the current state of the SST while each component (o o) & I corresponds to a register. Supposing that we have Σ = {a 1 , . . . , a k }, and that the letter corresponds to the first constructor in the input string, the λ ⊕& -definition is given byλs.λ ! a 1 . . . . λ ! a k .λ ! ε. o (s δ (δ a 1 ) . . . (δ a k ))where the terms δ : (o o) τ τ , δ : o τ τ and o : o (τ τ ) o are defined in Figure 5.1.3. Example 5.1.13. Consider the ranked alphabet Σ = {a : 2, b : 2, c : ∅} (where 2 = { , }) and the alphabet Γ = {a, b, c}. The conditional swap of Example 2.6.1 is λ ⊕& -definable as a term of type Tree Σ [(o o) & (o o)] → Str Γ reminiscent of the BRTT given in Example 2.6.3. Observe the use of an additive conjunction '&' (that is not of the form (-& I) meant to make data discardable), reflecting the fact that this BRTT is single-use-restricted but not copyless. To wit, setting τ = (o o) & (o o) and assuming free variables a, b : o o, define the auxiliary terms

  5.2.1. The syntactic category L of purely linear λ ⊕& -terms. First, we relate our notion of generalized SSTs from Chapter 4 to the λ ⊕& -calculus. If Γ = {b 1 , . . . , b n } is an alphabet, call Γ the non-linear typing context Γ = (b 1 : o o, . . . , b n : o o, ε : o) Definition 5.2.1. We call L( Γ) (or just L when Γ is clear from the context) the category • whose objects are purely linear types;

  Definition 5.2.3. L is the streaming setting (L, I, o, -L ) with output Γ * such that t L = w if and only if λ ! b 1 . . . . λ ! b n . λ ! ε. t () is βη-equivalent to the Church encoding of w (this defines a total function because of Proposition 5.1.7).

Σ

  = (a 1 : o . . . o, . . . , a n : o . . . o) where the type of a i has |A i | arguments (thus, it contains |A i | + 1 occurrences of o). Lemma 5.2.5. Let Σ = {a 1 : A 1 , . . . , a n : A n } and Γ = {b 1 : B 1 , . . . , b k : B k } be ranked alphabets such that there is some A i = ∅ (i.e., Tree(Σ) = ∅). Up to βη-equivalence, every term of type Tree Σ [κ] Tree Γ is of the shape λs.λ ! b 1 . . . . λ ! b k . o (s d 1 . . . d n ) such that o and the d i are purely linear λ ⊕& -terms with no occurrence of s. In particular: Γ; • o : κ o Γ; • d i : κ . . . κ (with the type of d i having |B i | arguments).

  Lemma 5.2.6. Let C be a streaming setting (C, ' , ', -) with output Γ * whose underlying category C is symmetric monoidal closed with ' = I and has finite products and coproducts. Let (f b ) b∈Γ ∈ Hom C (', ') Γ and e ∈ Hom C ( ' , ') be such that e = ε and, for every g ∈ Hom C ( ' , '), we have f b • g = b g (that is, f b acts by concatenating the single-letter word b on the left).

  3 to the base type o, regarded as an object of L, and to the family of endomorphisms ( Γ; • c : o o) c∈Γ ∈ Hom L (o, o) Γ . (Indeed, by definition, every letter c ∈ Γ serves as a variable c given the type o o in the typing context Γ.) This gives us F : SR → L such that F (∅) = I, F ({•}) = (o o) & I and ∀w ∈ Γ * , F ( w) = βη λz. let () = z in (λx. w 1 (w 2 . . . (w n x) . . .)), () Since ' SR = ∅ and ' L = I, we can simply take i = id I :' L → F ( ' SR )as part of our morphism of streaming settings. The map o :F (' SR ) → ' L is more interesting. Since ' SR = {•} and ' L = o, we can see that o must be a λ ⊕& -term of type ((o o) & I) o in the context Γ. The choice that works is o = λp. π 1 (p) ε (recalling that (ε : o) ∈ Γ stands for the empty string). Proving that o • F ( w) • i L = w SR for any w ∈ Γ * ismerely a matter of performing βη-conversions starting from the above equation on F ( w); we leave this to the reader. Since every f ∈ Hom SR ( ' , ') is of the form f = w for some w ∈ Γ * , this suffices to show that (F, i, o) fits the definition of a morphism of streaming settings.5.3. Comparison-free polyregularity equals (λ ⊕& , →)-definabilityHaving just proved the first result on strings claimed in Theorem 1.2.3, we now move on to the second one. 5.3.1. Extensional completeness. The easier direction, i.e., the fact that every comparisonfree polyregular function is (λ ⊕& , →)-definable (Definition 5.1.15), is established via the definition of the former as the smallest class of string-to-string functions containing all regular functions and closed under composition by substitution (Definition 3.1.2):• As a consequence of what we just saw in the previous section, every regular function is (λ ⊕& , →)-definable. Indeed, the function computed by t :Str Σ [τ ] Str Π is also implemented by λ ! x. t x : Str Σ [τ ] → Str Π .• The class of (λ ⊕& , →)-definable functions is closed under CbS, as the lemma below states. Lemma 5.3.1. Let f : Σ * → I * be computed by t : Str Σ [τ ] → Str I and g i : Σ * → Π * be defined by u i : Str Σ [σ i ] → Str Π for each i ∈ I. Assume that τ and every σ i are purely linear types. Then CbS(f, (g i ) i∈I ) is computed by some λ ⊕& -term of type Str Σ [κ] → Str Π where κ is purely linear.

∼

  --→ Hom L (I, σ σ) sends t to λ().t, just as in the definition of -from -. By Lemma 5.3.7, s d 1 . . . d |Σ| d ε (w) is therefore comparison-free polyregular. Now, it can be checked that for w ∈ Γ * , o s d 1 . . . d |Σ| d ε , () (w) = ev • |o| (w) ⊗ p • s d 1 . . . d |Σ| d ε (w) • λ -1 I where ev comes from the universal property of ( τ & I)

  w) Call h : Γ * → I * the first argument of the CbS in the left-hand side. It has the shape of a function computed by a single-state SR ⊕& -SST. As shown in Section 4.5.2, such devices only compute regular functions. Thus, h is regular, which concludes the proof. 5.3.4. Proof of Lemma 5.3.8.

Figure 5

 5 Figure 5.4.1. Normal forms for λ ⊕& -terms ( NF for normal forms and NE for neutral forms and X ∈ {NE, NF}).

Figure 5

 5 Figure 5.4.4. Commutative conversions ≈ c (p, q are patterns () or z ⊗ z and both sides are assumed to be well-scoped).

  obvious decomposition of δ and ∆ , the induction hypothesis yields Ψ ; ∆ 1 |= v[γ, δ 1 ] : κ κ and Ψ ; ∆ 2 |= v [γ, δ 2 ] : κ By definition of |= for type κ κ , we thus have Ψ ; ∆ |= v[γ, δ 1 ] v [γ, δ 2 ] : κ , so we may conclude. • The case of non-linear function application is entirely analogous. • If the last rule is the typing of a linear λ-abstraction Ψ; ∆, c : κ v : κ Ψ; ∆ λc.v : κ κ by the inductive hypothesis, we have Ψ ; ∆ , ∆ v[γ, δ, v /c] : κ for any v and ∆ such that Ψ ; ∆ |= v : κ. We can prove the conjunct defining Ψ ; ∆ |= (λc.v)[γ, δ] : κ κ as follows: -First, by taking ∆ = c : κ (Corollary 5.4.10), we obtain that there exists some v such that v[γ, δ] → * βε v and Ψ; ∆, c : κ NF v : κ . Therefore we have λc.v[γ, δ] → * βε λc.v and Ψ; ∆ NF λc.v : κ κ . -Then, assume we have some v and Ψ; ∆ |= v : κ, so that we have Ψ ; ∆ , ∆ v[γ, δ, v /c] : κ by the inductive hypothesis. Because

5.4. 3 .

 3 Proof of Proposition 5.1.7. Let us show that the Church encoding provides a bijection between ranked trees over Σ and closed inhabitants of Tree Σ .

  the last rule applied is an elimination of I Σ; s : τ NE t : I Σ; • NE u : σ Σ; • NE let () = t in u : σ then, the induction hypothesis (applicable because of Lemma 5.4.16) yields terms o and d 1 , . . . , d k such that t = βη o (s d 1 . . . d k ). We may set o = λz. let () = o z in u to conclude. • The last rule applied cannot be one of the other instances of I because of Lemma 5.4.16.

Figure 5

 5 Figure 5.4.5. Focused normal forms (top) / neutral forms (middle) / negative neutral forms (bottom) for λ ⊕& -terms.

  Then, there are terms o, d 1 , …, d k such that t = βη o s d 1 . . . d k , () and Ψ, s : τ ; ∆ NF f o : (κ & I) σ Ψ, s : τ ; • NF f d i : κ i for i ∈ {1, . . . , k} Furthermore, there are no more occurrences of s in o s d 1 . . . d k , () than in t. (For our intended application, take κ 1 = • • • = κ |Σ| = (σ σ) and κ |Σ|+1 = κ = σ.) To prove Lemma 5.4.23 we will need two additional observations, for which we do not provide detailed proofs. Recall that the strictly positive subtype relation + has been introduced in Section 5.4.2. Lemma 5.4.24. If Ψ; ∆ NE - f t : τ , then there is a variable in Ψ; ∆ of type σ with τ + σ.

Definition 6.1. 4 .

 4 Let C = (C, I C , ⊗ C , ' C , -C ) and D = (D, I D , ⊗ C , ' D , -D ) be tree streaming settings with output X. A morphism of tree streaming settings is given by a lax monoidal functor F : (C, ⊗ C , I C ) → (D, ⊗ D , I D ) and a D-arrow o : F

Lemma 6.1. 5 .

 5 If there is a morphism of tree streaming settings C → D, then D-BRTTs subsume C-BRTTs and single-state D-BRTTs subsume single-state C-BRTTs. Proof. Let us give the proof for single-state BRTTs; the proof for general BRTTs would be notationally heavier but not much more insightful. Suppose that we have some single-state C-BRTT T = (R, δ, o) -where we leave the only state implicit and regard the transition function δ and output function o as elements of a∈Σ Hom C ar(a) R, R and Hom C (R, ') respectively -and that the morphism under consideration is composed of a lax monoidal functor F : C → D and a D-arrow o : F (' C ) → ' D . Since F is lax monoidal, we have a family of natural transformations m I,A : I F (A) -→ F I A where I ranges over all finite sets 1 and A over objects of C; this family is compatible with the associators and unitors in C and D. Furthermore, m ∅,A : I → F (I) is the same for all A ∈ Obj(C), so we shall abbreviate it as m ∅ . We claim that T = T , where T is the single-state D-BRTT (F (R), δ , o • F (o)) with the same typing conventions and δ a = F (δ a ) • m ar(a),R . Let us prove this. To do so we first consider the iterations of the transition functions δ * : Tree(Σ) → Hom C (I, R) and δ * : Tree(Σ) → Hom D (I, F (R))

  Definition 6.3.2. Define T R m (Γ) (abbreviated T R m in the sequel) as the multicategory • whose class of objects Obj(T R m ) is FinSet.

  Figure 6.3.1. Composition of some multimorphisms of T R m .

t

  ∈ LTree Γ ((J, B) ⊗ O(C)) and u ∈ j∈J LTree Γ ((f -1 (j), (A i ) i ) ⊗ O(B j ))the composite t * f u is defined by recursion over t:if t = a((t k ) k ) for some a = in 1 (b) with b ∈ Γ or a = in 2 (in 2 (c)) for c ∈ C, then t * f u = a((t k * f u) k ) otherwise t = in 2 (in 1 (j))((t b ) b∈B j ) with j ∈ J and t b in some LTree Γ ((J b , B b ) ⊗ O(C j )) for b∈B j J b = J \ {j}, B b = B J b and b∈B j C b = C.In such a case, we sett * f u = u j [(t b * id J b (u j ) j ∈J b )/b] b∈B jwhere [-/-] -∈-denotes the more usual substitution of leaves by subtrees (recall that every b ∈ B, and a fortiori B j has arity ∅).

  Figure 6.3.1 depicts the composition α * f (β x ) x∈{t,u} with α = t(a(u(c()), * ()), c()) β t = a(x(p(), b(q())), y()) and β u = z(c(), r(), c())

I

  ι ⊕ : T R → T R ⊕ and a functor R : T R ⊕ → T R ≤1 ⊕ right adjoint to the inclusion I : T R ≤1 ⊕ → T R ⊕ . is strong symmetric monoidal. Therefore, by [Mel09, Proposition 14, Section 5.17], once we construct R right adjoint to I, it comes equipped with a canonical lax monoidal structure. Furthermore, since we want I R, we can use the implicit characterization of adjoints given in [Mac98, item (iv), Theorem 2, Section IV.1]: to define R, it suffices to give the value of R (A) for every object A ∈ Obj(T R ⊕ ) and counit maps A : I(R(A)) → A such that, for every object B ∈ Obj(T R ≤1 ⊕ ) and map h ∈ Hom T R ⊕ (I(B), A), there is a unique h ∈ Hom T R ≤1 ⊕ (R(A), B) such that the following diagram commutes

  recursive definition R(ι ⊕ (I(U ))) = I(1) ⊗ b∈Γ f :U →ar(b) nonconstant x∈ar(b)R(ι ⊕ (I(f -1 (x))))Note that this definition is well-founded because the function f in the second sum is taken to be non constant, so that |f -1 (x)| < |U | for every x. While this suffices as a definition of R(ι ⊕ (I(U ))), this might be a bit opaque without having the definition of R(ι ⊕ (I(U ))) . Before giving that, let us attempt to give an intuitive rationale behind this definition: there is an isomorphism 2Hom T R ≤1 ⊕ ( , R(ι ⊕ (I(U )))) ∼ = LTree Γ (U )which can be nicely pictured, provided we actually compute recursively R(ι ⊕ (I(U ))) and spell out a normal form R(ι ⊕ (I(U ))) ∼ = t∈PT(U ) n∈N (t)

  .3.2. Now, we define R(ι ⊕ (I(U ))) ∈ Hom T R ≤1 ⊕ (I(R(ι ⊕ (I(U )))), ι ⊕ (I(U ))), by induction over the size of U . If |U | ≤ 1, we take R(ι ⊕ (I(U ))) : ι ⊕ (I(U )) → ι ⊕ (I(U )) to be the identity. Otherwise, we need to define a map g U : ι ⊕ (I(U )) or, equivalently, a family of T R ⊕ -maps indexed by b ∈ Γ and f : U → ar(b) non-constant g b,f : x∈ar(b)I(R(ι ⊕ (I(f -1 (x))))) -→ ι ⊕ (I(U ))By the induction hypothesis, we have a family of T R ⊕ -maps (g x ) x∈ar(b)g x : I(R(ι ⊕ (I(f -1 (x))))) -→ ι ⊕ (I(f -1 (x)))We define g b,f as the compositex∈ar(b) I(R(ι ⊕ (I(f -1 (x))))) x gx -----→ x∈ar(b) ι ⊕ (I(f -1 (x))) b --→ ι ⊕ (I(U ))where b is obtained from the map of T R m which intuitively takes a family (t x ) x∈ar(b) of trees into a single tree b((t x ) x∈ar(b) ) (officially, the tree b(( * ) x∈ar(b) ) ∈ LTree Γ (O(U )).

2

  Which we may later on define formally as a compositeHom T R ≤1 ⊕ ( , R(ι⊕(I(U )))) I -→ HomT R ⊕ ( , R(ι⊕(I(U )))) → HomT R ⊕ ( , I(U )) ∼ --→ LTree Γ (U )where the mediating arrow is the post-composition by ι ⊕ (I(U )) .

Figure 6

 6 Figure 6.3.2. Decomposition of a multi-hole tree LTree Σ ({x, y, z, t}) (where Σ = {a : 2, b : 1, c : 0, d : 3}) as a tuple consisting of a partitioning tree and trees with at most one hole.



  (f, (α y ) y∈ Y ) ∈ Hom M coh of a linear map f ∈ Hom FinCoh (Y, X) and a family of multimorphisms α y ∈ Hom M (R x ) x∈f (y) , S y .• whose identities are pairs (id X , (id Rx ) x∈ X ).• where the composition of (f, (α y ) y∈ Y ) ∈ Hom and (g, (β z ) z∈ Z ) ∈ Hom • g, (β z * (α y ) y∈g(z) ) z∈Z ).

Lemma 6.4. 11 .S

 11 There is a strong monoidal functor M coh → (M aff ) & , which extends to a morphism of streaming settingsM coh → (M aff ) & .Proof. For a coherence space ( X , ¨X ), write Cl(X) ⊆ P(X) the set of cliques of XCl(X) = {S ∈ P(X) | ∀x y ∈ S. x ¨X y}We now define the functor F : M coh → (M aff ) & on objects asF x∈X A x = S∈Cl(X) x∈S A xAs for morphisms, first recall that a morphism (R, α) ∈ Hom M coh x∈X A x , y∈Y B y consists of a linear map R ∈ Hom FinCoh (Y, X) and a family(α y ) y∈ Y ∈ y∈ Y Hom M (A x ) (y,x)∈R , B yWe set out to defineF (R, α) ∈ Hom (M aff ) ∈Cl(Y ) S∈Cl(X) f :S S y∈S Hom M (A x ) x∈f -1 (x) , B ySo fixing S ∈ Cl(Y ) and recall that R being linear means that we have (y, x) ∈ R ∧ (y , x) ∈ R ⇒ y ¨Y y ⇒ x ¨X x (1) x = x ⇒ y ˚Y y (2)

  ) z∈S C z where C in 1 (x) = A x , C in 2 (y) = B y is a canonical isomorphism F (') ∼ = ' which completes the definition of our morphism M coh → (M aff ) & .

  Hom T R ⊕ ( , ι ⊕ (R) ι ⊕ (I(U ))) ∼ = Hom T R (R, I(U )) ∼ = LTree(R ⊗ O(U ))

Figure 6

 6 Figure 6.5.1. Decomposition of a map of Hom T R(Σ) ({x : 3, y : 3}, I(7)) (which is defined as LTree Σ ({x : 3, y : 3} ⊗ O(7)), for Σ = {a : 2, b : 1, c : 0}) as a tuple consisting of a partitioning tree and trees without the letters x and y.

  Their formal definition is as follows:R b I(W ) = f :W →ar(b) g:R→ar(b) g nonconstant x∈ar(Γ) ι ⊕ (R g -1 (x)) ι ⊕ (f -1 (x)) R r I(W ) = f :W →ar(r) g:R\{r}→ar(r) x∈ar(r) ι ⊕ (R g -1 (x)) ι ⊕ (f -1 (x))Note that the definitions of ι ⊕ (R) ι ⊕ (I(U )), R b I(W ) and R r I(W ) mutually depend on one another. Still this is is well-defined as the definitions of R b I(W ) and R r I(W ) only require ι ⊕ (S) ι ⊕ (I(V )) for S strictly smaller than R. We now describe the associated evaluation map ev R,I(U ) : (ι ⊕ (R) ι ⊕ (I(U ))) ⊗ R -→ I(U )

b∈Γ(-

  R b I(W )) ⊕ r∈R (R r I(W )) ⊗ R -→ I(W ) we may post-compose it with I(V + 1) ⊗ I(W ) → I(V + W ) ∼ = I(V W ) = I(U ) to define ev R I(U ) . Recalling that ⊗ distributes over ⊕, it suffices to provide specialized maps ev b R,I(W ) : R b I(W ) ⊗ R → I(W ) and ev r R,I(W ) : R r I(W ) ⊗ R → I(W ) for b ∈ Γ and r ∈ R, which we describe now. -For ev b R,I(W ) , it suffices to define a family of T R-maps indexed by f : W → ar(b) and g : R → ar(b) with g non-constant  x∈ar(Γ) (R g -1 (x)) I(f -1 (x))   ⊗ R -→ I(W )Recall that b can be seen as tree constructor and induces a canonical map b :x∈ar(b) I(f -1 (x)) -→ I(W )Using the induction hypothesis, we have evaluation maps(R g -1 (x)) I(f -1 (x)) ⊗ (R g -1 (x)) -→ I(W )We can then compose b with the product of those maps over x ∈ ar(b) and then the isomorphism R ∼ = x∈ar(b) R f -1 (x) to conclude the definition of ev b R,I(W ) . For ev r R,I(W ) , it suffices to define a family of T R-maps indexed by f : W → ar(r) and g : R \ {r} → ar(r)  x∈ar(Γ) (R g -1 (x)) I(f -1 (x))   ⊗ R -→ I(W )By exploiting the isomorphism R ∼ = I(ar(r)) ⊗ x∈ar(r) (R g -1 (x)) and using the inductive hypothesis as in the previous case, we obtain a map  x∈ar(Γ) (R g -1 (x)) I(f -1 (x))   ⊗ R -→ I(ar(r)) ⊗ x∈ar(r) I(f -1 (x))and we may conclude by post-composing by the mapI(ar(r)) ⊗ x∈ar(r) I(f -1 (x)) → I(W )which is induced by the depth-2 tree whose root corresponds to the first component, whose children correspond to the successive elements of x∈ar(r) I(f -1 (x)) and other leaves are in W .

  Lemma 6.6.2. Let C be a streaming setting. Then there are morphisms of streaming settingsC ⊕& → (C ⊕ ) ⊕& and (C ⊕ ) ⊕& → C ⊕& .Proof idea. The first morphism can be obtained using Lemma 6.6.1 with the morphism of streaming setting C → C ⊕ corresponding to ι ⊕ . The second morphism can be written as a composite(C ⊕ ) ⊕& ∼ = ((C ⊕ ) & ) ⊕ (Dist C ) ⊕ / / ((C & ) ⊕ ) ⊕ Mu C & / / (C & ) ⊕ ∼ = C ⊕& where (Dist C ) ⊕ is obtained from a morphism Dist C : (C ⊕ ) & → (C & ) ⊕ by Lemma 6.6.1. Dist C itself is built from a functor D C : (C ⊕ ) & → (C & ) ⊕defined on object following the mantra "products distribute over coproducts".

  v)∈U ×V (x,y)∈Xu×Yv A x ⊗ B y which are not isomorphisms in general, but constitute the non-trivial part of the lax monoidal structure of F ; m 0 : I → F (I) is actually the identity.

λ

  ⊕& = single-state L-BRTTs by Lemma 6.7.1 = single-state TR ˚,≤1 ⊕ -BRTTs ( †) = TR ˚,≤1 -BRTTs by Theorem 6.1.6 = regular tree functions by Proposition 6.4.5

  languages in non-commutative linear logic This is the final technical chapter of this dissertation, and it is devoted to Theorem 1.2.1: our characterization of star-free languages using a non-commutative linear λ-calculus. But whence comes non-commutativity? Consider the λ-terms id = λf. f = η λf. λx. λy. f x y flip = λf. λx. λy. f y x Then iterating flip yields flip, id, flip, id, . . . up to βη-equivalence. In other words, the sequence defined by the recurrence flip n+1 = λf. flip (flip n f ) is described by the closed forms flip 2n+1 = βη flip and flip 2n+2 = βη id; it has period two since flip = βη id. To enforce the aperiodicity (Definition 1.1.

Theorem 7.2. 1 .

 1 For any purely linear type τ , the set of closed λ ℘-terms of type τ τ quotiented by βη-convertibility and endowed with function composition, is a finite and aperiodic monoid.Let us comment on the role of the features of the type system here:• The existence of finitely many closed inhabitants of a purely linear type σ (considered here in the special case σ = τ τ ) still works in the commutative case; it is a well-known consequence of linearity (even of affineness, see [NP20, Proposition 3.1]).• On the other hand, the term flip = λf. λx. λy. f y x : linear, so aperiodicity truly depends on non-commutativity.

  of StrW η-expands into λ ! e. λ ! f 1 . . . . λ ! f |Σ| . t. The idea is that: • When the context Ψ of non-linear variables contains f i , . . . , f |Σ| : o o, any string w ∈ Σ * can be represented as the open λ ℘-term Ψ; . . . f w[1] • • • • • f w[|w|] : o o in that context, and such strings can even be concatenated by function composition. The point is that this gives us a kind of purely linear type of strings. • The variable e : (o o) o o therefore is a function from strings to strings, which one should interpret as a sort of admissible weakening: "erase my argument and return the empty string" (the latter is encoded as λy. y : o o) -the idea will be to feed an argument for e that will actually have this behavior in a function StrW Σ [τ ] NBool, or, in a function StrW Σ [τ ] StrW Π , to lift an eraser of type (o o) o o to an eraser of type (τ τ ) τ τ .

Lemma 7.3. 1 .

 1 There is a type-cast function castW :Str Σ [o o] StrW Σ . Proof. λs. λ ! e. λ ! f 1 . . . . λ ! f |Σ| . s (λg. f 1 • g) . . . (λg. f |Σ| • g) (λx. x).Following[START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF], we shall encode aperiodic sequential functions (cf. Definition 2.2.1) in the λ ℘-calculus. The difference is that [NP20, Theorem 4.1] is stated for the typeStr Σ [τ ]Str Γ ; this is not possible here because of Proposition 7.0.1. Theorem 7.3.2. Any aperiodic sequential function f : Σ * → Γ * can be "expressed" by a closed λ ℘-term t : StrW Σ [τ ]

ζ

  • κ w = ζ κ w • κ w = κ ww κ w (w )ζ(w ) = ζ(w )κ w (w ) = wwNow, consider an input letter c ∈ Σ; how to encode the corresponding transition δ(-, c) as a transformation on the pair encoding the current state and output history? It depends on the state transition δ st (-, c); we have thanks to the above identities:• (h, g) → (h • κ δout(1,c) , g • κ δout(2,c) ) when δ st (-, c) = id; • (h, g) → (κ h(δout(1,c))g(δout(2,c)) , ζ) when δ st (-, c) : q → 1 (note that h = ζ xor g = ζ);• (h, g) → (ζ, κ h(δout(1,c))g(δout(2,c))

  Then the expressionh(δ out (1, c))g(δ out (2, c)) above is in this case ζ(a)κ a•ψ(s ) (bb) = ε • a • ψ(s ) • bb = a • ψ(s)which is indeed the output that the transducer produces after reading the input prefix sa = s ba.Next, we must transpose these ideas to the setting of the λ ℘-calculus. This is where new ideas compared to [NP20] come into play.Proof of Lemma 7.3.7. We define the λ ℘-term meant to compute our sequential function asλs. λ ! e. λ ! f a 1 . . . . λ ! f a |Γ| . out (s elift trans c 1 . . . trans c |Σ| ) : Str Σ [τ ]Str Γ where Σ = {c 1 , . . . , c |Σ| }, Γ = {a 1 , . . . , a |Γ| } and, writing Ψ = {f a : o o | a ∈ Γ} ∪ {e : T } (with T = (o o) o o as we shall see), Ψ; ∅ trans c : τ τ (for all c ∈ Σ) Ψ; ∅ out :

•

  the new term to implement is the eraser for StrW Σ [τ ] using the e given to StrW Γ : elift = λg. λh. λl. λl . λx. e junk (h l l x)

  You're still here? Oh, I guess I should tell you math papers generally don't have what you or I might call a "conclusion". They just sort of stop. So, yeah, you can, um, go now. But, cheers! Piper H [H16, p. 127]

  Let us now present our concrete results, starting with one that concerns languages. It takes place in a fragment -that we call the λ ℘-calculus -of Intuitionistic Non-Commutative Linear Logic[START_REF] Polakow | Ordered linear logic and applications[END_REF] ('℘' as in "planar", see e.g.[START_REF] Abramsky | Temperley-Lieb Algebra: From Knot Theory to Logic and Computation via Quantum Mechanics[END_REF][START_REF] Zeilberger | A correspondence between rooted planar maps and normal planar lambda terms[END_REF]). As the name indicates, it features non-commutative linear types in the vein of the Lambek calculus (cf. §1.1.5). We have the following:

1.2.2. Equivalences in expressive power. Theorem 1.2.1 (variant of [NP20, Theorem 1.7]). A language L ⊆ Σ * can be defined by a λ ℘-term of type Str Σ

[τ ]

  However, this actually gives a misleading impression of what contemporary developments in descriptive complexity look like. Since the picture for implicit complexity is, for its part, relatively faithful (though it neglects the more practical applications of ideas derived from ICC to static analysis of programs, 83 just as we did not mention the historical ties of finite model theory to databases 84 ), this explains why the descriptive complexity and ICC communities are separate: they are mostly not interested in the same questions.Descriptive complexity today is mainly concerned with what happens if one considers (finite) relational structures that are not strings as inputs, for instance graphs (cf. the end of §1.3.1). Since one can choose any reasonable encoding of graphs as strings without making any difference for usual complexity theory, 85 it is tempting to think that the choice of input structure does not matter much. This initial intuition is completely wrong.

			; LM93]; for
	an overview of the past 30 years of research in the area, we recommend the survey [Péc20].
	Oversimplifying a bit, since all our examples of implicit complexity techniques have a
	"functional programming" flavor, we could summarize what we just said like this:
	programming paradigm	declarative	functional
	complexity classes	Descriptive Complexity Implicit Computational Complexity
	automata theory	subsystems of MSO	our work! + §1.3.3

Previous work on implicit automata and adjacent topics. After

	97 For an example of very speculative exploration towards this
	direction, see [Maz17, §4.2.3]. Finally, let us note that the "categorification" of descriptive
	complexity and finite model theory has been a very active research topic recently; the journal
	paper [AS21] 98 contains references to most of the work on this at the time of writing.
	1.3.3. these broad
	discussions of subfields of TCS, let us focus more narrowly on direct precursors of our work.
	If we consider non-type-theoretic approaches to ICC (as defined towards the beginning
	of the previous subsection), then there are several recent formalisms for regular string
	functions using combinators [AFR14; DGK18; BDK18] that arguably belong to "implicit
	automata". Recent results of this kind include characterizations of first-order transductions
	on strings [DGK21] and on trees [BD20].

  Let t 1 : Tree Γ [κ 1 ] Tree Π and t 2 : Tree Σ [κ 2 ]Tree Γ where κ 1 and κ 2 are both purely linear. Using Remark 5.1.8, we then havet 2 : (Tree Σ [κ 2 ]Tree Γ )[κ 1 ] and the result of this type substitution is equal toTree Σ [κ 2 [κ 1 ]] Tree Γ [κ 1 ]. Therefore, u = λx. t 1 (t 2 x) is a well-typed λ ⊕& -term, with type Tree Σ [κ 2 [κ 1 ]]

  . t (cast 0 s) û1 . . . û|I| x : Str Σ [κ] → Str Π (to make things clear, h 1 , . . . , h |Π| : o o and x : o) where, for each i ∈ I, we take ûi = u i (cast i s) (λf.λy. h 1 (f y)) . . . (λf.λy. h |Π| (f y)) (λy. y) Let Σ be a finite alphabet, J be a finite set of indices, and (τ j ) j∈J be a family of purely linear types. Then there exist a purely linear type κ and closed λ ⊕& -terms cast j : Str Σ [κ]

	Lemma 5.3.2.
	(thus, s : Str[κ], h 1 : o	o, . . . , h |Π| : o	o; •	ûi : o	o).

  base case: any term t such that Σ; • t : σ; • inductive case: o s d 1 . . . d |Σ| d ε , () for any d ε , d 1 , . . . , d |σ| , o in this set, with respective

	types σ, σ	σ, . . . , σ	σ, (σ & I)	σ (thus, the new term has type σ ).

  5.4.2. β-redexes. listed in Figure5.4.3; we also write → ε for the context closure of the relation described there. While the number of cases is daunting, it should be remarked that these rules are obtained mechanically by considering the nesting of an eliminator for a positive type (i.e., the let • = • in • constructions (⊗, I), case (⊕) and abort (0)) within another eliminator (the aforementioned constructions plus function application (→, ) and projections π 1 , π 2 (&)). For a more careful discussion of (a subset) of these rules, we point the reader to [Sch16, Section 3.3]. We write → * ε for the reflexive transitive closure of → ε , → βε for the union of → ε and → β and → ε , and → * βε for its reflexive transitive closure. With these notations, we can state the finer version of the normalization theorem for λ ⊕& . For every term t such that Ψ; ∆ t : τ , there exists t such that t → * βε t and Ψ; ∆ NF t : τ .Before embarking on the definitions of the reducibility candidates and the proof of Theorem 5.4.1 itself, we first make a couple of observations relating → * βε and = βη , which are both proved by straightforward induction on the relations → β and → βε . Suppose that we have terms t and t with matching types and that t → βε t . Then, we have t = βη t . Furthermore if t is normal, so is t . Similarly, if t is neutral, so is t . If t is normal, then there is no t such that t → β t .

	Theorem 5.4.1. Lemma 5.4.2. Lemma 5.4.3.

Lemma 5.4.5. If

  A first observation is that these are compatible with = βη and that neutral and normal term are preserved by commutative conversions. t ≈ c t , then t = βη t .

	Theorem 5.4.4. If we have t →

* βε u and t → * βε v, then there exists u and v such that u → * βε u , v → * βε v and u ≈ c v .

Lemma 5.4.6. If

  t is neutral (resp. normal) and t ≈ c t , then t is also neutral (resp. normal). can now turn to the definition of the reducibility candidates, where we write t → * βε ≈ c t when there is some t such that t → * βε t and t ≈ c t hold. Definition 5.4.7. Define a judgment Ψ; ∆ |= t : τ by induction over the type τ as follows: • for τ = o, I, 0 or , we have Ψ; ∆ |= t : τ if and only if there is t such that t → * βε t and Ψ; ∆ NE t : τ • Ψ; ∆ |= t : τ σ holds if and only if there is t such that t → * βε t and Ψ; ∆ NF t : τ σ for every u, ∆ such that Ψ; ∆ |= u : τ , we have Ψ; ∆, ∆ |= t u : σ • Ψ; ∆ |= t : τ → σ holds if and only if there is t such that t →

	We

* βε t and Ψ; ∆ NF t : τ → σ for every u such that Ψ; • |= u : τ , we have Ψ; ∆ |= t u : σ • Ψ; ∆ |= t : τ ⊗ σ holds if and only if there is t such that t → * βε t and Ψ; ∆ NF t : τ ⊗ σ Nested ⊗/I eliminator

  if there are t 1 , t 2 such that and t → * βε t 1 ⊗ t 2 , then there are ∆ 1 and ∆ 2 such that ∆ = ∆ 1 , ∆ 2 and Ψ; ∆ 1 |= t 1 : τ and Ψ; ∆ 2 |= t 2 : σ • Ψ; ∆ |= t : τ & σ holds if and only if there is t such that t → * βε t and Ψ; ∆ NF t : τ & σ -Ψ; ∆ |= π 1 (t) : τ -Ψ; ∆ |= π 2 (t) : σ • Ψ; ∆ |= t : τ ⊕ σ holds if and only if there is t such that t → * βε t and Ψ; ∆ NFt : τ ⊕ σ if there is u such that t → * βε ≈ c in 1 (u), then Ψ; ∆ |= u : τ if there is v such that t → * βε ≈ c in 2 (v), then Ψ; ∆ |= v : σThe set of terms t such that Ψ; ∆ |= t : τ constitutes our set of reducibility candidates at type τ in the context Ψ; ∆. They are defined in such a way that if Ψ; ∆ |= t : τ , then there is t such that t → * βε t and Ψ; ∆ NF t : τ . We shall be able to conclude this section if we show an adequacy lemma stating that every typable term lies in a reducibility candidate. Before doing that, we first need a couple of stability properties: closure under anti-reduction, and the fact that every neutral term lies in a reducibility candidate. If t is a neutral term, then t cannot be βη-equivalent to one of the following λx

	Lemma 5.4.8.

  Proof. The first point can be proven via an easy case analysis on τ that we skip. The second point we may prove by induction over τ ; let us sketch a few representative cases: • If τ is o, 0, I or , this is immediate. • Suppose that τ = σ κ and that t → * βε t . By definition of |= at τ κ, there is some normal t such that t → * βε t , so we also have t → * βε t by transitivity. Now suppose that we are given some u and ∆ such that Ψ; ∆ |= u : τ . By definition, we have Ψ; ∆, ∆ |= t u : κ. Using the induction hypothesis at κ and the fact that t u → * βε t u, we thus have that Ψ; ∆, ∆ |= t u : κ. We can thus conclude that Ψ; ∆ |= t : κ. • Suppose that τ = σ ⊕ κ and that t → * βε t . By definition of |=, there is some normal t such that t → * βε t , so we also have t → * βε t by transitivity. Now if we have u (resp. v) such that t → * βε ≈ c in 1 (u) (resp. in 2 (v)), then, thanks to confluence (Theorem 5.4.4) we also have t → * βε ≈ c in 1 (u) (resp. in 2 (v)), so we have Ψ; ∆ |= u : σ (resp. Ψ; ∆ |= u : κ) by definition. Therefore, we may conclude that Ψ; ∆ |= t : σ ⊕ κ. The third point is also proved via a straightforward induction over τ by leveraging Lemma 5.4.8. The last two points follow from induction over τ combined with Theorem 5.4.4 and Lemma 5.4.6. Proof. Immediate as variables are neutral. Suppose that we have Ψ; ∆ NE t : τ ⊗ σ and Ψ; ∆ , x : τ, y : σ |= u : κ. Then Ψ; ∆, ∆ |= let x ⊗ y = t in u : κ. Similarly, if Ψ; ∆ NE t : τ ⊕ σ, Ψ; ∆ , x : τ |= u : κ and Ψ; ∆ , y : σ |= u : κ, we have Ψ; ∆, ∆ |= case(t, x.u, y.u ) : κ.Finally, if Ψ; ∆ NE t : I and Ψ; ∆ |= u : κ, then Ψ; ∆, ∆ |= let () = t in u : κ. Suppose that we have a non-linear context Ψ = x 1 : σ 1 , . . . , x k : σ k , a linear context ∆ = a 1 : τ 1 , . . . , a n : τ n and a term v such that Ψ; ∆ v : κ for some type κ. Further, assume Ψ , ∆ 1 , . . . , ∆ n and terms t 1 , . . . t k , u 1 , . . . , u n such that Ψ ; • |= t i : σ i for 1 ≤ i ≤ k and Ψ ; ∆ j |= u j : τ j for 1 ≤ j ≤ n. Then we haveΨ ; ∆ 1 , . . . , ∆ n |= v[t 1 /x 1 , . . . , t k /x k , u 1 /a 1 , . . . , u n /a n ] : κProof. The proof goes by induction over the typing derivation Ψ; ∆ v : κ; we sketch a few representative subcases below. To keep notations short, we write γ (respectively δ) instead of the sequence of assignments t 1 /x 1 , . . . , t k /x k (respectively u 1 /a 1 , . . . , u n /a n ) and ∆ = ∆ 1 , . . . , ∆ n .• If the last rule used in an axiom, the conclusion is immediate.• If the last rule used is a linear function application Ψ; ∆ 1

	Lemma 5.4.11. Proof. By induction over κ.
	Theorem 5.4.12 (Adequacy).

• There exists t such that t → * βε t and Ψ; ∆ NF t : τ . • If we have t → * βε t , then we also have Ψ; ∆ |= t : τ . • If Ψ; ∆ NE t : τ , then Ψ; ∆ |= t : τ . • If t ≈ c t , then Ψ; ∆ |= t : τ . • If t → * βε t , then we also have Ψ; ∆ |= t : τ . Corollary 5.4.10. If x is a variable of type τ in either Ψ or ∆, we have Ψ; ∆ |= x : τ .

  δ 2 the splitting of δ according to the decomposition ∆ = ∆ 1 , ∆ 2 . The induction hypothesis yields If Ψ; ∆ is consistent and Ψ; ∆ NE t : τ , then there is a variable in Ψ; ∆ of type σ with τ + σ.Proof. By induction on the judgement Ψ; ∆ NE t : τ .• If the last rule applied was a variable lookup. Ψ; x : τ NE x : τ Ψ, x : τ ; • NE x : τ then the conclusion immediately follows. • The more interesting cases are those of the elimination rules for , ⊗ and &.

	Ψ; ∆ NE t : τ	σ	Ψ; ∆ NF u : τ

Ψ ; ∆ 1 |= t[γ, δ 1 ] : τ and Ψ ; ∆ 2 |= u[γ, δ 2 ] : σ Lemma 5.4.16.

•

  If the last rule applied is the elimination of a coproductΨ; ∆ NE t : σ ⊕ τ Ψ; ∆ , x : σ NE u : κ Ψ; ∆ , y : τ NE v : κ Ψ; ∆, ∆ NE case(t, x.u, y.v) : κthen, by the inductive hypothesis applied to the second premise, there is ζ with κ + ζ

	such that
	(1) either there is a variable in Ψ; ∆ with type ζ
	(2) or ζ = σ.

  where the type of u has k arguments, then there exists a ∈ Σ, a list of trees t 1 , . . . , t |ar(a)|-k ∈ Tree(Σ) such that u = a t • 1 . . . t • |ar(a)|-k . Proof. We proceed by induction over the typing judgment of the normal form u. Many cases are easily seen to not arise (typically, constructor for various datatypes). Most eliminators can also be ignored because of Lemma 5.4.16. For instance, suppose u = case(v, x.w, y.w ). Then it would means that we had some Σ; • NE v : τ ⊕ σ for some τ, σ, but that cannot be the case as τ ⊕ σ is never a strictly positive subtype of some o . . . o. As a consequence, there are only two cases of interest: the variable case and (linear) function application. • If u is a variable of type o, then the first result (and, as a consequence, the second) result is immediate: u is the Church encoding of a tree with a single leaf. If it is a variable of type o . . . o, the first claim is vacuously true and the second is also immediate. • If u is a function application v w, then we have that Σ; • NE v : o . . . o in both cases. So we may apply the inductive hypothesis to obtain some a ∈ Σ and trees t 1 , . . . , t l such that v = a t • 1 . . . t • l . We also have that Σ; • NF : w : o, so we have some tree t l+1 such that w = βη t • l+1 . Altogether, we thus have u = a t • 1 . . . t • l+1 as expected of the second item. If the first item is not vacuously true, we have that l + 1 = |A|, and thus, a t • 1 . . . t • l+1 = (a(t 1 , . . . , t l+1)) • as required. Given two ordered ranked alphabets Σ and Γ, write Σ ⊗ Γ for the ordered ranked alphabet with letters Σ + Γ determined by in 1 (a) < in 2 (b) for a ∈ Σ, b ∈ Γ and where the order is lifted from Σ and Γ otherwise. Fix ranked alphabets Σ, Γ. If we have Σ; • u : Tree Γ , then there exists some

	Lemma 5.4.18.

  5.4.4. Proof of Lemma 5.2.5. We now analyse the terms of type Tree Σ [σ] Tree Γ . Let τ = κ 1 → . . . → κ k → κ be a type and s a distinguished variable of type τ . Let Σ be a ranked alphabet such that Σ; s : τ is consistent. Then, if there is k < k such that Σ; s : τ NE t : κ k +1 → . . . → κ k → κ, there are also terms d 1 , . . . , d k such that t = βη s d 1 . . . d k and Σ; • NF d

	Lemma 5.4.19.

i : κ i for i ∈ {1, . . . , k } Proof. By induction over k . Note that t being neutral is essential here. Lemma 5.4.20. Let τ = κ 1 → . . . → κ k → κ be a type with κ purely linear and s a distinguished variable of type τ . Let Σ be a ranked alphabet such that Σ; s : τ is consistent and t be a term such that Σ; s : τ NE t : σ for some σ such that σ + κ or of the shape o . . . o. Then, there are terms o, d 1 , …, d k such that t = βη o (s d 1 . . . d k ) and Σ

•

  If the last rule considered is the following instance of the application ruleIn the first case, we can further see that σ σ + κ , so in both cases the induction hypothesis can be applied to the first premise to yield some o and d 1 , . . . , d k such that o (s d 1 . . . d k ) = βη t, and we may set o = λs. o s u to conclude. • If the last rule considered is the following instance of the application rule If the last rule considered is the other instance of the application rule Σ; ∆ NE t : σ σ Σ; ∆ , s : τ NF u : σ Σ; ∆, ∆ , s : τ NE t u : σ by Lemma 5.4.16 applied to the first premise, we know that σ = o. Therefore, we may apply the induction hypothesis to the second premise to obtain d 1 , . . . , d k and o such that u = βη o (s d 1 . . . d k ), in which case, t u = βη (λx. t (o x)) (s d 1 . . . d k ). We conclude by setting o = λz. t (o z). • If the last rule considered is the following instance of the elimination of tensor products Σ; s : τ NE t : ζ 1 ⊗ ζ 2 Σ; x 1 : ζ 1 , x 2 : ζ 2 NE u : σ Σ; s : τ NE let x ⊗ y = t in u : σ then, by the induction hypothesis (which is applicable because of Lemma 5.4.16), there are d 1 , . . . , d k and o such that t = βη o (s d 1 . . . d k ), in which case, we conclude by setting o = λz. let x ⊗ y = o z in u. • The last rule considered cannot be the following instance of the elimination of tensor products Σ; • NE t : ζ 1 ⊗ ζ 2 as Lemma 5.4.16 would require that ζ 1 ⊗ ζ 2 be a strictly positive subtype of some o . . . o. • If the last rule considered types a projection Σ; s : τ NE t : σ 1 & σ 2 Σ; s : τ NE π i (t) : σ i then the induction hypothesis yields terms o and d 1 , . . . , d k such that t = βη o (s d 1 . . . d k ). We may set o = λz. π i (o z) to conclude. • If the last rule applied is an elimination of a coproduct Σ; s : τ NE t : ζ 1 ⊕ ζ 2The last rule applied cannot be one of the following instances of the elimination of a coproduct because of Lemma 5.4.16 applied to the first premise:

	then, by Lemma 5.4.16 (applied on the first premise), it means that we have
	either σ	σ + τ	or σ	σ = o	. . .	o
	Σ; s : τ NE t : σ → σ	Σ; • NF u : σ
		Σ; s : τ NE t u : σ
	then, by Lemma 5.4.16 (applied on the first premise), it means that we have
	either σ → σ + τ	or σ → σ = o	. . .

Σ; s : τ NE t : σ σ Σ; • NF u : σ Σ; s : τ NE t u : σ o The second alternative is absurd, and the first leads to σ = κ and σ = κ k . Therefore, we may apply Lemma 5.4.19 to get terms d 1 , . . . , d k-1 in normal form such that t = βη s d 1 . . . d k-1 . We then set d k to be u and o to be the identity to conclude. • Σ; s : τ, x 1 : ζ 1 , x 2 : ζ 2 NE u : σ Σ; s : τ NE let x ⊗ y = t in u : σ Σ; x : ζ 1 NE u : σ Σ; y : ζ 2 NE v : σ Σ; • NE case(t, x.u, y.v) : σ then, the induction hypothesis (applicable because of Lemma 5.4.16) yields terms o and d 1 , . . . , d k such that t = βη o (s d 1 . . . d k ). We may set o = λz. case(o z, x.u, y.v) to conclude. •

  . . , d l such that t = βη s d 1 . . . d k-1 and Ψ; • NF f d i : κ i for i ∈ {1, . . . , k -1}Furthermore, there are no more occurrences of s in s d 1 . . . d k-1 than in t. This is a simplification of Lemma 5.4.19; the hypotheses can be simplified since we restrict to negative neutral forms.Proof of Lemma 5.4.23. We proceed by induction over the derivation of the typing judgment Ψ, s : τ ; ∆ NF f t : σ to produceΨ, s : τ ; ∆, α : κ & I NF f o : σ Ψ, s : τ ; • NF f d i : κ i such that o[ s d 1 . . . d k ), () /α] = βη t and that there be the same number of occurrences of s in both t and (λα.o) s d 1 . . . d k , () . Since we shall need to often emulate the weakening of the variable α, we write w α (u) for the term let () = π 2 (α) in u, noting that it is focused normal as long as u is either NF f or NE - f . For brevity, we use the notations o , d 1 . . . throughout for data obtained by applying the induction hypotheses without recalling all of the relevant property and merely explain how to build a suitable o.• If the last rule applied is a variable lookup, then the term in question must be s itself.Furthermore, we must have k = 0, so we may simply take o = α to conclude. • If the last rule considered is the following instance of the application rule Ψ, s : τ ; ∆ NE - If there is an occurrence of s in t, we apply the induction hypothesis to t to obtain some o and d i s and set o = o u to conclude.-Otherwise, we may apply the induction hypothesis to u to obtain some o and d i s and set o = t o to conclude. • If the last rule considered is the following instance of the application rule Ψ, s : τ ; ∆ NE - So we may set o = λx.o to conclude.• t cannot be non-linear λ-abstraction as σ is assumed to be purely linear.• If the last rule applied is a ⊗-introductionΨ, s : τ ; ∆ NF f t : σ Ψ, s : τ ; ∆ NF f t : σ Ψ, s : τ ; ∆, ∆ NF f t ⊗ t : σ ⊗ σthen apply the induction hypothesis to the first premise if possible to get o , d 1 , . . . and set o = o ⊗ t ; otherwise, do the analogous operation with the second premise.• If the last rule applied is a ⊗-elimination Ψ, s : τ ; ∆ NE - NF f let x ⊗ y = t in u : σ first note that we have we have σ and σ purely linear because of Lemma 5.4.24 applied to the first premise. We have then two subcases, according to whether s occurs in t or not. If it does, apply the induction hypothesis to the first premise to get o , d 1 , . . . If the last rule applied is a pairing Ψ, s : τ ; ∆ NF f t : σ Ψ, s : τ ; ∆ NF f t : σ Ψ, s : τ ; ∆ NF f t, t : σ & σ then apply the induction hypothesis to the first premise o , d 1 , . . . and set o = o , w α (t ) . If not possible because there is no occurrences of s in t, do the analogous thing with t . • If the last rule applied is a projection Ψ, s : τ ; ∆ NE - we apply the induction hypothesis to obtain o , d 1 , . . . and set o = π i o . • The last rule applied cannot be an introduction of because we need an occurrence of s. • If the last rule applied is an introduction of ⊕ Ψ, s : τ ; ∆ NF f t : σ i Ψ, s : τ ; ∆ NF f in i (t) : σ 1 ⊕ σ 2 we may simply apply the induction hypothesis to get o and set o = in i (o ). • If the last rule applied is an elimination of ⊕ Ψ; ∆ NE - If it is applicable to the second premise so that u = βη o [ s d 1 . . . d k , () /α], we set o = case(t, x.o , y.w α (v)). -Otherwise, v = βη o [ s d 1 . . . d k , () /α] and we set o = case(t, x.w α (u), y.o ).

	CHAPTER 6
	f Ψ, s : τ ; ∆ NE -t : σ σ t : σ 1 & σ 2 Ψ, s : τ ; ∆ NF f f t : σ i

Proof idea. By induction on the judgment Ψ, s : τ ; ∆ NE - f t : σ l+1 → . . . → σ . f u : σ Ψ, s : τ ; ∆, ∆ NE - f t u : σ then, we have two subcases, according to whether there is an occurrence of s in t or not.

f t : σ → σ Ψ, s : τ ; • NF f u : σ Ψ, s : τ ; ∆ NE - f t u : σ then,

we use Lemma 5.4.25 to obtain d 1 , . . . , d k-1 , set d k = u and o = α to conclude. • If the last rule applied is a linear λ-abstraction Ψ; ∆, x : σ NF f t : σ Ψ; ∆ NF f λx.t we may apply the induction hypothesis to obtain o , d 1 , . . . such that t = o [s d 1 . . .]. Note that x does not occur in any of the d i and that we have Ψ; ∆, x : σ o : κ σ. f t : σ ⊗ σ Ψ, s : τ ; ∆ , x : σ, y : σ NF f u : σ Ψ, s : τ ; ∆ and set o = let x ⊗ y = o in u, otherwise apply it to the second premise and set o = let x ⊗ y = t in o . • f t : σ ⊕ σ Ψ; ∆ , x : σ NF u : σ Ψ; ∆ , y : σ NF v : σ Ψ; ∆, ∆ NF case(t, x.u, y.v) : σ first note that σ and σ are necessarily purely linear because of Lemma 5.4.24. We then try to apply the induction hypothesis to one of the premise (at least one of them has an occurrence of s) to get some o , d 1 , . . . -If we can apply it to the first premise so that t = βη o [ s d 1 . . . d k , () /α], we can conclude by setting o = case(o , x.u, y.v). -

Sadly, my list of upcoming papers tends to grow faster than my list of written papers… In this specific case, I first wanted to solve another related problem -see https://cstheory.stackexchange.com/questions/

1.1. BACKGROUND

Melliès has coined the term "micrologic"[START_REF] Melliès | Une étude micrologique de la négation[END_REF] to describe the quest for the "elementary particles"

In fact this functor arises from the fact that PFSetΣ can be built from an (SR ˚)⊕-enriched category

This is slightly non-standard; the more usual notion would be that ar be only a family of numbers Σ → N. Our choice will be more convenient to describe some constructions in Chapter 6.

What is called a "sequential machine" in[START_REF] Krohn | Algebraic theory of machines. I. Prime decomposition theorem for finite semigroups and machines[END_REF] is in fact a Mealy machine.

This word is used here in an informal sense.

This is a consequence of the older and stronger fact that macro tree transducers with linearly bounded growth compute regular tree functions[START_REF] Engelfriet | Macro Tree Translations of Linear Size Increase are MSO Definable[END_REF].

Those characterizations had previously been announced in an invited paper by Sénizergues[START_REF] Sénizergues | Sequences of Level 1[END_REF]. Some other results announced in[START_REF] Sénizergues | Sequences of Level 1[END_REF] are proved in[START_REF] Cadilhac | On Polynomial Recursive Sequences[END_REF]. Moreover, the definition of HDT0L systems given in [Sén07; FMS14] makes slightly different choices of presentation: the family (hc)c∈Γ is presented as a morphism H : Γ * → Hom(∆ * , ∆ * ), and an initial letter is used instead of an initial word; this is of no consequence regarding the functions that can be expressed.

Except for that, this enumeration of Q is arbitrary. We write q (i) instead of qi to avoid confusion with the run of an automaton.

In the case of "map", the Lisp and ML traditions agree, which is not the case for "reduce" vs "fold".

This discussion does not use any of the property of regular functions; the same would apply to any class of function defined as a closure under CbS.

This is slightly abusive, as λ, ρ, α and γ are also part of the structure and not uniquely determined from the triple (C, ⊗, I).

Actually, complete DFA, i.e. DFA with total transition functions.

We keep this notion informal, but suffices to say that this is intended to be definable internally to λ ⊕& .

This is indeed a • ψ(s ) and not a • ψ(s) = a • ψ(s ) • bb. If the input turns out to end there, the final output function will provide the missing suffixF (q b ) = bbb to obtain f (s) = a • ψ(s) • b = a • ψ(s ) • bbb.

• L[f ] q is a regular language for all q ∈ Q(A);

• ρ[f ] q,r is a comparison-free polyregular function for all q, r.

We will apply this semantic notion of cfp function to denotations of λ ⊕& -terms. First, let -: L(Σ) → SR ⊕Σ (Σ) be the functor given by Lemma 5.2.6. For any λ ⊕& -term t such that Σ; • t : A (where the typing context Σ is defined at the beginning of §5.2.1), write λ().t = λx. let () = x in t and t = λ().t ∈ A Σ (indeed, λ().t ∈ Hom L (I, A)). This is not sufficient to interpret terms of type Str Γ [τ ] → Str Σ , however, so we introduce the following ad-hoc notion.

Definition 5.3.5. Suppose we are given a λ ⊕& -term t with Σ, s : Str Γ [τ ]; • t : σ where σ and τ are purely linear. We define the interpretation |t| :

With these definitions in mind, we can state the suitable semantic generalization of our desired soundness result.

Theorem 5.3.6. Let t be a λ ⊕& -term such that Σ, s : Str Γ [τ ]; • t : σ with σ and τ purely linear. Then the map between sets |t| : Γ * → σ Σ is comparison-free polyregular.

Let us show that this indeed implies what we want.

Proof that (λ ⊕& , →)-definable =⇒ comparison-free polyregular.

By Definition 5.2.3 and using the η-conversion rules, f (w) b 1 . . . b |Σ| ε L = f (w). The fact that -is a morphism of streaming settings (Lemma 5.2.6), combined with the observation that the bijection -SR ⊕& : o Σ ∼ --→ Σ * is an instance of Proposition 5.3.3, leads to f (w) = ρ[g] q,r (w) where q, r are such that {q} = Q( o ) and {r} = R( o ) q (note that by Lemma 5.2.6, o = ' SR ⊕& = ι ⊕& ({•})). Since g is comparison-free polyregular, so is f = ρ[g] q,r by definition.

We now intend to prove Theorem 5.3.6. The heart of the argument is contained in the following lemma involving a semantic counterpart to composition by substitution ( §3.1).

Lemma 5.3.7. Let f c : Γ * → A A Σ for c ∈ Γ and g : Γ * → A Σ be comparison-free polyregular. Then the map h : Γ * → A Σ defined below is also cfp:

where, for ϕ ∈ A A Σ , we write Λ -(ϕ) for the corresponding morphism A → Σ A (to be precise, Λ -is the inverse of the bijection Λ defined in Proposition 4.1.9).

A couple of further properties stating that comparison-free polyregular functions play well with the categorical structure of SR(Σ) ⊕& are also helpful. The first one allows to combine two functions f : Γ * → A Σ and g : Γ * → B Σ into a single function Γ * → A ⊗ B Σ . The second one pertains to the action of SR(Σ) ⊕& on A Σ . Lemma 5.3.8. If f : Γ * → A Σ and g : Γ * → B Σ are comparison-free polyregular, so are the following:

We do so by going by induction over the judgment Ψ ; ∆ 1 NF u : τ ⊗ σ.

-If we have Ψ ; ∆ 1 NE u : τ ⊗ σ, then we may use the outer inductive hypothesis Ψ ; ∆ 2 , x : τ, y : σ |= t[γ, δ 2 ] : κ and apply Lemma 5.4.11. -If we have u = let x ⊗ y = u in u , applying the induction hypothesis, we have some v such that

We may thus conclude using the sequence of reductions below and Lemma 5.4.11

-Finally, if u = u ⊗ u , we apply the outer induction hypothesis with the substitution γ, δ 2 , u /x, u /y to conclude.

To finish proving our normalization result (Theorem 5.4.1), instantiate Theorem 5.4.12 in the case of a trivial substitution (t i = x i and u j = a j ) using Corollary 5.4.10 and conclude with Theorem 5.4.9. 5.4.2. More useful syntactic properties. The material presented here will be useful for the proofs of Proposition 5.1.7 and Lemma 5.2.5. Definition 5.4.13. Write + for the least preorder relation over λ ⊕& types satisfying the following for every types τ and σ

We say that τ is a strictly positive subtype of σ whenever τ + σ. Proof. The first point is an easy corollary of Theorem 5.4.1. The second point follows from a case analysis, using the following facts:

Proof. It does not satisfy the conclusion of the theorem below.

Theorem 7.0.2. Let f : Γ * → Σ * be defined by a λ -term t :

Str Σ where τ is purely linear. The Parikh vector (containing the number of occurrences of each letter) of f (w) is entirely determined by the Parikh vector of w ∈ Γ * . Moreover, the relationship is given by an affine map (in the sense of linear algebra) with integer coefficients.

Proof sketch. First, we claim that an analogous property to Lemma 5.2.5 holds in the λ -calculus: t = βη λs.λ ! a 1 . . . . λ ! a |Σ| .λ ! a ε . o (s d 1 . . . d |Γ| d ε ) where o and the d i are purely linear λ -terms with no occurrence of s. Since we only have negative connectivessee the discussion at the beginning of Chapter 5 -in this fragment, this can be established much more easily than Lemma 5.2.5, by examining β-normal η-long forms.

The idea is then to work with the following "measure" on purely linear λ -terms with the non-linear free variables a 1 , . . . , a |Σ| , a ε : t c is the number of occurrences in t of a c (i.e. a i when c is the i-th letter of Σ). In fact this is a denotational semantics: it is not hard to check invariance by = βη manually, but more conceptually, it corresponds to the commutative monoid (N, +) seen as a one-object monoidal closed (and even compact closed) category.

If Despite this, moving from affineness to linearity does not affect the expressive power of our non-commutative λ-calculus -which we call the λ ℘-calculus -concerning languages.

In other words, one can express all star-free languages without weakening. Since linearity is more restrictive than affineness, the fact that λ ℘-definable languages are regular -i.e. the "only if" part of Theorem 1.2.1 -is already a consequence of the work done in [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF]; we shall recall briefly the key ideas in §7.2, and discuss (vaguely) an alternative approach to establishing the central property. Most of our focus in this chapter is on the converse ( §7.3): we show how to encode star-free languages as λ ℘-terms.

The λ ℘-calculus

The terms and types of the λ ℘-calculus are defined by the respective grammars σ, τ ::

There are two rules for β-reduction (closed under contexts)

and the remaining conversion rules are the expected η-reduction/η-expansion rules. Just as in the case of the λ ⊕& -calculus (cf. §5.1), the typing judgements make use of dual contexts (it is indeed a common feature, originating in [START_REF] Barber | Dual Intuitionistic Linear Logic[END_REF]): they are of the form Ψ; ∆ t : τ . The key difference with the λ ⊕& -calculus is that ∆ is an ordered list of bindings -this order is essential for non-commutativity. The typing rules are as follows, where ∆ • ∆ denotes the concatenation of the ordered lists ∆ and ∆ :

This coresponds to the fragment of Polakow and Pfenning's Intuitionistic Non-Commutative Linear Logic [PP99a; PP99b] that contains only and ' ' are called "intuitionistic functions" (→) and "right ordered functions" ( ) in the terminology of [START_REF] Polakow | Natural Deduction for Intuitionistic Non-communicative Linear Logic[END_REF]. (Their system additionally contains "linear [commutative] functions" and "left ordered functions".)

Remark 7.1.1. Morally, the non-affine variables "commute with everything". More formally, one could translate the λ ℘-calculus into a non-commutative version of Intuitionistic Affine Logic whose exponential modality '!' incorporates the customary rules (see e.g. [START_REF] Yetter | Quantales and (noncommutative) linear logic[END_REF])

The following property is analogous to the argument in the proof of Proposition 5.1.16. We write u • t = λx. u (t x) -this composition is associative modulo = βη .

admits exactly two closed inhabitants (this would not be the case in an affine setting!):

It is a sort of continuation-passing-style [START_REF] Reynolds | The discoveries of continuations[END_REF] transformed version of the boolean type

. (Interestingly, while Matsuoka works in commutative multiplicative linear logic, he mentions the potential relevance of planarity, i.e. non-commutativity, to expressivity questions.)

Let us show that a few pseudo-weakening functions are definable: We also have the following boolean operations:

)) (this definition of and was found by Noam Zeilberger). One could wonder whether, just like for conjunction, there is some definition of negation that does not require a substitution in the input type. We shall see in Example 7.1.3 that this is not the case. 7.1.2. Strings and λ ℘-definable languages. The linear Church encodings of strings are defined as in Section 5.1.2. This works in the λ ℘-calculus, with all the expected properties, e.g. the bijection between Σ * and the terms of type Str Σ up to βη-equivalence. Proving this is, again, just a matter of examining β-normal η-long forms, thanks to the fact that the λ ℘-calculus only has negative connectives. Note that while our type of strings -which specializes the encodings of ranked trees -is slightly different from the one in [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF], the two are interconvertible (one of the directions is similar to what happens in Lemma 7.3.1) so this has no significant effect (cf. [NP20, Remark 5.7]). • For t a = cstt and t b = λx. x, g decides the language of words in {a, b} * that contain at least one a; this language is indeed star-free as it can be expressed as ∅ c a∅ c .

Remark 7.3.3. Trying to characterize string-to-string function classes (first-order transductions?) using StrW Σ [τ ] StrW Γ would be rather abusive: terms of this type are not even guaranteed a priori to give, for two representations of the same string, two outputs that also represent a common string (but we will build terms for which this property holds).

The advantage of working with aperiodic sequential functions is that they can be assembled from small "building blocks" by function composition, as the Krohn-Rhodes decomposition (Theorem 2.2.4) tells us. Our proof strategy for the above theorem will consist in encoding these blocks (Lemma 7.3.7) and composing them together (Lemma 7.1.2). To deduce the desired result, we rely on two lemmas: Lemma 7.3.4 (classical). If a language L ⊆ Σ * is star-free, then its (string-valued) indicator function χ L : Σ * → {1} * , defined by χ L (w) = 1 if w ∈ L and χ L (w) = ε otherwise, is aperiodic sequential.

Remark 7.3.5. The converse is also true; more generally, the preimage of a star-free language by an aperiodic sequential function is star-free, and the preimage of a regular language is regular. But we will not need this here. StrW Γ , for a purely linear type τ depending on the function.

Let us start by exposing the rough idea of the encoding's trick using set-theoretic maps. This part is the same as in [START_REF] Thành | Implicit automata in typed λ-calculi I: aperiodicity in a non-commutative logic[END_REF]. We reuse the notations of Definition 2.2.1 and assume w.l.o.g. that the set of states is Q = {1, 2}.

Suppose that at some point, after processing a prefix of the input, the transducer has arrived in state 1 (resp. 2) and in the meantime has outputted w ∈ Γ * . We can represent this "history" by the pair (κ