Decision Questions for Probabilistic Automata on Small Alphabets

We study the emptiness and $\lambda$-reachability problems for unary and binary Probabilistic Finite Automata (PFA) and characterise the complexity of these problems in terms of the degree of ambiguity of the automaton and the size of its alphabet. Our main result is that emptiness and $\lambda$-reachability are solvable in EXPTIME for polynomially ambiguous unary PFA and if, in addition, the transition matrix is binary, we show they are in NP. In contrast to the Skolem-hardness of the $\lambda$-reachability and emptiness problems for exponentially ambiguous unary PFA, we show that these problems are NP-hard even for finitely ambiguous unary PFA. For binary polynomially ambiguous PFA with fixed and commuting transition matrices, we prove NP-hardness of the $\lambda$-reachability (dimension 9), nonstrict emptiness (dimension 37) and strict emptiness (dimension 40) problems.


Introduction
There are many possible extensions of the fundamental notion of a nondeterministic finite automaton.One such notion is that of Probabilistic Finite Automata (PFA) which was first introduced by Rabin [Rab63].In a PFA P over a (finite) input alphabet Σ the outgoing transitions from a state, for each input letter of Σ, form a probability distribution, as does the initial state vector.Thus, a word w ∈ Σ * is accepted with a certain probability, which we denote P(w).
There are a variety of interesting questions that one may ask about a PFA P over an alphabet Σ.In this article we focus on two decision questions, that of λ-reachability and emptiness.The λ-reachability problem is stated thus: given a probability λ ∈ [0, 1], does there exist some word w ∈ Σ * such that P(w) = λ?In the (strict) emptiness problem, we ask if there exists any word w ∈ Σ * such that P (w) ≥ λ (resp.P (w) > λ).We also mention the related cutpoint isolation problem -to determine if for each ϵ > 0, there exists a word w ∈ Σ such that |P(w) − λ| < ϵ.The value-1 problem is a special case of the cutpoint isolation problem when λ = 1 [GO10] and the value problem is to determine the supremum over all words of the acceptance probability of a word.
In general, the emptiness problem is undecidable for PFA [Paz71], even over a binary alphabet when the automaton has 25 states [Hir07].The cutpoint isolation problem is undecidable [BMT77] even for PFA with 420 states over a binary alphabet [BC03].The problem is especially interesting given the seminal result of Rabin that if a cutpoint λ is isolated, then the cutpoint language associated with λ is necessarily regular [Rab63].
We may ask which restrictions of PFA may lead to decidability of the previous problems.In this paper we are interested in PFA of bounded ambiguity, where the ambiguity of a word denotes the number of accepting runs of that word in the PFA.A PFA P is f -ambiguous, for a function f : N → N, if every word of length n has at most f (n) accepting runs.A run is accepting if the probability of that run ending in a final state is strictly positive.The degree of ambiguity is thus a property of the NFA underlying a PFA (i.e., the NFA produced by setting all nonzero transition probabilities to 1).We may consider the notions of finite, polynomial or exponential ambiguity of P based on whether f is bounded by a constant, is a polynomial or else is exponential, respectively.Characterisations of the degree of ambiguity of NFA are given by Weber and Seidel [WS91] and we discuss more about this in Section 2.1.
The authors of [FRW17] show that emptiness for PFA remains undecidable even for polynomially ambiguous automata (quadratic ambiguity), show PSPACE-hardness results for finitely ambiguous PFA and that emptiness is in NP for the class of k-ambiguous PFA for every k > 0. The emptiness problem for PFA was later shown to be undecidable for linearly ambiguous automata [DJL + 18].The emptiness problem is known to be in quasi-polynomial time for 2-ambiguous PFA [FRW17].Furthermore, the value of a k-ambiguous PFA is approximable in polynomial time up to any multiplicative constant [FRW17].
Another restriction is to constrain input words of the PFA to come from a given language L. If L is a letter-bounded language1 , then the emptiness and λ-reachability problems remain undecidable for polynomially ambiguous PFA, even when all transition matrices commute [Bel19].In contrast, the cutpoint-isolation problem is decidable even for exponentially ambiguous PFA when inputs are constrained to come from a given letterbounded context-free language, although it is NP-hard for 3-state PFA on letter-bounded inputs [BS20].
Our main results are as follows.We show that the λ-reachability and emptiness problems for probabilistic finite automata are: • In EXPTIME for the class of polynomially ambiguous unary PFA and are NP-complete if, in addition, the transition matrix is over {0, 1} [Theorem 3. We also show NP-hardness for the class of finitely ambiguous unary PFA with {0, 1} transition matrix [Proposition 3.10].Our hardness results rely on the NP-hardness of solving binary quadratic equations and the universality problem for unary regular expressions.Note that these restrictions of the PFA, to have polynomial ambiguity, a binary alphabet, fixed and commuting transition matrices, or else finite ambiguity, unary alphabet and binary transition matrix, makes it more difficult to prove an NP-hard lower-bound.The aim is to have as restricted a model as possible, while retaining NP-hardness.An interesting question, that is left open, is to find the exact complexity of these problems in the case of polynomially ambiguous unary PFA, i.e. to close the gap between the EXPTIME upper bound and NP-hard lower bound.
There are connections between problems on polynomially ambiguous unary PFA and reachability problems for special types of linear recurrence sequences (LRS).For example, polynomially ambiguous unary PFA (or more generally, polynomially ambiguous unary weighted automata) describe LRS whose characteristic roots are roots of rational numbers [BFLM22].It was recently shown that for LRS whose characteristic roots are roots of real algebraic numbers, the reachability problem (also called the Skolem problem) can be solved in NP RP [ABM + 20].However, the translation given in [BFLM22] can produce a description for an LRS that is exponential in the size of the PFA.On the other hand, it is claimed in [ABM + 20] that the reachability problem for PFA is in NP RP for the special case where roots are distinct roots of real numbers.Our results do not have such restrictions.
Our proof of the EXPTIME upper bound relies on a careful analysis of how fast the acceptance probability P(a k ) converges to its limit values as k → ∞.To prove the NP bound when the transition matrix is over {0, 1}, we consider a nondeterministic version of the EXPTIME algorithm, showing that the verification part can be done in polynomial time.We also show that the value of a polynomially ambiguous PFA can be computed in EXPTIME as a corollary of our techniques.This is an extended version of the conference paper [BS21].The present version contains an expanded introduction, additional figures and explanations and full proofs which were in the appendix of the submitted conference version.We also consider the problem of computing the value of a PFA which was not considered in [BS21].

Probabilistic Finite Automata and Notation
We denote by Q n×n the set of all n × n matrices over Q.Given two column vectors u ∈ Q n and v ∈ Q m , we denote by [u|v] the column vector (u 1 , . . ., u n , v 1 , . . ., v m ) T ∈ Q n+m .For a sequence of vectors u 1 , u 2 , . . ., u k , we write [u 1 |u 2 | • • • |u k ] for the column vector which stacks the vectors on top of each other.
Given A = (a ij ) ∈ Q m×m and B ∈ Q n×n , we define the direct sum A ⊕ B and Kronecker product A ⊗ B of A and B by: , where 0 i,j denotes the zero matrix of dimension i × j.Note that neither ⊕ nor ⊗ are commutative in general.The following useful properties of ⊕ and ⊗ are well known.
Lemma 2.1.Let A, B, C, D ∈ Q n×n .Then we have: • If A and B are stochastic matrices, then so are A ⊕ B and A ⊗ B.
• If A, B ∈ Q n×n are both upper-triangular, then so are A ⊕ B and A ⊗ B.
See [HJ91] for proofs of the first three properties of Lemma 2.1.The fourth property follows directly from the definition of the direct sum and Kronecker product.
A Probabilistic Finite Automaton (PFA) P with n states over an alphabet Σ is defined as P = (u, {M a |a ∈ Σ}, v) where u ∈ Q n is the initial probability distribution; v ∈ {0, 1} n is the final state vector and each M a ∈ Q n×n is a (row) stochastic matrix.We will primarily be interested in unary and binary PFA, for which |Σ| = 1 and |Σ| = 2 respectively.For a word w = a 1 a 2 • • • a k ∈ Σ * , we define the acceptance probability P(w) : Σ * → Q of P as: which denotes the acceptance probability of w. 2For a given cutpoint λ ∈ [0, 1], we define the following languages: L ≥λ (P) = {w ∈ Σ * | P(w) ≥ λ}, a nonstrict cutpoint language, and L >λ (P) = {w ∈ Σ * | P(w) > λ}, a strict cutpoint language.The (strict) emptiness problem for a cutpoint language is to determine if L ≥λ (P) = ∅ (resp.L >λ (P) = ∅).We are also interested in the λ-reachability problem, for which we ask if there exists a word w ∈ Σ * such that P(w) = λ.
2.1.PFA Ambiguity.The degree of ambiguity of an automaton is a structural parameter, indicating the number of accepting runs for a given input word.See [WS91] for details of ambiguity for nondeterministic automata and [Bel19, BS20, DJL + 18, FRW17] for connections to PFA.
Let w ∈ Σ * be an input word of an NFA N = (Q, Σ, δ, Q I , Q F ), with Q the set of states, Σ the input alphabet, δ ⊂ Q × Σ × Q the transition function, Q I the set of initial states and Q F the set of final states.For each (p, w, q) ∈ Q × Σ * × Q, define da N (p, w, q) as the number of paths for w in N leading from state p to q.The degree of ambiguity of w in N , denoted da N (w), is defined as the number of all accepting paths for w (starting from an initial and ending in a final state).The degree of ambiguity of N , denoted da(N ), is the supremum of the set {da N (w) | w ∈ Σ * }.N is called infinitely ambiguous if da(N ) = ∞, finitely ambiguous if da(N ) < ∞, and unambiguous if da(N ) ≤ 1.The degree of growth of the ambiguity of N , denoted deg(N ), is defined as the minimum degree of a univariate polynomial h with positive integral coefficients such that for all w ∈ Σ * , da N (w) ≤ h(|w|) (if such a polynomial exists, in which case N is called polynomially ambiguous, otherwise the degree of growth is infinite and N which we call exponentially ambiguous).
The above notions relate to NFA.We may derive an analogous notion of ambiguity for PFA by considering an embedding of a PFA P into an NFA N in such a way that for each letter a ∈ Σ, if the probability of transitioning from a state i to state j is nonzero under P, then there is an edge from state i to j under N for letter a.The initial states of N are those of P having nonzero initial probability and the final states of N and P coincide.We then say that P is finitely/polynomially/exponentially ambiguous if N is (respectively).
A state q ∈ Q in an NFA (resp.PFA) is called useful if there exists an accepting path which visits q (resp.an accepting path of nonzero probability which visits q).We can characterise whether an NFA A (and thus a PFA by the above embedding) has finite, polynomial or exponential ambiguity using the following properties (see Figs 1 and 2

):
EDA -There is a useful state q ∈ Q such that, for some word v ∈ Σ * , da A (q, v, q) ≥ 2.
].An NFA (or PFA) A having the EDA property is equivalent to it being exponentially ambiguous.For any d ∈ N, an NFA (or PFA) A having property IDA d is equivalent to deg(A) ≥ d.
Clearly, if N agrees with IDA d for some d > 0, then it also agrees with IDA 1 , . . ., IDA d−1 .An NFA (or PFA) is thus finitely ambiguous if it does not possess property IDA 1 .

