Abstract 1 Introduction 2 Preliminaries 3 Pumping Sequence Families of CCRA 4 Pumping Sequence Families of Polynomially Ambiguous WA 5 Equivalence and Zeroness of CCRA References

Pumping-Like Results for Copyless Cost Register Automata and Polynomially Ambiguous Weighted Automata

Filip Mazowiecki ORCID University of Warsaw, Poland Antoni Puch ORCID University of Warsaw, Poland Daniel Smertnig ORCID University of Ljubljana and Institute of Mathematics, Physics, and Mechanics (IMFM), Slovenia
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 1-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 problem
Funding:
Filip Mazowiecki: Supported by Polish National Science Centre SONATA BIS-12 grant number 2022/46/E/ST6/00230.
Antoni Puch: Supported by Polish National Science Centre SONATA BIS-12 grant number 2022/46/E/ST6/00230.
Daniel Smertnig: Supported by the Slovenian Research and Innovation Agency (ARIS) program P1-0288 and grant J1-60025.
Copyright and License:
[Uncaptioned image] © Filip Mazowiecki, Antoni Puch, and Daniel Smertnig; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Formal languages and automata theory
; Theory of computation Quantitative automata
Related Version:
Full Version: https://arxiv.org/abs/2502.07356 [19]
Editors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim Thắng

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.

(a) A four state unambiguous weighted automaton 𝒜 over a 1-letter alphabet {a}. Nonzero initial labels for p1 and q1 have value 1. The nonzero final states are p2 and q1, both with weight 1. For every word an there are two runs: on the left of value 12n; on the right of value 13n. Depending on the parity of n only one of the runs has nonzero output, thus 𝒜(an)=3n for even n, and 𝒜(an)=2n, otherwise.
(b) A 2-state polynomially ambiguous weighted automaton over the alphabet {a}. Note that every word an has n runs with value 1, hence (an)=n.
Figure 1: Weighted automata over the field of rationals (+,). For clarity, we omit zero labels.

Given a weighted automaton 𝒲 over the alphabet Σ consider 𝒲(Σ), the set of all outputs over all words. For example, in Figure 1 we have: 𝒜(a)={ 22n+1n}{ 32nn}; and (a)=. Reutenauer’s conjecture (now Bell and Smertnig’s Theorem) states that for every weighted automaton 𝒲 over a field K: there exists an equivalent unambiguous weighted automaton if and only if there exists a finitely generated multiplicative subgroup GK such that 𝒲(Σ)G{0}. For example 𝒜(a)G𝒜, where G𝒜 is generated by the transition weights {2,3}. 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 {0} 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 1-letter alphabets. By identifying words an with their length n, one can view such automata as sequences. In fact weighted automata over 1-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: i=1npi(x)λix, for every i there is an ni such that λini. 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 (PSF), which allows us to exploit the behaviour of these classes over 1-letter alphabets. In the following we use the standard sequence notation (an)n=a0,a1,a2,.

Definition 1.

A Pumping Sequence Family of a function f:ΣA, for any set A, is the set of all sequences of the form f^(u,w,v)(f(uwnv))n, with u,w,v ranging over all words in Σ. We denote it by PSF(f).

One should think that f is being projected onto many single-letter-like cases at once, where w plays the role of the single letter in the alphabet, while u and v correspond to slight adjustments of respectively the initial and acceptance conditions. The definition of PSF(f) exploits that u, v and w 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 A={,} (meaning acceptance and rejection of the word).

Example 2.

Consider f:{a}{,} which maps all words of even length to and all others to . Then PSF(f) consists of four sequences (for simplicity we write an example generator for each sequence):

  • f^(ε,ε,ε)=,,,,

  • f^(a,ε,ε)=,,,,

  • f^(ε,a,ε)=,,,,

  • f^(a,a,ε)=,,,,.

Example 3.

Consider g:{a,b}{,} which maps all words of the form anbn to and all others to . Then PSF(g) is an infinite set:

  • g^(ab,ε,ε)=,,,,

  • g^(a,ε,ε)=,,,,

  • g^(ε,ab,ε)=,,,,

  • g^(ak,b,ε)=,k,,,, for every k0.

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 L={akbkk} is infinite, proving that it is not regular and thus differentiating regular and context-free languages. Note that, due to Parikh’s theorem, over 1-letter alphabets the two language classes are equivalent and semi-linear. Meaning if we would fix u, v and w 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 A from Definition 1 is simply the underlying field.

