Abstract 1 Introduction 2 Preliminaries 3 Twinning Properties 4 Approximate determinisation of rational functions 5 Approximate decision problems for rational relations 6 Future works References

Approximate Problems for Finite Transducers

Emmanuel Filiot ORCID Université libre de Bruxelles, Belgium Ismaël Jecker ORCID Université Marie et Louis Pasteur, CNRS, institut FEMTO-ST, F-25000 Besançon, France Khushraj Madnani ORCID Max Planck Institute for Software Systems (MPI-SWS), Saarbrücken, Germany Saina Sunny ORCID Indian Institute of Technology Goa, India
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 R, whether there exists a sequential function that is close to some function uniformising R. As its exact version, we prove that this problem is undecidable.

Keywords and phrases:
Finite state transducers, Edit distance, Determinisation, Functionality
Category:
Track B: Automata, Logic, Semantics, and Theory of Programming
Funding:
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] © Emmanuel Filiot, Ismaël Jecker, Khushraj Madnani, and Saina Sunny; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Transducers
; Theory of computation Quantitative automata
Related Version:
Full Version: https://arxiv.org/abs/2504.17299
Editors:
Keren Censor-Hillel, Fabrizio Grandoni, Joël Ouaknine, and Gabriele Puppis

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 T, it is decidable in PTime whether T recognises a function [21, 10]. In that case, T 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 f𝗅𝖺𝗌𝗍:{a,b}{a,b} which moves the last symbol upfront. For example, f𝗅𝖺𝗌𝗍(abb¯)=b¯ab and f𝗅𝖺𝗌𝗍(aba¯)=a¯ab. Since the number of symbols that have to be read before reading the last symbol is arbitrarily large, a finite transducer recognising f𝗅𝖺𝗌𝗍 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 (,max,+)-automata [25].

Approximate determinisation.

The function f𝗅𝖺𝗌𝗍 is not sequential, in other words, the latter transducer is not determinisable. It turns out that f𝗅𝖺𝗌𝗍 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 d between words is lifted to functions f1,f2 with the same input domain, by taking the supremum of d(f1(u),f2(u)) for all words u in their domain. Coming back to our example, f𝗅𝖺𝗌𝗍 and 𝗂𝖽 are close for the edit distance, in the sense that d(f𝗅𝖺𝗌𝗍,𝗂𝖽) is finite for d 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 d): given a finite transducer recognising a function f, does there exists a sequential function s such that d(f,s) 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 f and s are given (by finite transducers), checking whether they are close (for various and classical edit distances) is known to be decidable, even if s 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 f is given, and which asks to generate s 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 R is almost a rational function, in the sense that d(R,f) is finite for some rational function f, where d(R,f) is now the supremum, for all (u,v)R, of d(v,f(u)). 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 R, there exists a sequential function f with the same domain, and whose graph is included in R. 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 f is included in R, we require that it is close to some function whose graph is included in R. 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 k, let [k] denote the set {1,2,,k}, and for integers ij, let [i,j] denote the set {i,i+1,,j}.

Words.

Let A or B 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 |w|, in particular |ϵ|=0. The ith letter of a word w, for i{1,,|w|}, is denoted by w[i]. The primitive root of w is the shortest word ρw such that wρw. The set of all finite words over the alphabet A is denoted by A. A relation RA×B is sometimes called a transduction, and is said to be functional if it is the graph of a function. We let 𝑑𝑜𝑚(R)={uAvB,(u,v)R} be the domain of R, and for all uA, we let R(u)={vB(u,v)R}. Note that u𝑑𝑜𝑚(R) iff R(u).

Finite State Automata and Transducers.

A (non-deterministic) finite automaton over an alphabet A is denoted as a tuple 𝒜=(Q,I,Δ,F) where Q is the finite set of states, IQ the set of initial states, FQ the set of final states, and ΔQ×A×Q the transition relation. A run on a word σ1σn is a sequence of states q1qn+1 such that (qi,σi,qi+1) for all i[n]. It is accepting if and only if q1I and qn+1F. We denote by L(𝒜) 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 q, there exists at least one accepting run visiting q. When 𝒜 is deterministic, we denote the transition function as δ:Q×AQ.

A rational transducer 𝒯 over an input alphabet A and an output alphabet B is a (non-deterministic) finite automaton over a finite subset of A×B. A transition (p,(u,v),q) of 𝒯 is often denoted puv𝒯q. More generally, we write pu1unv1vn𝒯q whenever there exists a run ρ of 𝒯 from p to q on (u1,v1)(un,vn). The relation recognised by 𝒯, denoted as R𝒯A×B, is defined as R𝒯={(u,v)q0I,qfF,q0uv𝒯qf}. 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 A and output alphabet B is given by a tuple 𝒯=(Q,I,Δ,F,λ) where (Q,I,Δ,F) is a finite automaton over a finite subset of A×B, and λ:FB is a final output function.