Unary PFA
Our main focus is on unary automata.We begin by giving a simple folklore proof that the λ-reachability and emptiness problems are as computationally difficult as the famous Skolem problem, which is only known to be decidable for instances of depth 4 [Ver85].See also [AAOW15] for connections to reachability problems for Markov chains.
Proof (Folklore).The λ-reachability problem for unary exponentially ambiguous PFA can be shown Skolem-hard based on the matrix formulation of Skolem's problem [HHHK05] and Turakainen's technique showing the equivalence of (strict) cutpoint language acceptance of generalised automata and exponentially ambiguous probabilistic automata [Tur69].We shall now show the details of this procedure.
Consider the following linear recurrence sequence (LRS) u n for n ≥ 0, with recurrence coefficients a 0 , . . ., a k−1 ∈ Z and where u 0 , . . ., u k−1 ∈ Z are the given initial conditions: Let M ∈ Z k×k be defined thus: , We may now define: where r ∈ Z, s, t ∈ Z k are (uniquely) chosen so that each row and column sum is zero and 0 ∈ Z k is the zero vector.Clearly then A ′j also has zero row and column sums and retains this same structure for any It can now be seen that: The emptiness problem can be shown Skolem-hard by encoding the positivity problem which is known to be Skolem-hard, see [OW14] for example.Essentially this stems from the fact that u 2 j is also an LRS and clearly u 2 j is nonnegative.Thus, encoding u 2 j in the same way as above means that P(a j ) ≥ 1 (k+2) with equality if and only if u j = 0 as required.Note that stochastic matrix A is necessarily exponentially ambiguous so long as one of the coefficients a 0 , . . ., a k−1 is negative.This follows since A is then strictly positive by construction.The degree of ambiguity of word a j is thus (k +2) j .An interesting construction is shown in [OW12], where a technique to generate a stochastic matrix of dimension 2k + 1 is given (rather than dimension k + 2 shown above).The resulting PFA is still exponentially ambiguous, but with lower ambiguity.
We now move to prove our main result, specifically that the emptiness and λ-reachability problems for polynomially ambiguous unary probabilistic finite automata are in EXPTIME.Note again that without the restriction of polynomial ambiguity the problem is Skolem-hard by Theorem 3.1 and thus not even known to be decidable.
In order to establish Theorem 3.2, we need to prove a series of lemmas.The next lemma states that we may consider a unary polynomially ambiguous PFA whose transition matrix is upper-triangular.This will prove useful since in that case the eigenvalues of the transition matrix are rational nonnegative.In general, a polynomially ambiguous unary PFA may have a transition matrix with complex eigenvalues as illustrated here: . The proof of the lemma relies on the analysis of strongly connected components (SCCs) of the underlying transition graph of a PFA.
The following lemma is folklore although we could not find a definite reference which proved the statement and therefore we include a proof for completeness.
Lemma 3.3.Let P = (u, A, v) be a polynomially ambiguous unary Probabilistic Finite Automaton with acceptance function P(a k ) = u T A k v. Then we can compute in EXPTIME a set of d polynomially ambiguous unary PFAs Proof.We will identify P and its underlying graph in which an edge (p, q) exists iff A p,q ̸ = 0. Two states p, q of a PFA are said to be connected if there exists a path from p to q and from q to p.We partition the set of states into Strongly Connected Components (SCC) denoted S 1 , S 2 , . . ., S ℓ so that for any SCC S j , either |S j | = 1, or else any two states in S j are connected.These SCCs can be computed in linear time.
A polynomially ambiguous PFA does not have the EDA property (see Sec. 2.1).This implies that every S j , with |S j | > 1, consists of a single directed cycle, possibly with transitions to other SCCs.To see this, suppose there are two different directed cycles inside S j of lengths m and n and a common vertex p. Then one can construct two different paths of length mn from p to p by going m times along the first cycle and n time along the second cycle, respectively, contradicting the assumption that P does not have the EDA property.
Note that if there exists a path from a state p ∈ S j 1 to some q ∈ S j 2 , then there does not exist any path from any state in S j 2 to a state in S j 1 , otherwise S j 1 and S j 2 would merge to a single SCC (since all vertices are then connected).This implies that the connected components S 1 , S 2 , . . ., S ℓ can be reordered in such a way that there are no transitions from S j to S i for i < j.Hence there exists a permutation matrix P such that the following matrix is stochastic block upper-triangular: , where d j is the size of S j , and B j ⪯ P j , where P j ∈ N d j ×d j is a permutation matrix, and the entries * are arbitrary.Here M ⪯ N means that M is entrywise less than or equal to N , i.e.M i,j ≤ N i,j .Let d = lcm{d j | 1 ≤ j ≤ ℓ} (in fact, we can simply take d = ℓ j=1 d j ).We then see that: Note that each B d j ⪯ P d j = I j , where I j ∈ N d j ×d j is the identity matrix, and the entries * are arbitrary.Therefore, each B d j is diagonal, and so U is clearly upper-triangular.We then define P s = (u s , U, v ′ ), for 0 ≤ s ≤ d − 1, with u T s = u T A s P −1 and v ′ = P v noting that P v is a binary vector as required of a final state vector.We now see that: Here we used the identity U r = P A rd P −1 .
Finally, note that d can be exponential in the number of states of P, which in turn is bounded by the input size.Hence computing U and all u s , for 0 ≤ s ≤ d − 1, takes exponential time.
The next lemma gives us an efficient method to compute an explicit formula for the acceptance probability function of a unary PFA with upper-triangular transition matrix.3Lemma 3.4.Let P = (u, A, v) be a unary probabilistic finite automaton such that A is rational upper-triangular, and let Then there exist a constant c ∈ Q and univariate polynomials p 1 , . . ., p m over Q, all of which can be computed in polynomial time, such that Proof.First, we write A in Jordan normal form A = S −1 JS, where S is a nonsingular (det(S) ̸ = 0) matrix consisting of the generalised eigenvectors of A. Recall that A is a rational upper-triangular matrix.It follows that J and S must have rational entries because to compute them, we need to solve systems of linear equations over Q.These calculations, that is, computing J, S and S −1 can be done in polynomial time.In fact, these problems are in NC, see [BvzGH82,Pap94].Matrix J has the form J = m i=0 n i j=1 J ℓ i,j (λ i ), where J ℓ i,j (λ i ) is a ℓ i,j × ℓ i,j Jordan block and n i is the geometric multiplicity of λ i (hence n i j=1 ℓ i,j is the algebraic multiplicity of λ i ).Recall that a Jordan block J ℓ (λ) of size ℓ × ℓ that corresponds to an eigenvalue λ has the form: Noting that x y = 0 if y > x, we see that Note that the entries of J ℓ (λ) k have the form q i,j (k)λ k , where q i,j (k) are polynomials over Q that can be computed in polynomial time.Namely, q i,i+p (k) = k p λ −p for 0 ≤ p ≤ ℓ − i, and q i,j (k) = 0 for i > j.Note that even though p appears in the exponent of λ −p and as p! in k p , these values are still computable in PTIME from the input data because p is bounded by the dimension of the matrix, which in turn is bounded by the input size.
Next, we note that J k = m i=0 n i j=1 J ℓ i,j (λ i ) k .Hence the entries of J k have the form p s,t (k)λ k i , where p s,t (k) are polynomials over Q.So we can write the function P(a k ) as follows: Note that in the above equation, u T S −1 and Sv are rational vectors.It follows that for some polynomials p i (k) over Q.In fact, these polynomials are rational linear combinations of those p s,t (k) that multiply λ k i in the expression for J k , and so they can be computed in polynomial time.
Finally, recall that λ 0 = 1 and note that the Jordan blocks that correspond to the dominant eigenvalues of a stochastic matrix have size 1 × 1 (for the proof of this fact see, e.g.[Fri15, Theorem 6.5.3]).It follows from (3.1) that the terms λ k 0 in the formula for J k are multiplied by constant polynomials p s,t (k) = 1.Hence p 0 (k) = c for some constant c ∈ Q.
The next technical lemma is crucial in our later analysis of the running time of the algorithms for the emptiness and λ-reachability problems presented in Lemmas 3.7 and 3.9.Lemma 3.5.Let D ∈ R be such that ln D > 2. Then for all x > 3D ln D, we have D ln x < x.
Proof.Our goal is to find x 0 > 0 such that every x > x 0 satisfies D ln x < x.First, let us make a substitution x = Dt, where t > 1.Then we can rewrite D ln x < x as follows D ln(Dt) < Dt, ln t + ln D < t.
We want to find t 0 > 1 such that every t > t 0 satisfies ln t + ln D < t.Let us make another substitution t = ln D + u ln ln D, where u > 0. Then we can write the previous inequality as ln ( So we need to find u 0 > 0 such that for all u > u 0 , the inequality (3.2) holds.In order to do this, we can replace the left-hand side of (3.2) with a larger value using ln 1 + u ln ln R ln R < u ln ln R ln R .Thus we obtain ln ln D + u ln ln D ln D < u ln ln D, Recall that by our assumption ln D > 2. In this case, ln D ln D−1 < 2, and hence we can choose u 0 = 2.This gives us the values t 0 = ln D + u 0 ln ln D = ln D + 2 ln ln D and x 0 = Dt 0 = D(ln D + 2 ln ln D).Since ln ln D < ln D, we can choose x 0 to be x 0 = 3D ln D.
We now proceed to the proof of our main result.We split the analysis into two cases depending on whether or not the cutpoint λ coincides with the limit lim k→∞ P(a k ), which is unique by Lemma 3.4.Lemma 3.6.Let P = (u, A, v) be a unary probabilistic finite automaton such that A is rational upper-triangular.Let λ ∈ [0, 1] ∩ Q be a cutpoint and assume that c = lim k→∞ P(a k ) ̸ = λ.Then we can compute in PTIME a bound k 0 > 0 such that for all k > k 0 , we have Moreover, we give an explicit formula for k 0 in (3.6).
Proof.By Lemma 3.4, we can write the eigenvalues of A. Note that c, λ i 's and the coefficients of p i are rational numbers that can be computed in polynomial time.By assumption, lim k→∞ P(a k ) = c ̸ = λ.Let ϵ = |c − λ|/2.We now show how to compute an integer k 0 > 0 such that |P(a k ) − c| < ϵ for all k > k 0 .
Let each p i (k) have the form , where s ≤ n is the size of the largest Jordan block in the Jordan normal form of A (we do not assume here that a i,s ̸ = 0).Then for all k > 0 we have where d = m i=1 s j=0 |a i,j | ∈ Q can be computed in polynomial time by Lemma 3.4.Let k 1 > 0 be a number to be defined later such that for all k > k 1 , Then for all k > k 1 , we have 1 .Thus we need to find k 0 ≥ k 1 such that for all k > k 0 , we have λ To determine k 0 , we need an upper bound on the right-hand side of (3.3).We will use the fact that for any rational r > 1, ln r < log 2 r ≤ log 2 ⌈r⌉ < bins(⌈r⌉), where bins(n) is the size of the binary representation of n.Thus bins(⌈r⌉) gives a polynomially computable integer upper bound for ln r.
Hence in order to find k 1 , we can replace C in (3.5) with D = 2s 1 − λ 1 . In addition, we can assume that ln D > 2, since otherwise we can replace D with a larger value that satisfies this condition, e.g. with D = 9.Now, Lemma 3.5 implies that every k > 3D ln D satisfies D ln k < k.To make this value polynomially computable, we can choose it to be Finally, combining the right-hand side of (3.4) with the above formula, we can define Note that all the values that appear in the above formula, e.g.ϵ, d and D, can be computed in polynomial time from the input data.
Lemma 3.7.Let P = (u, A, v) be a unary probabilistic finite automaton such that A is rational upper-triangular, and let λ ∈ [0, 1] ∩ Q be a cutpoint.Assuming that λ ̸ = lim k→∞ P(a k ), the (strict) emptiness and λ-reachability problems for P and λ are decidable in EXPTIME.
Proof.In Lemma 3.6, we have derived a polynomially computable bound k 0 such that P(a k ) = u T A k v ∈ (c − ϵ, c + ϵ), where ϵ = |c − λ|/2.In particular, P(a k ) ̸ = λ for all k > k 0 .Now, to decide the λ-reachability problem, we need to check for each integer k ∈ [0, k 0 ] whether u T A k v = λ.Note that the number of integers in [0, k 0 ] is O(2 bins(k 0 ) ), which is exponential in the instance size.Also, computing A k for a given k ∈ [0, k 0 ] takes exponential time because bins(A k ) = O(2 bins(k 0 ) bins(A)).So, the overall algorithm is in EXPTIME.
In a similar way, we can decide the (strict) emptiness problem in EXPTIME.For instance, suppose λ > c.Then for all k > k 0 , we have P(a k ) < c + ϵ < λ.Thus deciding whether there exists k such that P(a k ) < λ is trivial.Suppose we want to know if there exists k such that P(a k ) ≥ λ.In this case, we need to check for each integer k ∈ [0, k 0 ] whether u T A k v ≥ λ.By the same argument as before, this can be done in EXPTIME.
Lemma 3.8.Let P = (u, A, v) be a unary polynomially ambiguous probabilistic finite automaton such that A is upper-triangular.Let λ ∈ [0, 1] ∩ Q be a cutpoint such that λ = lim k→∞ P(a k ).Then we can compute in PTIME a bound k 0 > 0 such that either P(a k ) > λ for all k > k 0 , or P(a k ) < λ for all k > k 0 .
Proof.Recall that by Lemma 3.4, we can write are the eigenvalues of A, and c, λ i 's and the coefficients of p i are rational numbers that can be computed in polynomial time.By our assumption, λ = lim k→∞ P(a k ) = c.Let each p i (k) have the form p i (k) = a i,s k s + a i,s−1 k s−1 + • • • + a i,0 , where s ≤ n is the size of the largest Jordan block in the Jordan normal form of A (we do not assume here that a i,s ̸ = 0).In addition, assume that the leading coefficient of p 1 (k) is a 1,t , for some t ≤ s.Suppose that a 1,t > 0. We now show how to compute k 0 such that P(a k ) > λ for all k > k 0 .(The case when a 1,t < 0 and P(a k ) < λ for all k > k 0 is symmetric).
First, we compute k 1 such that p 1 (k) > 1 2 a 1,t k t for all k > k 1 .To do this, we will use the following inequalities: Now we want to find k 2 ≥ k 1 such that for all k > k 2 , we have where d = m i=2 s j=0 |a i.j |.Using (3.7) and (3.9), we see that (3.8) holds whenever k > k 1 and (3.10) We will use the following inequality Then we can replace (3.10) with a stronger inequality In the following, we will assume t < s since otherwise (3.11) simplifies to 1 Let us make the substitution k = t 2d a 1,t − 1 s−t , where t > 0. Then (3.11) can be written as Here 9 is needed to satisfy the requirement ln D > 2 in Lemma 3.5.Then by Lemma 3.5, the above inequality holds when t > 3D ln D. Therefore, (3.11) and hence (3.10) holds when k > 3 2d a 1,t − 1 s−t D ln D. To make this bound polynomially computable, we can simplify it as follows.Suppose that 2d ≥ a 1,t .Then (3.10) holds when k > k 2 := 3⌈E⌉bins(⌈E⌉), where Finally, we conclude that (3.8) holds for all k > k 0 := max{k 1 , k 2 }, where both k 1 and k 2 are computable in PTIME.
Lemma 3.9.Let P = (u, A, v) be a unary polynomially ambiguous probabilistic finite automaton such that A is upper-triangular and let λ ∈ [0, 1] ∩ Q be a cutpoint.Assuming that λ = lim k→∞ P(a k ), the (strict) emptiness and λ-reachability problems for P and λ are decidable in EXPTIME.
Proof.In Lemma 3.8, we obtained a polynomially computable value k 0 such that either P(a k ) > λ for all k > k 0 or P(a k ) < λ for all k > k 0 .Using the same argument as at the end of the proof of Lemma 3.7, we can show that the (strict) emptiness and λ-reachability problems are decidable in EXPTIME.
We are now ready to give a proof of Theorem 3.2.
Proof of Theorem 3.2.Let P = (u, A, v) be a polynomially ambiguous unary PFA.By Lemma 3.3, we can compute in EXPTIME a set of d polynomially ambiguous unary PFAs Suppose λ is a given cutpoint.If we want to decide whether there exists k such that P(a k ) = λ (or P(a k ) ≥ λ), we can check for every s from 0 to d − 1 whether there exists r such that P s (a r ) = λ (or P s (a r ) ≥ λ, respectively), which can be done in EXPTIME using Lemmas 3.7 and 3.9.Namely, we will use Lemma 3.7 if λ ̸ = c s and Lemma 3.9 if λ = c s for the current values of s ∈ [0, d − 1].Finally, we note that even though the value of d can be exponential in the input size, the whole procedure can still be done in EXPTIME.
Skolem's problem is at least NP-hard [BP02] implying that the λ-reachability and emptiness problems are also NP-hard, at least for PFA of exponential ambiguity.Our next result shows that NP-hardness can be established even for unary PFAs of finite ambiguity.
Proof.The NP-hardness of Skolem's problem was established in [BP02].Specifically, Corollary 1.3 of [BP02] states that the problem of determining, for a given matrix A ∈ {0, 1} n×n and row vectors b, c ∈ {0, 1} n , if b T A k c = 0 for some k ≥ 0 is NP-hard.Examination of the proof of this corollary shows that in fact P is finitely ambiguous as we shall show.
The proof of Theorem 1.1 of [BP02] shows a reduction of 3SAT on m clauses with n letters to a unary rational expression E of the form: where k = O(n 3 m) and z j , r j = O(n 6 ) as is not difficult to see from the proof in [BP02].Notice then that each z j , r j represented in unary has a polynomial size in terms of the 3SAT instance and thus E also has a polynomial representation size.
We may then invoke Kleene's theorem [Kle56] to state that the language recognised by E is also recognised by an NFA P = (b, {A}, c) which thus allows the derivation of Corollary 1.3 of [BP02].Note that E is simply the union of rational expressions of the form E j = a z j (a r j ) * .Each E j can be transformed to an NFA N j with z j + r j + 1 states S j = n 0,j , . . ., n z j ,j , n z j +1,j , . . ., n z j +r j ,j with initial state n 0,j , final state n z j +1,j and transition function δ : S j × {a} → S j given by δ(n i,j , a) = n i+1,j for 0 ≤ i ≤ z j + r j − 1 and δ(n z j +r j , a) = n z j +1,j .
We may then form an NFA N by N = k j=0 N j with the usual construction.In this case, N has set of initial states {n 0,j | 1 ≤ j ≤ k}, set of final states {n z j +1,j | 1 ≤ j ≤ k} and states in disjoint subsets S j and S j ′ with j ̸ = j ′ are not connected.This implies by the IDA property of [WS91] that N is finitely ambiguous since there does not exist any state with two outgoing transitions (by which reasoning we also know that each row of N 's transition matrix has exactly one entry 1 with all others 0).In fact one may see that N is k-ambiguous with k = O(n 3 m).The number of states of N is d = k j=0 z j + r j + 1 = O(n 9 m) which is polynomial in the 3SAT instance representation size.
We note that actually N is already close to a PFA.Since each row is zero except for exactly one entry 1, matrix A is stochastic.We thus consider Probabilistic Finite Automaton P = (u, {A}, c) where u = b |b| is the initial (stochastic) vector.P has polynomial ambiguity since N does.Therefore, deciding if there exists k ≥ 0 such that P(a k ) = 0 or P(a k ) ≤ 0 is NP-hard to determine, proving NP-hardness of the λ-reachability and emptiness problems.Since we did not modify N to derive P other than to scale the initial vector, the degree of ambiguity is retained.
Proof.NP-hardness follows from Proposition 3.10 since finite ambiguity is a stronger property than polynomially ambiguity.To prove the NP upper bound, we will show that the algorithm in the proof of Theorem 3.2 can be done in NP.We again use Lemmas 3.3, 3.4, 3.7 and 3.9.Note that the value d from Lemma 3.3 can be exponential.However, its binary presentation has polynomial size.So, instead of cycling though all s from 0 to d − 1, we can nondeterministically guess in polynomial time a value s ∈ [0, d − 1].
Next, we note that the values of k 0 in Lemma 3.7 and k 2 in Lemma 3.9 also have binary representations of polynomial size.Again, instead of checking every k in [0, k 0 ] or [0, k 2 ], we can nondeterministically guess k in polynomial time.
Finally, in the verification step of our algorithm we need to compute the matrices A d , A s and (A d ) k .This can be done in polynomial time using exponentiation by squaring.Indeed, the exponentiation by squaring requires polynomially many steps.Also, any power of a stochastic {0, 1}-matrix is also a stochastic {0, 1}-matrix, so the entries of the power matrices do not grow in size.
As an additional application of the techniques developed within this section, we can also show that the value of a unary PFA can be determined.
Corollary 3.12.Let P = (u, A, v) be a polynomially ambiguous unary Probabilistic Finite Automaton with acceptance function P(a k ) = u T A k v. Then we can compute the value of P in EXPTIME.
Proof.By Lemma 3.3, we can compute in EXPTIME a set of d PFA {P s = (u s , U, v ′ ) | 0 ≤ s ≤ d − 1} which are unary and polynomially ambiguous, such that U is rational uppertriangular and P(a k ) = P s (a r ) = u T s U r v ′ , where k = rd + s with 0 ≤ s ≤ d − 1.The size of d depends on the structure of P but is no more than exponential in the description size of P. The value of P defined by sup k≥0 P(a k ) is clearly the same as max 0≤s≤d {sup k≥0 P s (a k )} and thus we may simply compute the value of each of these d unary PFA with upper triangular stochastic transition matrices.Assume then for the rest of the proof that P is a PFA with a rational upper triangular transition matrix A ∈ Q n×n .Lemma 3.4 shows that we can write the acceptance probability function of P as: where |λ i | < 1 and p i are polynomials.There are two cases that we consider.Either sup k≥0 P(a k ) = c, or else sup k≥0 P(a k ) > c.
By defining λ = c and then applying Lemma 3.9, we can determine if the first or second cases holds, i.e., we can determine if there exists a word a k such that P(a k ) > λ.If P(a ℓ ) ≤ λ for all ℓ ≥ 0, then the value of P is λ (which is reached in the limit) and we may thus stop.Assume then that P(a k ) > c for at least one k > 0.
The outline of our approach is now as follows.Suppose the leading coefficient a 1,t of the polynomial p 1 (k) is positive, that is, a 1,t > 0 (the case when a 1,t < 0 is similar and even simpler).Also, consider the derivative of P(a k ) with respect to k: The leading coefficient of q 1 (k) is equal to a 1,t ln λ 1 .Note that since ln λ 1 < 0, we have a 1,t ln λ 1 < 0. Using the same ideas as in the proof of Lemma 3.9, we can compute in polynomial time a value k 0 such that P(a k ) > c and P ′ (a k ) < 0 for all k > k 0 .Notice that the logarithms ln λ i , for i = 1, . . ., m, that appear in P ′ (a k ) may be irrational.In order to do the above computations in polynomial time, we can use the following rational upper bounds: ln λ 1 ≤ λ 1 − 1 < 0 and | ln λ i | = ln(1/λ i ) ≤ 1/λ i − 1 for i = 1, . . ., m. Hence P(a k ) is greater than c and is strictly decreasing for all k > k 0 .Therefore, we only need to evaluate {P(a ℓ ) | 1 ≤ ℓ ≤ k 0 } in order to find the value of P.This can be done in EXPTIME using the same argument as at the end of the proof of Lemma 3.7.

Binary PFA
The following theorem shows that the λ-reachability and emptiness problems are NP-hard for binary PFA of polynomial ambiguity with commuting transition matrices (and the matrices can be assumed fixed in the case of λ-reachability and nonstrict emptiness).The emptiness problem for non-commutative binary PFA over 25 states is known to be undecidable, at least over exponentially ambiguous PFA [Hir07].Emptiness is also undecidable for exponentially ambiguous commutative PFA, although with many more states and a larger alphabet [Bel19].
Theorem 4.1.The λ-reachability and emptiness problems are NP-hard for binary probabilistic finite automata of polynomial ambiguity with commuting matrices of dimension 9 for λ-reachability, 37 for nonstrict emptiness, and 40 for strict emptiness.Moreover, the matrices can be assumed fixed for the λ-reachability and nonstrict emptiness problems.
Proof.We use a reduction from the solvability of binary quadratic Diophantine equations.Namely, given an equation of the form ax 2 + by − c = 0, where a, b, c ∈ N, it is NP-hard to determine if there exists x, y ∈ N satisfying the equation [MA78].We begin with the λ-reachability problem before considering the emptiness problem.
λ-Reachability reduction.Let A = 1 1 0 1 and note that A k = 1 k 0 1 and that We form a weighted automaton4 W 1 on binary alphabet Σ = {h, g} in the following way to encode ax 2 + by (we will deal with c later).Let where 1 = (1, 1, . . ., 1) T ∈ Q 7 .We used here the fact that X1 = 1 for a row stochastic matrix X.We finally define that , both of which are row stochastic and commute, and let u 2ac + 2bc to normalise vector u ⋆ .We see then that u ⋆ is a stochastic vector as required.We define the PFA P 2 = (u ⋆ , {H, G}, v ⋆ ) and we can now compute that where * denote the column vectors used to ensure row sums of 16 x+y and 0 denotes zero matrices of appropriate sizes.We also used Eqns (4.4) and (4.5).Since (ax 2 + by − c) 2 is nonnegative, we see that u T ⋆ H x G y v ⋆ ≥ 2ac+2bc z with equality if and only if (ax 2 + by − c) 2 = 0, which is NP-hard to determine.Therefore using cutpoint λ = 2ac+2bc z ∈ Q ∩ [0, 1] means the (nonstrict) emptiness problem is NP-hard (i.e.does there exist x, y ∈ N such that u T ⋆ H x G y v ⋆ ≤ λ is NP-hard).As before, matrices H and G are upper-triangular and commute by their structure, and therefore the result holds.Strict Emptiness reduction.Finally we show how to handle the strict emptiness problem.We proceed with a technique inspired by [GO10].By (4.6), if P 2 (h x g y ) = u T ⋆ H x G y v ⋆ ̸ = 1 z (2ac + 2bc), then u T ⋆ H x G y v ⋆ ≥ 1 z (2ac + 2bc) + 1 16 x+y therefore P 2 (h x g y ) ≤ 1 z (2ac + 2bc) if and only if P 2 (h x g y ) < 1 z (2ac + 2bc) + 1 16 x+y .Let us adapt P 2 in the following way to create a new PFA P 3 .Note that P 2 has 6 initial states (by u ⋆ ).We add three new states to P 3 , denoted q 0 , q F and q * .State q 0 is a new initial state of P 3 which, for any input letter, has probability 1 2•6 of moving to each of the 6 initial states of P 2 and probability 1 2 to move to new state q F .State q F is a new final state that remains in q F for any input letter with probability 1 − 1 16z and moves to a new non-accepting absorbing sink state q * with probability 1 16z .We now see that for any a ∈ {h, g}: If there exists w 1 = h x g y with x, y ≥ 0 such that P 2 (w 1 ) ≤ 1 z (2ac + 2bc) then P 2 (w 1 ) = 1 z (2ac + 2bc) and thus: For any w 2 = h x g y with x, y ≥ 0 such that P 2 (w 2 ) > 1 z (2ac + 2bc) then P 2 (w 2 ) ≥ 1 z (2ac + 2bc) + 1 16 x+y by (4.6).Thus: Thus determining if there exists w = h x g y such that P 3 (w) < 1 2 1 z (2ac + 2bc) + 1 , i.e. the strict emptiness problem for P 3 on cutpoint 1 2 1 z (2ac + 2bc) + 1 , is NP-hard.The modifications to P 2 retain polynomial ambiguity since q 0 and q F have no incoming (non self looping) edges and q * has no outgoing edges, therefore property EDA does not hold.Commutativity of the PFA is unaffected since P 3 is identical to P 2 except for adding three new states, behaving identically for both input letters.Note that P 3 has 37 + 3 = 40 states.

Conclusion
We considered the emptiness and λ-reachability problems for unary and binary probabilistic finite automata of bounded ambiguity.Our main result is an EXPTIME algorithm to solve λ-reachability and emptiness for unary polynomially ambiguous PFA.We may note that our procedure generates a polynomial size certificate for these problems, however the verification step takes EXPTIME.We also note that the λ-reachability and emptiness problems are NP-hard for unary finitely ambiguous PFA.It would be interesting to close the gap between the upper and lower bounds for this problem.We also showed NP-hardness results for λ-reachability (9 states) and strict (40 states) and nonstrict (37 states) emptiness for binary polynomially ambiguous PFA with commutative transition matrices but a PSPACE-hardness result in this setting appears challenging.A further avenue of research is to reduce the number of states for which NP-hardness holds.
ln D + u ln ln D) + ln D < ln D + u ln ln D, ln ln D 1 + u ln ln D ln D < u ln ln D, ln ln D + ln 1 + u ln ln D ln D < u ln ln D. (3.2) IDA d -There are useful states r 1 , s 1 , . . ., r d , s d ∈ Q and words v 1 , u 2 , v 2 , . . ., u d , v d ∈ Σ * such that for all 1 ≤ i ≤ d, r i and s i are distinct and (r i , v i , r i ), (r i , v i , s i ), (s i , v i , s i ) ∈ δ and for all 2 ) + 1 16 x+y a 2 x 4 + 2abx 2 y + b 2 y 2 + c 2 −