For a function h 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 PSF(h) can be essentially represented as exponential polynomials. Consider such a sequence an=i=1dpi(n)λin. Let us write the polynomials pi explicitly: pi(x)=j=1miαi,jxj. For every degree k we define the sum of k-degree coefficients Sk((an)n)=i=1dαi,k. In Theorem 15 we show that, up to minor technical details, for all k the set {Sk((an)n)|(an)nPSF(h)} is contained in a finitely generated subsemiring R. For intuition, if we consider the generators {12,13}, by adding, subtracting and multiplying, they generate R={a6ka,k}. 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 (cn)nPSF(𝒲) consider again its exponential polynomial i=1dpi(x)λix and let E((cn)n)={λi1id} be the set of exponential bases. In Theorem 28 we show that the set (cn)nPSF(𝒲)E((cn)n) is contained in a finitely generated subgroup G. 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 𝒞(w)=𝒞(wr), where wr is w 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

We start with definitions in Section 2. In Section 3 and Section 4 we prove the properties of copyless CRA, and polynomially ambiguous weighted automata, respectively; and we present examples separating the classes. In Section 5 we discuss the decision problems.

2 Preliminaries

Let {0,1,2,}. For a field K, let K×K{0} denote the multiplicative group of nonzero elements. We sometimes write 1K and 0K for the elements 1 and 0 of the field, to emphasize which 1 and 0 we mean.

2.1 Automata and Sequences

A weighted automaton over a field K is a tuple 𝒜=(d,Σ,(M(a))aΣ,I,F), where: d is its dimension; Σ is a finite alphabet; M(a)Kd×d are transition matrices; I, FKd are the initial and final vectors, respectively. For simplicity, sometimes we will write 𝒜=(d,M,I,F), 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 w=w1wnΣ, we denote M(w)M(w1)M(wn). In particular M(ϵ) is the d×d-identity matrix. A weighted automaton defines a function 𝒜:ΣK, by 𝒜(w)IM(w)F. We say that a weighted automaton 𝒜 is a linear recurrence sequence (LRS) if |Σ|=1. Then, by identifying Σ with , that is, identifying the word an with its length n, we write that 𝒜:K. We will also denote such sequences (an)n instead of 𝒜, where an𝒜(n).

Example 5.

Consider an LRS 𝒜=(2,M,I,F), where: M=(1101); I=(10) and F=(01). Then 𝒜(n)=an=n.

For weighted automata we define their underlying automata. A weighted automaton 𝒜=(d,Σ,(M(a))aΣ,I,F) can be interpreted as an automaton with states {1,,d} such that for every aΣ a nonzero entry in Ma[i,j] defines a transition from i to j labeled by a of weight Ma[i,j] (thus we ignore transitions of weight 0). Similarly, initial and final states are i such that I[i] and F[i] are nonzero, respectively. Their weights are I[i] and F[i]. 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 𝒜=(2,M,I,F) 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 p: such that for every wΣ the number of accepting runs of the underlying automaton on w is bounded by p(|w|). For example, the automaton in Example 6 is polynomially ambiguous as it suffices to take p(n)=n. 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 (an)n can be defined by a (homogeneous) recurrence relation of the form an+k=i=0k1cian+i with ciK and k initial values a0, …, ak1. Here k is the order of the recurrence. For instance, the LRS (an)n from Example 5 can be defined by an+2=2an+1an and a0=0, a1=1. 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 d of the weighted automaton equals the order k of the recurrence.

Any given LRS (an)n satisfies many different linear recurrences. However, it is well-known that there is a unique (homogeneous) recurrence of minimal order satisfied by (an)n [6, Ch. 6.1]. The corresponding order k is then the order of the LRS. This minimal recurrence gives rise to the characteristic polynomial q=xkck1xk1c0 of (an)n [6, Ch. 6.1] [13]. The roots of the characteristic polynomial (considered in the algebraic closure K¯) are the characteristic roots of the LRS (an)n.

Example 7.

Continuing from Example 5, the characteristic polynomial is q=x22x+1=(x1)2. Hence, the only characteristic root is 1 (with multiplicity 2).

