Pumping-Like Results for Copyless Cost Register Automata and Polynomially Ambiguous Weighted Automata
Abstract
In this work we consider two rich subclasses of weighted automata over fields: polynomially ambiguous weighted automata and copyless cost register automata. Primarily we are interested in understanding their expressiveness power. Over the field of rationals and -letter alphabets, it is known that the two classes coincide; they are equivalent to linear recurrence sequences (LRS) whose exponential bases are roots of rationals. We develop a tool we call Pumping Sequence Families, which, by exploiting the simple single-letter behaviour of the models, yields two pumping-like results over arbitrary fields with unrestricted alphabets, one for each class. As a corollary of these results, we present examples proving that the two classes become incomparable over the field of rationals with unrestricted alphabets.
We complement the results by analysing the zeroness and equivalence problems. For weighted automata (even unrestricted) these problems are well understood: there are polynomial time, and even NC2 algorithms. For copyless cost register automata we show that the two problems are PSpace-complete, where the difficulty is to show the lower bound.
Keywords and phrases:
weighted automata, cost register automata, ambiguity, linear recurrence sequences, equivalence problemFunding:
Filip Mazowiecki: Supported by Polish National Science Centre SONATA BIS-12 grant number 2022/46/E/ST6/00230.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Formal languages and automata theory ; Theory of computation Quantitative automataEditors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim ThắngSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Weighted automata are a computational model assigning values from a fixed domain to words [12]. The domain can be anything with a semiring structure. Typical examples are: fields [28], where in particular probabilistic automata assign to every word the probability of its acceptance [24]; and tropical semirings, popular due to their connection with star height problems [16]. In this paper we focus on weighted automata over fields. These are finite automata with transitions, input and output edges additionally labeled by weights from the field. On an input word the value of a single run is the product of all weights, and the output of the weighted automaton is the sum of values over all runs. See Figure 1 for examples.
Unlike finite automata, nondeterminism makes weighted automata more expressive. This naturally leads to the decision problem of determinisation: given a weighted automaton does there exist an equivalent deterministic one? Over fields, it was recently shown that the problem is decidable [4], later improved to a 2-ExpTime upper bound on the running time [5]. Both papers rely on techniques used to obtain Bell and Smertnig’s result [3] characterising the intermediate class of unambiguous weighted automata: a subclass that allows nondeterminism, but for every word there is at most one run of nonzero value. The authors proved Reutenauer’s conjecture [26], which we explain below.
Given a weighted automaton over the alphabet consider , the set of all outputs over all words. For example, in Figure 1 we have: ; and . Reutenauer’s conjecture (now Bell and Smertnig’s Theorem) states that for every weighted automaton over a field : there exists an equivalent unambiguous weighted automaton if and only if there exists a finitely generated multiplicative subgroup such that . For example , where is generated by the transition weights . It is not hard to see that this construction generalises to every unambiguous weighted automaton, the crux is to prove the other implication. As an immediate nontrivial application, notice that there is no unambiguous weighted automaton equivalent to , as the set is not contained in any finitely generated subgroup.
The equivalence problem for weighted automata over fields is famously decidable in polynomial time [28]. However, most natural problems are undecidable [24, 14, 11, 10]. This triggered the study of intermediate classes between deterministic and unrestricted weighted automata. One way to define such a class is based on ambiguity, generalising unambiguous weighted automata. A much broader class are polynomially ambiguous weighted automata, where the number of accepting runs is bounded by a polynomial in the size of the input word (see Figure 1(b)). Restricting the input automaton to polynomially ambiguous can significantly lower the complexity of a problem, for example, the discussed problem of determinisation is known to be in PSpace over the field of rationals [17]. Another way to define such a class comes from cost register automata [1] (CRA), a deterministic model with polynomial register updates. In this context it is natural to consider its copyless restriction (CCRA), because every function recognisable by a CCRA is also recognisable by a weighted automaton [20] (for simplicity the definition of CCRA is postponed to Section 2).
As far as we know, these two classes, polynomially ambiguous weighted automata and copyless CRA, are the richest studied classes that are known to be strictly contained in the class of unrestricted weighted automata. Over the tropical semiring they are known to be incomparable in terms of expressiveness [21, 9], which suggests the same over fields. One attempt to prove this result was in [2], where the authors considered weighted automata over the field of rationals with -letter alphabets. By identifying words with their length , one can view such automata as sequences. In fact weighted automata over -letter alphabets are equivalent to the well-known class of linear recurrence sequences (LRS) [22]. In [2], the authors prove that polynomially ambiguous weighted automata and copyless CRA coincide, and that they are also equivalent to the class of LRS whose exponential bases are roots of rationals. This means that in the exponential polynomial representation of LRS: , for every there is an such that . In particular this shows that the Fibonacci sequence does not belong to this class, as the golden ratio is not of this form.
Our Contribution
Our work can be seen as a follow-up to [2]. An immediate corollary of our results is that polynomially ambiguous weighted automata and copyless CRA over the field of rationals are incomparable classes in terms of expressiveness. To prove this, we developed a tool we call Pumping Sequence Families (), which allows us to exploit the behaviour of these classes over -letter alphabets. In the following we use the standard sequence notation .
Definition 1.
A Pumping Sequence Family of a function , for any set , is the set of all sequences of the form , with ranging over all words in . We denote it by .
One should think that is being projected onto many single-letter-like cases at once, where plays the role of the single letter in the alphabet, while and correspond to slight adjustments of respectively the initial and acceptance conditions. The definition of exploits that , and range over all words, which captures behaviour beyond the single letter alphabet case. Using fixed words one cannot differentiate polynomially ambiguous weighted automata and copyless CRA due to [2, Theorem 6, Theorem 13]. However, this simple extension of the single letter case analysis will be enough to show those models to be incomparable. To showcase our approach, let us consider a simple application for languages, where (meaning acceptance and rejection of the word).
Example 2.
Consider which maps all words of even length to and all others to . Then consists of four sequences (for simplicity we write an example generator for each sequence):
-
-
-
-
.
Example 3.
Consider which maps all words of the form to and all others to . Then is an infinite set:
-
-
-
-
for every .
The above examples already present us with a simple use case for Pumping Sequence Families. By looking at the transition function of the underlying DFA we can see that, generalising Example 2, for a regular language the Pumping Sequence Family of its characteristic function will be finite. However, as witnessed in Example 3, the Pumping Sequence Family of the context-free language is infinite, proving that it is not regular and thus differentiating regular and context-free languages. Note that, due to Parikh’s theorem, over -letter alphabets the two language classes are equivalent and semi-linear. Meaning if we would fix , and then simply looking at the single letter case behaviour we would not be able to differentiate these classes.
We now present how we use Pumping Sequence Families for weighted functions. There the set from Definition 1 is simply the underlying field.
For a function recognised by a Copyless Cost Register Automaton we will restrict elements of its Pumping Sequence Family. Note that, since copyless CRA are a subset of weighted automata, elements of can be essentially represented as exponential polynomials. Consider such a sequence . Let us write the polynomials explicitly: . For every degree we define the sum of -degree coefficients . In Theorem 15 we show that, up to minor technical details, for all the set is contained in a finitely generated subsemiring . For intuition, if we consider the generators , by adding, subtracting and multiplying, they generate . This allows us to give an example of a polynomially ambiguous automaton that is not definable by any copyless CRA (the proof is short but technical, see Example 17).
For polynomially ambiguous weighted automata, our work is inspired by [25], where the authors attempt to characterise polynomially ambiguous weighted automata in a similar manner to Bell and Smertnig’s Theorem. For a function recognised by a polynomially ambiguous weighted automaton and given a sequence consider again its exponential polynomial and let be the set of exponential bases. In Theorem 28 we show that the set is contained in a finitely generated subgroup . We provide a self-contained proof, and we show that our property, which is simpler to work with when considering examples, is equivalent to the one in [25] (conjectured to characterise polynomially ambiguous automata). We obtain a corresponding, simple but technical, example of a copyless CRA that is not definable by any polynomially ambiguous weighted automaton (Example 29).
In this context a natural question is whether our property for copyless CRA can be a characterisation. We conjecture that it is not the case and that, in some sense, such a characterisation should not exist. We show examples of functions that satisfy the property we developed for CCRA, but we find it unlikely that there are CCRA that define them. More generally, in [21] the authors prove that the class of CCRA is not closed under reversal for the tropical semiring. More precisely, there is a CCRA such that there is no CCRA , where is reversed. We conjecture that over fields CCRA are also not closed under reversal, which makes such characterisations unlikely.
Our final contribution is the analysis of the equivalence and zeroness problems for both classes. As already mentioned for weighted automata (even without restrictions) equivalence and zeroness are in polynomial time [28] and even in NC2 [29]. For copyless CRA the translation to weighted automata [20] yields an exponential blow up in the size of the automaton (we provide a self-contained short translation). Since problems in NC2 can be solved sequentially in polylogarithmic space [27], this yields a trivial PSpace algorithm. Our contribution is a matching PSpace lower-bound.
Theorem 4.
Zeroness and equivalence problems are PSpace-complete for CCRA over .
Organisation
2 Preliminaries
Let . For a field , let denote the multiplicative group of nonzero elements. We sometimes write and for the elements and of the field, to emphasize which and we mean.
2.1 Automata and Sequences
A weighted automaton over a field is a tuple , where: is its dimension; is a finite alphabet; are transition matrices; , are the initial and final vectors, respectively. For simplicity, sometimes we will write , that is, we will omit in the tuple.
Weighted automata can be defined more generally over semirings, but in this paper we only consider the case of fields. The field is already rich enough to produce all phenomena of interest to us. Thus, our examples will be for with the usual addition and product, unless stated otherwise.
Given a word , we denote . In particular is the -identity matrix. A weighted automaton defines a function , by . We say that a weighted automaton is a linear recurrence sequence (LRS) if . Then, by identifying with , that is, identifying the word with its length , we write that . We will also denote such sequences instead of , where .
Example 5.
Consider an LRS , where: ; and . Then .
For weighted automata we define their underlying automata. A weighted automaton can be interpreted as an automaton with states such that for every a nonzero entry in defines a transition from to labeled by of weight (thus we ignore transitions of weight ). Similarly, initial and final states are such that and are nonzero, respectively. Their weights are and . By ignoring the weights of transitions, initial and final states, we obtain a finite automaton , which we call the underlying automaton of .
Example 6.
The LRS in Example 5 is an equivalent presentation of the weighted automaton in Figure 1(b).
A weighted automaton is polynomially ambiguous if there is a polynomial function such that for every the number of accepting runs of the underlying automaton on is bounded by . For example, the automaton in Example 6 is polynomially ambiguous as it suffices to take . In general this is a strict subclass: there exist weighted automata that are not equivalent to any polynomially ambiguous weighted automata.
LRS can be characterised in another way. An LRS can be defined by a (homogeneous) recurrence relation of the form with and initial values , …, . Here is the order of the recurrence. For instance, the LRS from Example 5 can be defined by and , . It is well-known that the two definitions coincide [15, Lemma 1.1] [8, Proposition 2.1]. Moreover, the translation is effective in polynomial time, and under this translation, the dimension of the weighted automaton equals the order of the recurrence.
Any given LRS satisfies many different linear recurrences. However, it is well-known that there is a unique (homogeneous) recurrence of minimal order satisfied by [6, Ch. 6.1]. The corresponding order is then the order of the LRS. This minimal recurrence gives rise to the characteristic polynomial of [6, Ch. 6.1] [13]. The roots of the characteristic polynomial (considered in the algebraic closure ) are the characteristic roots of the LRS .
Example 7.
Continuing from Example 5, the characteristic polynomial is . Hence, the only characteristic root is (with multiplicity ).
The characteristic roots of LRS definable by polynomially ambiguous weighted automata are always roots of elements of [2, 18, 25]. So, for example, the Fibonacci sequence , , , is not recognised by a polynomially ambiguous weighted automaton over , as its characteristic roots are the golden ratio and .
We recall an additional characterisation of LRS, namely as coefficient sequences of rational functions, leading to exponential polynomials. See also [6, Chapter 6][13][15, Proposition 2.11] or [19, Appendix A]. A sequence is an LRS if and only if the (formal) generating series is a rational function: the series is the formal Taylor series expansion of some with , coprime polynomials and . For nonzero , the following are now equivalent:
-
is a characteristic root of ;
-
appears as an eigenvalue of in a weighted automaton representation of of minimal dimension;
-
is a pole of , that is, .
Further, the characteristic roots appear as eigenvalues of in every representation of using a weighted automaton. But in a weighted automaton that is not of minimal dimension, the matrix may have additional eigenvalues.
In characteristic , every LRS , has, for large enough , a representation as an exponential polynomial sequence (EPS):
with polynomials over and the nonzero characteristic roots of . Furthermore, the exponential bases and the polynomials are uniquely determined by .
Example 8.
The Fibonacci numbers admit the representation .
In characteristic , the situation is more complicated (see [19, Appendix A]): an LRS may not have a representation by an exponential polynomial (even for large ). If it does have such a representation, it is however still unique as long as the polynomials are chosen of minimal degree, that is, with . Further, every EPS is an LRS, and the exponential bases of the EPS are precisely the nonzero characteristic roots of the LRS.
2.2 Cost Register Automata
We will introduce one more formalism that generalises weighted automata to polynomial updates [1]. A cost register automaton (CRA) over a field is a tuple , where: is a finite set of states; is the initial state; is its dimension; is a finite alphabet; is a deterministic transition function, where is the set of -dimensional polynomial maps; is the vector of initial register values; and is the final function. Here, a polynomial map is a tuple with polynomials . Every polynomial map induces a function .
Given and we write for the polynomial map such that for some . Note that if we ignore the polynomials in , then is just a deterministic finite automaton without final states. Thus, given a word , there is a unique state reachable from when reading . We will denote it . For words we define polynomial maps by induction: if is a letter then ; otherwise if for a letter then .
A CRA defines a function , similarly to weighted automata. Formally, given a word we define .
Example 9.
We can define the automaton recognising the same function as in Example 5. There is only one state, which is also initial, and only one letter. The dimension is , we will label the two resulting registers as and . There is only one transition defined by the polynomial map with and . The initial vector is defined by , ; and the output is the polynomial .
One can think of the polynomial maps as generalising linear updates definable by matrices. When restricting the model to linear polynomials, the CRA formalism is equivalent to weighted automata [1], and it is called linear CRA. The resulting weighted automaton is of polynomial size in the size of the linear CRA. Note that CRA use separate notions of states (the set ) and registers (i.e., the dimension ). In general, states are not needed, as one can easily encode the states by enlarging the dimension to , even for linear CRA. However, such encodings do not preserve the copyless restriction on CRA, which we discuss next.
A copyless CRA (CCRA) is a CRA such that all polynomial maps in the transition function and the output function are copyless. A polynomial map is copyless if it can be written using sum, product, variable names and constants using each variable name only once. In particular for is not copyless.
Example 10.
For the map is defined by three polynomials , and . If , and , then is copyless; but if , and , then is not copyless.
It is easy to see that copyless polynomial maps are preserved under composition. Thus, in a CCRA all polynomial maps are copyless.
3 Pumping Sequence Families of CCRA
Throughout the section, fix a field . In this section we prove a result restricting Pumping Sequence Families of CCRA. This result will be based on the observation that sequences of the form , obtained from a CCRA , are always representable by very particular exponential polynomials. To this end, we first introduce the following class of functions.
Definition 11.
A -valued sequence is an exponential polynomial sequence generable from (in short, an -generable EPS) if it can be obtained, using pointwise products and sums, from the following sequence families:
-
Constant sequences for ,
-
The linear sequence ,
-
Exponential sequences (that is, geometric progressions) for ,
-
Sequences of the form for .
The last family may be a bit unexpected at first glance. It arises from the geometric sum
with the representation in Definition 11 corresponding to the normal form for exponential polynomials (with the two exponential bases and ). Because possibly , this last family cannot always be generated from the other three families.
Example 12.
Since , the geometric sum appears when iterating a copyless update rule of the form from the starting value .
Taking , the class of -generable EPS admits a more familiar description.
Lemma 13.
A sequence is a -generable EPS if and only if it is an EPS with coefficients and exponential bases in .
Proof.
We first check that every -generable EPS is indeed an EPS. Since EPS with coefficients and exponential bases in are closed under products and sums, it suffices to verify the claimed property for the families in Definition 11. However, each of these families is obviously an EPS and the only exponential bases that appear are and .
Conversely, suppose that has a representation with (only finitely many of which are nonzero). Each of , and is clearly a -generable EPS, and so is therefore .
Recall that the exponential bases being contained in is a nontrivial restriction on an EPS. In general, these will be contained in the algebraic closure . In particular, every -generable EPS is trivially a -generable EPS, and hence by Lemma 13 an EPS (in the sense discussed in Section 2), so that our terminology is consistent. Working with, possibly proper, subsets will be crucial to obtain a pumping-like criterion that is strong enough to differentiate between CCRA and polynomially ambiguous WFA.
We need a final definition before stating our main theorem of the section.
Definition 14.
Let be a subsemiring. An -CCRA is a CCRA with all of its initial register values, output expression and transition coefficients in .
We will now exploit Pumping Sequence Families, the main tool introduced in this paper (recall Definition 1).
Theorem 15.
If is a subsemiring and is recognised by an -CCRA, then there exists such that,
-
for every , the sequence is an -generable EPS, and
-
if the characteristic of is and is the exponential polynomial representing , then for every the sum of -degree coefficients is in .
The sum of -degree coefficients is obtained by summing all the coefficients of in across all the exponential bases (see [19, Appendix A] for a detailed discussion). The characteristic condition in the second property can be removed, leading to a slightly weaker result which is discussed in [19, Appendix B.7].
It is obvious that, for any input, the output of an -CCRA is in . However, this is different from the property in Theorem 15 – we make a claim about the coefficients of the exponential polynomial, not the values that it takes. The individual coefficients do not need to always lie in , as the following example illustrates.
Observe that we can assume is finitely generated – by the initial register values, output expression and transition coefficients of the CCRA.
Example 16.
Before proving Theorem 15, we demonstrate how it can be applied. We use it to show that not every function recognisable by a polynomially ambiguous WFA can be recognised by a CCRA.
Example 17.
The automaton in Figure 3 is polynomially ambiguous. Let be the function associated with the automaton and, for the sake of contradiction, assume that can be recognised by a CCRA. This yields a finitely generated subsemiring and a natural number such that for all , the sequence meets the conditions from Theorem 15. Consider, for any , . By grouping the paths based on which is used to transition between the second and third state, we get
Using the identity , which can be derived from the geometric sum by formal differentiation and some easy manipulations, one finds
with
We have . Only a finite set of prime numbers can appear among denominators of elements of and only finitely many primes divide , we can thus take a prime that fulfills neither of these conditions. We can also now fix . We get
Since , the numerator is not divisible by . However, by Fermat’s Little Theorem, the denominator is. As we have assumed that does not appear in the denominator of any element of , this means , contradicting the statement of Theorem 15.
We record the conclusion as a theorem.
Theorem 18.
If , then there exist functions that are recognisable by a polynomially ambiguous weighted automaton, but not by a -CCRA.
Proof.
By Example 17.
3.1 The Proof of Theorem 15
The proof of Theorem 15 proceeds in several steps. We start with a very simple case and then, in each step, use the previous result to show a slightly more general one.
Definition 19.
A single letter, single state CCRA is simple if, in the transition, every register value is either set to a constant (constant registers), or depends only on its old value and on the values of constant registers (updating registers).
Since there is only one state, there is also only one transition, so the definition makes sense. We can visualise constant and updating registers with a graph representing the dependency of register values on each other (Figure 4).
Lemma 20.
If is a single state, single letter simple -CCRA, then is an -generable EPS.
Proof.
In a simple CCRA, the register values change in very simple ways. For constant registers, after the first transition, they remain set to the same values. For updating registers, the first update is special. However, after that, the input they get from the constant registers stabilizes. Let us consider what happens from that point on. After the first step, the register values are of course still in . Since the updating registers can only depend on themselves and constants, the update formulas can be reduced to the form for constants , . This gives us an LRS (). Solving the LRS, we need to distinguish two cases. For , the solution is
In both cases the sequence is clearly an -generable EPS. Constant registers, leading to constant sequences, also clearly are -generable EPS.
The output expression combines these sequences using sums and products of the sequences and additional constants from . These operations preserve the property of being an -generable EPS, and so the sequence is an -generable EPS.
In the next two lemmas we will reason about the behaviour of CCRA on cycles. Similar, but different, observations were made in [21, Proposition 1 and Lemma 4].
Lemma 21.
If is a single state, single letter -CCRA (not necessarily simple) with registers, then is an -generable EPS.
Proof.
Consider the compound effect on registers of the letter being applied times. We can get the corresponding expressions simply by composing the substitution times. They will still of course be copyless and polynomial, meaning we can create an auxiliary CCRA with a 1-letter alphabet such that . It is also easy to see, from how substitutions compose, that is still an -CCRA.
We claim that the new CCRA is simple: we will prove this by looking at the variable flow graph of . Since is copyless, there is at most one outgoing edge from any vertex. In the expression for register will use if and only if in the variable flow graph of there is a path of length from to . (This is visualised in Figure 5.)
Consider an arbitrary register . It will either be in a cycle on the graph of or not. Assume is not in a cycle and there is a path of length from some register to . Such a path would have to contain a cycle. However, that is impossible, since each vertex has at most one outgoing edge and itself is not in a cycle. This means will be a constant register in the auxiliary automaton.
Now assume is in a cycle in the variable flow graph of , and let be the length of the cycle. We want to prove that is an updating register in . Assume there is a path of length from some to . To show that is an updating register, we need to show that either or is a constant register in . If is in the same cycle as , we have , since . If is outside the cycle containing , then cannot be a part of any cycle, as any vertex can have at most one outgoing edge. This means that is a constant register in . Thus, the auxiliary CCRA is simple, and we can apply Lemma 20 to it, finishing the proof.
Lemma 22.
If is a single letter -CCRA (not necessarily single state) with states and registers, then is an -generable EPS.
Proof.
Consider the compound effect on registers of the letter being applied times. We can get the corresponding transitions between states by looking at paths of length , and corresponding update expressions by composing appropriate substitutions. The updates will of course still be copyless and polynomial, and the transitions deterministic, meaning we can create an auxiliary CCRA such that . Note that the transition expression coefficients will all still be in , so is still an -CCRA. Since is deterministic, after at most steps it always reaches a cycle. This cycle has length at most , and so its length divides . This means that, after trimming , we get an automaton of one of the forms in Figure 6.
We want to reduce to only one state. The first possible form already has only one state. The second one can easily be simulated with one state, as shown in Figure 7. After this operation, the automaton is a single-state -CCRA with registers such that . This lets us use Lemma 21 and finishes the proof.
Lemma 23.
If is an -CCRA (not necessarily single letter) with registers and states, then, for all , the sequence is an -generable EPS.
Proof.
Consider the composite effect of the word on registers and state transitions. This effect is still copyless, polynomial, deterministic and all the transition coefficients are still in . We can thus create an auxiliary -CCRA such that . The CCRA has a one letter alphabet, letting us use Lemma 22 and finishing the proof.
Lemma 24.
If is an -CCRA with registers and states, then, for all , the sequence is an -generable EPS.
Proof.
Adding some prefix simply changes the initial register values. The register values are of course still in . Adding a suffix simply changes the output expression. Its coefficients are of course still in . Thus, we obtain an -CCRA with for all words . By Lemma 23, the sequence is an -generable EPS.
We also need the next lemma which is proven in [19, Appendix B].
Lemma 25.
If is a subsemiring, , is an -generable EPS and is the exponential polynomial representing , the sum of -degree coefficients of is in .
We can finally prove the main theorem of Section 3.
Proof of Theorem 15.
3.2 CCRA versus -generable EPS
We have seen that, for functions recognisable by a CCRA, there always exists a finitely generated subsemiring and such that for all the sequence is an -generable EPS. We conjecture that this is not sufficient to characterise functions recognised by CCRA, even if it is already known that the function is recognised by a weighted automaton.
At present, we do not have a counterexample, but we outline a plausible candidate in this subsection. However, it appears difficult to prove that the given function is not recognised by a CCRA.
Example 26.
Consider the following function . Given , let be the indices of all ’s in , e.g. for we have: , , . Then .
Technical computations show that each element of is a -generable EPS ([19, Appendix B]). Nevertheless, it appears unlikely to us that could be recognised by a CCRA.
The reason why functions can or cannot be recognised by a CCRA can be subtle: while it appears that the function in Example 26 cannot be recognised by a CCRA, the following example shows a function of similar nature that can be recognised by a CCRA.
Example 27.
We define : as before, given , let be the indices of all ’s. Then is recognised by the CCRA in Figure 8.
Another promising example is discussed in [19, Appendix B].
4 Pumping Sequence Families of Polynomially Ambiguous WA
In this section we prove a result restricting Pumping Sequence Families of polynomially ambiguous weighted automata.
Theorem 28.
If is recognised by a polynomially ambiguous weighted automaton over , then there exist a finitely generated multiplicative semigroup and such that
-
the characteristic roots of every sequence in are contained in ,
-
and for all .
With this theorem, we can give the following example.
Example 29.
The function defined by the CCRA in Figure 9 cannot be recognised by a polynomially ambiguous weighted automaton.
Proof.
Let us consider inputs of the form for . We have , meaning that every natural number appears as a characteristic root of an LRS in . However, the monoid generates as a group, and is a countably generated free abelian group (with primes as the generators). Since subgroups of a finitely generated abelian group are finitely generated, but there are infinitely many primes, the natural numbers cannot be a submonoid of a finitely generated abelian group. Theorem 28 shows that is not recognised by a polynomially ambiguous weighted automaton.
We again record this conclusion as a theorem.
Theorem 30.
If , then there exist functions that can be recognised by a -CCRA but not by a polynomially ambiguous weighted automaton over .
Proof.
By Example 29.
The core of the proof of Theorem 28 will be the following lemma. The argument is similar to an argument in [17] and in [25, Prop. 9.3]. A self-contained proof can be found in [19, Appendix B].
Lemma 31.
Let be a trim polynomially ambiguous weighted automaton. Then, for every word , there exists a permutation matrix such that is upper triangular. Furthermore, all nonzero eigenvalues of are products of transition weights (that is, of entries of the matrices for letters ).
Before proving Theorem 28, we need a final small observation.
Lemma 32.
If is a finitely generated semigroup and , then the semigroup is also finitely generated.
Proof.
Suppose , …, generate . For each let be a root of . Let be the subsemigroup of generated by , …, together with the -th roots of unity in (of which there are at most , since they are the roots of ).
We claim . The inclusion holds by definition. Suppose . Then for some . Define . Then . It follows that with an -th root of unity (whether or not ). So .
Proof of Theorem 28.
We have to show that there exists a finitely generated multiplicative semigroup and an such that for every , , , the characteristic roots of are contained in and for all .
Let be a polynomially ambiguous weighted automaton recognising . Let . Without restriction, we can take to be trim. Let be the subsemigroup of generated by all the finitely many transition weights of , and let . By Lemma 32, the semigroup is finitely generated.
The characteristic roots of the LRS are eigenvalues of . By Lemma 31, the eigenvalues of are products of transition weights. We have , and so the eigenvalues of are roots of degree of products of transition weights of . This means they belong to .
We (ambitiously) conjecture the following converse of Theorem 28.
Conjecture 33.
Let be recognised by a weighted automaton. If there exists a finitely generated multiplicative subsemigroup and such that
-
the characteristic roots of every sequence in are contained in ,
-
and for all ,
then is recognised by a polynomially ambiguous weighted automaton.
Conjecture 33 postulates a pumping-style characterisation. The following conjecture postulates a “global” characterisation, with a similar restriction as in Conjecture 33 imposed on the eigenvalues of the matrix semigroup. Here it is important that the condition is imposed on all matrices, not just on the generators.
Conjecture 34.
Let be recognised by a weighted automaton. If there exists a finitely generated multiplicative subsemigroup and such that
-
all eigenvalues of matrices for are contained in G,
-
and for all ,
then is recognised by a polynomially ambiguous weighted automaton.
A positive resolution of the conjectures would extend a characterisation in similar spirit of functions that can be recognised by unambiguous weighted automata [4]. While the conjectures seem ambitious, in the preprint [25], Conjecture 34 was already proved in the case that all transition matrices are invertible.
Lemma 35.
Let be a minimal weighted automaton and let . Then the set of nonzero eigenvalues of is precisely the set of all nonzero characteristic roots of the LRS as , range through all words.
Proof.
One direction is obvious – characteristic roots come from eigenvalues of the matrix . We only have to show that every nonzero eigenvalue of shows up as characteristic root of some LRS.
Working over we can assume that is algebraically closed. This allows us to change to a basis in which is in the Jordan normal form. In particular, we can assume that is upper triangular and . Let and let be its transpose. Then .
Because is minimal, the reachability set spans as a vector space, and analogously the coreachability set spans – otherwise we could easily decrease the dimension. Therefore, there exist , and , such that and . Now
expresses the LRS as linear combination of LRS . Since the former has a characteristic root , a summand must have as a characteristic root as well: this is easily seen by considering the LRS as rational functions, and recalling that nonzero characteristic roots correspond to reciprocals of poles, or by the uniqueness result in [19, Theorem 39].
While the main theorem of this section provides a necessary pumping criterion for polynomially ambigualisable automata, that is, those weighted automata that are equivalent to polynomial ambiguous ones, another related open problem is to relate the minimal degree of the polynomial bounding the ambiguity to arithmetic properties of the output (in other words, to characterise linearly ambiguous, quadratically ambiguous, etc.). At least in characteristic zero, a tempting idea is to look at the degrees of polynomials arising in the PSF. Indeed, it is easy to see that if the ambiguity of the automaton is bounded by a polynomial of degree , then no polynomial of higher degree can appear in the PSF. The converse however does not hold, as the following example shows.
Example 36.
The function , mapping a binary word to the natural number it represents (say, LSB on the left), is easily seen to be recognisable by a weighted automaton. We check that, for any , , , the exponential polynomial representation of only contains constant polynomials. Indeed, let , , . We have
This gives us an exponential polynomial with only constant polynomials.
A set of the form for some and a finitely generated subgroup is called a Bézivin set [25]. One can show that is not a Bézivin set.111This is a consequence of a theorem of Bézivin [7, Th. 4]: if were Bézivin, its generating series would have to have simple poles only, which is not the case. It is also easy to see that the output set of a finitely ambiguous weighted automaton is a Bézivin set. Since , the function cannot be recognised by a finitely ambiguous weighted automaton.
5 Equivalence and Zeroness of CCRA
The two problems are defined as follows (for any classes of automata):
-
equivalence: given two automata and , decide if for all .
-
zeroness: given an automaton , decide if for all .
It is folklore that for (polynomially) weighted automata and CCRA the two problems are effectively interreducible. Indeed, to decide zeroness of it suffices to check equivalence with that outputs on all words. Conversely, to check equivalence of and one can check zeroness of , which can be efficiently constructed for these models. Therefore we will deal only with zeroness.
For polynomially ambiguous weighted automata, even unrestricted weighted automata, we know that zeroness is in polynomial time [28] and in NC2 [29]. Thus, we focus on the complexity of zeroness for CCRA. For the problem to make sense we need to introduce the size of the input CCRA. Given , we say that its size is , where ranges over all polynomials and constants used in , and . We assume that polynomials are represented in the natural succinct form of arithmetic tree circuits, not as a list of all monomials.
Recall that in the update function one cannot use polynomials like because two copies of are needed. However, in some sense CCRA can evaluate any polynomial. For example there is a CCRA such that , simply by having two registers storing and defining the output function as their product. We can say that evaluating requires two copies of . We generalise this observation to any polynomial. Given , we say that a polynomial is -copyless if there exists a copyless polynomial , where ( copies of every ) such that , substituting for all and . In particular -copyless is copyless.
We will use a standard and convenient lemma that allows us to turn formulas into polynomials. Note that we assume that formulas, like polynomials, are represented as tree circuits. By the size of the formula, denoted , we understand the size of the circuit. The proof can be found in [19, Appendix B].
Lemma 37.
Let and let be a Boolean quantifier free formula. There exists a polynomial , of size polynomial in , such that for every we have: ; and if and only if evaluates to true. Moreover, the polynomial is -copyless.
We are ready to prove the main theorem.
Theorem 4. [Restated, see original statement.]
Zeroness and equivalence problems are PSpace-complete for CCRA over .
Proof.
Regarding the upper bound, by [19, Lemma 50], we know that a CCRA can be translated to a weighted automaton of exponential size. It is known that the equivalence problem for weighted automata is in NC2 [29]. Since problems in NC2 can be solved sequentially in polylogarithmic space [27], this essentially yields a PSpace algorithm. One has to take care that the weighted automaton is not fully precomputed (as it would require too much space). A standard approach computing the states and transitions on the fly solves this issue. See e.g. [17, Section 6.1] for a similar construction.
The rest of the proof is devoted to the matching PSpace lower bound. We reduce from the validity problem for Quantified Boolean Formulas (QBF), which is known to be PSpace-complete [23, Theorem 19.1]. One can assume the input is a formula of the form
| (1) |
where is quantifier-free. The variables and alternate, are quantified universally and are quantified existentially. For simplicity, we write and . We write instead of . Given we denote by the truth value of the formula with all variables evaluated according to .
For the reduction, we will need to go through many evaluations of and in a way that respects the quantifiers. It will be convenient to define these evaluations using auxiliary formulas. Let and be fresh copies of variables in and all of dimension . We define three quantifier-free formulas: , and , as follows.
Note that start and end do not use , but in this form it will be easier to state the claim later explaining their purpose. We also define
To understand the formulas, it is easier to ignore the and variables at first. Then these formulas essentially encode a binary counter with bits: start encodes that all are ; end encodes that all are ; and next encodes that is increased by in binary. The values of can be guessed to anything in start and end. In next we keep consistently the guessed existential values for all unchanged universal variables. The following lemma formally states the purpose of the formulas.
Claim 38.
The formula in Equation 1 is valid if and only if there exists a sequence such that:
-
1.
is true for all ;
-
2.
is true;
-
3.
is true for all ;
-
4.
is true.
Proof.
The formulas start, next and end are defined in such a way that they go through all possible evaluations of universal variables, guessing consistently the values for existential variables. The first condition guarantees that is valid.
Thanks to Claim 38 we will not need to differentiate between universal and existential variables. In the following we will implicitly use Lemma 37. To avoid additional notation we will write formula names for their corresponding polynomials. Let , then all polynomials corresponding to these formulas are -copyless. To ease the notation we write
for identical copies of vectors of variables in and . Note that identical copies occur on indices equal modulo (this will be useful when defining the transitions). The number of copies will be sufficient to evaluate all polynomials corresponding to the formulas in a copyless manner. To emphasise this, we will write , and .
We are ready to define the CCRA , where: ; ; . We denote the variables as follows: , , , and . That is: four disjoint copies corresponding to copies of , and one extra variable . We denote the variables in the copies by , , , for . The initial function assigns the value to all variables. It will be important that ; for all other variables the initial value could be arbitrary. The final function is defined by for all and .
Before we define the transitions we give an intuition on how the automaton works. We call a subword of length a block. The automaton will read a sequence of blocks which correspond to consecutive evaluations from Claim 38 and store them in multiple copies of and . After reading every block the automaton will check whether: next holds with the previous block; and whether holds on the current block. As an invariant, the register will have value if no error has been detected, and otherwise.
Most of the transitions will initialise some registers. Given a set of variables and , we define the copyless polynomial map as: for and otherwise. In words, the variables in are initialised to and all others keep their previous value. We will use one type of sets , defined as follows: . This will allow us to remember copies at once.
Formally, we define the transitions as follows (see Figure 10 for the shape of the automaton without the register updates):
-
1.
for all and .
-
2.
for all and .
-
3.
, where resets all variables to except for: where it puts the content of , i.e., for all ; and .
-
4.
, where resets all variables to except for: where it puts the content of , i.e., for all ; and .
Note that all polynomials are copyless.
The proof that the reduction works follows essentially from Claim 38. The transitions in Item 1 and Item 2 guess the evaluations . These are stored in three copies: , , . The remaining two transitions verify the correctness of these evaluations, i.e., whether they satisfy the conditions in Claim 38. Note that as an invariant these transitions keep in the previous valuation. In both Item 3, Item 4 we check whether holds. Additionally, in Item 3 we check whether is true; and in Item 4 we check whether is true. All checks are multiplied into the register , which becomes if any error occurs, and remains otherwise. Finally, the output function guarantees that a nonzero value can be output only if holds.
References
- [1] Rajeev Alur, Loris D’Antoni, Jyotirmoy V. Deshmukh, Mukund Raghothaman, and Yifei Yuan. Regular Functions and Cost Register Automata. In 28th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2013, New Orleans, LA, USA, June 25-28, 2013, pages 13–22. IEEE Computer Society, 2013. doi:10.1109/LICS.2013.65.
- [2] Corentin Barloy, Nathanaël Fijalkow, Nathan Lhote, and Filip Mazowiecki. A robust class of linear recurrence sequences. Inf. Comput., 289(Part):104964, 2022. doi:10.1016/J.IC.2022.104964.
- [3] Jason Bell and Daniel Smertnig. Noncommutative rational Pólya series. Selecta Math. (N.S.), 27(3):Paper No. 34, 34, 2021. doi:10.1007/s00029-021-00629-2.
- [4] Jason P. Bell and Daniel Smertnig. Computing the linear hull: Deciding deterministic? and unambiguous? for weighted automata over fields. In 38th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2023, Boston, MA, USA, June 26-29, 2023, pages 1–13. IEEE, 2023. doi:10.1109/LICS56636.2023.10175691.
- [5] Yahia Idriss Benalioua, Nathan Lhote, and Pierre-Alain Reynier. Minimizing Cost Register Automata over a Field. In Rastislav Královic and Antonín Kucera, editors, 49th International Symposium on Mathematical Foundations of Computer Science, MFCS 2024, August 26-30, 2024, Bratislava, Slovakia, volume 306 of LIPIcs, pages 23:1–23:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.MFCS.2024.23.
- [6] Jean Berstel and Christophe Reutenauer. Noncommutative Rational Series with Applications, volume 137 of Encyclopedia of Mathematics and its Applications. Cambridge University Press, Cambridge, 2011.
- [7] Jean-Paul Bézivin. Sur un théorème de G. Pólya. J. Reine Angew. Math., 364:60–68, 1986. doi:10.1515/crll.1986.364.60.
- [8] Michaël Cadilhac, Filip Mazowiecki, Charles Paperman, Michal Pilipczuk, and Géraud Sénizergues. On Polynomial Recursive Sequences. Theory Comput. Syst., 68(4):593–614, 2024. doi:10.1007/S00224-021-10046-9.
- [9] Agnishom Chattopadhyay, Filip Mazowiecki, Anca Muscholl, and Cristian Riveros. Pumping lemmas for weighted automata. Log. Methods Comput. Sci., 17(3), 2021. doi:10.46298/LMCS-17(3:7)2021.
- [10] Wojciech Czerwinski, Engel Lefaucheux, Filip Mazowiecki, David Purser, and Markus A. Whiteland. The boundedness and zero isolation problems for weighted automata over nonnegative rationals. In Christel Baier and Dana Fisman, editors, LICS ’22: 37th Annual ACM/IEEE Symposium on Logic in Computer Science, Haifa, Israel, August 2 - 5, 2022, pages 15:1–15:13. ACM, 2022. doi:10.1145/3531130.3533336.
- [11] Laure Daviaud, Marcin Jurdzinski, Ranko Lazic, Filip Mazowiecki, Guillermo A. Pérez, and James Worrell. When are emptiness and containment decidable for probabilistic automata? J. Comput. Syst. Sci., 119:78–96, 2021. doi:10.1016/J.JCSS.2021.01.006.
- [12] Manfred Droste, Werner Kuich, and Heiko Vogler. Handbook of Weighted Automata. Springer Science & Business Media, 2009.
- [13] Graham Everest, Alfred Jacobus Van Der Poorten, Igor Shparlinski, Thomas Ward, et al. Recurrence Sequences, volume 104. American Mathematical Society Providence, RI, 2003.
- [14] Nathanaël Fijalkow, Cristian Riveros, and James Worrell. Probabilistic automata of bounded ambiguity. Inf. Comput., 282:104648, 2022. doi:10.1016/J.IC.2020.104648.
- [15] Vesa Halava, Tero Harju, Mika Hirvensalo, and Juhani Karhumäki. Skolem’s Problem — On the Border between Decidability and Undecidability. TUCS Technical Reports, 683, 2005.
- [16] Kosaburo Hashiguchi. Algorithms for Determining Relative Star Height and Star Height. Inf. Comput., 78(2):124–169, 1988. doi:10.1016/0890-5401(88)90033-8.
- [17] Ismaël Jecker, Filip Mazowiecki, and David Purser. Determinisation and Unambiguisation of Polynomially-Ambiguous Rational Weighted Automata. In Pawel Sobocinski, Ugo Dal Lago, and Javier Esparza, editors, Proceedings of the 39th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2024, Tallinn, Estonia, July 8-11, 2024, pages 46:1–46:13. ACM, 2024. doi:10.1145/3661814.3662073.
- [18] Peter Kostolányi. Polynomially Ambiguous Unary Weighted Automata over Fields. Theory Comput. Syst., 67(2):291–309, 2023. doi:10.1007/S00224-022-10107-7.
- [19] Filip Mazowiecki, Antoni Puch, and Daniel Smertnig. Pumping-like results for copyless cost register automata and polynomially ambiguous weighted automata. CoRR, abs/2502.07356, 2025. doi:10.48550/arXiv.2502.07356.
- [20] Filip Mazowiecki and Cristian Riveros. Maximal Partition Logic: Towards a Logical Characterization of Copyless Cost Register Automata. In Stephan Kreutzer, editor, 24th EACSL Annual Conference on Computer Science Logic, CSL 2015, September 7-10, 2015, Berlin, Germany, volume 41 of LIPIcs, pages 144–159. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2015. doi:10.4230/LIPIcs.CSL.2015.144.
- [21] Filip Mazowiecki and Cristian Riveros. Copyless cost-register automata: Structure, expressiveness, and closure properties. J. Comput. Syst. Sci., 100:1–29, 2019. doi:10.1016/J.JCSS.2018.07.002.
- [22] Joël Ouaknine and James Worrell. On linear recurrence sequences and loop termination. ACM SIGLOG News, 2(2):4–13, 2015. doi:10.1145/2766189.2766191.
- [23] Christos H. Papadimitriou. Computational complexity. In Encyclopedia of Computer Science, pages 260–265. 2003.
- [24] Azaria Paz. Introduction to Probabilistic Automata. Academic Press, 1971.
- [25] Antoni Puch and Daniel Smertnig. Factoring through monomial representations: Arithmetic characterizations and ambiguity of weighted automata, 2024. Preprint. doi:10.48550/arXiv.2410.03444.
- [26] Christophe Reutenauer. On Polya series in noncommuting variables. In Lothar Budach, editor, Fundamentals of Computation Theory, FCT 1979, Proceedings of the Conference on Algebraic, Arthmetic, and Categorial Methods in Computation Theory, Berlin/Wendisch-Rietz, Germany, September 17-21, 1979, pages 391–396. Akademie-Verlag, Berlin, 1979.
- [27] Walter L. Ruzzo. On Uniform Circuit Complexity. J. Comput. Syst. Sci., 22(3):365–383, 1981. doi:10.1016/0022-0000(81)90038-6.
- [28] Marcel Paul Schützenberger. On the Definition of a Family of Automata. Inf. Control., 4(2-3):245–270, 1961. doi:10.1016/S0019-9958(61)80020-X.
- [29] Wen-Guey Tzeng. On Path Equivalence of Nondeterministic Finite Automata. Inf. Process. Lett., 58(1):43–46, 1996. doi:10.1016/0020-0190(96)00039-7.
