Rational Stochastic Languages
- Rational stochastic languages are finite-state quantitative models that compute nonnegative word probabilities via weighted automata and CRAs.
- They leverage spectral normalization to ensure convergence and decide stochasticity using polynomial-time matrix methods.
- Their algebraic characterization with convex combinations and discounted Kleene star facilitates approximation, asymptotic analysis, and identity testing.
Rational stochastic languages are probability distributions on words that are realized by finite-state quantitative devices with nonnegative weights. In the formulation developed in "Stochastic Languages at Sub-stochastic Cost" (Agarwal et al., 22 Oct 2025), they are exactly the stochastic quantitative languages computed by weighted finite automata, equivalently by linear cost-register automata (CRAs), and they admit both a spectral normalization theory and an algebraic Kleene–Schützenberger characterization. The topic sits at the intersection of weighted automata, probabilistic automata, formal power series, and distributional analysis on infinite discrete domains, with later work connecting the class to limit laws for random word generation and to identity testing over string distributions (Goldwurm et al., 2021, Agarwal et al., 5 Aug 2025).
1. Formal definition and equivalent presentations
A quantitative language over an alphabet is any function . Its total mass is
when the sum converges. Such an is stochastic if for all and (Agarwal et al., 22 Oct 2025).
A real-weighted finite automaton is a tuple
with initial vector , nonnegative transition matrices 0, and final vector 1. Its semantics is the series
2
The class of rational stochastic languages is
3
The same class is captured by linear CRAs over 4. In that presentation, a transition 5 updates the register vector 6 by a nonnegative linear map 7. The fully linear fragment is equivalent to weighted automata: every linear CRA can be flattened into an equivalent weighted automaton with state space 8, and conversely every weighted automaton arises as a linear CRA (Agarwal et al., 22 Oct 2025).
A related convention appears in "Identity Testing for Stochastic Languages" (Agarwal et al., 5 Aug 2025), which writes 9 for stochastic languages over 0, i.e. nonempty strings. This is a notational difference in presentation rather than a distinct automata-theoretic mechanism.
2. Spectral normalization and the stochasticity problem
The central technical question is when a deterministic quantitative model actually defines a probability distribution. For weighted automata and CRAs this is the stochasticity problem. The general CRA setting is undecidable, but the fully linear fragment admits a complete and tractable theory (Agarwal et al., 22 Oct 2025).
For a weighted automaton with transition matrices 1, define
2
Then
3
and the total mass is the Neumann series
4
where 5 is the spectral radius. By Perron–Frobenius one computes 6 in 7, checks 8, and if so inverts 9 in 0. Consequently, for linear CRAs, equivalently weighted automata over 1 with affine output, one can decide in polynomial time whether the total mass converges and compute it as 2 (Agarwal et al., 22 Oct 2025).
This result separates two levels of difficulty. Global stochasticity is undecidable for CRAs in general, but becomes polynomial-time decidable in the linear setting. A plausible implication is that linearity is not merely a technical convenience; it is the boundary at which the semantic normalization problem becomes algebraically analyzable by matrix methods.
A later formulation in (Agarwal et al., 5 Aug 2025) expresses the same verification problem as a linear system. If 3 denotes the total continuation mass from state 4, then
5
and Gaussian elimination yields an 6 validity test for nonnegative weighted automata.
3. Algebraic characterization of the class
The algebraic core of the theory is a Kleene–Schützenberger theorem specialized to normalized nonnegative series. The class of rational stochastic languages is the smallest class of quantitative languages 7 that contains all Dirac distributions 8 for 9 and is closed under convex combinations, Cauchy product, and discounted Kleene star (Agarwal et al., 22 Oct 2025).
The operators are given explicitly. For 0 and 1,
2
For the Cauchy product,
3
For 4, the discounted Kleene star is
5
These operations preserve nonnegativity and total mass 6. Convex combination preserves normalization by direct summation. The Cauchy product preserves normalization because
7
For the discounted star, the geometric law on the number of factors yields total mass 8 (Agarwal et al., 22 Oct 2025).
The proof of the characterization has two directions. In the automata-to-algebra direction, one first normalizes any stochastic weighted automaton to be locally sub-stochastic and then applies a state-elimination construction. Eliminating a state 9 with total outgoing weight 0 produces a star operator with discount 1, while finite path concatenations become Cauchy products. In the algebra-to-automata direction, every stochastic regular expression built from Dirac distributions, convex combination, product, and discounted star yields a locally stochastic weighted automaton whose semantics is the desired distribution (Agarwal et al., 22 Oct 2025).
This characterization sharpens a classical fact from weighted automata theory. "On the Theory of Stochastic Automata" states that a series 2 is rational over 3 if and only if there exists a finite stochastic automaton 4 such that 5, with rational series closed under finite sums, Cauchy product, and star (Cakir et al., 2021). The normalized stochastic-language version replaces arbitrary finite sums by convex combinations and ordinary star by discounted Kleene star so that total mass remains 6.
4. Local sub-stochasticity and stochastic regular expressions
A weighted automaton is locally sub-stochastic if for every state 7,
8
This is a local, per-state condition, in contrast to the global condition 9. One of the principal results of (Agarwal et al., 22 Oct 2025) is that whenever the global matrix 0 satisfies 1, there exists a positive diagonal matrix 2 such that 3 has each row sum 4. Conjugating each 5, as well as the initial and final vectors, yields an equivalent automaton whose transitions are locally sub-stochastic.
In the CRA view, this becomes a syntactic criterion: 6 The significance is twofold. First, it provides a local characterization of a global semantic property. Second, it is the normalization step that supports the state-elimination proof of the Kleene–Schützenberger theorem (Agarwal et al., 22 Oct 2025).
The same paper introduces stochastic regular expressions (SREs) as a complete grammar for rational stochastic languages: 7 where 8 and 9. Their semantics is defined by the closure equations above, and every SRE denotes a stochastic language. Conversely, every rational stochastic language arises from an SRE (Agarwal et al., 22 Oct 2025).
A worked example in (Agarwal et al., 22 Oct 2025) starts from a two-state linear CRA over 0. Its equivalent weighted automaton satisfies
1
After Perron–Frobenius normalization to a sub-stochastic automaton, state elimination yields the SRE
2
whose semantics coincides with the original CRA.
5. Relation to stochastic automata and structural theory
Rational stochastic languages are closely related to the older theory of stochastic automata. In that setting, a discrete-time stochastic automaton is a 5-tuple
3
with transition probabilities 4, initial distribution 5, and accepting probabilities 6. For each 7, one defines a matrix 8 by 9, and for a word 0,
1
The recognized stochastic series is
2
yielding a function 3 (Cakir et al., 2021).
The classical equivalence theorem states that a series 4 is rational over 5 if and only if there exists a finite stochastic automaton 6 such that 7 (Cakir et al., 2021). This theorem is attributed there to Schützenberger, Rabin, and Fliess. It situates rational stochastic languages within the broader landscape of rational series and stochastic finite-state devices.
The same source develops structural notions that parallel classical automata theory. Equivalence of underlying series is decidable in polynomial time. For cut-point languages
8
emptiness with general rational 9 is PSPACE-complete in the size of 0 and the bit-length of 1, while Rabin’s theorem implies that if 2 is isolated then 3 is regular (Cakir et al., 2021).
Canonical forms are likewise available. Reduction merges states with identical result vectors; minimization removes states that are convex combinations of others; strong reduction yields a unique minimal linear representation of dimension equal to the Hankel rank; and observability or determinism may be enforced, though determinization can incur exponential blow-up (Cakir et al., 2021). These results concern the broader stochastic-automata framework rather than normalized distributions specifically, but they provide the ambient representation theory in which rational stochastic languages are naturally embedded.
6. Statistical behavior, approximation, and testing
Once a rational stochastic language is used as a model for random word generation, one can study statistics conditioned on word length. For a rational series 4 with linear representation 5, (Goldwurm et al., 2021) defines a probability measure on 6 by
7
and studies the random variable 8. Writing
9
one obtains exact mean and variance from derivatives at 00. If 01 is primitive and an aperiodicity condition holds, then
02
and there is a Gaussian local limit with uniform 03 error (Goldwurm et al., 2021).
In bicomponent models, the limiting law depends on spectral and perturbative parameters of the two primitive blocks. The regimes reported in (Goldwurm et al., 2021) are as follows.
| Model regime | Local limit law |
|---|---|
| Single primitive, aperiodic | Gaussian 04 with 05 error |
| Communicating bicomponent, 06 | Gaussian driven by component 07 |
| Communicating bicomponent, 08, 09 | Uniform law on 10 |
| Communicating bicomponent, 11, 12 | Mixture over a variance interval |
| Sum bicomponent, 13 | Convex combination of two Gaussians |
A detailed example in the communicating equipotent case uses 14 and yields 15, 16, 17, so 18 converges locally to the uniform density on 19 with rate 20 (Goldwurm et al., 2021).
Algorithmic developments extend beyond representation and asymptotics. "Identity Testing for Stochastic Languages" proves that a nonnegative weighted automaton can be checked in polynomial time for being a stochastic language, shows that convex mixtures of geometric distributions are dense in 21 under 22, and develops a truncation-based identity tester for a known rational reference distribution against an unknown distribution (Agarwal et al., 5 Aug 2025). The geometric subclass is defined by
23
and for every stochastic language 24 and 25, there exist geometric distributions 26 and convex weights 27 such that
28
For identity testing, the key observation is that rational languages have exponential decay: 29 for computable 30. Truncating at length 31 reduces the problem to a finite domain 32. Using the tolerant identity tester of Canonne et al. with thresholds 33 and 34, one obtains sample complexity
35
or, in the abstract’s notation,
36
where 37 is the size of the truncated support (Agarwal et al., 5 Aug 2025). The paper states completeness if 38, soundness if 39, both with probability at least 40.
Taken together, these results position rational stochastic languages as a finite-state class of distributions over strings with three distinctive features: exact automata-theoretic realization, a normalization theory based on spectral or linear-system methods, and enough regularity to support asymptotic analysis, approximation, and testing on infinite discrete domains.