The characteristic roots of LRS definable by polynomially ambiguous weighted automata are always roots of elements of K [2, 18, 25]. So, for example, the Fibonacci sequence F0=0, F1=1, Fn+2=Fn+1+Fn, is not recognised by a polynomially ambiguous weighted automaton over , as its characteristic roots are the golden ratio φ=1+52 and ψ=152.

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 (an)n is an LRS if and only if the (formal) generating series F=n=0anxnKx is a rational function: the series F is the formal Taylor series expansion of some p/q with p, qK[x] coprime polynomials and q(0)0. For nonzero λK¯, the following are now equivalent:

  • λ is a characteristic root of (an)n;

  • λ appears as an eigenvalue of M(a) in a weighted automaton representation of (an)n of minimal dimension;

  • 1/λ is a pole of F, that is, q(1/λ)=0.

Further, the characteristic roots appear as eigenvalues of M(a) in every representation of (an)n using a weighted automaton. But in a weighted automaton that is not of minimal dimension, the matrix M(a) may have additional eigenvalues.

In characteristic 0, every LRS (an)n, has, for large enough n, a representation as an exponential polynomial sequence (EPS):

an=i=1kqi(n)λinfor sufficiently large n,

with qi polynomials over K¯ and λiK¯ the nonzero characteristic roots of (an)n. Furthermore, the exponential bases λi and the polynomials qi are uniquely determined by (an)n.

Example 8.

The Fibonacci numbers admit the representation Fn=15φn15ψn.

In characteristic p>0, the situation is more complicated (see [19, Appendix A]): an LRS may not have a representation by an exponential polynomial (even for large n). If it does have such a representation, it is however still unique as long as the polynomials qi are chosen of minimal degree, that is, with deg(qi)<p. 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 K is a tuple 𝒞=(Q,q0,d,Σ,δ,μ,ν), where: Q is a finite set of states; q0Q is the initial state; d is its dimension; Σ is a finite alphabet; δ:Q×ΣQ×Polyd is a deterministic transition function, where Polyd is the set of d-dimensional polynomial maps; μ:Kd is the vector of initial register values; and ν:QPolyd is the final function. Here, a polynomial map PPolyd is a tuple P=(p1,,pd) with polynomials piK[x1,,xd]. Every polynomial map induces a function KdKd.

Given qQ and aΣ we write pq,a for the polynomial map such that δ(q,a)=(q,pq,a) for some qQ. Note that if we ignore the polynomials in δ, then (Q,q0,Σ,δ) is just a deterministic finite automaton without final states. Thus, given a word w, there is a unique state reachable from q0 when reading w. We will denote it qw. For words wΣ+ we define polynomial maps pw by induction: if w=aΣ is a letter then pw=pq0,a; otherwise if w=wa for a letter aΣ then pw=pqw,apw.

A CRA defines a function 𝒞:ΣK, similarly to weighted automata. Formally, given a word w=w1wnΣ we define 𝒞(w)=(ν(qw)pw)(μ).

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 2, we will label the two resulting registers as x and y. There is only one transition defined by the polynomial map (px,py) with px(x,y)=x+y and py(x,y)=y. The initial vector is defined by μ(x)=0, μ(y)=1; and the output is the polynomial x.

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 Q) and registers (i.e., the dimension d). In general, states are not needed, as one can easily encode the states by enlarging the dimension to d×|Q|, 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 PPolyd is copyless if it can be written using sum, product, variable names and constants using each variable name only once. In particular xk for k>1 is not copyless.

Example 10.

For d=3 the map P is defined by three polynomials px(x,y,z), py(x,y,z) and pz(x,y,z). If px=(x+3)(y+z), py=7 and pz=1, then P is copyless; but if px=y+1, py=y and pz=z, then P is not copyless.

It is easy to see that copyless polynomial maps are preserved under composition. Thus, in a CCRA all polynomial maps pw are copyless.

Functions definable by Copyless CRA are known to be definable by weighted automata [20, 21].

3 Pumping Sequence Families of CCRA

Throughout the section, fix a field K. 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 (𝒜(uwm(n+1)v))n, 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 K-valued sequence (an)n is an exponential polynomial sequence generable from AK (in short, an A-generable EPS) if it can be obtained, using pointwise products and sums, from the following sequence families:

  • Constant sequences (α)n for αA,

  • The linear sequence (n1K)n,

  • Exponential sequences (that is, geometric progressions) (αn)n for αA,

  • Sequences of the form (1α1αn1α1)n for 1αA.

The last family may be a bit unexpected at first glance. It arises from the geometric sum

1α1αn1α1=αn1α1=i=0n1αi(α1),