Given a word u=a1anA where aiA for all i, a run ρ of 𝒯 over u is a sequence q0qn such that q0I and (qi1,ai,vi,qi)Δ for all i[n]. The input word of the run ρ is u=a1an and the output word of ρ is v1vnλ(qn) if qn is a final state; otherwise, v1vn. As for rational transducers, the relation R𝒯 recognised by 𝒯 is defined as the set of pairs (u,v) such that u (resp. v) is the input (resp. output) word of some accepting run. We often confuse 𝒯 with R𝒯, and may write 𝑑𝑜𝑚(𝒯) for 𝑑𝑜𝑚(R𝒯), or 𝒯(u) for R𝒯(u).

The underlying automaton of 𝒯 is the automaton obtained by projection on inputs, i.e. the automaton 𝒜=(Q,I,Δ,F) such that Δ={(q,a,q)(q,a,v,q)Δ}. Note that 𝑑𝑜𝑚(𝒯)=L(𝒜). The transducer 𝒯 is said to be trim if its underlying automaton is trim.

The cartesian product, denoted 𝒯1×𝒯2, of two transducers 𝒯i=(Qi,Ii,Δi,Fi,λi), i[2], is the transducer (Q1×Q2,I1×I2,Δ,F1×F2,λ) where ((p1,p2),a,(v1,v2),(q1,q2))Δ if (pi,a,vi,qi)Δi for i[2], and, λ(p1,p2)=(λ1(p1),λ2(p2)) for (p1,p2)F1×F2.

(Sub)classes of rational functions.

Let 𝒯 be a real-time transducer. When R𝒯 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 δ:Q×AQ×B. 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 𝒟1,,𝒟k where additionally, for every 1i<k, there is a single transition from a (not necessarily final) state qi of 𝒟i to the initial state of the next transducer 𝒟i+1. Moreover, the initial state of 𝒯 is the initial state of 𝒟1 (the initial states of 𝒟i is not considered as initial in 𝒯, for all 2ik). In particular, non-determinism is allowed, for all 1i<k, only in state qi, from which it is possible to move to 𝒟i+1 or to stay in 𝒟i. We denote111This notation should not be confused with the split-sum operator of [3], which is semantically different. such a transducer as 𝒟1𝒟k. 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 E is a mapping d:E2+{} 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.

Table 1: Edit Distances [2].
Edit Distances Notation Edit Operations
Hamming  dh letter-to-letter substitutions
Longest Common Subsequence  dlcs insertions and deletions
Levenshtein  dl insertions, deletions and substitutions
Damerau-Levenshtein  ddl 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 d be a metric on words over some alphabet B. Given two partial functions f1,f2:AB, the distance between f1 and f2 is defined as

