Approximate Problems for Finite Transducers
Abstract
Finite (word) state transducers extend finite state automata by defining a binary relation over finite words, called rational relation. If the rational relation is the graph of a function, this function is said to be rational. The class of sequential functions is a strict subclass of rational functions, defined as the functions recognised by input-deterministic finite state transducers. The class membership problems between those classes are known to be decidable. We consider approximate versions of these problems and show they are decidable as well. This includes the approximate functionality problem, which asks whether given a rational relation (by a transducer), is it close to a rational function, and the approximate determinisation problem, which asks whether a given rational function is close to a sequential function. We prove decidability results for several classical distances, including Hamming and Levenshtein edit distance. Finally, we investigate the approximate uniformisation problem, which asks, given a rational relation , whether there exists a sequential function that is close to some function uniformising . As its exact version, we prove that this problem is undecidable.
Keywords and phrases:
Finite state transducers, Edit distance, Determinisation, FunctionalityCategory:
Track B: Automata, Logic, Semantics, and Theory of ProgrammingFunding:
Emmanuel Filiot: He is a senior research associate at the National Fund for Scientific Research (F.R.S.-FNRS) in Belgium. His work is supported by the FNRS project T011724F.Copyright and License:
![[Uncaptioned image]](x1.png)
2012 ACM Subject Classification:
Theory of computation Transducers ; Theory of computation Quantitative automataEditors:
Keren Censor-Hillel, Fabrizio Grandoni, Joël Ouaknine, and Gabriele PuppisSeries and Publisher:

1 Introduction
Finite (state) transducers are a fundamental automata model to compute functions from words to words. The literature on finite state transducers is rich, and dates back to the early days of computer science, where they were called generalised sequential machines [29, 20]. See also [28, 19] and the references therein. Finite state transducers extend finite automata with outputs on their transitions, allowing them to produce none or several symbols. While finite automata recognise languages of (finite) words, finite transducers recognise binary relations from words to words, called rational relations. When the rational relation is the graph of a function, it is called a rational function. This subclass is decidable within the class of rational relations. In particular, given a finite transducer , it is decidable in PTime whether recognises a function [21, 10]. In that case, is said to be functional. Beyond the fact that it is a natural restriction, the class of functional transducers is of high importance, as many problems known to be undecidable for transducers (such as inclusion and equivalence), become decidable under the functional restriction.
Determinisation.
It turns out that non-determinism is needed for finite transducers to capture rational functions. A canonical example is the function which moves the last symbol upfront. For example, and . Since the number of symbols that have to be read before reading the last symbol is arbitrarily large, a finite transducer recognising needs non-determinism to guess the last symbol, as illustrated by the following transducer:
So non-determinism, unlike finite automata, brings some extra expressive power when it comes to finite transducers. On the other hand, non-determinism also yields some inefficiency issues when the input is received sequentially as a stream, because the whole input may have to be stored in memory until the first output symbol can be produced. This motivates the class of sequential functions, as the rational functions recognised by input-deterministic finite transducers, and the determinisation problem: given an arbitrary finite transducer, does it recognise a sequential function? In other words, can it be (input-) determinised? This well-studied problem is known to be decidable in PTime [10]. The determinisation problem is a central problem in automata theory. It has been for instance extensively considered for weighted automata [27], and a long-standing open problem is whether this problem is decidable for -automata [25].
Approximate determinisation.
The function is not sequential, in other words, the latter transducer is not determinisable. It turns out that is almost sequential, in the sense that it is close to some sequential function, for instance the identity function . “Close to” can be defined in different ways, by lifting standard distances between words to functions and relations. Two classical examples are the Hamming distance and the Levenshtein distance, which respectively measure the minimal number of letter substitutions (respectively letter substitutions, insertion and deletion) to rewrite a word into another. A distance between words is lifted to functions with the same input domain, by taking the supremum of for all words in their domain. Coming back to our example, and are close for the edit distance, in the sense that is finite for the edit distance, but they are not close for the Hamming distance. This raises a natural and fundamental problem, called approximate determinisation problem (for a distance ): given a finite transducer recognising a function , does there exists a sequential function such that is finite? The approximate determinisation problem has been extensively studied for weighted automata [4, 8, 5] and quantitative automata [6, 7], but, to the best of our knowledge, nothing was known for transducers. However, if both and are given (by finite transducers), checking whether they are close (for various and classical edit distances) is known to be decidable, even if is rational but not sequential [2]. This can be seen as the verification variant of approximate determinisation, while approximate determinisation is rather a synthesis problem, for which only is given, and which asks to generate if it exists.
Contributions.
In this paper, our main result is the decidability of approximate determinisation of finite transducers, for a family of edit distances, which include Hamming and Levenshtein distances. For exact determinisation, determinisable finite transducers are characterised by the so called twinning property (TP) [10, 9, 13], a pattern that requires that the delay between any two outputs on the same input must not increase when taking synchronised cycles of the transducer. As noticed in [2], bounded (Levenshtein) edit distance is closely related to the notion of word conjugacy. In this paper, we consider an approximate version of the twinning property (ATP), with no constraints on the delay, but instead requires that the output words produced on the synchronised loops are conjugate. It turns out that ATP is not sufficient to characterise approximately determinisable transducers, and an extra property is needed, the strongly connected twinning property (STP), which requires that the TP holds within SCCs of the finite transducer. We show that a transducer is approximately determinisable (for Levenshtein distance) iff both ATP and STP hold and, if they do, we show how to approximately determinise . We also prove that ATP and STP are both decidable.
For Hamming distance, which only allows letter substitutions, determinizable transducers are characterized by both STP and another property called Hamming twinning property (HTP), which roughly requires that outputs on synchronised cycles have same length and do not mismatch. We also show that HTP is decidable, which entails decidability of approximate determinisation for Hamming distance.
We also consider another fundamental problem: the approximate functionality problem. Informally, the approximate functionality problem asks whether a given rational relation is almost a rational function, in the sense that is finite for some rational function , where is now the supremum, for all , of . We prove that the approximate functionality problem is decidable for all the distances in . We prove this problem to be decidable for classical distances, including Hamming and Levenshtein.
Finally, we consider the approximate (sequential) uniformisation problem. In its exact version, this problem asks whether for a given rational relation , there exists a sequential function with the same domain, and whose graph is included in . This problem is closely related to a synthesis problem, but is unfortunately undecidable [11, 17]. We consider its approximate variant, where instead of requiring that the graph of is included in , we require that it is close to some function whose graph is included in . However, despite this relaxation, we show that the problem is still undecidable. The proofs omitted are provided in the full version.
Other related works.
Variants of the determinisation problem have been considered in the literature [17]. However, this work considers the exact determinisation of a transducer , by some sequential transducer which is close to , for some notions of structural similarity between transducers. Robustness and continuity notions for finite transducers have been introduced in [22]. While those notions are also based on word distances, the problems considered are different from ours.
2 Preliminaries
For every , let denote the set , and for integers , let denote the set .
Words.
Let or denote finite alphabets of letters. A word is a sequence of letters. The empty word is denoted by . The length of a word is denoted by , in particular . The th letter of a word , for , is denoted by . The primitive root of is the shortest word such that . The set of all finite words over the alphabet is denoted by . A relation is sometimes called a transduction, and is said to be functional if it is the graph of a function. We let be the domain of , and for all , we let . Note that iff .
Finite State Automata and Transducers.
A (non-deterministic) finite automaton over an alphabet is denoted as a tuple where is the finite set of states, the set of initial states, the set of final states, and the transition relation. A run on a word is a sequence of states such that for all . It is accepting if and only if and . We denote by the language accepted by , i.e. the set of words on which there is an accepting run. An automaton is said to be trim if for any state , there exists at least one accepting run visiting . When is deterministic, we denote the transition function as .
A rational transducer over an input alphabet and an output alphabet is a (non-deterministic) finite automaton over a finite subset of . A transition of is often denoted . More generally, we write whenever there exists a run of from to on . The relation recognised by , denoted as , is defined as . Relations recognised by rational transducers are called rational relations.
When rational transducers recognise functions, it is often convenient to restrict their transitions to input words of length one exactly, modulo the possibility of producing a word on accepting states. This defines the so-called class of real-time transducers, which is expressively equivalent to rational transducers when restricted to functions. Formally, a real-time transducer (or simply, a transducer in the sequel) over input alphabet and output alphabet is given by a tuple where is a finite automaton over a finite subset of , and is a final output function.
Given a word where for all , a run of over is a sequence such that and for all . The input word of the run is and the output word of is if is a final state; otherwise, . As for rational transducers, the relation recognised by is defined as the set of pairs such that (resp. ) is the input (resp. output) word of some accepting run. We often confuse with , and may write for , or for .
The underlying automaton of is the automaton obtained by projection on inputs, i.e. the automaton such that . Note that . The transducer is said to be trim if its underlying automaton is trim.
The cartesian product, denoted , of two transducers , , is the transducer where if for , and, for .
(Sub)classes of rational functions.
Let be a real-time transducer. When is functional, is said to be functional as well, and the functions recognised by functional transducers are called rational functions. If the underlying automaton of is unambiguous (i.e., has at most one accepting run on any input), is referred to as an unambiguous transducer. It is well-known that a function is recognised by real-time transducer iff, it is recognised by a rational transducer [23] iff, it is recognised by an unambiguous transducer [15].
Sequential transducers are those whose underlying automaton is deterministic and they define functions known as sequential functions. In that case, we denote the transition function as . The functions recognised by transducers that are finite disjoint unions of sequential transducers are called multi-sequential functions [14, 24]. The symmetric counterpart of multi-sequential is the class of series-sequential functions.
A transducer is series-sequential if it is a finite disjoint union of sequential transducers where additionally, for every , there is a single transition from a (not necessarily final) state of to the initial state of the next transducer . Moreover, the initial state of is the initial state of (the initial states of is not considered as initial in , for all ). In particular, non-determinism is allowed, for all , only in state , from which it is possible to move to or to stay in . We denote111This notation should not be confused with the split-sum operator of [3], which is semantically different. such a transducer as . A function is series-sequential if it is recognised by a series-sequential transducer.
Distances between words and word functions.
We recall that a metric on a set is a mapping satisfying the separation, symmetry and triangle inequality axioms. Classical metrics between finite words are the edit distances. An edit distance between two words is the minimum number of edit operations required to rewrite a word to another if possible, and otherwise. Depending on the set of allowed edit operations, we get different edit distances. Table 1 gives widely used edit distances with their edit operations.
Edit Distances | Notation | Edit Operations |
---|---|---|
Hamming | letter-to-letter substitutions | |
Longest Common Subsequence | insertions and deletions | |
Levenshtein | insertions, deletions and substitutions | |
Damerau-Levenshtein | insertions, deletions, substitutions and swapping adjacent letters |
Distances between words can be lifted to that between functions from words to words.
Definition 2.1 (Metric over Functions [2]).
Let be a metric on words over some alphabet . Given two partial functions , the distance between and is defined as
It is shown that is a metric over functions (Proposition 3.2 of [2]). The distance between two functional transducers is defined as the distance between the functions they recognise. A notion closely related to the distance between functions is diameter of a relation. The diameter of a relation w.r.t. a metric , denoted by , is defined to be the supremum of the distance of every pair in the relation, i.e., .
The distance between rational functions and the diameter of rational relation w.r.t. the metrics given in Table 1 are computable [2]. The computability of distance and diameter relies on the notion of conjugacy. Two words and are conjugate if there exist words such that and . In other words, they are cyclic shifts of each other. For example, words and are conjugate with and . But and are not conjugate. Conjugacy is an equivalence relation over words.
Proposition 2.2.
Let be words and . For any metric in Table 1, if for all , then and the primitive roots of and are conjugate.
Proposition 2.3 ([2]).
Given a rational relation defined by a transducer , for if and only if every pair of input-output words generated by loops in are conjugate.
3 Twinning Properties
The class of sequential functions has been characterised by transducers satisfying the so called twinning property. In this section, we recall this property and introduce three variants – approximate twinning property, strongly connected twinning property and Hamming twinning property. We also show that these properties on transducers are decidable as well as independent of the representation of the transducers. All these properties are expressed as particular conditions on twinning patterns. A twinning pattern for a transducer over is a tuple such that the following runs (graphically depicted) exist:
The longest common prefix of any two words is denoted by . The delay between and , denoted by , is the pair such that and .
Definition 3.1 (Twinning Property (TP)).
Let be a trim transducer. We say that satisfies twinning property if for each twinning pattern such that are initial, holds.
It is well-known that a function recognised by a transducer is sequential iff satisfies the twinning property [12, 10]. We now define its approximate variant.
Definition 3.2 (Approximate Twinning Property (ATP)).
A trim transducer satisfies approximate twinning property if for each twinning pattern where are initial, the words and are conjugate.
Definition 3.3 (Strongly Connected Twinning Property (STP)).
A trim transducer satisfies strongly connected twinning property if for each twinning pattern such that (not necessarily initial) and are in the same strongly connected component, then holds.
Definition 3.4 (Hamming Twinning Property (HTP)).
A trim transducer satisfies Hamming twinning property if for each twinning pattern such that are initial, it holds that and there is no mismatch between and , i.e., for all position , .
Proposition 3.5.
Each trim transducer satisfying TP also satisfies ATP, STP and HTP.
The following lemma states that ATP, STP and HTP is preserved between transducers up to finite edit distance, and so in particular between equivalent transducers. This shows that these properties do not depend on the representation of the transductions, not even on the representation of close transductions.
Lemma 3.6.
Let and be two trim transducers satisfying , and such that there exists an edit distance in Table 1 and a constant for which
Then for every , satisfies if and only if satisfies . The statement also holds for and .
Proof sketch.
Let us suppose that satisfies , and show that so does . The converse is symmetric. We show this for ATP, and the proofs for STP and HTP, following similar arguments, are provided in the full version. Let be an instance of the twinning pattern for with and initial. Since is trim, there exist words and two accepting states such that:
Since , for all , . Iterating the loop of on sufficiently many times causes to also loop on some power of . Formally, there exist , states and words such that:
Let such that for all . Then in particular for all :
From the above inequalities, using Proposition 2.2, we get that and , the primitive roots of and respectively, are conjugate and for . Since satisfies the ATP, we also have that and are conjugate, and hence their primitive roots are conjugate and . By transitivity of the conjugacy relation, we get that and are conjugate. Further, since and . Therefore, and are conjugate, and thus the ATP holds for as well.
Note that the above lemma does not necessarily hold for TP. For instance, although and the transducer defining the identity function satisfies TP, the transducer defining does not.
We now show that checking each of the variants of the twinning property is decidable.
Lemma 3.7.
It is decidable whether a transducer satisfies ATP, STP and HTP.
Proof.
Let be a transducer that defines a relation .
Deciding ATP.
Let be the cartesian product of by itself. Verifying whether satisfies ATP reduces to checking that every loop in produces a pair of conjugate output words. For each state , we define a rational relation consisting of pairs of output words produced by the loops in rooted at . The transducer defining is obtained from by disregarding the inputs and setting both the initial and final state to be . It is known that we can decide whether every pair of words in a given rational relation is conjugate [1], which entails decidability of ATP.
Deciding STP.
The twinning property is decidable in polynomial time [10]. To decide STP, we first decompose the transducer into SCCs (in polynomial time). Then, for each SCC and each state , the SCC is seen as a transducer with initial state on which we check TP.
Deciding HTP.
We prove that it can be decided in PTime whether a transducer does not satisfy HTP. The HTP can be decomposed as a conjunction of two properties : on lengths and on mismatches. The (negation of) can be directly expressed in the pattern logic of [18], whose model-checking is in PTime. Then, we reduce the problem of deciding the to the emptiness problem of a Parikh automaton of polynomial size, in the size of the transducer . We recall that a Parikh automaton of dimension is an NFA extended with vectors in on its transitions. It accepts a word if there exists a run of the NFA that reaches an accepting state, and the sum of the vectors seen along the run belongs to some semi-linear set , given for example as a Presburger formula . The emptiness problem is known to be decidable in PTime when both and are constant [16, 18]. Our reduction follows standard ideas, and falls in this particular case. Let us give a bit more details.
A twinning pattern can be encoded as a word over , where is the transition relation of . In this construction, a run of is seen as a sequence of transitions. So, a twinning pattern consists of four runs, and where for all , is the run such that and is the run such that . The four runs are encoded as a word where is the convolution of and , i.e. the overlapping of and (and similarly for ). It should be clear that the set of words for all twinning pattern such that and are initial states is a regular language, recognizable by an NFA of polysize in the size of .
In order to check the condition that there is a mismatch between and on a position common to and , the NFA is extended with two counters and , and the linear acceptance condition (making it a Parikh automaton). Those two counters are used to guess the mismatching position. Initially, using an -loop, those two counters are incremented in parallel. At the end of this first phase, they therefore hold the same value, say . Then, the Parikh automaton is built in such a way that it checks that and , and . To do so, while reading any transition of producing some word , , is decremented by . The same is done when reading transitions of , but the automaton can non-deterministically guess that the counter is equal to , and store (in its state) the corresponding letter in . From then on, it never decrements the counter again. When the whole input has been read, the automaton has two letters stored in its state. It accepts the input, if those two letters are different, and if .
4 Approximate determinisation of rational functions
In this section, we define approximately determinisable functions and give decidable properties on transducers to characterise them.
Definition 4.1 (Approximate determinisation).
A rational function is approximately determinisable w.r.t. a metric if there exists a sequential function such that . In this case, we also say that approximately determinises w.r.t. .
Example 4.2.
The function from the introduction is approximately determinisable w.r.t. Levenshtein, while not w.r.t. Hamming distance. The function (depicted below) that maps , for , to for some separator is approximately determinisable w.r.t neither Levenshtein nor Hamming distance.
The approximate determinisation problem asks whether a rational function given as a functional transducer is approximately determinisable. We prove the following.
Theorem 4.3.
The approximate determinisation problem for rational functions w.r.t. Levenshtein family () and Hamming distance are decidable.
To prove the theorem, we show that ATP and STP characterise rational functions that can be approximately determinised w.r.t Levenshtein family (Lemma 4.8). Similarly, we establish that HTP and STP characterise rational functions that can be approximately determinised w.r.t Hamming distance. Theorem 4.3 then follows directly, as these three properties are decidable (Lemma 3.7). We now outline the proof strategy. The full proof for Levenshtein family is presented in Section 4.1, while the proof for Hamming distance, which follows a similar approach, is provided in the full version.
Levenshtein family.
We show with Proposition 4.4 that ATP and STP are necessary conditions for approximate determinisation with respect to Levenshtein family, a consequence of Lemma 3.6. The main challenge lies in proving that these properties are sufficient. To prove it, we first show that ATP alone suffices for certain subclasses of functional transducers: it enables the approximate determinisation of multi-sequential (Lemma 4.6) and unambiguous series-sequential (Lemma 4.7) functions. However, for rational functions in general, ATP does not suffice. For example, the transducer above for satisfies ATP but is not approximately determinisable. To extend this result to all rational functions, we incorporate STP. Given a functional transducer satisfying STP, we transform each strongly connected component of into a sequential transducer, effectively decomposing into a finite union of concatenations of sequential transducers. We then leverage our results for series-sequential and multi-sequential functions to approximate this structure with a sequential function (Lemma 4.8).
Figure 1 illustrates the main construction technique used in these proofs: Starting with a transducer that we aim to approximate, we construct a sequential transducer as follows. We apply the powerset construction to , introducing a distinguished state (marked by a in the figure) in each subset. The output is determined by the distinguished state’s production. If the distinguished state reaches a point where it has no continuation, we simply transition to another distinguished state. We show that ATP, combined with a carefully chosen priority scheme for selecting distinguished states, ensures bounded Levenshtein distance.
Hamming Distance.
The proof strategy is similar to the Levenshtein setting: We first show that HTP and STP are necessary conditions for approximate determinisation with respect to Hamming distance, we show that HTP alone suffices for the approximate determinisation of multi-sequential and series-sequential functions, and then we conclude by using STP to transform functional transducers into a finite unions of concatenations of sequential transducers.
While the core ideas remain similar to those used for the Levenshtein family, the constructions required for the Hamming distance, illustrated in Figure 1, are more intricate. Approximating the transducer with respect to the Levenshtein distance (as shown by in the figure) allows us, at each step, to select a run, produce its output, and disregard other possible runs. However, for the Hamming distance, it is crucial to carefully track the length difference between the produced output and the potential outputs of alternative runs. For instance, compare the outputs of , , and after reading :
We observe that after reading the input , realizes that its distinguished state is incorrect and jumps to another state. However, this shift causes a misalignment with , and reading additional ’s results in arbitrarily many mismatches.222The Levenshtein distance remains bounded, as inserting a letter at the start resynchronizes both outputs. In contrast, keeps in memory the delay relative to other runs. Although it may still introduce mismatches along the way, it ensures that when the distinguished run terminates, it adjusts the output while transitioning to another run, preventing long-term misalignment with .
4.1 Approximate determinisation for Levenshtein Family
We give a decidable characterisation of approximately determinisable rational functions w.r.t. Levenshtein family of distances – Levenshtein (), Longest common subsequence () and Damerau-Levenshtein (). They are all equivalent up to boundedness (Lemma 2.1 and Remark 7 of [2]), i.e., for any two rational functions , We show that a rational function is approximately determinisable w.r.t. Levenshtein family if and only if the transducer that defines the function satisfies both ATP and STP. One direction is a consequence of Lemma 3.6 as follows.
Proposition 4.4.
If a rational function given by a trim transducer is approximately determinisable w.r.t. a metric then satisfies both ATP and STP.
Proof.
Given that the rational function given by is approximately determinisable, i.e., there exists a sequential function given by a deterministic transducer such that . Since is a sequential transducer, it satisfies the twinning property, and consequently, also satisfies ATP and STP by Proposition 3.5. Since , we can conclude that also satisfies ATP as well as STP by applying Lemma 3.6.
Towards proving the other direction, we prove the following lemma, which provides a bound on the distance between the output words produced by distinct runs of a transducer on the same prefix of an input word using Proposition 2.3.
Lemma 4.5.
Let be a trim transducer satisfying the ATP. Then, there exists a constant such that for any two output words produced via two distinct runs of from an initial state on the same prefix of an input word, for .
Proof.
Let be the cartesian product of by itself. By designating all states of as final, and disregarding the input word, we obtain a new transducer that defines the relation , consisting of all pairs of output words produced by distinct runs of on the same prefix of an input word. Since satisfies ATP, every pair of output words produced by loops in on any input are conjugate. Consequently, since is obtained by ignoring the input word from , it satisfies the condition in Proposition 2.3. Hence, the diameter of w.r.t. Levenshtein family of distances is bounded.
Let . By the definition of diameter, it follows that for all . As a result, the distance between any two output words produced by distinct runs of on the same word is at most . Setting completes the proof.
For subclasses of rational functions, namely multi-sequential and series-sequential functions, we show that ATP is a sufficient condition for approximate determinisation.
Lemma 4.6.
A multi-sequential function given by a trim transducer is approximately determinisable w.r.t. a metric iff satisfies the ATP.
Proof.
() is direct by Proposition 4.4, and we show (). Since the transducer is multi-sequential, it is equivalent to some finite union of sequential transducers for some where is a sequential trim transducer for . By Lemma 3.6 and since satisfies ATP, the transducer also satisfies ATP. We construct a sequential transducer that approximately determinises , which intuitively is simply the cartesian product of which on each transition produces the output of the smallest index transducer for which that transition is defined. Let where
-
1.
The set of states is the cartesian product of the state set for such that where represents a dead state. The initial state is , and the set of final states is .
-
2.
The function is defined as: where for each , either or, if or is undefined, then . The output is set to , where is the smallest index for which the transition is defined.
-
3.
The output function is defined as where is the smallest index such that .
We show that w.r.t. Levenshtein family. From the construction, it is clear that and have the same domain. Consider an input word . Let be the smallest index such that , with output word, say . The transducer on input produces output, say , by concatenating output on each transition over input word produced by the smallest index transducer.
Thus, can be decomposed into where and for each , is the output produced by along the partial run of . For each , let denote the prefix of the output produced by upto . The output produced by on via is .
Observe that and (for ) is the output produced by and on the same prefix of input . By Lemma 4.5, we obtain . Similarly, since are the outputs of and on the same input prefix, we get .
In fact, on any input word, the distances between the outputs produced by and is less than or equal to , as there can be at most switches between runs. Hence, we get that is bounded.
The characterisation of Lemma 4.6 also holds for unambiguous series-sequential functions.
Lemma 4.7.
Let be an unambiguous transducer where each is a sequential trim transducer for . The series-sequential function defined by is approximately determinisable w.r.t. a metric if and only if satisfies ATP.
Proof.
() follows from Proposition 4.4, and we prove (). Similarly to the proof in Lemma 4.6, we construct a sequential transducer using a subset construction of such that approximately determinises . Although is functional, and each , , is sequential, the non-determinism arises between the transitions between one to the other. We assume an ordering for the states of for each . Intuitively, stores a subset of states of to capture all possible active runs on any input word. It produces the output of the active run of the smallest indexed sequential transducer, called the producing run. Upon termination of the producing run, it switches to the next active run of the smallest indexed sequential transducer. Since is unambiguous, there is at most one accepting run on any input. Formally, where
-
1.
is the power set of the states in . Each set has exactly one state marked with a to denote the currently producing run.
-
2.
is the initial state of and is marked with a .
-
3.
The transition function is defined as follows: where consists of all states in reachable from a state via transition in . The output word is set as follows. Let be the marked state in that belongs to the sequential transducer for some .
-
(a)
If a transition in exists within the same sequential transducer , then and is marked in .
-
(b)
If no transition exists from on within , but a transition in exists to a different sequential transducer, i.e., belongs to , then and is marked in . Such a transition is called a switch (to ).
-
(c)
Otherwise, choose the smallest numbered state that belongs to the smallest indexed sequential transducer where with a defined transition in , and set and mark in . Such a transition is also called a switch (to ).
-
(a)
-
4.
is the set of all states such that contains a final state of .
-
5.
The output function is defined, for , as for some arbitrary final state of , where is the output function of .
The number of states of is exponential in the number of states of . We now argue that the number of switches in the run of between the active runs of on any input word is less than the number of states in , and hence finite. Let be the number of states in for . Consider the run of on an arbitrary input word. Initially, only the initial state of is active in . As the run proceeds, if is the set of states of reached so far, then by construction of , the only marked state in is the last state of the active run of that belongs to the smallest indexed . If this run eventually dies, then two cases can happen: switches to another active run in , or, if none exists, switches to some active run in , where is minimal. If case happens, then no more states of are active, so will never switch again to in the future. The number of times case can happen is bounded by . Indeed, at most states of can be active at any moment, and since is sequential, the number of active states in can only decrease.
Now, if eventually switches to , at most states in are active, so at most switches of type can happen in , and so on until eventually terminates in some sequential transducer for . Therefore, in the worst case, switches times in before switching to for all . So, the overall number of switches in the run of is at most , which is exactly the number of states in .
Now we show that w.r.t. Levenshtein family. From the construction, it is clear that and have the same domain.
Consider an input word accepted by . Since is unambiguous, there is exactly one run in that accepts . Let and . From the construction of , can be decomposed into accommodating switches between the active runs of on the prefixes of , where each , is the output produced by an active run on the prefix of . For each , let denote the prefix of the output produced by the run up to .
Observe that and (for ) is the output produced by and on the same prefix of where . By using Lemma 4.5, we obtain . Similarly, since are the outputs of and on the same input prefix, it follows that . As a consequence,
Therefore, . This holds for any , and being the number of states in , we get that is bounded. We extend the characterisation to rational functions, where STP is also required to decompose the function into a finite union of series-sequential functions, which can then be transformed into a multi-sequential function using the properties of ATP.
Lemma 4.8.
A rational function given by a trim transducer is approximately determinisable w.r.t. a metric iff satisfies both ATP and STP.
Proof.
() follows from Proposition 4.4. We prove (). Assume that the rational function is given by an unambiguous transducer with set of states . Disregarding the labels on transitions, decompose into maximal SCCs . Consider the set of paths of the form such that is an SCC which contains an initial state, is an SCC which contains a final state, and for all , is a transition of from a state of to some state of . Let denote the trim subtransducer of that removes all the transitions in except the transitions and the transitions occurring in the SCCs ().
Note that since the SCCs are maximal, the set is finite. Now, it is straightforward to see that . From Lemma 3.6, we deduce satisfies both ATP as well as STP. Moreover, given ’s unambiguity, each input accepted by is accepted by exactly one and, each SCC within a has a single entry and exit point.
Since satisfies STP, each SCC in satisfies TP, with initial state being the unique entry point of the SCC. Hence we can determinise each SCC in and can obtain a series-sequential transducer that is equivalent to and indeed satisfies ATP by Lemma 3.6. From Lemma 4.7, there exists a sequential transducer for each , such that is finite.
Let for some . Consequently, the distance between and the new transducer is bounded where . Further, since satisfies ATP, we deduce also satisfies ATP by Lemma 3.6. Being multi-sequential and satisfying ATP, can be further approximately determinised using the construction outlined in Lemma 4.6. Let be the sequential transducer such that . Since is a metric, . Since both and are finite, is also finite.
5 Approximate decision problems for rational relations
In this section, we consider three possible generalisations of the approximate determinisation problem to rational relations. We describe those generalisations informally. The first one asks to decide whether a rational relation is close to some rational function. We call it the approximate functionality problem. The second one, that we still call determinisation problem, amounts to decide, given a rational relation , whether it is almost a sequential function. The third generalisation we consider is an approximate uniformisation problem, which asks, given , whether there exists a sequential function which is close to a function , whose graph is included in . We however show that this problem is undecidable.
We now proceed with the formal definitions and statements of our results. First, we need to extend the notion of distance from functions of words to binary relations of words. Towards this, we use Hausdorff distance between languages, defined as
Given a metric on words, and two relations , the distance between and is defined as follows.
Therefore, iff and there exists such that for all word in the domain and any output of on , there exists some output of on , such that , and symmetrically. In fact, is a metric on relations (see full version).
Approximate functionality problem.
Definition 5.1 (Approximate Functionalisation).
A rational relation is approximately functionalisable w.r.t. a metric if there exists a rational function such that .
The approximate functionality problem asks, given represented by a transducer, whether it is approximately functionalisable w.r.t. . Towards this, we define the following value for a relation and metric , which measures how different are output words over the same input. More precisely, it is the maximal distance between any two output words over the same input word, by :
Lemma 5.2.
For a rational relation given as a rational transducer, is computable for all metrics given in Table 1.
Proof.
Given a rational relation , we can construct a rational relation that consists of all pairs of output words of on any input, i.e., . If is a relation defined by a transducer , then the transducer obtained by (cartesian product of by itself) by ignoring the input word is a transducer that defines the relation . Observe that is equivalent to the diameter of w.r.t. . It is shown in [2] that diameter of a rational relation is computable for all metrics given in Table 1. Hence, for those metrics, is computable.
We now characterise rational relations which are approximately functionalisable.
Lemma 5.3.
A rational relation is approximately functionalisable w.r.t. a metric if and only if .
Proof.
() Assume that is approximately funtionalisable, i.e., there exists a rational function such that . Therefore, and there exists an integer such that for each input word , for each output word , (since is a function). By triangle inequality of metric , the distance between any two arbitrary output words on any input is . Since this holds for any input in the domain of , we get .
() Assume that . Let for some . We show that any uniformiser of the relation (a function of same domain as the relation whose graph is included in the relation) is a function that approximately functionalises the relation. Let be a uniformiser of . We prove that . Since is a uniformiser of , , and for all , it holds that . Since , the distance between the outputs of on any input is less than or equal to . Thus, for any input word , for each output word , (since is also an output of ). Hence, , i.e., is approximately functionalisable w.r.t. .
Since is computable (see Lemma 5.2), we get the following result.
Theorem 5.4.
The approximate functionality problem for rational relations given as rational transducers w.r.t. a metric given in Table 1 is decidable.
Approximate determinisation problem.
A rational relation is said to be approximately determinisable for a metric if it is almost a sequential function with respect to . Formally, it means that there exists a sequential function such that . We show that the associated decision problem, that we call approximate determinisation problem, is decidable for Levenshtein family of distances. In fact, the characterisation for approximate determinisation of rational functions also holds for rational relations.
Lemma 5.5.
A rational relation defined by a trim transducer is approximate determinisable w.r.t. Levenshtein family () if and only if satisfies ATP and STP.
Proof.
Let be a rational relation given by a transducer , and let . The proof of direction ) is the same as Proposition 4.4 when the function is replaced with a relation. For the other direction, assume that satisfies both ATP and STP. We first show that if is approximately functionalisable then it is approximately determinisable when (that defines ) satisfies both ATP and STP. Let be a rational function that approximately functionalises w.r.t. Levenshtein distance, i.e., . Thus, a functional transducer that defines satisfies . From Lemma 3.6, because satisfies both ATP and STP and , it follows that also satisfies ATP and STP. Using Lemma 4.8, the rational function is approximately determinisable. Let be a sequential function that approximately determinises w.r.t Levenshtein, i.e, . Since is a metric on relations, . Since both and are finite, we get . Hence, the rational relation is approximately determinisable.
Now it suffices to show that is approximately functionalisable w.r.t. Levenshtein family of distance. Towards this, we prove that when satisfies ATP. Observe that where is a rational relation that consists of all pairs of output words of on any input. Using Lemma 4.5, when satisfies ATP. Hence, , and is approximately functionalisable w.r.t. by virtue of Lemma 5.3.
Since ATP and STP are decidable for transducers (Lemma 3.7), we obtain the following.
Theorem 5.6.
The approximate determinisation problem for rational relations given as rational transducers w.r.t. a metric is decidable.
Approximate uniformisation problem.
Given a relation , a uniformiser of is a function such that and for all , it holds that . It is known that any rational relation admits a rational uniformiser [26], which is not true if we seek for a sequential uniformiser. Moreover, the problem of deciding whether a given rational relation admits a sequential uniformiser is undecidable [11]. We consider an approximate variant of this problem.
Definition 5.7 (Approximate Uniformisation).
A rational relation is approximately uniformisable w.r.t. a metric if there exists a uniformiser of and a sequential function such that . In that case, we say that is -approximate uniformisable by a sequential function.
In other words, is -approximate uniformisable by a sequential function iff there exists an integer such that for all , there exists with .
Theorem 5.8.
Checking whether a rational relation is -approximate uniformisable for is undecidable.
Proof.
Let and be two morphisms defining an instance of the post correspondence problem (PCP), which asks whether there exists such that . Let .
Let be the relation which as input takes any word of the form where for and . Let us define the outputs:
-
If , then the only output is .
-
If , then any word of the form for all is a valid output.
It can be shown that is rational, recognizable by some transducer . We now show that is approx-uniformisable iff PCP has no solution iff is exact-uniformisable. First, suppose that PCP has a solution and is approx-uniformisable by some sequential transducer , i.e. for some . Consider inputs of the form for , and let be such that , where is the initial state, is a state and are final states of . Since , for all , holds. Similarly, for all , there exist all different from such that
Since is uniformly bounded for all by some , by applying triangular inequalities, we get that for all , there exist all different from such that
Take , and fix a sequence of at most edits from
to
. In this sequence, at least one copy of
is not edited by the sequence. Therefore,
there exists some such that and hence . It is a contradiction since . Therefore is not approximately uniformisable.
Conversely, if there is no solution to PCP, then the following sequential function is an exact uniformiser of : on any input of the form it outputs .
6 Future works
In this paper, we proved that approximate determinisation is decidable for functional transducers, by checking various twinning properties. We have shown that HTP and STP are decidable in PTime, which entails that approximate determinization of functional transducers for the Hamming distance is decidable in PTime. For the other distances, such as Levenshtein distance, the time complexity is doubly exponential, as deciding conjugacy of a rational relation, and hence ATP, is doubly exponential [1]. We conjecture that this is suboptimal, and leave as future work finding a better upper-bound.
We show that approximate uniformisation is undecidable for Levenshtein family. We leave the case of Hamming distance as future work. The current undecidability proof for Levenshtein family, based on PCP, heavily requires that the lengths of the output words produced on transitions can differ, which may not guarantee that the total output lengths are the same, which is necessary to have a finite Hamming distance. Our proof also does not extend to the letter-to-letter setting, where both the given transducer and the required uniformiser process and produce a single letter on every transition. This problem is closely related to the standard Church synthesis for regular specifications, with the modification that the strategy to be synthesized is allowed to make a bounded number of errors. To our knowledge, this variant has not been studied in the literature.
Finally, we studied approximate decision problems up to finite distance. Another interesting question is to consider their “up to distance ” variant, where is given as input.
References
- [1] C. Aiswarya, Amaldev Manuel, and Saina Sunny. Deciding conjugacy of a rational relation - (extended abstract). In 28th International Conference on Developments in Language Theory, DLT 2024, volume 14791 of Lecture Notes in Computer Science, pages 37–50. Springer, 2024. doi:10.1007/978-3-031-66159-4_4.
- [2] C. Aiswarya, Amaldev Manuel, and Saina Sunny. Edit Distance of Finite State Transducers. In 51st International Colloquium on Automata, Languages, and Programming ICALP 2024, volume 297 of LIPIcs, pages 125:1–125:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.ICALP.2024.125.
- [3] Rajeev Alur, Adam Freilich, and Mukund Raghothaman. Regular combinators for string transformations. In Joint Meeting of the 23rd EACSL Annual Conference on Computer Science Logic (CSL) and the Twenty-Ninth Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), CSL-LICS ’14, pages 9:1–9:10. ACM, 2014. doi:10.1145/2603088.2603151.
- [4] Benjamin Aminof, Orna Kupferman, and Robby Lampert. Rigorous approximated determinization of weighted automata. In Proceedings of the 26th Annual IEEE Symposium on Logic in Computer Science, LICS 2011, pages 345–354. IEEE Computer Society, 2011. doi:10.1109/LICS.2011.50.
- [5] Benjamin Aminof, Orna Kupferman, and Robby Lampert. Rigorous approximated determinization of weighted automata. Theoretical Computer Science, 480:104–117, 2013. doi:10.1016/J.TCS.2013.02.005.
- [6] Udi Boker and Thomas A. Henzinger. Approximate determinization of quantitative automata. In IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science, FSTTCS 2012, volume 18 of LIPIcs, pages 362–373. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2012. doi:10.4230/LIPICS.FSTTCS.2012.362.
- [7] Udi Boker and Thomas A. Henzinger. Exact and approximate determinization of discounted-sum automata. Logical Methods in Computer Science, 10(1), 2014. doi:10.2168/LMCS-10(1:10)2014.
- [8] Adam L. Buchsbaum, Raffaele Giancarlo, and Jeffery R. Westbrook. An approximate determinization algorithm for weighted finite-state automata. Algorithmica, 30(4):503–526, 2001. doi:10.1007/S00453-001-0026-6.
- [9] Marie-Pierre Béal and Olivier Carton. Determinization of transducers over finite and infinite words. Theoretical Computer Science, 289(1):225–251, 2002. doi:10.1016/S0304-3975(01)00271-7.
- [10] Marie-Pierre Béal, Olivier Carton, Christophe Prieur, and Jacques Sakarovitch. Squaring transducers: an efficient procedure for deciding functionality and sequentiality. Theoretical Computer Science, 292(1):45–63, 2003. doi:10.1016/S0304-3975(01)00214-6.
- [11] Arnaud Carayol and Christof Loeding. Uniformization in automata theory. In 14th International Congress of Logic, Methodology and Philosophy of Science, pages 153–178. London: College Publications, 2015.
- [12] Christian Choffrut. Une caractérisation des fonctions séquentielles et des fonctions sous-séquentielles en tant que relations rationnelles. Theoretical Computer Science, 5(3):325–337, 1977. doi:10.1016/0304-3975(77)90049-4.
- [13] Christian Choffrut and Serge Grigorieff. Uniformization of rational relations. In Jewels are Forever, Contributions on Theoretical Computer Science in Honor of Arto Salomaa, pages 59–71. Springer, 1999.
- [14] Christian Choffrut and Marcel Paul Schützenberger. Décomposition de fonctions rationnelles. In 3rd Annual Symposium on Theoretical Aspects of Computer Science STACS 1986, volume 210 of Lecture Notes in Computer Science, pages 213–226. Springer, 1986. doi:10.1007/3-540-16078-7_78.
- [15] Samuel Eilenberg. Automata, languages, and machines. vol. A. Pure and applied mathematics. Academic Press, 1974.
- [16] Diego Figueira and Leonid Libkin. Path logics for querying graphs: Combining expressiveness and efficiency. In 30th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, pages 329–340. IEEE Computer Society, 2015. doi:10.1109/LICS.2015.39.
- [17] Emmanuel Filiot, Ismaël Jecker, Christof Löding, and Sarah Winter. On equivalence and uniformisation problems for finite transducers. In 43rd International Colloquium on Automata, Languages, and Programming ICALP 2016, volume 55 of LIPIcs, pages 125:1–125:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPICS.ICALP.2016.125.
- [18] Emmanuel Filiot, Nicolas Mazzocchi, and Jean-François Raskin. A pattern logic for automata with outputs. International Journal of Foundations of Computer Science, 31(6):711–748, 2020. doi:10.1142/S0129054120410038.
- [19] Emmanuel Filiot and Pierre-Alain Reynier. Transducers, logic and algebra for functions of finite words. ACM SIGLOG News, 3(3):4–19, 2016. doi:10.1145/2984450.2984453.
- [20] Seymour Ginsburg and Gene F. Rose. A characterization of machine mappings. Journal of Symbolic Logic, 33(3):468–468, 1968. doi:10.2307/2270340.
- [21] Eitan M. Gurari and Oscar H. Ibarra. A note on finitely-valued and finitely ambiguous transducers. Mathemtical Systems Theory, 16(1):61–66, 1983. doi:10.1007/BF01744569.
- [22] Thomas A. Henzinger, Jan Otop, and Roopsha Samanta. Lipschitz robustness of finite-state transducers. In 34th International Conference on Foundation of Software Technology and Theoretical Computer Science, FSTTCS 2014, volume 29 of LIPIcs, pages 431–443. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2014. doi:10.4230/LIPICS.FSTTCS.2014.431.
- [23] J. Berstel. Transductions and Context-Free Languages. Teubner, Stuttgart, 1979.
- [24] Ismaël Jecker and Emmanuel Filiot. Multi-sequential word relations. International Journal of Foundations of Computer Science, 29(2):271–296, 2018. doi:10.1142/S0129054118400075.
- [25] Daniel Kirsten and Sylvain Lombardy. Deciding unambiguity and sequentiality of polynomially ambiguous min-plus automata. In 26th International Symposium on Theoretical Aspects of Computer Science STACS 2009, volume 3 of LIPIcs, pages 589–600. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Germany, 2009. doi:10.4230/LIPICS.STACS.2009.1850.
- [26] K. Kobayashi. Classification of formal languages by functional binary transductions. Information and Control, 15(1):95–109, 1969. doi:10.1016/S0019-9958(69)90651-2.
- [27] Mehryar Mohri. Finite-state transducers in language and speech processing. Computational Linguistics, 23(2):269–311, 1997. URL: https://aclanthology.org/J97-2003.pdf.
- [28] Anca Muscholl and Gabriele Puppis. The many facets of string transducers (invited talk). In 36th International Symposium on Theoretical Aspects of Computer Science STACS 2019, volume 126 of LIPIcs, pages 2:1–2:21. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPICS.STACS.2019.2.
- [29] George N. Raney. Sequential functions. Journal of the ACM, 5(2):177–180, 1958. doi:10.1145/320924.320930.