with the representation in Definition 11 corresponding to the normal form for exponential polynomials (with the two exponential bases α and 1K). Because possibly 1/(1α)A, this last family cannot always be generated from the other three families.

Example 12.

Since i=0n1αi=α((α(α+1)+1))+1, the geometric sum appears when iterating a copyless update rule of the form xαx+1 from the starting value 1.

Taking A=K, the class of K-generable EPS admits a more familiar description.

Lemma 13.

A sequence (an)n is a K-generable EPS if and only if it is an EPS with coefficients and exponential bases in K.

Proof.

We first check that every K-generable EPS is indeed an EPS. Since EPS with coefficients and exponential bases in K 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 1K and αK.

Conversely, suppose that (an)n has a representation an=λK×i0αλ,iniλn with αλ,iK (only finitely many of which are nonzero). Each of (αλ,i)n, (ni)n and (λn)n is clearly a K-generable EPS, and so is therefore (an)n.

Recall that the exponential bases being contained in K is a nontrivial restriction on an EPS. In general, these will be contained in the algebraic closure K¯. In particular, every A-generable EPS is trivially a K-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 AK 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 RK be a subsemiring. An R-CCRA is a CCRA with all of its initial register values, output expression and transition coefficients in R.

We will now exploit Pumping Sequence Families, the main tool introduced in this paper (recall Definition 1).

Theorem 15.

If RK is a subsemiring and f:ΣK is recognised by an R-CCRA, then there exists m1 such that,

  • for every gPSF(f), the sequence (h(n))n=(g(m(n+1)))n is an R-generable EPS, and

  • if the characteristic of K is 0 and q is the exponential polynomial representing h, then for every k the sum of k-degree coefficients Sk(q) is in R.

The sum of k-degree coefficients Sk(q) is obtained by summing all the coefficients of xk in q 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 R-CCRA is in R. 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 R, as the following example illustrates.

Observe that we can assume R is finitely generated – by the initial register values, output expression and transition coefficients of the CCRA.

Example 16.
  • Consider the left -CCRA in Figure 2. On words of the form an+1, this CCRA outputs q(n)=𝒜(n+1)=3n+112=323n121n. Even though the automaton itself only uses integer coefficients, a denominator 2 appears in the coefficients of q. However, the sum of the coefficients is S0(q)=3212=1, an integer.

  • The second -CCRA in Figure 2 outputs

    (an+1)=5n+214(n+7)+3n+1=(254n+1754)5n+33n+(14n74)1nq(n).

    Here S1(q)=25414=6 and S0(q)=1754+374=45.

