1 Introduction
sec:introduction
Transducers are a fundamental model to describe programs manipulating strings. They date back to the very first works in theoretical computer science, and are already present in the pioneering works on finite state automata [23, 1]. While finite state automata are very robust w.r.t. modifications of the model such as nondeterminism and twowayness, this is not the case for transducers. These two extensions do affect the expressive power of the model. Nondeterminism is a feature very useful for modelisation and specification purposes. However, when one turns to implementation, deriving a sequential, i.e. inputdeterministic, transducer is a major issue. A natural and fundamental problem thus consists, given a (nondeterministic) transducer, in deciding whether there exists an equivalent sequential transducer. This problem is called the sequentiality problem.
In [10], Choffrut addressed this problem for the class of functional (oneway) finite state transducers, which corresponds to socalled rational functions. He proved a multiple characterisation of the transducers admitting an equivalent sequential transducer. This characterisation includes a machineindependent property, namely a Lipschitz property of the function realised by the transducer. It also involves a pattern property, namely the twinning property, that allows to prove that the sequentiality problem is decidable in polynomial time for the class of functional finite state transducers [25]. This seminal work has led to developments on the sequentiality of finite state transducers [8, 7]. These results have also been extended to weighted automata [9, 19, 15] and to tree transducers [24]. See also [20] for a survey on sequentiality problems.
While the model of oneway transducers is now rather wellunderstood, a current challenge is to address the socalled class of regular functions, which corresponds to functions realised by twoway transducers. This class has attracted a lot of interest during the last years. It is closed under composition [11] and enjoys alternative presentations using logic [14], a deterministic oneway model equipped with registers, named streaming string transducers [2] (SST for short), as well as a set of regular combinators [4, 6, 12]. This class of functions is much more expressive, as it captures for instance the mirror image and the copy. Yet, it has good decidability properties: equivalence and typechecking are decidable in PSpace [18, 3]. We refer the interested reader to [16] for a recent survey. Intuitively, twoway finite state transducers (resp. SST) extend oneway finite state transducers with two important features: firstly, they can go through the input word both ways (resp. they can prepend and append words to registers), and secondly, they can perform multiple passes (resp. they can perform register concatenation).
In this paper, we lift the results of Choffrut [10] to a class of transducers that can perform the first of the two features mentioned above, thus generalising the class of rational functions. More precisely, we consider transducers which, at each transition, extend the output word produced so far by prepending and appending two words to it. This operation can be defined as the extension of a word with a context, and we call these transducers the stringtocontext transducers. However, it is important to notice that that they still describe functions from strings to strings. We characterise the functional stringtocontext transducers that admit an equivalent sequential stringtocontext transducer through a machine independent property: the function realised by the transducer satisfies a Lipschitz property that involves an original factor distance and a pattern property of the transducer which we call contextual twinning property, and that generalises the twinning property to contexts. We also prove that the sequentiality problem for these transducers is in the class coNP.
A key technical tool of the result of [10] was a combinatorial analysis of the loops, showing that the output words of synchronised loops have conjugate primitive roots. For stringtocontext transducers, the situation is more complex, as the combinatorics may involve the words of the two sides of the context. Intuitively, when these words do commute with the output word produced so far, it is possible for instance to move to the right a part of the word produced on the left. In order to prove our results, we thus dig into the combinatorics of contexts associated with loops, identifying different possible situations, and we then use this analysis to describe an original determinisation construction.
Our results also have a strong connection with the register minimisation problem for SST. This problem consists in determining, given an SST and a natural number , whether there exists an equivalent SST with registers. It has been proven in [13] that the problem is decidable for SST that can only append words to registers, and the proof crucially relies on the fact that the case exactly corresponds to the sequentiality problem of oneway finite state transducers. Hence, our results constitute a first step towards register minimisation for SST without register concatenation. The register minimisation problem for nondeterministic SST has also been studied in [5] for the case of concatenationfree SST. The targeted model being nondeterministic, the two problems are independent.
Due to lack of space, omitted proofs can be found in the Appendix.
2 Models
sec:preliminaries
Words, contexts and partial functions
Let be a finite alphabet. The set of finite words (or strings) over is denoted by . The empty word is denoted by . The length of a word is denoted by . We say that a word is a prefix (resp. suffix) of a word if there exists a word such that (resp. ). We say that two words are conjugates if there exist two words such that and . If this holds, we write . The primitive root of a word , denoted , is the shortest word such that for some . [[17]]l:Fine Let . There exists such that if there is a common factor of and of length at least , then .
Given two words , the longest common prefix (resp. suffix) of and is denoted by (resp. ). We define the prefix distance between and , denoted by , as .
Given a word , we say that is a factor of if there exist words such that . Given two words , a longest common factor of and is a word of maximal length that is a factor of both and . Note that this word is not necessarily unique. We denote such a word by . The factor distance between and , denoted by , is defined as . This definition is correct as is independent of the choice of the common factor of maximal length.
Using a careful case analysis, we can prove that is indeed a distance, the only difficulty lying in the subadditivity:
r:distf is a distance.
Given a finite alphabet , a context on is a pair of words . The set of contexts on is denoted . The empty context is denoted by . For a context , we denote by (resp. ) its left (resp. right) component: (resp. ). The length of a context is defined by . The lateralized length of a context is defined by . For a context and a word , we write for the word . We define the concatenation of two contexts as the context . Last, given a context and a word , we denote by the unique word such that , when such a word exists.
Given a set of contexts , we denote by the longest common context of elements in , defined as . We also write .
We consider two sets . Given , we let . We denote the set of partial functions from to as . Given , we write , and we denote by its domain. When more convenient, we may also see elements of as subsets of . Last, given , we let denote some such that and .
StringtoContext and StringtoString Transducers
Let be two finite alphabets. A stringtocontext transducer (S2C for short) from to is a tuple where is a finite set of states, (resp. ) is the finite initial (resp. final) function, is the finite set of transitions.
A state is said to be initial (resp. final) if (resp. ). We depict as as (resp. ) the fact that (resp. ). A run from a state to a state on a word where for all , , is a sequence of transitions: . The output of such a run is the context , and is denoted by . We depict this situation as . The set of runs of is denoted . The run is said to be accepting if is initial and final. This stringtocontext transducer computes a relation defined by the set of pairs such that there are with . Thus, even if its definition involves contexts on , the semantics of is a relation between words on and words on . Given an S2C , we define the constant as . Given , we denote by the S2C obtained by replacing with . An S2C is trimmed if each of its states appears in some accepting run. W.l.o.g., we assume that the stringtocontext transducers we consider are trimmed. An S2C from to is functional if the relation is a function from to . An S2C is sequential if is a singleton and if for every transitions , we have and .
The classical model of finitestate transducers is recovered in the following definition: Let be two finite alphabets. A stringtocontext transducer is a stringtostring transducer (S2S for short) from to if, for all , , and for all , .
Notations defined for S2C hold for classical transducers as is. For an S2S, we write (resp. , and ) instead of (resp. , and ).
Given an S2C , we define its right S2S, denoted , as the tuple where, for all , and , and, for all , . Its left S2S is defined similarly, and by applying the mirror image on its output labels.
Two examples of S2C (not realisable by S2S) are depicted on e:StoC.
3 Lipschitz and Twinning Properties
sec:lipschitztwinning
We recall the properties considered in [10], and the associated results.
We say that a function satisfies the Lipschitz property if there exists such that .
We consider an S2S and . Two states and are said to be twinned if for any two runs and , where and are initial, we have for all , . An S2S satisfies the twinning property (TP) if there exists such that any two of its states are twinned.
[[10]] Let be a functional S2S. The following assertions are equivalent:

there exists an equivalent sequential S2S,

satisfies the Lipschitz property,

satisfies the twinning property.
We present the adaptation of these properties to stringtocontext transducers. We say that satisfies the contextual Lipschitz property (CLip) if there exists such that .
d:ctp We consider an S2C and . Two states and are said to be contextually twinned if for any two runs and , where and are initial, we have for all , . An S2C satisfies the contextual twinning property (CTP) if there exists such that any two of its states are contextually twinned.
4 Main Result
sec:mainresult
The main result of the paper is the following theorem, which extends to stringtocontext transducers the characterisation of sequential transducers amongst functional ones.
t:main Let be a functional S2C. The following assertions are equivalent:

there exists an equivalent sequential stringtocontext transducer,

satisfies the contextual Lipschitz property,

satisfies the contextual twinning property.
Proof.
The implications and are proved in r:detimplieslip and r:lipimpliesctp respectively. The implication is more involved, and is based on a careful analysis of word combinatorics of loops of stringtocontext transducers satisfying the CTP. This analysis is summarised in r:ctpimplies2loop and used in sec:construction to describe the construction of an equivalent sequential S2C. ∎
r:detimplieslip Let be a functional S2C realizing the function . If there exists an equivalent sequential S2C, then satisfies the contextual Lipschitz property.
Proof.
Let us consider the equivalent sequential S2C. We claim that is contextLipschitzian with coefficient . Consider two input words in the domain of . If , then the result is trivial. Otherwise, let
Comments
There are no comments yet.