Manuscript Offprint
arXiv:2611.01430Polynomial-Time Minimax Prediction for Stationary Renewal Processes
Abstract
The minimax next-symbol Kullback–Leibler risk for stationary binary renewal processes is known to have order . We give a polynomial-time predictor attaining this order for an arbitrary unknown finite-mean interarrival law. The construction uses a classical type-uniform renewal code. Its contribution is an exact dynamic program for censored prefix marginals, avoiding enumeration of gap histograms or binary completions. Combined with an established prediction reduction, it gives risk at most , where counts renewal types. Shared suffix updates reduce the total computation to arithmetic work and polynomial bit complexity, without tail, mixing, known-mean, or bounded-support assumptions. The statistical rate and its lower bound are prior results; the proposed advance concerns computation.
Index terms: Renewal processes, universal prediction, minimax risk, computational complexity.
1 Problem and contribution
Let be independent with common law on and finite mean . Independently choose with the equilibrium residual law
Set exactly at times . These laws form the stationary binary renewal class . Neither nor its mean is known. Given , define next-symbol prediction risk by
Logarithms are natural. Han, Jiang, and Wu [1] proved minimax risk of order and explicitly asked for a polynomial-time predictor attaining this order.
The type method and renewal coding bound are classical [2, 3, 4]. Computing a complete-word probability, however, does not compute its prefix marginals. We give the latter computation for the classical type-uniform code and apply the suffix-averaged prediction reduction of [1]. No new statistical minimax rate, lower bound, sufficient statistic, or general reduction is claimed.
The computation must account for a last observed gap that has not yet ended. Direct enumeration can visit superpolynomially many gap histograms; we instead retain coefficients
*OpenAI Codex assisted with mathematical derivations, software development, computational checks, and manuscript preparation. The authors are responsible for the final content.
indexed only by future span and number of gaps. A marked coefficient records whether the first future gap exceeds the observed age. Removing observations from the left then updates these coefficients by multiplication by a single polynomial, allowing all suffixes to share one computation.
Let be the integer partition number, , and set
Theorem 1. There is an explicit deterministic rational-valued predictor such that for every ,
Its rate is minimax optimal by [1, Theorem 1.4]. The predictor is evaluated by the algorithm in Theorem 2.
The statistical consequence and the new computational statement are separate: Theorem 2 evaluates all required prefix masses in arithmetic operations, with polynomial bit complexity and stored integer entries. Theorem 1 then applies an existing statistical reduction to that evaluator. Polynomial complexity is not a large-scale runtime claim. The predictor may use the observation horizon; no horizon-free update result is asserted.
This work resolves the computational question raised by Han, Jiang, and Wu (2024) [1] concerning the existence of a polynomial-time predictor attaining the minimax-optimal risk for stationary renewal processes.
Each ordering gives a unique word. There are histograms of span and choices for , proving (1). The classical type-uniform distribution is
Lemma 1 (Classical coding bound). For every ,
Proof. Every nonzero word has probability
It is constant on a type, hence . The zero type is a singleton. This proves the first two inequalities. For , Euler's partition product gives
Optimizing bounds by for . Equation (1) then gives the final bound.
The type bound also holds for arbitrary independent initial waiting times; stationarity will enter the prediction argument separately.
3 Censored prefix marginals
This section supplies the computational result. We first express a prefix mass as a sum over admissible future gap counts, then evaluate its coefficients, and finally share these evaluations across suffixes. The observation horizon stays fixed in all three steps. Fix one horizon . For a prefix of length , define
Thus . When , compatible types are exactly the length- types translated by , including the zero type. Each contributes one, so
Otherwise let describe the observed completed gaps and set , , and . The completion with no further one has weight . For future gap counts , write and . The first future gap must exceed the censored age . Define
Lemma 2 (Prefix identity).
All terms in (6) are nonnegative integers.
Proof. For a fixed histogram , choose its first gap . The number of allowed orderings is
Every ordering determines the future one positions and then the trailing zeros. The full word has inverse type size . Multiplication and summation give (5). Also , since the first one is at , proving integrality in (6). Counts with remain in , although their future multiplicities are zero.
The strict inequality in the mark is essential. A gap of length would put the next one at the last observed position, contradicting the observed trailing zeros. The zero-future-gap term must also be retained: the observation window may end before the next renewal. For a single observed one, and ; the same identity applies without an artificial completed gap before the first observation. Repeated gaps enter through their multiplicities , including those with . Such counts affect the full type's factorial weight even though a future gap of that length cannot fit in the remaining window.
3.1 Two coefficient recurrences
Initialize arrays on with and other entries zero. Process gap lengths . For each old state and , set and update new arrays by
Induction on shows that sums products of binomial factors and additionally counts the gaps longer than . Thus the final is exactly (4). Equivalently, it is the coefficient array of
The explicit multiplicity loop costs arithmetic operations per prefix. To reduce this to , replace each factor by copies of . For each copy visit in increasing order and, for , update in place:
The entries at already include the current factor. These are its ordinary and marked coefficient recurrences. The number of factors is at most , with states.
3.2 Sharing the suffix evaluations
Theorem 2 (Simultaneous fixed-horizon prefix evaluation). For every binary history , , put and . All 2n positive integers
can be computed exactly in a total of arithmetic operations. The algorithm stores integer entries. Its coefficient entries have bits, and its prefix masses have bits. Consequently all conditionals
and their average can be computed in polynomial bit time. The average requires further arithmetic operations if fractions are added without cancellation.
The proof is constructive. The coefficient initialization, queries, and deletions below constitute Algorithms 1–3; their invariants establish (7), and the subsequent bit analysis completes the theorem.
Let be the number of trailing zeros in the length- history. Write for its suffix of length . If , every suffix conditional follows from (3). Otherwise all nonzero suffixes , have the same age . For each such suffix keep its histogram , gap count , and . Put . Appending a one adds precisely one gap of length , so and .
To reuse computations as suffixes shorten, retain all coefficients through span N in the three formal series
Denote their coefficients by . For , use (6) with . For , the age is zero, so its marked coefficient is , and
Factors of span exceeding a query budget have constant term one and cannot affect that query. Retaining them is necessary because the budget grows when the suffix shortens.
Deleting a leading zero leaves the arrays unchanged. Deleting a leading one, while another one remains, removes its completed gap . Write and . The updated histogram obeys
The last identity is the product rule for the marked series. Thus, with all right sides referring to old coefficients,
\begin{align*}A^{\prime}_{s,k}&=A_{s,k}-A_{s-j,k-1},\\B^{\prime}_{s,k}&=B_{s,k}-B_{s-j,k-1}-bA_{s-j,k-1},\ $ A^{+})^{\prime}_{s,k}&=A^{+}_{s,k}-A^{+}_{s-j,k-1}.\end{align*}(10)
Descending span permits in-place updates. The remaining product still has positive integer exponents, so its coefficients are nonnegative. Update using the old positive count and . After the last one is removed, use (3): the conditional at suffix is .
Initialization uses at most geometric factors and states, costing operations. Each of the deletions and queries costs . This proves the total arithmetic bound with three arrays. No coefficient of span greater than N can affect a retained coefficient in any of these multiplications.
Algorithm 1: initialize the coefficient arrays. Input the horizon , observed histogram , and trailing age . Every array is indexed by ; invalid indices mean zero.
-
Set all entries to zero and .
-
For , put . Repeat times: for and , put and , then set
- Copy and put . For and , set
- Return . They represent respectively through span .
Ascending allows arbitrarily many copies of the current geometric factor. Each cell requires a bounded number of integer operations; there are at most factors and cells.
Algorithm 2: delete one completed gap. Input with and the three arrays for the old histogram.
-
Save and .
-
For and , save and . Apply
- Set , , and . Return the updated arrays and counts.
Here descending preserves the old lower-span coefficients. The marked correction is needed in addition to multiplying by . Omitting it changes the meaning of the admissible-first-gap mark.
Algorithm 3: compute every prefix pair and the predictor. Input . Put , and let for .
-
Compute the partition numbers by , other ; for and ascending , set . Compute the from (1) and the factorials . This takes operations.
-
Find the trailing age . For , set
If , go to step 5.
-
From the ordered one positions form . Run Algorithm 1. Keep a pointer to the first remaining one position.
-
For , set
Add to every term for . Add to every term for . If and , let be the distance to the next remaining one, run Algorithm 2, and advance the pointer. Deleting a zero changes only and hence the query budgets.
- Return and , .
All factorial divisions are exact. Zero coefficients may be skipped before multiplying by a factorial ratio; they correspond to no admissible completion. The largest denominator index is at most in every query. The invariant at entry to step 4 is that the arrays and belong to , with the original horizon and the original age retained. The prefix and append identities prove each query. Deletion preserves the invariant by (10); the precomputed zero branch covers the remaining suffixes. Thus Algorithm 3 proves (7).
3.3 Bit complexity
Dropping the span constraint bounds a degree- coefficient of any ordinary series above, whose total exponent is at most , by . For , it has bits; marking adds a factor at most . Moreover
Deletion differences also have bits. All terms in (6) and the append-one formula are nonnegative, so their products and partial sums have bits. Factorials and type counts have polynomial preprocessing cost. Rebuilding each prefix separately would cost ; the shared computation above costs . The sum of rational conditionals has a denominator of at most bits. Exact integer arithmetic thus has polynomial bit cost; no unit-cost unbounded register or exact-real oracle is assumed. For the arithmetic bound one may add the fractions without cancellation using further operations; the same denominator bound applies. These bounds complete the proof of Theorem 2.
4 Risk of the predictor
Set and . Define
Full support and make every conditional valid. All suffixes use the same horizon- distribution.
Proof of Theorem 1. The reduction of [1, Proposition 2.1] gives
(12)
To see this, use KL convexity in (11) and insert into each likelihood ratio. Stationarity identifies each conditional divergence with the first coordinates; the chain rule telescopes their sum.
As in [1, Section 3.4], represent the process by a stationary countdown chain : decrement if , draw a fresh value after state 1, and emit . Conditional data processing and stationarity give
Summation bounds the memory term's numerator by . Also is a Markov chain: all larger countdowns generate the same N zeros. Therefore
No bound on the entropy of itself is needed. Combine this with (12) and Lemma 1. Complexity was proved above.
5 Failure of terminal-score shortcuts
Efficient full-word evaluation need not give an efficient generic offline-to-online conversion [7]. Even within the present model the following simple shortcuts fail.
Proposition 1. Normalizing only , , or using the terminal conditional of without suffix averaging, does not give uniformly vanishing next-symbol risk on .
Proof. For the stationary periodic source , , history has mass and oracle next-one probability . Both words and have singleton types. Both shortcuts predict on this history; they are algebraically the same estimator. Averaging local-horizon normalized full-word scores over suffixes also gives on this history. Their risk is at least
where is binary entropy in nats. This tends to for . In contrast, (3) and marginal consistency imply
for the actual averaged rule. Neither full-word scores nor a terminal conditional replaces the prefix calculation and the suffix average.
6 Prior work and scope
6.1 Which probability assignment must be evaluated?
The classical code is not proposed as new. For this code, the conditional required by the reduction is exactly
Its horizon is even for a short suffix . Computing or the two complete-word scores , does not perform either of the sums in (13). This family of type-uniform block assignments is not projectively consistent across horizons: for example , whereas the prefix marginal . Consistency within each fixed is supplied by summing its completions. The preceding counterexample shows why a local-horizon substitution changes the prediction guarantee.
6.2 Unconditional renewal generating functions
Flajolet-Szpankowski [4] is the closest algebraic precedent. Their equations (7), (15), and (25) organize complete renewal words and maximum-likelihood redundancy sums using products over gap multiplicities and marked coefficients. Those tools are established, and truncated coefficient multiplication itself is a standard algorithmic operation. An unconditional normalizing coefficient has neither a supplied observed histogram nor a constraint that the first future gap exceed an observed age . Consequently reading off that coefficient does not evaluate (13) for an arbitrary observed prefix.
The additional object here is specifically together with the restricted mark in (4) and the factorial multiplier in (6). These retain the dependence between observed and future multiplicities in . Algorithms 1-3 evaluate that object and share it over all suffixes. This is an adaptation of classical algebra, not a claim that generating functions or renewal types are new. The distinction is the conditional query and its computational consequence; no lower bound on the difficulty of adapting earlier machinery is asserted.
6.3 Sequential CTW assignments
CTW does supply efficiently computable sequential conditionals for its own coding distribution. They need not equal (13), which is a different probability assignment. More generally, equality with our is unnecessary: another code with redundancy and polynomial prefix evaluation would also solve the prediction problem. Garivier [5] proves worst-case CTW redundancy of order on the renewal class. Applied directly to the same compression-to-prediction bound, that guarantee gives only an upper bound, rather than the desired . Thus the missing inference is the optimal statistical guarantee, not the existence of sequential CTW conditionals. This comparison does not prove a statistical lower bound for every possible predictor based on CTW.
For observed finite-state Markov chains, Han-Jana-Wu [6] already use suffix averages of add-one estimators, evaluated in time. The infinite-memory reduction used here is from Han-Jiang-Wu [1]; the average and the reduction are not new. The 2026 author survey [9], Section IV.B-C, restates the renewal risk theorem and gives a finite-state HMM algorithm without a renewal implementation in that discussion. The renewal example in [8, Appendix F] is an explicit limitation of its general entropy upper bounds, not a computational lower bound.
The theorem concerns a known observation horizon, independent gaps, and stationary initialization. Dependent gaps, noisy observations, and efficient horizon-free updates require additional arguments. The arithmetic and bit bounds are asymptotic computational guarantees; practical large-scale performance is a separate question.
A Independent finite verification and reproducibility
The accompanying standard-library Python implementation is anc/renewal_predictor.py; the single entry point anc/reproduce_appendix.py regenerates appendix_results.json. Run the latter script using Python 3.10 or later from any working directory. No training, external data, network access, or third-party Python package is required. The suffix_marginals method returns the integer pairs ; suffix_conditionals and predict_one return exact Fraction values. The result file records the interpreter, platform, source hashes, deterministic case names, and timing repetitions. These are independent reference computations, not an independent human review or a substitute for the proofs above.
A.1 An oracle that enumerates actual type classes
For each , the oracle enumerates all words and groups them by first-one position, last-one position, and the sorted multiset of completed gaps; the all-zero word is its own group. It assigns every member of an enumerated group of size the weight . Importantly, the reference obtains by counting actual words, without using the factorial type-size identity, either prefix DP, or the generating-function recurrences under test. Summing these weights over completions produces an independent integer prefix-mass table.
The script compares every computed prefix mass with this table, including the empty prefix and complete words. It separately checks that the enumerated number of groups equals
and that the empty-prefix mass is . For every nonterminal prefix it checks
both in the reference table and in the evaluated implementation. For every length- history, all shared-suffix pairs are compared individually with the reference masses; the conditional probabilities and their average are checked exactly as rational numbers.
A.2 Shared-array invariants and censored boundaries
A read-only trace hook inspects the actual implementation on entry to each nonzero-suffix query for a named boundary suite at . A second reference enumerates integer partitions of each span . For each partition histogram , it adds to and this quantity times to . Adding one observed gap of length gives a separate reference for . This reference uses direct finite histogram enumeration and no in-place geometric multiplication or deletion update. It compares every retained array entry through span , including spans beyond the current query budget, as well as and . Thus leading-zero deletions, marked-gap deletions, and growing future budgets are checked at the state level.
Named histories include all-zero and all-one words, a single one at the beginning, middle, or end, repeated gaps of length two and three, and repeated gaps followed by unfinished ages below, at, and above the observed gap length. This tests the strict admissibility threshold , nonzero multiplicity when appending a one, and the transition to all-zero suffixes. Larger named and seeded-random histories at are compared with separately rebuilt prefix DPs. These latter references do share the mathematical prefix identity; their role is to check reuse across suffixes, not to provide a second derivation of that identity.
A.3 Operation growth and actual elapsed time
The script counts visits to five kernels in the running shared-suffix implementation: initialization, the append-one factor, denominator and numerator query cells, and deletion. A visit entails a bounded number of integer operations, although integer bit costs vary with . These counts are obtained from executed source lines, rather than by returning a predicted cubic formula. On the dense all-one histories, the script checks that their total is at most for . The count excludes preprocessing, loop control, and rational averaging, which have the separately bounded costs in Theorem 2.
For elapsed time, each run constructs a fresh predictor and computes the complete averaged prediction with exact rational arithmetic. Five untraced repetitions are retained, and the median is reported. The trace-counting runs are excluded from timing. A wall-clock ratio is machine dependent and includes increasing integer sizes and gcd normalization in Python's Fraction; it need not be exactly eight under a doubling of . The asymptotic arithmetic and bit statements follow from the proof, independently of these measurements.
Table 1: Executed kernel visits and untraced elapsed time. Dense all-one histories; five timing repetitions per horizon.
| Horizon | Kernel visits | Visits/ | Median (ms) |
|---|---|---|---|
| 8 | 812 | 1.5859 | 0.217 |
| 16 | 6,680 | 1.6309 | 1.573 |
| 32 | 54,064 | 1.6499 | 13.488 |
| 64 | 434,784 | 1.6586 | 119.323 |
The recorded run passed 4,082 prefix-mass comparisons, 2,036 binary mass-split checks, and 8,194 suffix-pair comparisons on 1,022 exhaustive histories. The boundary suite checked 57 complete coefficient states; the larger suite checked 1,308 additional pairs. These counts overlap across test purposes and are not independent statistical samples. The run used Python 3.14.7 on Windows-11-10.0.26300-SP0.
References
[1] Y. Han, T. Jiang, and Y. Wu, Prediction from compression for models with infinite memory, with applications to hidden Markov and renewal processes, COLT, PMLR 247, pp. 2270–2307, 2024. https://proceedings.mlr.press/v247/han24a.html
[2] I. Csiszár and P. C. Shields, Redundancy rates for renewal and other processes, IEEE Transactions on Information Theory, 42(6), pp. 2065–2072, 1996. doi:10.1109/18.556596.
[3] I. Csiszár, The method of types, IEEE Transactions on Information Theory, 44(6), pp. 2505–2523, 1998.
[4] P. Flajolet and W. Szpankowski, Analytic variations on redundancy rates of renewal processes, IEEE Transactions on Information Theory, 48(11), pp. 2911–2921, 2002. doi:10.1109/TIT.2002.804115.
[5] A. Garivier, Redundancy of the context-tree weighting method on renewal and Markov renewal processes, IEEE Transactions on Information Theory, 52(12), pp. 5579–5586, 2006. doi:10.1109/TIT.2006.885484.
[6] Y. Han, S. Jana, and Y. Wu, Optimal prediction of Markov chains with and without spectral gap, IEEE Transactions on Information Theory, 69(6), pp. 3920–3959, 2023. doi:10.1109/TIT.2023.3239508.
[7] M. Hutter, Offline to online conversion, Algorithmic Learning Theory, pp. 230–244, 2014. https://www.hutter1.net/publ/off2on.pdf
[8] Z. Jia, A. Rakhlin, and Y. Polyanskiy, On the minimax regret of sequential probability assignment via square-root entropy, COLT, PMLR 291, pp. 2958–3016, 2025. https://proceedings.mlr.press/v291/jia25a.html
[9] Y. Han and Y. Wu, Next-symbol prediction from compression: Statistical and computational foundations, author manuscript, February 2026. https://yanjunhan2021.github.io/paper/BITS.pdf