Figure 2: Two simple single-state CCRAs on a single-letter alphabet (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.

Figure 3: A polynomially ambiguous weighted automaton with no equivalent CCRA (Example 17).
Figure 4: A simple CCRA and its variable flow graph. Red nodes are constant registers; blue nodes are updating ones (Definition 19).
Example 17.

The automaton in Figure 3 is polynomially ambiguous. Let f:{a,b} be the function associated with the automaton and, for the sake of contradiction, assume that f can be recognised by a CCRA. This yields a finitely generated subsemiring R and a natural number m such that for all gPSF(f), the sequence (h(n))n(g((n+1)m))n meets the conditions from Theorem 15. Consider, for any k, gkf^(ε,akb,ε)PSF(f). By grouping the paths based on which b is used to transition between the second and third state, we get

hk(n)gk((n+1)m)=k2k+2k22k++m(n+1)k2m(n+1)k=j=1m(n+1)jk2jk.

Using the identity j=1ljxj=lxl+2(l+1)xl+1+x(x1)2, which can be derived from the geometric sum j=1lxj=xl+1xx1 by formal differentiation and some easy manipulations, one finds

hk(n)=q1(n)(2km)n+q2(n)1n,

with

q1(n)=km2km+k(2k1)n+k(m2km1)2km+k(2k1)2andq2(n)=k2k(2k1)2.

We have S1(hk)=km2km+k/(2k1). Only a finite set of prime numbers can appear among denominators of elements of R and only finitely many primes divide 2m, we can thus take a prime p that fulfills neither of these conditions. We can also now fix k=p1. We get

S1(hp1)=(p1)m2(p1)m+p12p11.

Since p2m, the numerator is not divisible by p. However, by Fermat’s Little Theorem, the denominator is. As we have assumed that p does not appear in the denominator of any element of R, this means S1(hp1)R, contradicting the statement of Theorem 15.

We record the conclusion as a theorem.

Theorem 18.

If |Σ|2, then there exist functions f:Σ 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 R-CCRA, then (𝒜(an+1))n is an R-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 R. Since the updating registers can only depend on themselves and constants, the update formulas can be reduced to the form xαx+β for constants α, βR. This gives us an LRS (xn+1=αxn+β). Solving the LRS, we need to distinguish two cases. For α=1, the solution is

xn+1=x1+βn,and for α1 it isxn+1=αnβα1βα1+αnx1.

In both cases the sequence (xn+1)n is clearly an R-generable EPS. Constant registers, leading to constant sequences, also clearly are R-generable EPS.

The output expression combines these sequences using sums and products of the sequences and additional constants from R. These operations preserve the property of being an R-generable EPS, and so the sequence (𝒜(an+1))n is an R-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 R-CCRA (not necessarily simple) with r registers, then (𝒜(ar!(n+1)))n is an R-generable EPS.

Proof.

Consider the compound effect on registers of the letter a being applied r! times. We can get the corresponding expressions simply by composing the substitution r! times. They will still of course be copyless and polynomial, meaning we can create an auxiliary CCRA with a 1-letter alphabet such that (an)=𝒜(anr!). It is also easy to see, from how substitutions compose, that is still an R-CCRA.

Figure 5: An example for variable flow graphs of 𝒜 and in the proof of Lemma 21.

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 v will use u if and only if in the variable flow graph of 𝒜 there is a path of length r! from u to v. (This is visualised in Figure 5.)

Consider an arbitrary register t. It will either be in a cycle on the graph of 𝒜 or not. Assume t is not in a cycle and there is a path of length r! from some register u to t. Such a path would have to contain a cycle. However, that is impossible, since each vertex has at most one outgoing edge and t itself is not in a cycle. This means t will be a constant register in the auxiliary automaton.

Now assume t is in a cycle in the variable flow graph of 𝒜, and let l be the length of the cycle. We want to prove that t is an updating register in . Assume there is a path of length r! from some u to t. To show that t is an updating register, we need to show that either u=t or u is a constant register in . If u is in the same cycle as t, we have u=t, since lr!. If u is outside the cycle containing t, then u cannot be a part of any cycle, as any vertex can have at most one outgoing edge. This means that u 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 R-CCRA (not necessarily single state) with s states and r registers, then (𝒜(a(4r+2)!s!(n+1)))n is an R-generable EPS.

Proof.

Consider the compound effect on registers of the letter a being applied s! times. We can get the corresponding transitions between states by looking at paths of length s!, and corresponding update expressions by composing appropriate s! substitutions. The updates will of course still be copyless and polynomial, and the transitions deterministic, meaning we can create an auxiliary CCRA such that (an)=𝒜(ans!). Note that the transition expression coefficients will all still be in R, so is still an R-CCRA. Since 𝒜 is deterministic, after at most s steps it always reaches a cycle. This cycle has length at most s, and so its length divides s!. This means that, after trimming , we get an automaton of one of the forms in Figure 6.

Figure 6: The two possible forms the auxiliary automaton can take in the proof of Lemma 22.
Figure 7: How to transform into a single state automaton in the proof of Lemma 22.

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 R-CCRA with 4r+2 registers such that (an)=𝒜(ans!). This lets us use Lemma 21 and finishes the proof.

Lemma 23.

If 𝒜 is an R-CCRA (not necessarily single letter) with r registers and s states, then, for all wΣ, the sequence (𝒜(w(4r+2)!s!(n+1)))n is an R-generable EPS.

Proof.

Consider the composite effect of the word w on registers and state transitions. This effect is still copyless, polynomial, deterministic and all the transition coefficients are still in R. We can thus create an auxiliary R-CCRA such that 𝒜(wn)=(an). The CCRA has a one letter alphabet, letting us use Lemma 22 and finishing the proof.

Lemma 24.

If 𝒜 is an R-CCRA with r registers and s states, then, for all u,w,vΣ, the sequence (𝒜(uw(4r+2)!s!(n+1)v))n is an R-generable EPS.

Proof.

Adding some prefix u simply changes the initial register values. The register values are of course still in R. Adding a suffix v simply changes the output expression. Its coefficients are of course still in R. Thus, we obtain an R-CCRA with (x)=𝒜(uxv) for all words xΣ. By Lemma 23, the sequence (𝒜(uwnv))n=((wn))n is an R-generable EPS.

We also need the next lemma which is proven in [19, Appendix B].

Lemma 25.

If RK is a subsemiring, charK=0, (an)n is an R-generable EPS and q is the exponential polynomial representing (an)n, the sum of k-degree coefficients of q is in R.

We can finally prove the main theorem of Section 3.

Proof of Theorem 15.

Let 𝒜 be an R-CCRA recognizing f. Let m=(4r+2)!s!, where r is the number of registers and s is the number of states of 𝒜. By Lemma 24 the sequence (h(n))n(g((n+1)m))n(f(uwm(n+1)v))n is an R-generable EPS. Let q be the exponential polynomial representing h. By Lemma 25, for every k, the sum of k-degree coefficients of this representation is in R.

3.2 CCRA versus 𝑹-generable EPS

We have seen that, for functions f:ΣK recognisable by a CCRA, there always exists a finitely generated subsemiring R and m1 such that for all gPSF(f) the sequence (g((n+1)m))n is an R-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 f:{0,1}. Given wΣ, let 0<k1<k2<<kr be the indices of all 1’s in w, e.g. for w=0110 we have: r=2, k1=2, k2=3. Then f(w)=i=1rki.

Technical computations show that each element of PSF(f) is a 12-generable EPS ([19, Appendix B]). Nevertheless, it appears unlikely to us that f 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 f 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 g:{0,1}: as before, given wΣ, let 0<k1<k2<<kr be the indices of all 1’s. Then g(w)=i=1r2ki is recognised by the CCRA in Figure 8.

Figure 8: A CCRA recognising a function that, at first glance, may seem unrecognisable by a CCRA (Example 27).
Figure 9: A two-register CRA recognising the function from Example 29.

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 f is recognised by a polynomially ambiguous weighted automaton over K, then there exist a finitely generated multiplicative semigroup GK¯ and N1 such that

  • the characteristic roots of every sequence in PSF(f) are contained in G,

  • and αNK for all αG.

With this theorem, we can give the following example.

Example 29.

The function f:{a,b} defined by the CCRA in Figure 9 cannot be recognised by a polynomially ambiguous weighted automaton.

Proof.

Let us consider inputs of the form (akb)n for k1. We have f^(ε,akb,ε)(n)=f((akb)n)=kn, meaning that every natural number k appears as a characteristic root of an LRS in PSF(f). However, the monoid (>0,) generates (>0,) as a group, and (>0,) 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 f is not recognised by a polynomially ambiguous weighted automaton.

We again record this conclusion as a theorem.

Theorem 30.

If |Σ|2, then there exist functions f:Σ 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 𝒜=(d,I,M,F) be a trim polynomially ambiguous weighted automaton. Then, for every word wΣ, there exists a permutation matrix P such that PM(wd!)P1 is upper triangular. Furthermore, all nonzero eigenvalues of M(wd!) are products of transition weights (that is, of entries of the matrices M(a) for letters aΣ).

Before proving Theorem 28, we need a final small observation.

Lemma 32.

If HK is a finitely generated semigroup and N1, then the semigroup G={αK¯αNH{1}} is also finitely generated.

Proof.

Suppose β1, …, βn generate H. For each βi let αiK¯ be a root of XNβi. Let G be the subsemigroup of K¯ generated by α1, …, αn together with the N-th roots of unity in K¯ (of which there are at most N, since they are the roots of XN1).

We claim G=G. The inclusion GG holds by definition. Suppose γG. Then γN=β1k1βnkn for some ki0. Define γα1k1αnknG. Then (γ)N=γN. It follows that γ=γζ with ζ an N-th root of unity (whether or not γ=0). So γG.

Proof of Theorem 28.

We have to show that there exists a finitely generated multiplicative semigroup GK¯ and an N1 such that for every u, w, vΣ, the characteristic roots of (f(uwnv))n are contained in G and αNK for all αG.

Let 𝒜=(d,I,M,F) be a polynomially ambiguous weighted automaton recognising f. Let Nd!. Without restriction, we can take 𝒜 to be trim. Let HK be the subsemigroup of K generated by all the finitely many transition weights of 𝒜, and let G={αK¯αNH{1}}. By Lemma 32, the semigroup G is finitely generated.

The characteristic roots of the LRS (𝒜(uwnv))n are eigenvalues of M(w). By Lemma 31, the eigenvalues of M(wN) are products of transition weights. We have M(wN)=M(w)N, and so the eigenvalues of M(w) are roots of degree N of products of transition weights of 𝒜. This means they belong to G.

We (ambitiously) conjecture the following converse of Theorem 28.

Conjecture 33.

Let f:ΣK be recognised by a weighted automaton. If there exists a finitely generated multiplicative subsemigroup GK¯ and N1 such that

  • the characteristic roots of every sequence in PSF(f) are contained in G,

  • and αNK for all αG,

then f 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 f:ΣK be recognised by a weighted automaton. If there exists a finitely generated multiplicative subsemigroup GK¯ and N1 such that

  • all eigenvalues of matrices M(w) for wΣ are contained in G,

  • and αNK for all αG,

then f 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.

The following lemma shows that Conjectures 33 and 34 are in fact equivalent.

Lemma 35.

Let 𝒜=(d,I,M,F) be a minimal weighted automaton and let wΣ. Then the set of nonzero eigenvalues of M(w) is precisely the set of all nonzero characteristic roots of the LRS (𝒜(uwnv))n as u, vΣ range through all words.

Proof.

One direction is obvious – characteristic roots come from eigenvalues of the matrix M(w). We only have to show that every nonzero eigenvalue λK¯ of M(w) shows up as characteristic root of some LRS.

Working over K¯ we can assume that K=K¯ is algebraically closed. This allows us to change to a basis in which M(w) is in the Jordan normal form. In particular, we can assume that M(w) is upper triangular and M(w)[1,1]=λ. Let e1=(1,0,,0)Kd×1 and let e1 be its transpose. Then λn=e1M(wn)e1.

Because 𝒜 is minimal, the reachability set {IM(w)wΣ} spans K1×d as a vector space, and analogously the coreachability set spans Kd×1 – otherwise we could easily decrease the dimension. Therefore, there exist αi, βjK and ui, vjΣ such that e1=i=1dαiIM(ui) and e1=j=1dM(vj)Fβj. Now

λn=i=1dj=1dαiβjIM(uiwnvj)F,

expresses the LRS (λn)n as linear combination of LRS (IM(uiwnvj)F)n. 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 d, 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 f:{0,1}, 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 u, w, vΣ, the exponential polynomial representation of (𝒜(uwnv))n only contains constant polynomials. Indeed, let u=u1u2ur, w=w1w2wt, v=v1v2vl. We have

f(uwnv)=20u1+21u2++2r1ur+(2rw1+2r+1w2++2r+t1wt)(1+2t++2t(n1))+2nt+rv1++2nt+r+l1vl=α+βi=0n12ti=α+β2tn12t1(α,β).

This gives us an exponential polynomial with only constant polynomials.

A set of the form {g1++gmmM,giG} for some M0 and a finitely generated subgroup G× 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 n=0nxn=x(1x)2 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 f(Σ)=, the function f 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 𝒜(w)=(w) for all wΣ.

  • zeroness: given an automaton 𝒜, decide if 𝒜(w)=0 for all w.

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 0 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 𝒞=(Q,q0,d,Σ,δ,μ,ν), we say that its size is |Q|+d+|Σ|+maxp(|p|), where p 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 x2 because two copies of x are needed. However, in some sense CCRA can evaluate any polynomial. For example there is a CCRA 𝒞 such that 𝒞(1n)=n2, simply by having two registers storing n and defining the output function as their product. We can say that evaluating x2 requires two copies of x. We generalise this observation to any polynomial. Given x1,,xk, we say that a polynomial p(x1,,xk) is d-copyless if there exists a copyless polynomial p(𝐱), where 𝐱=x1,1,,x1,k,xd,1,,xd,k (d copies of every xi) such that p(𝐱)=p(x1,,xk), substituting xi,j=xj for all 1id and 1jk. In particular 1-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 𝐱=(x1,,xk) and let φ(𝐱) be a Boolean quantifier free formula. There exists a polynomial p(𝐱), of size polynomial in |φ|, such that for every 𝐯{0,1}k we have: p(𝐯){0,1}; and p(𝐯)=1 if and only if φ(𝐯) evaluates to true. Moreover, the polynomial p(𝐱) 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

ψ=x1y1xkykφ(x1,y1,,xk,yk), (1)

where φ is quantifier-free. The variables xi and yi alternate, xi are quantified universally and yi are quantified existentially. For simplicity, we write 𝐱=(x1,,xk) and 𝐲=(y1,,yk). We write φ(𝐱,𝐲) instead of φ(x1,y1,,xk,yk). Given 𝐯{0,1}2k 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 xi and yi 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 k. We define three quantifier-free formulas: start(𝐱,𝐲), next(𝐱,𝐲,𝐱,𝐲) and end(𝐱,𝐲), as follows.

start(𝐱,𝐲)=i=1k¬xi,end(𝐱,𝐲)=i=1kxi.

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

next(𝐱,𝐲,𝐱,𝐲)=i=1k(¬xij=i+1kxj)
(xij=i+1k¬xjj=1i1(xjxj)(yjyj)).

To understand the formulas, it is easier to ignore the 𝐲 and 𝐲 variables at first. Then these formulas essentially encode a binary counter with k bits: start encodes that all xi are 0; end encodes that all xi are 1; and next encodes that 𝐱 is 𝐱 increased by 1 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 𝐯1,,𝐯n{0,1}2k such that:

  1. 1.

    φ(𝐯i) is true for all 1in;

  2. 2.

    start(𝐯1) is true;

  3. 3.

    next(𝐯i,𝐯i+1) is true for all 1in1;

  4. 4.

    end(𝐯n) 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 =max{|start|,|end|,|next|,|φ|}, then all polynomials corresponding to these formulas are -copyless. To ease the notation we write

𝐳=(x11,,xk1,y11,,yk1,,x1,,xk,y1,,yk)

for identical copies of vectors of variables in 𝐱 and 𝐲. Note that identical copies occur on indices equal modulo 2k (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 start(𝐳), end(𝐳) and next(𝐳).

We are ready to define the CCRA 𝒞=(Q,p0,d,Σ,δ,μ,ν), where: Q={pi,qi0i2k}; d=8k+1; Σ={0,1,#}. We denote the 8k+1 variables as follows: 𝐳, 𝐳, 𝐳′′, 𝐳old and s. That is: four disjoint copies corresponding to copies of 𝐱, 𝐲 and one extra variable s. We denote the variables in the copies by zi, zi, zi′′, ziold for 1i2k. The initial function assigns the value 1 to all variables. It will be important that μ(s)=1; for all other variables the initial value could be arbitrary. The final function is defined by ν(x)=0 for all xQ{q0} and ν(q0)=send(𝐳old).

Before we define the transitions we give an intuition on how the automaton works. We call a subword of length 2k a block. The automaton will read a sequence of blocks which correspond to consecutive evaluations 𝐯i 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 s will have value 1 if no error has been detected, and 0 otherwise.

Most of the transitions will initialise some registers. Given a set of variables Z and b{0,1}, we define the copyless polynomial map PZ,b as: PZ,b(z)=b for zZ and PZ,b(z)=z otherwise. In words, the variables in Z are initialised to b and all others keep their previous value. We will use one type of sets Z, defined as follows: Zi={zj,zj,zj′′jimod2k}. This will allow us to remember 3 copies at once.

Formally, we define the transitions as follows (see Figure 10 for the shape of the automaton without the register updates):

  1. 1.

    δ(pi1,b)=(pi,PZi,b) for all 1i2k and b{0,1}.

  2. 2.

    δ(qi1,b)=(qi,PZi,b) for all 1i2k and b{0,1}.

  3. 3.

    δ(p2k,#)=(q0,Q0), where Q0 resets all variables to 0 except for: 𝐳old where it puts the content of 𝐳′′, i.e., Q0(ziold)=zi′′ for all 1i2k; and Q0(s)=sstart(𝐳)φ(𝐳).

  4. 4.

    δ(q2k,#)=(q0,R0), where R0 resets all variables to 0 except for: 𝐳old where it puts the content of 𝐳′′, i.e., Q0(ziold)=zi′′ for all 1i2k; and Q0(s)=snext(𝐳old,𝐳)φ(𝐳).

Note that all polynomials are copyless.

Figure 10: Example for k=1. The state q0 has an outgoing edge as it is the only one that has a possibly nonzero output.

The proof that the reduction works follows essentially from Claim 38. The transitions in Item 1 and Item 2 guess the evaluations 𝐯i. 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 𝐯old the previous valuation. In both Item 3, Item 4 we check whether φ(𝐯i) holds. Additionally, in Item 3 we check whether start(𝐯1) is true; and in Item 4 we check whether next(𝐯i1,𝐯i) is true. All checks are multiplied into the register s, which becomes 0 if any error occurs, and remains 1 otherwise. Finally, the output function guarantees that a nonzero value can be output only if end(𝐯n) 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.