d(f1,f2)={sup{d(f1(w),f2(w))w𝑑𝑜𝑚(f1)} if 𝑑𝑜𝑚(f1)=𝑑𝑜𝑚(f2) otherwise 

It is shown that d 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 R w.r.t. a metric d, denoted by 𝑑𝑖𝑎d(R), is defined to be the supremum of the distance of every pair in the relation, i.e., 𝑑𝑖𝑎d(R)=sup{d(u,v)(u,v)R}.

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 u and v are conjugate if there exist words x,y such that u=xy and v=yx. In other words, they are cyclic shifts of each other. For example, words aabb and bbaa are conjugate with x=aa and y=bb. But aabb and abab are not conjugate. Conjugacy is an equivalence relation over words.

Proposition 2.2.

Let x,y,x,y,u,v be words and c,C. For any metric d in Table 1, if d(xuky,xvcky)C for all k0, then |u|=|vc| and the primitive roots of u and v are conjugate.

Proposition 2.3 ([2]).

Given a rational relation R defined by a transducer 𝒯, 𝑑𝑖𝑎d(R)< for d{dl,dlcs,ddl} 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 𝒯=(Q,I,Δ,F,λ) over A,B is a tuple (p1,q1,p2,q2,u,v,u1,v1,u2,v2)Q4×(A)2×(B)4 such that the following runs (graphically depicted) exist:

The longest common prefix of any two words is denoted by uv. The delay between u and v, denoted by 𝑑𝑒𝑙𝑎𝑦(u,v), is the pair (u,v) such that u=(uv)u and v=(uv)v.

Definition 3.1 (Twinning Property (TP)).

Let 𝒯 be a trim transducer. We say that 𝒯 satisfies twinning property if for each twinning pattern (p1,q1,p2,q2,u,v,u1,v1,u2,v2) such that p1,p2 are initial, 𝑑𝑒𝑙𝑎𝑦(u1,u2)=𝑑𝑒𝑙𝑎𝑦(u1v1,u2v2) 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 (p1,q1,p2,q2,u,v,u1,v1,u2,v2) where p1,p2 are initial, the words v1 and v2 are conjugate.

Definition 3.3 (Strongly Connected Twinning Property (STP)).

A trim transducer 𝒯 satisfies strongly connected twinning property if for each twinning pattern (p1,q1,p2,q2,u,v,u1,v1,u2,v2) such that p1=p2 (not necessarily initial) and p1,q1,q2 are in the same strongly connected component, then 𝑑𝑒𝑙𝑎𝑦(u1,u2)=𝑑𝑒𝑙𝑎𝑦(u1v1,u2v2) holds.

Definition 3.4 (Hamming Twinning Property (HTP)).

A trim transducer 𝒯 satisfies Hamming twinning property if for each twinning pattern (p1,q1,p2,q2,u,v,u1,v1,u2,v2) such that p1,p2 are initial, it holds that |v1|=|v2| and there is no mismatch between v1 and v2, i.e., for all position i[max(|u1|,|u2|),min(|u1v1|,|u2v2|)], (u1v1)[i]=(u2v2)[i].

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 d in Table 1 and a constant C for which

d(v,v)C for all u𝑑𝑜𝑚(𝒯),v𝒯(u),v𝒮(u).

Then for every 𝖯{ATP,STP}, 𝒮 satisfies 𝖯 if and only if 𝒯 satisfies 𝖯. The statement also holds for d=dh and 𝖯=HTP.

Proof sketch.

Let us suppose that 𝒮 satisfies 𝖯{ATP,STP,HTP}, 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 (p1,p2,q1,q2,u,v,u1,u2,v1,v2) be an instance of the twinning pattern for 𝒯 with p1 and q1 initial. Since 𝒯 is trim, there exist words w,w,w1,w2 and two accepting states pf,qf such that:

p1u|u1𝒯p2v|v1𝒯p2w|w1𝒯pfq1u|u2𝒯q2v|v2𝒯q2w|w2𝒯qf

Since 𝑑𝑜𝑚(𝒯)=𝑑𝑜𝑚(𝒮), for all i1, uviw,uviw𝑑𝑜𝑚(𝒯)=𝑑𝑜𝑚(𝒮). Iterating the loop of 𝒯 on v sufficiently many times causes 𝒮 to also loop on some power of v. Formally, there exist a,b,c, states p1,p2,q1,q2,pf,qf and words u1,u2,v1,v2,w1,w2 such that:

p1uva|u1v1a𝒯p2vb|v1b𝒯p2vcw|v1cw1𝒯pfq1uva|u2v2a𝒯q2vb|v2b𝒯q2vcw|v2cw2𝒯qfp1uva|u1𝒮p2vb|v1𝒮p2vcw|w1𝒮pfq1uva|u2𝒮q2vb|v2𝒮q2vcw|w2𝒮qf

Let C such that d(𝒯(x),𝒮(x))C for all x𝑑𝑜𝑚(𝒯). Then in particular for all k0:

d(u1v1a+kb+cw1,u1v1kw1)C and d(u2v2a+kb+cw2,u2v2kw2)C.

From the above inequalities, using Proposition 2.2, we get that ρvi and ρvi, the primitive roots of vi and vi respectively, are conjugate and |vib|=|vi| for i[2]. Since 𝒮 satisfies the ATP, we also have that v1 and v2 are conjugate, and hence their primitive roots are conjugate and |v1|=|v2|. By transitivity of the conjugacy relation, we get that ρv1 and ρv2 are conjugate. Further, |v1|=|v2| since |ρv1|=|ρv2| and |v1b|=|v1|=|v2|=|v2b|. Therefore, v1 and v2 are conjugate, and thus the ATP holds for 𝒯 as well.

Note that the above lemma does not necessarily hold for TP. For instance, although dl(f𝗅𝖺𝗌𝗍,𝗂𝖽)< and the transducer defining the identity function satisfies TP, the transducer defining f𝗅𝖺𝗌𝗍 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 R.

Deciding ATP.

Let 𝒯2 be the cartesian product of 𝒯 by itself. Verifying whether 𝒯 satisfies ATP reduces to checking that every loop in 𝒯2 produces a pair of conjugate output words. For each state (p,q)𝒯2, we define a rational relation R(p,q) consisting of pairs of output words produced by the loops in 𝒯2 rooted at (p,q). The transducer defining R(p,q) is obtained from 𝒯2 by disregarding the inputs and setting both the initial and final state to be (p,q). 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 p, the SCC is seen as a transducer with initial state p 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 : HTPlgth on lengths and HTPmism on mismatches. The (negation of) HTPlgth can be directly expressed in the pattern logic of [18], whose model-checking is in PTime. Then, we reduce the problem of deciding the HTPmism 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 d is an NFA extended with vectors in d 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 Wd, given for example as a Presburger formula ϕ(x1,,xd). The emptiness problem is known to be decidable in PTime when both d 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 t can be encoded as a word ut over Δ2{#}, 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, r1,r1 and r2,r2 where for all i=1,2, ri is the run such that piu|uiqi and ri is the run such that qiv|viqi. The four runs are encoded as a word ut=(r1r2)#(r1r2) where r1r2 is the convolution of r1 and r2, i.e. the overlapping of r1 and r2 (and similarly for r1r2). It should be clear that the set of words ut for all twinning pattern t such that p1 and p2 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 u1v1 and u2v2 on a position common to v1 and v2, the NFA is extended with two counters c1 and c2, and the linear acceptance condition c1=c2=0 (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 i. Then, the Parikh automaton is built in such a way that it checks that |u1|<i|u1v1| and |u2|<i|u2v2|, and (u1v1)[i](u2v2)[i]. To do so, while reading any transition of rj producing some word αj, j=1,2, cj is decremented by |αj|. The same is done when reading transitions of rj, but the automaton can non-deterministically guess that the counter cj is equal to 0, and store (in its state) the corresponding letter in αj. From then on, it never decrements the counter cj again. When the whole input (r1r2)#(r1r2) has been read, the automaton has two letters stored in its state. It accepts the input, if those two letters are different, and if c1=c2=0.

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 f:AB is approximately determinisable w.r.t. a metric d if there exists a sequential function g:AB such that d(f,g)<. In this case, we also say that g approximately determinises f w.r.t. d.

Example 4.2.

The function f𝗅𝖺𝗌𝗍 from the introduction is approximately determinisable w.r.t. Levenshtein, while not w.r.t. Hamming distance. The function f𝗅𝖺𝗌𝗍 (depicted below) that maps u1#un#, for n1, to f𝗅𝖺𝗌𝗍(u1)#f𝗅𝖺𝗌𝗍(un)# 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 (dl,dlcs,ddl) and Hamming (dh) 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 f𝗅𝖺𝗌𝗍 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 𝒟1 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 𝒟1 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 𝒯, 𝒟1, and 𝒟2 after reading babcccc :

𝒯(babcccc)=bbabcabcabcabc,𝒟1(babcccc)=aabcabcabcabc,𝒟2(babcccc)=ababcabcabcabc.

We observe that after reading the input bab, 𝒟1 realizes that its distinguished state is incorrect and jumps to another state. However, this shift causes a misalignment with 𝒯, and reading additional c’s results in arbitrarily many mismatches.222The Levenshtein distance remains bounded, as inserting a letter at the start resynchronizes both outputs. In contrast, 𝒟2 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 𝒯.

Figure 1: An unambiguous non-deterministic transducer 𝒯, along with two sequential approximations 𝒟1 and 𝒟2 with respect to the Levenshtein distance, respectively Hamming distance.

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 (dl), Longest common subsequence (dlcs) and Damerau-Levenshtein (ddl). They are all equivalent up to boundedness (Lemma 2.1 and Remark 7 of [2]), i.e., for any two rational functions f,g, dlcs(f,g)<dl(f,g)<ddl(f,g)<. 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 d{dl,dlcs,ddl} 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 d(𝒯,𝒟)<. Since 𝒟 is a sequential transducer, it satisfies the twinning property, and consequently, 𝒟 also satisfies ATP and STP by Proposition 3.5. Since d(𝒯,𝒟)<, 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 N𝒯 such that for any two output words v,vB produced via two distinct runs of 𝒯 from an initial state on the same prefix of an input word, d(v,v)N𝒯 for d{dl,dlcs,ddl}.

Proof.

Let 𝒯2 be the cartesian product of 𝒯 by itself. By designating all states of 𝒯2 as final, and disregarding the input word, we obtain a new transducer that defines the relation Ro, consisting of all pairs of output words produced by distinct runs of T on the same prefix of an input word. Since 𝒯 satisfies ATP, every pair of output words produced by loops in 𝒯2 on any input are conjugate. Consequently, since Ro is obtained by ignoring the input word from 𝒯2, it satisfies the condition in Proposition 2.3. Hence, the diameter of Ro w.r.t. Levenshtein family of distances is bounded.

Let 𝑑𝑖𝑎d(Ro)k. By the definition of diameter, it follows that d(u,v)k for all (u,v)Ro. As a result, the distance between any two output words produced by distinct runs of 𝒯 on the same word is at most k. Setting NT=k 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 d{dl,dlcs,ddl} 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 𝒰=𝒟1𝒟k for some k where 𝒟i=(Qi,si,δi,Fi,λi) is a sequential trim transducer for i[k]. 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 𝒟1,,𝒟k which on each transition produces the output of the smallest index transducer 𝒟i for which that transition is defined. Let 𝒟=(Q,s,δ,F,λ) where

  1. 1.

    The set of states Q=Q1×Q2××Qk is the cartesian product of the state set Qi for i[k] such that Qi=Qi{d} where d represents a dead state. The initial state is s=(s1,s2,,sk), and the set of final states F is {(p1,p2,,pk)ipiFi}.

  2. 2.

    The function δ:Q×AQ×B is defined as: δ((p1,p2,,pk),a)=((q1,q2,,qk),x) where for each i[k], either δi(pi,a)=(qi,xi) or, if pi=d or δi(pi,a) is undefined, then qi=d. The output x is set to xj, where j[k] is the smallest index for which the transition δj(pj,a) is defined.

  3. 3.

    The output function λ:FB is defined as λ((p1,p2,,pk))=λi(pi) where i[k] is the smallest index such that piFi.

We show that d(𝒟,𝒯)< w.r.t. Levenshtein family. From the construction, it is clear that 𝒟 and 𝒯 have the same domain. Consider an input word u𝑑𝑜𝑚(𝒯). Let i[k] be the smallest index such that u𝑑𝑜𝑚(𝒟i), with output word, say v. The transducer 𝒟 on input u produces output, say v, by concatenating output on each transition over input word produced by the smallest index transducer.

Thus, v can be decomposed into vi1vi2vin where i1<i2<<in=i and for each ij[i], vij is the output produced by 𝒟ij along the partial run of u. For each vij, let vij denote the prefix of the output produced by 𝒟ij upto vij. The output produced by 𝒯 on u via 𝒟i is v=vivi=vinvin.

Observe that vijvij and vij+1 (for i1<ij<in) is the output produced by 𝒟ij and 𝒟ij+1 on the same prefix of input u. By Lemma 4.5, we obtain d(vijvij,vij+1)NT. Similarly, since vi1,vi2 are the outputs of 𝒟i1 and 𝒟i2 on the same input prefix, we get d(vi1,vi2)NT.

d(vi1vi2vi3vin,v) =d(vi1vi2vi3vin,vinvin) (Since v=vinvin)
d(vi1vi2vi3vin,vi2vi2vi3vin)+d(vi2vi2vi3vin,vi3vi3vin)
++d(vin1vin1vin,vinvin) (Applying triangle inequality of d)
nNT (using Lemma 4.5)

In fact, on any input word, the distances between the outputs produced by 𝒟 and 𝒯 is less than or equal to kNT, as there can be at most k switches between runs. Hence, we get that d(𝒟,𝒯) is bounded.

The characterisation of Lemma 4.6 also holds for unambiguous series-sequential functions.

Lemma 4.7.

Let 𝒯=𝒟1𝒟k be an unambiguous transducer where each 𝒟i is a sequential trim transducer for i[k],k>1. The series-sequential function defined by 𝒯 is approximately determinisable w.r.t. a metric d{dl,dlcs,ddl} 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 𝒟i, i[k], is sequential, the non-determinism arises between the transitions between one 𝒟i to the other. We assume an ordering for the states of 𝒯 for each Di. 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, 𝒟=(Q,s0,δ,F,λ) where

  1. 1.

    Q is the power set of the states in 𝒯. Each set SQ has exactly one state marked with a to denote the currently producing run.

  2. 2.

    s0 is the initial state of 𝒯 and is marked with a .

  3. 3.

    The transition function δ:Q×AQ×B is defined as follows: δ(P,a)=(S,x) where S consists of all states q in 𝒯 reachable from a state pP via transition (p,a,q,xpq) in 𝒯. The output word x is set as follows. Let p be the marked state in P that belongs to the sequential transducer 𝒟i for some i[k].

    1. (a)

      If a transition (p,a,q,xpq) in 𝒯 exists within the same sequential transducer 𝒟i, then x=xpq and q is marked in S.

    2. (b)

      If no transition exists from p on a within 𝒟i, but a transition (p,a,q,xpq) in 𝒯 exists to a different sequential transducer, i.e., q belongs to 𝒟i+1, then x=xpq and q is marked in S. Such a transition is called a switch (to 𝒟i+1).

    3. (c)

      Otherwise, choose the smallest numbered state pP that belongs to the smallest indexed sequential transducer 𝒟j where j[k] with a defined transition (p,a,q,xpq) in 𝒯, and set x=xpq and mark q in S. Such a transition is also called a switch (to 𝒟j).

  4. 4.

    F is the set of all states PQ such that P contains a final state of 𝒯.

  5. 5.

    The output function λ:FB is defined, for PF, as λ(P)=λ𝒯(p) for some arbitrary final state pP 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 ni be the number of states in 𝒟i for i[k]. Consider the run of 𝒟 on an arbitrary input word. Initially, only the initial state of 𝒟1 is active in 𝒟. As the run proceeds, if P is the set of states of 𝒯 reached so far, then by construction of 𝒟, the only marked state in P is the last state of the active run of 𝒯 that belongs to the smallest indexed 𝒟i. If this run eventually dies, then two cases can happen: (1) 𝒟 switches to another active run in 𝒟i, or, (2) if none exists, 𝒟 switches to some active run in 𝒟j, where j>i is minimal. If case (2) happens, then no more states of 𝒟i are active, so 𝒟 will never switch again to 𝒟i in the future. The number of times case (1) can happen is bounded by ni. Indeed, at most ni states of 𝒟i can be active at any moment, and since 𝒟i is sequential, the number of active states in 𝒟i can only decrease.

Now, if 𝒟 eventually switches to 𝒟j, at most nj states in 𝒟j are active, so at most nj switches of type (1) can happen in 𝒟j, and so on until 𝒟 eventually terminates in some sequential transducer 𝒟l for lj. Therefore, in the worst case, 𝒟 switches ni times in 𝒟i before switching to 𝒟i+1 for all i{1,,k1}. So, the overall number of switches in the run of 𝒟 is at most N=i=1kni, which is exactly the number of states in 𝒯.

Now we show that d(𝒟,𝒯)< w.r.t. Levenshtein family. From the construction, it is clear that 𝒟 and 𝒯 have the same domain.

Consider an input word u accepted by 𝒯. Since 𝒯 is unambiguous, there is exactly one run in 𝒯 that accepts u. Let v=𝒯(u) and v=𝒟(u). From the construction of 𝒟, v can be decomposed into vs1vs2vsn accommodating n[N] switches between the active runs of 𝒯 on the prefixes of u, where each vsi, i[n] is the output produced by an active run ri on the prefix of u. For each vsi, let vsi denote the prefix of the output produced by the run ri up to vsi.

Observe that vsivsi and vsi+1 (for 1<i<n) is the output produced by 𝒟1𝒟ji and 𝒟1𝒟ji+1 on the same prefix of u where ji,ji+1[k]. By using Lemma 4.5, we obtain d(vsivsi,vsi+1)NT. Similarly, since vs1,vs2 are the outputs of 𝒟1𝒟j1 and 𝒟1𝒟j2 on the same input prefix, it follows that d(vs1,vs2)NT. As a consequence,

d(vs1vs2 vsn,v)
=d(vs1vs2vsn,vsnvsn) (v=vsnvsn since rsn is the only accepting run of u)
d(vs1vs2vsn,vs2vs2vsn)+d(vs2vs2vsn,vs3vs3vsn)
++d(vsn1vsn1vsn,vsnvsn) (Applying triangle inequality of d)
nN𝒯 (using Lemma 4.5)

Therefore, d(𝒟(u),𝒯(u))nNTNN𝒯. This holds for any u𝑑𝑜𝑚(𝒯), and N being the number of states in 𝒯, we get that d(𝒟,𝒯) 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 d{dl,dlcs,ddl} 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 Q. Disregarding the labels on transitions, decompose 𝒯 into maximal SCCs S1,,SkQ. Consider the set of paths Π of the form π=Si1ti1Si2tin1Sin such that Si1 is an SCC which contains an initial state, Sin is an SCC which contains a final state, and for all 1k<n, tik is a transition of 𝒯 from a state of Sik to some state of Sik+1. Let 𝒯π denote the trim subtransducer of 𝒯 that removes all the transitions in 𝒯 except the transitions tik (1k<n) and the transitions occurring in the SCCs Sik (1kn).

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 Tπ 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 d(𝒟π,𝒯π) is finite.

Let d(𝒯π,𝒟π)kπ for some kπ. Consequently, the distance between 𝒯 and the new transducer 𝒰=πΠ𝒟π is bounded where d(𝒯,𝒰)=d(𝒰,𝒰)max{kππΠ}. 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 d(𝒰,𝒟)<. Since d is a metric, d(𝒯,𝒟)d(𝒯,𝒰)+d(𝒰,𝒟). Since both d(𝒯,𝒰) and d(𝒰,𝒟) are finite, d(𝒯,𝒟) 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 R, whether it is almost a sequential function. The third generalisation we consider is an approximate uniformisation problem, which asks, given R, whether there exists a sequential function s which is close to a function f, whose graph is included in R. 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

dH(L,L)=max{supwLinfwLd(w,w),supwLinfwLd(w,w)}.

Given a metric d on words, and two relations R1,R2A×B, the distance between R1 and R2 is defined as follows.

d(R1,R2)={sup{dH(R1(w),R2(w))w𝑑𝑜𝑚(R1)} if 𝑑𝑜𝑚(R1)=𝑑𝑜𝑚(R2) otherwise 

Therefore, d(R1,R2)< iff 𝑑𝑜𝑚(R1)=𝑑𝑜𝑚(R2) and there exists k such that for all word u in the domain and any output v1 of R1 on u, there exists some output v2 of R2 on u, such that d(v1,v2)<k, and symmetrically. In fact, d is a metric on relations (see full version).

Approximate functionality problem.

Definition 5.1 (Approximate Functionalisation).

A rational relation R is approximately functionalisable w.r.t. a metric d if there exists a rational function f such that d(R,f)<.

The approximate functionality problem asks, given R represented by a transducer, whether it is approximately functionalisable w.r.t. d. Towards this, we define the following value for a relation R and metric d, 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 R:
x𝖽𝗂𝖿𝖿d(R)=supudom(R)supv1,v2R(u)d(v1,v2)

Lemma 5.2.

For a rational relation R given as a rational transducer, 𝖽𝗂𝖿𝖿d(R) is computable for all metrics given in Table 1.

Proof.

Given a rational relation R, we can construct a rational relation Ro that consists of all pairs of output words of R on any input, i.e., Ro={(v1,v2)u𝑑𝑜𝑚(R),(u,v1),(u,v2)R}. If R 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 Ro. Observe that 𝖽𝗂𝖿𝖿d(R) is equivalent to the diameter of Ro w.r.t. d. It is shown in [2] that diameter of a rational relation is computable for all metrics given in Table 1. Hence, for those metrics, 𝖽𝗂𝖿𝖿d(R) is computable.

We now characterise rational relations which are approximately functionalisable.

Lemma 5.3.

A rational relation R is approximately functionalisable w.r.t. a metric d if and only if 𝖽𝗂𝖿𝖿d(R)<.

Proof.

() Assume that R is approximately funtionalisable, i.e., there exists a rational function f such that d(R,f)<. Therefore, 𝑑𝑜𝑚(R)=𝑑𝑜𝑚(f) and there exists an integer k such that for each input word u𝑑𝑜𝑚(R), for each output word vR(u), d(v,f(u))k (since f is a function). By triangle inequality of metric d, the distance between any two arbitrary output words v1,v2R(u) on any input u𝑑𝑜𝑚(R) is d(v1,v2)d(v1,f(u))+d(f(u),v2)2k. Since this holds for any input in the domain of R, we get 𝖽𝗂𝖿𝖿d(R)=supudom(R)supv1,v2R(u)d(v1,v2)2k.

() Assume that 𝖽𝗂𝖿𝖿d(R)<. Let 𝖽𝗂𝖿𝖿d(R)k for some k. 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 f be a uniformiser of R. We prove that d(R,f)<. Since f is a uniformiser of R, 𝑑𝑜𝑚(R)=𝑑𝑜𝑚(f), and for all u𝑑𝑜𝑚(R), it holds that (u,f(u))R. Since 𝖽𝗂𝖿𝖿d(R)k, the distance between the outputs of R on any input is less than or equal to k. Thus, for any input word u𝑑𝑜𝑚(R), for each output word vR(u), d(v,f(u))k (since f(u) is also an output of R(u)). Hence, d(R,f)<, i.e., R is approximately functionalisable w.r.t. d.

Since 𝖽𝗂𝖿𝖿d(R) 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 R is said to be approximately determinisable for a metric d if it is almost a sequential function with respect to d. Formally, it means that there exists a sequential function f such that d(R,f)<. 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 (dl,dlcs,ddl) if and only if 𝒯 satisfies ATP and STP.

Proof.

Let R be a rational relation given by a transducer 𝒯, and let d{dl,dlcs,ddl}. 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 R is approximately functionalisable then it is approximately determinisable when 𝒯 (that defines R) satisfies both ATP and STP. Let f be a rational function that approximately functionalises R w.r.t. Levenshtein distance, i.e., d(R,f)<. Thus, a functional transducer that defines f satisfies d(𝒯,)<. From Lemma 3.6, because 𝒯 satisfies both ATP and STP and d(𝒯,)<, it follows that also satisfies ATP and STP. Using Lemma 4.8, the rational function f is approximately determinisable. Let g be a sequential function that approximately determinises f w.r.t Levenshtein, i.e, d(f,g)<. Since d is a metric on relations, d(R,g)d(R,f)+d(f,g). Since both d(R,f) and d(f,g) are finite, we get d(R,g)<. Hence, the rational relation R is approximately determinisable.

Now it suffices to show that R is approximately functionalisable w.r.t. Levenshtein family of distance. Towards this, we prove that 𝖽𝗂𝖿𝖿d(R)< when 𝒯 satisfies ATP. Observe that 𝖽𝗂𝖿𝖿d(R)=𝑑𝑖𝑎d(Ro) where Ro={(v1,v2)u𝑑𝑜𝑚(R),(u,v1),(u,v2)R} is a rational relation that consists of all pairs of output words of R on any input. Using Lemma 4.5, 𝑑𝑖𝑎d(Ro)N𝒯 when 𝒯 satisfies ATP. Hence, 𝖽𝗂𝖿𝖿d(R)=𝑑𝑖𝑎d(Ro)<, and R is approximately functionalisable w.r.t. d 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 d{dl,dlcs,ddl} is decidable.

Approximate uniformisation problem.

Given a relation RA×B, a uniformiser of R is a function U:AB such that 𝑑𝑜𝑚(R)=𝑑𝑜𝑚(U) and for all u𝑑𝑜𝑚(R), it holds that (u,U(u))R. 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 R is approximately uniformisable w.r.t. a metric d if there exists a uniformiser U of R and a sequential function f such that d(U,f)<. In that case, we say that R is d-approximate uniformisable by a sequential function.

In other words, R is d-approximate uniformisable by a sequential function f iff there exists an integer k such that for all udom(R), there exists (u,v)R with d(v,f(u))k.

Theorem 5.8.

Checking whether a rational relation is d-approximate uniformisable for d{dl,dlcs,ddl} is undecidable.

Proof.

Let ϕ1:{1,,k}B and ϕ2:{1,,k}B be two morphisms defining an instance of the post correspondence problem (PCP), which asks whether there exists w{1,,k}+ such that ϕ1(w)=ϕ2(w). Let A=B{1,,i,a,b,#}.

Let R be the relation which as input takes any word of the form w1#w2#wm#X where wi{1,,k} for 1im and X{a,b}. Let us define the outputs:

  • If X=a, then the only output is ϕ1(w1)#ϕ1(w2)#ϕ1(wm)#.

  • If X=b, then any word of the form v1#vm# where viϕ2(wi) for all 1im is a valid output.

It can be shown that R is rational, recognizable by some transducer 𝒯. We now show that R is approx-uniformisable iff PCP has no solution iff R is exact-uniformisable. First, suppose that PCP has a solution w and R is approx-uniformisable by some sequential transducer 𝒟, i.e. d(𝒯,𝒟)K for some K. Consider inputs of the form u=(w#) for 0, and let α,αa,αb be such that q0u|α𝒟q,qaαa𝒟qf and qbαb𝒟pf, where q0 is the initial state, q is a state and qf,pf are final states of 𝒟. Since d(𝒯,𝒟)K, for all , d((Φ1(w)#),ααa)K holds. Similarly, for all , there exist v1,v2,,v all different from Φ2(w) such that

d(v1#v2#v#,ααb)K.

Since d(ααa,ααb) is uniformly bounded for all by some M, by applying triangular inequalities, we get that for all , there exist v1,,v all different from Φ2(w) such that

d((Φ1(w)#),v1#v2#v#)2K+M

Take =4K+2M+2, and fix a sequence of at most 2K+M edits from
(Φ1(w)#)=(Φ1(w)#Φ1(w)#)2K+M+1 to v1#v2#v#. In this sequence, at least one copy of (Φ1(w)#Φ1(w)#) is not edited by the sequence. Therefore, there exists some i such that #vi#=#Φ1(w)# and hence vi=Φ1(w). It is a contradiction since viΦ2(w)=Φ1(w). Therefore R is not approximately uniformisable.

Conversely, if there is no solution to PCP, then the following sequential function is an exact uniformiser of R: on any input of the form w1##wmX it outputs Φ1(w1)##Φ1(wm).

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 k” variant, where k 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.