Estimating biased finite-memory sources from a single trajectory is a fundamental problem with practical impact, for example in estimating entropy for cryptography. We study order-d binary sources whose conditional probabilities have bias at most ϵ, and establish sharp sample complexity bounds: relative accuracy γ with confidence 1−δ needs γ−2(21−ϵ)−d(logd+logδ1) samples up to constants depending on ϵ, with matching upper and lower bounds and no dependence on mixing time or spectral gap. The proof rests on a sharp bound on expected hitting times of the sliding-window (de Bruijn) chain, which stay of order 1/π(w) uniformly in d exactly when ϵ<103, and on majorization of the window masses by those of independent biased coins. Applied to published entropy-source validations, the bounds show that their trace lengths may be underpowered: 106 bits cannot resolve all transitions of an 8-bit model to better than about 4.5% relative error.
Learning binary sources with finite memory is of fundamental importance for applications such as cryptographic randomness assessment, lossless compression and sequential prediction (Turan et al., 2018; Willems et al., 1995; Han et al., 2023).
Unlike in the equally classical and well-understood memoryless model of independent coins, here the next-bit probabilities depend on a longer context, and the contexts are visited with exponentially different frequencies, resulting in very diverse reliability for each transition. How many samples are needed to estimate reliably and accurately all of them?
In this work we settle this problem for sources of bounded bias, pointing out that classical techniques, such as those based on mixing times or spectral gaps, do not yield optimal bounds Section 2. Our bounds, optimal in the minimax sense, show that the sample size is inversely proportional to the mass of the rarest window, inversely quadratic in the desired accuracy, logarithmic in the confidence, and, most importantly, only double-logarithmic in the parameters to learn (e.g., in the number of transitions). More precisely, under next-bit bias at most ϵ, relative accuracy γ and confidence 1−δ, the sample size splits into three interpretable factors:
n⋆≍ϵwaiting for the rarest window(21−ϵ)−d⋅accuracy (Fisher information)γ−2⋅confidence for multiple windows(logd+logδ1),
Our strategy is to bound the expected hitting times of the sliding-window chain, which controls the visits to a single window, and then to majorize the window masses by those of independent coins, which controls the visits to all windows at once. We outline the proof plan; key results are highlighted with main ingredients discussed in the main body, the detailed proofs, symbolic calculations or numerical simulations are in the supplementary appendix, which together with the code is also available at https://github.com/maciejskorski/learning-binary-sources.git.
Sharp overlap of Bernoulli sequences (Theorems 3 and 4). Distances and divergences between product distributions are well-studied (Talagrand, 1995; Smirnov, 2026), unlike the far-apart regime: the overlap cd=1−dTV is what matters for us; the larger the overlap, the sooner two starts can be coupled, and the shorter waiting, hitting and coverage times, hence (intuitively) more efficient estimation of transitions. For d tosses of coins with biases 21±ϵ, letting β=1−4ϵ2, m=⌈d/2⌉, we prove
with sharp constants of 1/π from below and 1 from above. Critically, independent coins are shown to be the extreme overlap case for chain transition laws as well:
P∈Cϵ,dinf(1−δ(Pd))=cd(ϵ).
Occupancy and hitting times from the oscillation (Theorem 5 and Corollary 6). A hitting time is an occupancy in disguise: by the strong Markov property, the visit counter with start at u is behind a start at w by the steps lost while waiting for the first hit. Thus it is controlled by the expected visit counts Gn(⋅,w)=∑s<nPs(⋅,w) of two starts, more precisely by their oscillation oscGn(⋅,w), the largest difference between starts. We bound this oscillation by a careful split of the series at a block length L: the head part keeps the cancellation between the visits of different starts, and the tail is estimated by contraction, because the column oscillation of forward transition kernels decays geometrically. Specifically, for all n,
and the same upper bound carries over to the expected hitting times through the fundamental matrix identity. Namely, π(w)Eu[τw]=limn(Gn(w,w)−Gn(u,w))⩽supnoscGn(⋅,w), where π is the stationary distribution and τw the hitting time. Applications require different regimes of L: for shift chains we will use L=d, and for expanders L=⌈lnm/ln(1/λ∗)⌉.
Hitting without mixing: a sharp phase transition (Theorems 7 and 8; Appendix B.2). For any chain with positive block overlap, expected hitting times are controlled by local quantities, not by mixing, which may be exponentially slow. For biased binary sources the worst normalised expected hitting time Hitd(ϵ):=supP∈Cϵ,dmaxu,wπ(w)Eu[τw] is bounded uniformly in the memory d exactly below 103, and it blows up as the threshold is approached. With the distance to the threshold Δ:=∣ϵ−103∣ and Hit(ϵ):=supdHitd(ϵ),
The threshold is caused by a race between the exponential scales of the recurrence time a−d and the crossing time of β−d in a bistable chain, which balances at ϵ=3/10.
Final result: sample complexity with logd, not d (Theorems 12 and 13; Appendices A.4 and A.5). From an arbitrary initial state, with explicit constants, in relative accuracy γ (what a min-entropy claim needs, at the price (21−ϵ)−1 over additive bounds), the failure probability at a window of mass π(w) is at most exp(−κϵnπ(w)γ2) for a constant κϵ>0, with no mixing or spectral quantity. To handle the visits to all windows simultaneously, we majorize the window masses by those of independent biased coins (Theorem 10): only polynomially many windows are near the minimal mass bd, so the union over 2d windows costs logd, not d. A matching lower bound (Fano's inequality over the d windows with a single 1, and a two-point argument for the confidence) makes the worst case sharp for fixed 0<ϵ<103:
n⋆(γ,δ)≍ϵγ2(21−ϵ)dlog(d+1)+logδ1.
For δ≲1/d, the typical regime, this is n⋆≍ϵ(21−ϵ)−d⋅γ−2⋅lnδ1: waiting for the rarest window, accuracy, confidence; for larger δ the confidence factor is lnd+lnδ1, and the logd is the price of covering all windows at once. No hitting-time constant enters the lower bound (Theorem 13). The dependence on ϵ is not settled: the upper bound carries C(ϵ), which blows up at 103, and we do not show that this is necessary for learning.
Fast mixing is misleading (Proposition 14). The memoryless chain has the minimum possible mixing time and the minimum possible πmin: the minimax lower bound is proved on perturbations of it, so fast mixing alone does not make learning cheap. In the worst case the cost is exponential in the memory, with a bias-dependent rate:
Applications: cryptographic security and expanders (Section 4.7; Appendix B.1). Cryptographic security. We apply our bounds to published entropy assessments obtained through Markov chain estimation. Resolving the min-entropy rate to η bit per bit needs, in order of magnitude,
n≳2dη−2,
and our exact numerical bounds, with explicit constants (Appendix B.1), show that some published traces fall short of the necessary length at their targeted accuracy and confidence. Expanders. The hitting-time mechanism is not specific to shift chains: on expander graphs the same argument recovers the classical fact that a random walk reaches any vertex from any start in expected time linear in the number of vertices (Corollary 15).
2. Related work
Kernel estimation. The closest non-asymptotic baselines bound the error of the maximum-likelihood kernel estimator in terms of a global chain constant. Wolfer and Kontorovich (2019) give minimax rates for the maximal rowwise ℓ1 error in terms of the pseudo-spectral gap and the minimum stationary probability, and Wolfer and Kontorovich (2021) a matrix-level total-variation guarantee with sample size proportional to the mixing time multiplied by a factor depending on stationary transition frequencies, for fixed accuracy and under geometric ergodicity; Huang and Li (2024) give entrywise Chernoff-type concentration bounds with the iterated Poincaré gap in the exponent, valid for any irreducible chain but with an additional factor that degrades from a poor initial state. Han et al. (2018) give non-asymptotic guarantees for entropy-rate estimation of Markov chains with a large state space, in a model parametrised by a spectral gap, and Kamath and Verdú (2016) for the min-entropy rate of reversible chains in terms of the relaxation time and the minimum stationary mass. Han et al. (2023) study the prediction of Markov chains, including higher-order ones, in expected Kullback–Leibler (KL) risk, with and without a spectral gap. The kernel-estimation bounds are additive, none is accompanied by a matching lower bound in our setting, and all treat the 2d windows as generic states.
Standard tools and their limits. The problem is elementary to state, yet standard tools do not directly yield sharp bounds from bounded bias alone: the missing ingredients are (a) quantitative control of visits to each context and (b) a way to combine those guarantees without uniformly treating every context by a union-bound. The transition probabilities are bounded in [b,a]; what varies exponentially are the context frequencies π(w)∈[bd,ad], products over d steps.
Spectral theory and perturbation. Relaxation-time bounds, such as π(w)Eπ[τw]≲trel, need a reversible chain with a spectral gap (Aldous and Fill, 2002; Levin et al., 2017). Sliding-window chains are not reversible, and for such chains eigenvalues can hide slow transients. The usual fix by symmetrising with P∗P, does not help either: for the fair source the chain forgets its start after exactly d steps, yet P∗P only ever changes the first bit of the window, so it has no gap at all. Perturbation from the fair source fails too: each transition is within ϵ of 21, but this compounds over d steps, since 2dπ(w) ranges from (1−2ϵ)d to (1+2ϵ)d, so no bound uniform in d follows.
Mixing time. Bounds of the form Eu[τw]≲tmix/π(w) are valid but costly here: tmix can be exponentially large in d (the majority chain of Theorem 8), and our hard instances are small changes of a memoryless source, which mixes in exactly d steps (Proposition 14).
Hitting times and coverage. The naive route waits for k visits at every window: minorisation Pd⩾bd bounds the expected hitting time by db−d, regeneration and Chernoff give accuracy γ from k≍γ−2ln(2d/δ) visits, and a union bound over the 2d windows gives n≳d(d+lnδ1)γ−2b−d, larger than our γ−2b−d(lnd+lnδ1) by a factor between d and d2/lnd. It lower-bounds all windows by the smallest mass bd, the difficulty we handle differently.
Our route. We obtain the missing ingredients through block overlap and occupancy oscillations, which bound the normalised hitting times (Theorems 7 and 8), followed by majorization of the stationary window masses by independent coins (Theorem 10).
3. Preliminaries
3.1. Notation
All logarithms are natural unless marked log2. The symbols ≲,≳ and ≍ hide universal positive constants; a subscript indicates permitted dependence.
We follow Levin et al. (2017). A Markov chain (Wt)t≥0 with transition matrix P lives on a countable state space. We write Px and Ex when it starts at W0=x, so that Pt(x,y)=Px{Wt=y}. Distributions are row vectors and functions are column vectors, so that μP(y)=∑xμ(x)P(x,y) and Pf(x)=∑yP(x,y)f(y)=Exf(W1). A distribution π is stationary if πP=π. The hitting time of a state w is the random time τw=min{t⩾0:Wt=w}, which is 0 if the chain starts at w, and the return time is τw+=min{t⩾1:Wt=w}. Bounds on hitting times are bounds on their expectations Eu[τw] (the expected hitting time from u), unless stated otherwise. Let τw(1)<τw(2)<⋯ be the successive visits to w, and Nw(n)=∑t=0n−11{Wt=w} the number of visits among the first n steps (each followed by one new bit). By the strong Markov property, after each visit to w the chain starts afresh from w, independently of the past. The total variation distance is dTV(μ,ν)=21∑z∣μ(z)−ν(z)∣, and the oscillation of a real function is oscf=supf−inff. The mixing time is tmix=min{t:maxxdTV(Pt(x,⋅),π)⩽41}; it appears only for comparison. The Dobrushin coefficient (Dobrušin, 1956) of P is δ(P)=maxx,ydTV(P(x,⋅),P(y,⋅)), so 1−δ(P)=minx,y∑zmin{P(x,z),P(y,z)} is the overlap of two one-step laws with different starts; it is the contraction factor for oscillation, osc(Pg)⩽δ(P)oscg. The expected visit counts Gn(x,y)=∑t=0n−1Pt(x,y) give the expected number of visits to y during times 0,…,n−1 from x; in equilibrium they equal nπ(y). Appendix B.2 develops these in detail.
3.2. The learning problem
An order-d source emits each new bit given the context w∈{0,1}d of its last d bits, sampling one with probability p(1∣w). The class Cϵ,d consists of the sources of bias at most ϵ<21, that is,
∣p(1∣w)−21∣⩽ϵfor all w,(1)
and we write a=21+ϵ,b=21−ϵ, so that p(v∣w)∈[b,a]. An estimator p^ observes a trajectory of n bits, after an arbitrary initial window, and approximates conditional probabilities p(⋅∣w). For a targeted relative accuracy γ and confidence 1−δ, we require that, with probability at least 1−δ,
p^(v∣w)=(1±γ)p(v∣w)for all w∈{0,1}d,v∈{0,1}.(2)
The minimax sample size n⋆(γ,δ) is the least n for which some estimator achieves this on every source of the class, from every initial window.
3.3. The sliding-window chain
Let X=(Xt)t≥1 be a binary process of order d from the class Cϵ,d of Equation (1), so that p(v∣w)=P{Xt+1=v∣Wt=w}∈[b,a] for the window Wt=(Xt−d+1,…,Xt)∈{0,1}d of the last d bits. Thus, a source with memory d is a binary chain sliding over d-bit windows: in each step the last bit is dropped and a new one added. This is a Markov chain on {0,1}d with the shift kernel
P(u,w)={p(wd∣u),0,w=(u2,…,ud,wd),otherwise,
and its transitions are represented by the de Bruijn graph.
The results below follow from the observation that a d-step transition of the shift kernel factorizes over a unique path (for k>d steps it is a sum over 2k−d paths): starting from u, the window after d steps is exactly the string of d new bits, so Pd(u,w)=∏j=1dp(wj∣uj⋯udw1⋯wj−1).
Proposition 1 (Window law bounds) For every u,w∈{0,1}d,
bd⩽Pd(u,w)⩽ad,and consequentlybd⩽π(w)⩽ad.
By Proposition 1, Pd has positive entries, so P is irreducible and aperiodic with a unique stationary law π; write πmin=minwπ(w). We also write β=2ab=1−4ϵ2.
Proposition 2 (Kac)Ewτw+=1/π(w) for every w. In particular, all mean return times lie in [a−d,b−d], and the shortest one, 1/maxwπ(w), is 2 to the min-entropy of π.
Proofs of Propositions 1 and 2 are in Appendix A.1.
4. Results
Proofs are in Appendix A; extensions, with their own proofs, are in Appendix B; the code and numerical experiments are in the supplementary repository (link in the introduction).
4.1. Overlap of Bernoulli and Markovian coins
Classical results control the total variation distance between independent coin product laws, through powers of the Hellinger affinity (Bhattacharyya coefficient) β=1−4ϵ2; refinements include polynomial prefactors in tails and universal-factor estimates of total variation (Talagrand, 1995; Smirnov, 2026). We focus on the regime where the coins are distinguishable and dTV→1. There the overlap cd=1−dTV decides, since estimates of dTV are not helpful when it is exponentially small. Theorem 3 determines cd up to optimal constants, and Theorem 4 shows that independent coins are the extreme (worst) case for Markov dependencies.
be the distribution overlap of Bernoulli products. For every d⩾1 and 0⩽ϵ⩽21, with β=1−4ϵ2 and m=⌈d/2⌉:
(i) (parity)c2m−1(ϵ)=c2m(ϵ).
(ii) (exactformula) with r=2ϵ, c2m(ϵ)=2P{Bin(2m−1,b)⩾m}=∫01(1−u2)m−1du∫r1(1−u2)m−1du.
(iii) (sharpbounds)
π11+4mϵ2β2m⩽cd(ϵ)⩽1+4mϵ2β2m.
Both constants are best possible: 1 is attained as ϵ→0 and 1/π≈0.564 as m→∞.
Intuition. The exponent βd is the affinity of the two coins. If ϵd≲1 the coins are hard to tell apart and this is the whole answer; if ϵd≫1 there is an extra factor 1/(ϵd), the chance that a random walk with a small drift ends within 1/ϵ of its centre. The proof appears in Appendix A.2.
From coins to chains. We now move from independent coins to dependencies: the same overlap bound survives them, sharply.
Theorem 4 (Sharp contraction of biased binary chains) Consider a sliding-window chain P∈Cϵ,d of order d. Then
δ(Pd)⩽dTV(Bern(a)⊗d,Bern(b)⊗d)=1−cd(ϵ),
with cd(ϵ) being the overlap of Theorem 3. Equality holds for the chain p(1∣w)=b+(a−b)w1 (where w1∈{0,1} is the oldest bit), so cd(ϵ)=infP∈Cϵ,d(1−δ(Pd)) and the bound cannot be improved.
Intuition. Two starts are hardest to bring together when one always sits at the top of the allowed range, p=a, and the other at the bottom, p=b: their d new bits are then two coins of bias a and b. The chain that copies its oldest bit does exactly this, since for d steps the oldest bit is still the one of the start. Concavity implies that no other configuration can be worse (worst conditional probabilities at endpoints); the argument is deferred to Appendix A.2.
4.2. Oscillation, occupancy and hitting times
We bound occupancy and hitting times of w through the column spread oscPs(⋅,w): differences of visit counts control hitting (Theorem 5), and a head-tail split controls the differences (Corollary 6).
Theorem 5 (Occupancy and hitting times) Let π be stationary and let w be a state with π(w)>0 whose column spread oscPs(⋅,w) (how much the chance of standing on w at time s still depends on the start) tends to 0 as s→∞. Let Gn(u,w) be the expected visit counts of w from the start u. Then for all states u and all n⩾0
Corollary 6 (Head and tail) If δ(PL)<1 for some L⩾1, then P has a unique stationary law, the column spread contracts, oscPs+L(⋅,w)⩽δ(PL)oscPs(⋅,w) for all s, so Theorem 5 applies to every state w with π(w)>0, and
Here HL(w)⩽∑s<LoscPs(⋅,w) by subadditivity, and the tail is at most ∑j<LoscPL+j(⋅,w)/(1−δ(PL))⩽LoscPL(⋅,w)/(1−δ(PL)), as the column spreads are nonincreasing. Hence both the occupancy at every finite n and the expected hitting time are bounded by BL(w): ∣Gn(u,w)−nπ(w)∣⩽BL(w) and π(w)Eu[τw]⩽BL(w).
ϵ⩽
0.05
0.10
0.15
0.20
0.25
0.28
0.29
C(ϵ)⩽
2.31
2.84
3.71
5.34
10.61
30.42
76.37
Table 1: Verified upper bounds on supdBd(ϵ) (Appendix A.3.2).
Intuition. A walker started at u is behind one started at w by the steps lost before the first hit, so hitting times are differences of visit counts, bounded by sums of column spreads. The first L (the head) are kept for cancellations; the rest (the tail) contract geometrically. Proofs: Appendix A.3.1.
4.3. Hitting times and occupancy of sliding-window chains
We now combine our sharp results on the overlap of Bernoulli sequences (Section 4.1), together with the oscillation control of occupancy and hitting times (Section 4.2), to obtain accurate bounds on the expected hitting times of biased shift chains: below bias 103, the normalised hitting times π(w)Eu[τw] stay bounded independently of the memory d.
Theorem 7 (Hitting times and occupancy of biased binary sources) Consider a binary chain of order d in Cϵ,d, i.e. with p(1∣s)∈[b,a] for all windows s. Let cd(ϵ) be the overlap of Theorem 3. Put
Bd(ϵ)≜1−a1−ad+cd(ϵ)d(ad−bd).
Then for all u,w and n, with the visit counts Gn of Theorem 5,
oscGn(⋅,w)⩽Bd(ϵ),π(w)Eu[τw]⩽Bd(ϵ).
For ϵ<103 this is uniform in d: Bd(ϵ)⩽C(ϵ):=supd⩾1Bd(ϵ)<∞, where C(ϵ)⩽52(103−ϵ)−3/2 (Appendix A.3.2; exact values in Table 1).
Intuition. The first term (⩽1/b) is the memory of the first d steps; the second is the cost of merging afterwards, governed by the overlap cd(ϵ) of Theorem 4. It grows like (a/β)d up to a polynomial factor in d, so Bd is bounded exactly when a<β, i.e. ϵ<103 (the race is explained after Theorem 8). Proof: Appendix A.3.2. The threshold 103 is not a proof limitation, but rather a transition in the behaviour of hitting times.
Theorem 8 (Sharp transition at ϵ=0.3 for normalised hitting times) For 0⩽ϵ<21 and Hit(ϵ)=supdsupP∈Cϵ,dmaxu,wπ(w)Eu[τw],
Hit(ϵ)<∞⟺ϵ<103.
More precisely, for odd d let Md∈Cϵ,d be the majority chain: p(1∣w)=a if w has more ones than zeros, and p(1∣w)=b otherwise. Then
π(1d)E0d[τ1d]⩾4β2πϵd(βa)d,
which tends to infinity with d exactly when a⩾β, i.e. ϵ⩾103 (at ϵ=103 one has a=β=0.8).
Intuition. The majority chain is bistable: its majority rule traps the chain in the well it is in, a well of mostly zeros or of mostly ones. To reach 1d from 0d it must first escape the zeros well, which needs a window with a majority of ones from a coin of bias b: probability about βd per step, so a waiting time about β−d. The target 1d has mass about ad, so the normalised time is about (a/β)d, unbounded exactly when a⩾β. The proof appears in Appendix A.3.3.
4.4. Bounds on multiple visits
Good estimation of p(⋅∣w) requires a number of visits to each window w. The time until every state is visited k times, known as the k-cover time (Chan et al., 2021), is the right tool here.
Multiple visits to one state. We first prove that, during n steps, each window w is visited at least ≳nπ(w) times (not much less than expected) with overwhelming probability 1−exp(−Ω(nπ(w))). For our class the bound holds uniformly over d when ϵ<103 (Theorem 7), which gives the Chernoff-type guarantee (5), with explicit constants. In addition, the argument isolates the hitting-time cost as an additive term (a naively used hitting time incurs a multiplicative cost); this avoids a polynomially large prefactor C(ϵ)≲(103−ϵ)−3/2 in the sample size.
Theorem 9 (Repeated visits to one state) Fix a window w and let tw=maxyEy[τw] be the expected time to hit w from the worst start. Then, for every η∈(0,1), with probability at least 1−η the k-th visit to w happens by time
τw(k)⩽1.3π(w)k−1+6.5twlnη2.
For ϵ<103 we have tw⩽Bd/π(w) with Bd⩽C(ϵ) (Theorem 7), and the exponential-tail bound in the proof of the theorem gives, for every chain in Cϵ,d, window w, start and n,k⩾1,
So, with probability at least 1−56exp(−13Bd(n−1)π(w)) the window is visited at least 2.6(n−1)π(w) times.
Intuition. After the first visit the chain is at w, so each revisiting costs one return time, of mean 1/π(w) (the first term; the constant 1.3 can be further improved towards 1). The delay before the first visit, of mean at most tw, contributes only once (the second term). Thus, the costs add rather than multiply. The proof is in Appendix A.4.
Multiple visits to all states. Accurate estimation needs multiple visits to all windows at once; since their masses are unknown and can vary a lot across windows w, the bounds are not directly summable. Indeed, a uniform bound, which treats every window with the smallest mass bd, would overshoot the true failure probability by a factor exponential in d, resulting in a sample size linear rather than logarithmic in d.
We handle this by majorizing, once again, by independent coins: the window masses of every chain of the class are majorized by those of d independent biased coins. This buys logd instead of d: for independent coins the masses are bd(a/b)k with exactly (kd) windows at level k, only polynomially many windows near the smallest mass. Just as in coupon collection with unequal probabilities, the cost is driven by how many coupons are rare, rather than how many are there.
Theorem 10 (Majorization by independent coins) Let P be a chain of order d whose conditional probabilities lie in the box [b,a], a=1−b. For every convex function φ,
w∑φ(π(w))⩽k=0∑d(kd)φ(akbd−k),
with equality for the memoryless chain.
Intuition. The failure bound is a convex function of the mass (an exponential), and a convex sum is largest when the masses are spread out as much as possible. We then study the stationary law as a binary tree: at each branch the mass is split between the two next bits with probabilities in [b,a]. By convexity, the worst tree splits every node as (a,b), which is the memoryless chain. In fact, the box need not be symmetric: if only p(1∣w)∈[β,α], the theorem holds with a:=max{α,1−β} and b:=1−a. The proof is in Appendix A.4.
Corollary 11 (Summing over windows for our class) Let P∈Cϵ,d with ϵ>0 (b=21−ϵ, a=21+ϵ), and let c,t>0. Suppose that each window w has an "exceptional" event (for instance, too few visits) of probability at most ce−tπ(w). If tbd⩾2ϵb(1+lnd), then the probability that some window is exceptional is at most 1.445ce−tbd.
Intuition. By Theorem 10 we may count windows as for independent coins: level k has at most dk windows, but under the stated condition its windows are so much heavier that level k adds at most e−k times the failure probability of the lightest window. The sum is essentially geometric, so all windows together cost a constant factor, and the price of the union is the condition tbd≳lnd, which is the logd of the sample size.
4.5. Learning bounds
The estimator. Fix a window w and let ξj be the bit following the j-th visit to w. The estimator is the standard maximum-likelihood one, the empirical frequency of these bits (Algorithm 1).
Algorithm 1: Estimator of transition probabilities of a sliding-window chain
Input: initial window and n new bits x1−d,…,xn, window w, bit v
Output: estimate p^(v∣w)
S←{0⩽t<n:(xt−d+1,…,xt)=w}; // visits to w
N←∣S∣ if N=0 then return 21;
return N1∑t∈S1{xt+1=v}
Each bit ξj is a fresh draw from p(⋅∣w), whatever happened before (strong Markov property), so the ξj are i.i.d. The estimator uses the trajectory only, with no knowledge of the bias, the stationary law, or mixing and hitting times. Combined with the multiple-visit bounds of Section 4.4 ((5) for one window, Theorem 10 for all of them), this gives the final result:
Theorem 12 (Sample complexity, upper bound) Let ϵ<21 and γ⩽1, let Bd=Bd(ϵ) be the constant of Theorem 7, and let mγ=(1−2ϵ)γ21+2ϵ≍ϵγ−2 be the number of flips needed to learn the rarer bit to relative accuracy γ. For every chain in Cϵ,d, every window w and every n⩾1, the estimator has relative error above γ at w with probability at most
4exp(−8(mγ+Bd)nπ(w)).
Consequently, for 0<ϵ<103 and C(ϵ)=supdBd(ϵ), Equation (2) holds w.p. ⩾1−δ as soon as
n⩾bd8(mγ+C(ϵ))max{lnδ6,2ϵb(1+lnd)}.
Intuition. A window of mass π(w) is seen about nπ(w) times, each visit is one coin flip, and Theorem 7 says no start delays the visits by more than a constant factor on the scale 1/π(w). So a window is learned once nπ(w)≳mγ+Bd, and the union over windows adds only logd (Appendix A.4). The proof uses Theorem 7 only through Theorem 9, so any bound on the hitting time tw would do. The proof is in Appendix A.5.
It remains to show that these costs cannot be avoided. We show a matching lower bound that applies to every estimator. The key property used in the proof is that trajectory divergence equals the expected number of visits to the modified row times its per-visit divergence (Lemma 21).
Theorem 13 (Lower bound with the logd term) Let 0<ϵ<21, d⩾1, γ⩽min{ϵ/4,121} and δ⩽41. Then every procedure that satisfies Equation (2) with probability at least 1−δ on every chain of Cϵ,d, from the initial state 1d, needs
n⩾γ2bdc[ln(d+1)+lnδ1],c=201.
Together with Theorem 12, for fixed 0<ϵ<103 and γ, δ as above,
n⋆(γ,δ)≍ϵγ2bdlog(d+1)+logδ1.
No hitting-time constant C(ϵ) enters the lower bound, and it holds for every bias ϵ<21: the threshold 103 limits only the matching upper bound.
Intuition. The memoryless chain with P{0}=b has d windows with a single 1, all of mass ≍bd. Raising the zero-probability at one of them by the factor 1+2.2γ gives d alternatives, each costing about γ−2 visits to detect; finding which one changed needs lnd times more information (Fano), not d times. The proof, which also covers Theorem 12, can be found in Appendix A.5.
4.6. Mixing is misleading; consequence for practice
The rarest possible window already occurs in a memoryless source, so rapid mixing does not remove the learning cost.
Proposition 14 (Extremal chain: mixing is misleading) Over Cϵ,d, πmin is minimised by the memoryless chain p(1∣w)≡21+ϵ, for which π(w)=(21+ϵ)∣w∣(21−ϵ)d−∣w∣ and πmin=π(0d)=bd, meeting the floor of Proposition 1 with equality. This chain has tmix=d exactly, the minimum possible over Cϵ,d. The minimax lower bound of Theorem 13 is proved on perturbations of this chain, so the worst-case order of the learning cost already occurs among near-memoryless sources, which mix fast: fast mixing alone does not imply cheap learning.
Consequence. For fixed 0<ϵ<103 and γ,δ, Theorems 12 and 13 give limd→∞d−1log2n⋆=1+log21−2ϵ1≈1+2.885ϵ: bias costs about 2.9ϵ bits per unit of memory, accuracy only 2log2γ1 once. For realistic trace lengths, full-kernel validation is therefore infeasible beyond d≈16−20 (see the audit in Appendix B.1).
4.7. Applications: cryptographic security and expanders
Cryptographic security: validating an entropy source. A hardware entropy source is certified by fitting a Markov chain of memory d to a captured trace and computing a min-entropy rate from the fitted kernel, as in NIST SP 800-90B (Turan et al., 2018) and in published evaluations (Hamburg et al., 2012). What is missing is the statistics of the fit: how long the trace must be for the rare windows, to which a min-entropy bound is most sensitive, to be seen often enough. The rarest window gets about n2−d observations; applied to published validations (OpenTRNG, a multi-ring-oscillator source, Intel's Ivy Bridge source), our bounds show that traces of 106 bits fall short by a factor 23 at d=8 (Appendix B.1). The bounds hold for sources in Cϵ,d.
Expanders. The hitting-time mechanism is not specific to shift chains. As a fast-mixing example, let G be a connected non-bipartite k-regular graph on m⩾4 vertices and P its simple random walk, π is uniform. Let λ∗∈(0,1) be the largest absolute value of an eigenvalue of P other than 1.
Corollary 15 (Expanders) With L=⌈lnm/ln(1/λ∗)⌉, for all vertices u,w,
π(w)Eu[τw]=m1Eu[τw]⩽1−λ∗1+m5L.
In particular, for a family of expanders, whose spectral gap 1−λ∗ is bounded below, Eu[τw]≲m uniformly in u,w.
Intuition. By Theorem 5, π(w)Eu[τw] is a difference of visit counts of two starts. After L≍logm/(1−λ∗) steps the walk is close to uniform from every start, so only the O(L/m) visits to w within a block and the returns to w (bounded through the gap) remain. For a bounded gap this gives Eu[τw]≲m, the order of the return time m=1/π(w) (Kac) and of the classical bound trel/π(w). The proof, an application of the block bound Corollary 23, is in Appendix B.3.
Conclusions
Learning an order-d binary source of bias at most ϵ<103 to relative accuracy γ with confidence 1−δ takes γ−2(21−ϵ)−d(logd+logδ1) samples, up to constants depending on ϵ; this is optimal in the minimax sense and involves no mixing time or spectral gap. As for practical consequences, our bounds suggest that trace lengths in published entropy-source validations may be underpowered; for theory, extending the matching upper bound beyond ϵ=103, where hitting times are no longer of order 1/π(w), is the main open question.
AI Disclosure
AI assistant (Claude, Anthropic) was used for minor editorial polishing, related-work search, and coding numerical simulations. The authors reviewed all AI output, and take full responsibility for the entire article content.
References
David Aldous and James Allen Fill. Reversible Markov chains and random walks on graphs, 2002. Unfinished monograph.
J. Bretagnolle and C. Huber. Estimation des densités: risque minimax. Zeitschrift für Wahrscheinlichkeitstheorie und Verwandte Gebiete, 47:119–137, 1979.
Siu On Chan, Qinghua Ding, and Sing Hei Li. Learning and testing irreducible Markov chains via the k-cover time. In Proceedings of the 32nd International Conference on Algorithmic Learning Theory (ALT), volume 132 of PMLR, 2021.
Thomas M. Cover and Joy A. Thomas. Elements of Information Theory. Wiley, 2 edition, 2006.
R. L. Dobrušín. Central limit theorem for nonstationary Markov chains. I, II. Theory of Probability & Its Applications, 1:65–80, 329–383, 1956.
David A. Freedman. On tail probabilities for martingales. The Annals of Probability, 3(1):100–118, 1975. doi: 10.1214/aop/1176996452.
Mike Hamburg, Paul Kocher, and Mark E. Marson. Analysis of Intel's Ivy Bridge digital random number generator. Technical report, Cryptography Research, Inc., 2012.
Yanjun Han, Jiantao Jiao, Chuan-Zheng Lee, Tsachy Weissman, Yihong Wu, and Tiancheng Yu. Entropy rate estimation for Markov chains with large state space. In Advances in Neural Information Processing Systems 31 (NeurIPS), 2018.
Yanjun Han, Soham Jana, and Yihong Wu. Optimal prediction of Markov chains with and without spectral gap. IEEE Transactions on Information Theory, 69(6):3920–3959, 2023.
Steven R. Howard, Aaditya Ramdas, Jon McAuliffe, and Jasjeet Sekhon. Time-uniform Chernoff bounds via nonnegative supermartingales. Probability Surveys, 17:257–317, 2020.
De Huang and Xiangyuan Li. Non-asymptotic estimates for Markov transition matrices via spectral gap methods. arXiv:2408.05963, 2024.
Mark Kac. On the notion of recurrence in discrete stochastic processes. Bulletin of the American Mathematical Society, 53(10):1002–1010, 1947.
Sudeep Kamath and Sergio Verdú. Estimation of entropy rate and Rényi entropy rate for Markov chains. In IEEE International Symposium on Information Theory (ISIT), 2016.
David Asher Levin, Y. Peres, Elizabeth L. Wilmer, James Propp, and David B. Wilson. Markov chains and mixing times. American Mathematical Society, Providence, Rhode Island, second edition edition, 2017. ISBN 978-1-4704-4232-3. OCLC: 1029470821.
Michel Talagrand. The missing factor in Hoeffding's inequalities. Annales de l'Institut Henri Poincaré, Probabilités et Statistiques, 31(4):689–702, 1995. URL https://www.numdam.org/item/AIHPB_1995__31_4_689_0/.
Meltem Sönmez Turan, Elaine Barker, John Kelsey, Kerry McKay, Mary Baish, and Mike Boyle. Recommendation for the entropy sources used for random bit generation. NIST Special Publication 800-90B, National Institute of Standards and Technology, 2018.
Frans M. J. Willems, Yuri M. Shtarkov, and Tjalling J. Tjalkens. The context-tree weighting method: Basic properties. IEEE Transactions on Information Theory, 41(3):653–664, 1995. doi: 10.1109/18.382012. URL https://doi.org/10.1109/18.382012.
Geoffrey Wolfer and Aryeh Kontorovich. Minimax learning of ergodic Markov chains. In Proceedings of the 30th International Conference on Algorithmic Learning Theory (ALT), volume 98 of PMLR, pages 904–930, 2019.
Geoffrey Wolfer and Aryeh Kontorovich. Statistical estimation of ergodic Markov chain kernel over discrete state space. Bernoulli, 27(1), 2021.
Appendix A. Proofs
In the proofs we abbreviate the column spread by Ωs(w):=oscPs(⋅,w)=maxxPs(x,w)−minxPs(x,w).
The proofs follow the order of the results, and no mixing quantity enters any of them. After the preliminary window-law and return-time facts, we prove the sharp overlap and contraction of biased chains (Theorems 3 and 4), then, in one subsection, the occupancy and hitting-time bounds from the column oscillation (Theorem 5 and Corollary 6), the uniform hitting times of sliding-window chains (Theorem 7, with the numerical constant of Theorem 18), and the threshold, proved with the majority chain (Theorem 8). Then come the repeated-visit and majorization bounds (Theorems 9 and 10), and the learning bounds (Theorems 12 and 13). The proofs of the additional results (Appendix B) are collected next to their statements.
A.1. Window laws and return times
Proof [Proof of Proposition 1] Each of the d factors in the product lies in [b,a]. Since π=πPd, we get π(w)=∑uπ(u)Pd(u,w), which lies in the same interval.
Proof [Proof of Proposition 2] The first claim is Kac's formula (Kac, 1947); the range follows from Proposition 1. The shortest mean return time is 1/maxwπ(w)=2H∞(π), where H∞(π)=−log2maxwπ(w).
A.2. Overlap of Bernoulli and Markovian coins
Proof [Proof of Theorem 3] Write ρ=a/b, so t=b/a=1/ρ, and β=2ab, so 4ab=β2. The cases ϵ=0 (cd=1) and ϵ=21 (cd=0=β) are trivial, so let 0<ϵ<21. For z∈{0,1}d with k ones put A(z)=akbd−k and B(z)=bkad−k, so cd=∑zmin{A(z),B(z)}.
(i) Parity. Let d be odd. Then A(z)/B(z)=ρ2k−d with 2k−d odd, so either A/B⩾ρ or A/B⩽1/ρ. Appending a bit multiplies A by a or b and B by b or a, hence
x∈{0,1}∑min{A(x),B(x)}=min{aA,bB}+min{bA,aB}.
If A/B⩾ρ both minima are the B-terms and the sum is (a+b)B=B=min{A,B}; if A/B⩽1/ρ both are the A-terms and the sum is A=min{A,B}. Summing over z gives cd+1=cd.
(ii) Exact formula. Let d=2m−1 and z∈{0,1}d with k ones. If k⩾m then A(z)>B(z) and the minimum is B(z)=bkad−k; the terms with k<m are their mirror images under k↦d−k. Hence c2m−1=2P{Bin(2m−1,b)⩾m}, which equals c2m by (i). The binomial tail is a Beta probability (the regularised incomplete beta function, DLMF, §8.17): P{Bin(2m−1,b)⩾m}=P{Beta(m,m)⩽b}. Let U=1−2Beta(m,m), symmetric on (−1,1) with density proportional to (1−u2)m−1. Then
with q(0)=0 and q(1)=2m/m+1. Since Nm=2mKm, this reads κmq(1)=Nm.
The constants. The ratio of consecutive terms is κm+1/κm=2m+22m+1m+1m+2<1, so κm decreases from κ1=1/2, in particular κm<1; its limit is 1/π by Stirling's formula, hence κm⩾1/π. Therefore q(1)>Nm.
Lower bound. (T−κmR)′=(1−r2)m−1[κmq(r)−Nm]⩽0, because κmq(r)⩽κmq(1)=Nm. So T−κmR decreases to its value 0 at r=1, hence is ⩾0.
Upper bound. (R−T)′=(1−r2)m−1[Nm−q(r)]. As q increases from 0 to q(1)>Nm, this derivative is positive and then negative, once. So R−T increases and then decreases, with values 0 at r=0 and r=1, hence is ⩾0.
Sharpness. For fixed m, T/R→1 as ϵ→0. As ϵ→21 we have T/R=1+mr2T/(1−r2)m and, by l'Hôpital's rule, T/(1−r2)m→lim2mr(1−r2)m−1Nm(1−r2)m−1=2mNm=Km, so T/R→κm. Thus 1 is the best upper constant for every m, and κm↓1/π is the best lower one.
Proof [Proof of Theorem 4] Let An=Bern(a)⊗n, Bn=Bern(b)⊗n and, for s,t⩾0,
Fn(s,t):=z∈{0,1}n∑min{sAn(z),tBn(z)}.
Fn is concave (a sum of minima of linear functions) and positively homogeneous, Fn(λs,λt)=λFn(s,t). Splitting according to the first bit,
Fn+1(s,t)=Fn(sa,tb)+Fn(sb,ta).(6)
Moreover Fn+1⩽Fn, because min{u1,v1}+min{u2,v2}⩽min{u1+u2,v1+v2} and a+b=1: forgetting the last bit can only increase the overlap. Call a law μ on {0,1}n admissible if all its next-bit conditional probabilities lie in [b,a].
Claim. For admissible μ,ν on {0,1}n and all s,t⩾0,
z∑min{sμ(z),tν(z)}⩾Fn(s,t).(7)
For n=0 both sides equal min{s,t}. For the step n→n+1, let p,q∈[b,a] be the first-bit probabilities of μ,ν; given the first bit, the remaining bits are admissible laws of length n. Conditioning on the first bit and applying the induction hypothesis to the two branches, which carry the masses sp,tq and s(1−p),t(1−q), gives
Now Φ is concave on the rectangle [b,a]2, so its minimum is attained at a corner. At (a,b) and (b,a), Equation (6) gives Φ=Fn+1(s,t). At (a,a) and (b,b), homogeneity gives Φ=(a+b)Fn(s,t)=Fn(s,t)⩾Fn+1(s,t). Hence Φ⩾Fn+1(s,t) on the whole rectangle, which proves Equation (7) for n+1.
Contraction. For windows x,y, the laws μ=Pd(x,⋅) and ν=Pd(y,⋅) of the next d bits are admissible: the j-th conditional probability is p(1∣xj⋯xdv1⋯vj−1)∈[b,a]. Applying Equation (7) with s=t=1 gives 1−dTV(μ,ν)⩾Fd(1,1)=1−dTV(Ad,Bd)=cd(ϵ) (a string with k ones has Ad(z)=akbd−k and Bd(z)=bkad−k). Maximising over x,y gives the bound on δ(Pd).
Equality. For the chain p(1∣w)=a if w1=1 and b if w1=0, the window at step j⩽d is xj⋯xdv1⋯vj−1, whose oldest bit is xj. From x=1d all conditionals equal a, so the next d bits have law Ad; from y=0d they have law Bd. Hence δ(Pd)⩾dTV(Ad,Bd).
A.3. Occupancy, hitting times and the threshold
A.3.1. OSCILLATION AND OCCUPANCY
Lemma 16 (Oscillation contraction) For a transition matrix Q and any bounded function g, osc(Qg)⩽δ(Q)osc(g). In particular, for every state w and s,L⩾0,
Ωs+L(w)⩽δ(PL)Ωs(w).(8)
Intuition. Two walks starting at x and y after L steps forget a fraction 1−δ(PL) of where they begin, so the averages of g seen from x and from y differ by at most the remaining fraction δ(PL).
Proof [Proof of Lemma 16] Let μ=Q(x,⋅) and ν=Q(y,⋅). Since ∑z(μ(z)−ν(z))=0, we may subtract ming from g:
and we maximize over x,y. For Equation (8) use Ps+L(⋅,w)=PLg with g=Ps(⋅,w).
Proof [Proof of Theorem 5] Convergence of the columns. Fix w and let Ms=maxxPs(x,w), ms=minxPs(x,w). Since Ps+1(⋅,w)=PPs(⋅,w) is an average of Ps(⋅,w), ms increases and
Ms decreases, and Ms−ms=Ωs(w)→0. So Ps(x,w) converges to a limit that does not depend on x, and it equals π(w)=∑yπ(y)Ps(y,w).
Centering. By stationarity nπ(w)=∑yπ(y)Gn(y,w) is an average of the values of Gn(⋅,w) and lies between their minimum and maximum, which gives Equation (3).
Hitting times. Put Δn(u):=Gn(w,w)−Gn(u,w), which is at most oscGn(⋅,w). By the strong Markov property at τw, Gn(u,w)=Eu[1{τw<n}Gn−τw(w,w)], so
with both terms nonnegative. Since Ps(w,w)→π(w)>0, Gn(w,w)→∞. If Pu{τw=∞}>0, the second term tends to ∞, so Δn(u)→∞=π(w)Eu[τw] and the inequality is trivial. Otherwise τw<∞ a.s., the integrand of the first term tends to τwπ(w) pointwise, and Fatou's lemma gives π(w)Eu[τw]⩽liminfnΔn(u)⩽liminfnoscGn(⋅,w). For the equality we may assume Eu[τw]<∞, since otherwise Δn(u)→∞ by Fatou. Then, as Ps(w,w)⩽1, the integrand of the first term is at most τw, and dominated convergence gives the limit π(w)Eu[τw]; the second term is at most nPu{τw⩾n}⩽Eu[τw;τw⩾n]→0. Hence Δn(u)→π(w)Eu[τw] in [0,∞].
Proof [Proof of Corollary 6] Stationary law. PL is a strict contraction of the total-variation distance on probability measures on a countable set, a complete metric space, so it has a unique fixed point π; since Pπ is also fixed by PL, we get Pπ=π.
Contraction. This is Equation (8); in particular Ωs(w)→0, so Theorem 5 applies. Every s⩾L is uniquely s=L+j+kL with 0⩽j<L and k⩾0, and iterating gives ΩL+j+kL(w)⩽δ(PL)kΩL+j(w), hence
The spreads are nonincreasing (proof of Theorem 5), so the numerator is at most LΩL(w). (The contraction acts on the column Ps(⋅,w) as a function, so no pair of states, in particular not y=w, is singled out.)
Head and tail. For n⩽L, oscGn⩽HL(w) by definition. For n>L write Gn=GL+∑L⩽s<nPs(⋅,w); subadditivity of osc gives the first inequality, and applying it termwise to the tail gives osc(∑L⩽s<nPs(⋅,w))⩽∑s⩾LΩs(w), bounded above. Termwise on the head gives HL(w)⩽∑s<LΩs(w).
A.3.2. HITTING WITHOUT MIXING: UNIFORM UPPER BOUNDS
Return bound for shift chains. Here the chain state is the window s∈Σd, the conditionals are p(v∣s) with sups,vp(v∣s)⩽a, and we take the block length of L=d.
Lemma 17 (Return bound) For all y,w and 1⩽t<d we have Pt(y,w)⩽at, and for t⩾d we have Pt(y,w)⩽ad.
Proof For 1⩽t⩽d the windows y and w are connected by at most one path of length t: the t new symbols must spell the last t symbols of w, and the first d−t symbols of w must agree with the last d−t symbols of y. Since each conditional next-symbol probability is at most a, this path has weight at most at.
For t>d we condition on the state z at time t−d and apply the case t=d to the remaining d steps: Pt(y,w)=∑zPt−d(y,z)Pd(z,w)⩽ad.
Biased binary sources. Proof [Proof of Theorem 7] We apply Corollary 6 with L=d and bound its head and its tail in five steps; no mixing quantity enters.
Step 1 (one block is one path). After d steps the window is exactly the string of the d new bits, so Pd(z,w) is a product of d conditionals and bd⩽Pd(z,w)⩽ad for all z. For 1⩽t<d also Pt(w,w)⩽at (Lemma 17).
Step 2 (two starts overlap). By Theorem 4, δ(Pd)⩽1−cd(ϵ)<1, so Corollary 6 applies.
Step 3 (head: visits while standing on w). By the strong Markov property, for m⩽d and every x, Gm(x,w)=Ex[1{τw<m}Gm−τw(w,w)]⩽Gd(w,w), so Gm(⋅,w) takes values in [0,Gd(w,w)] and
Hd(w)⩽Gd(w,w)=t<d∑Pt(w,w)⩽t<d∑at=1−a1−ad.
Step 4 (tail: spreads after one block). For s⩾d, Ps(x,w)=∑zPs−d(x,z)Pd(z,w) is an average of values in [bd,ad], so Ωs(w)⩽ad−bd. With 1−δ(Pd)⩾cd(ϵ),
Step 5 (assemble). Corollary 6 gives supnoscGn(⋅,w)⩽Hd(w)+∑s⩾dΩs(w)⩽Bd(ϵ), and with it ∣Gn(u,w)−nπ(w)∣⩽Bd(ϵ) and π(w)Eu[τw]⩽Bd(ϵ). The uniform bound in d is Theorem 18.
Theorem 18 (Uniform hitting-time constant) For 0⩽ϵ<103 and all d⩾1,
Bd(ϵ)⩽C(ϵ)⩽52(103−ϵ)−3/2.
Numerically the constant can be lowered to 31, which is essentially optimal for this method. For specific ϵ, C(ϵ) is bounded by the entries of Table 1.
Proof [Proof of Theorem 18] Write Δ=103−ϵ. Recall that Bd(ϵ) is a head plus a tail (Corollary 6 with L=d): the head 1−a1−ad=∑k<dak⩽b1 bounds the visits to w=1d made during the first d steps while standing on w (each step stays with probability a), and the tail d(ad−bd)/cd(ϵ) collects all later steps through the contraction 1−cd. In the tail insert cd(ϵ)⩾β2m/(π1+4mϵ2) from Theorem 3, and use 2m⩽d+1, 1+4mϵ2⩽1+2ϵ2+2ϵd and a/β=e−λ. The mean value theorem gives ad−bd⩽2ϵdad−1, a single power with a factor ϵ. Maximizing over d with supx>0xre−λx=(r/(eλ))r,
C(ϵ)⩽b1+aβ2πϵ[1+2ϵ2(eλ2)2+2ϵ(2eλ5)5/2].
The function λ is concave with λ(0)=ln2, λ(101)=0.490 and λ(103)=0.
Easier proof (constant 52). For ϵ⩽101 we have λ⩾0.69−2.03ϵ, and the display above times Δ3/2 is an algebraic function of ϵ. For ϵ⩾101 use instead ad−bd⩽ad, which gives the same bound with b1+βπ[eλ1+2ϵ2+2ϵ(2eλ3)3/2] on the right, and λ⩾2.45Δ; with Δ=t2 this times Δ3/2 is an algebraic function of t. Wolfram's Resolve proves that both functions are at most 52 on their ranges (the maxima are 0.386 and 0.374; script certify-hit-constant.wl).
The values of Table 1 are certified likewise (exact evaluation of Bd(ϵi) for d⩽D0 plus a tail bound).
A.3.3. THE THRESHOLD: THE MAJORITY CHAIN
Why a threshold. The question is whether the chain reaches the region of the target before the target's own recurrence scale makes the delay significant. Take the majority chain of Theorem 8, which has a zeros region and a ones region, and the target w=1d.
• The target has stationary mass π(w)≍ad, so its mean return time is 1/π(w)≍a−d.
• Escaping the zeros wheel takes about β−d steps (up to a polynomial factor).
• The ratio of these two scales is
recurrencetimeescapetime≈(βa)d.
Below 103 we have a<β: the recurrence time of the target outgrows the escape barrier, and the starting point changes the hitting time by at most a constant factor on the scale 1/π(w); this is Theorem 7, Eu[τw]⩽C(ϵ)/π(w) for every chain in the class. Above 103 we have a>β: in the majority chain of Theorem 8, leaving the wrong region takes far longer than 1/π(w), and the normalised hitting time grows exponentially.
Proof [Proof of Theorem 8] Finiteness for ϵ<103 is Theorem 7. For the converse let d be odd, Md be the majority chain defined in Theorem 8, R1={w:∣w∣⩾2d+1} denote the windows with a majority of ones, and R0={0,1}d∖R1; put qd=P{Bin(d,b)⩾2d+1}.
Step 1: π(1d)⩾51ad. Appending a one and dropping the last bit never decreases the number of ones, so a window in R1 stays in R1 as long as the chain draws ones. Hence, from any window in R1, sampling d consecutive ones holds with probability exactly ad. Particularly, under π,
π(1d)=Pπ{Wd=1d}⩾adPπ{W0∈R1}=adπ(R1).
Further, the chain is invariant under flipping (negating) the bits: P(¬u,¬v)=P(u,v) for all windows u,v. Thus, π(R1)=π(R0)=21.
Step 2: E0d[τ1d]⩾1/(4qd). Let τ∗ be the first time the window enters R1; since 1d∈R1, τ1d⩾τ∗. Until τ∗ the window has a majority of zeros, and every new bit is 1 with probability b, sampled independently. The event τ∗⩽T requires one of the first T windows to have at least 2d+1 ones, and the union bound gives P{τ∗⩽T}⩽Tqd. Take T=⌊1/(2qd)⌋: then τ∗>T with probability at least 21, and E[τ∗]=∑t⩾0P{τ∗>t}⩾2T+1⩾4qd1.
Step 3: qd⩽πd21−b/ab/aβd. Write tk=(kd)bkad−k. For k⩾k0:=2d+1 we have tk+1/tk=k+1d−k⋅ab⩽ab, so qd⩽tk0/(1−b/a). Finally (k0d)⩽2d2/(πd) and bk0ad−k0=(ab)d/2b/a=(β/2)db/a.
Combining the three steps, and using (a−b)/(4ab)=ϵ/β,
For ϵ⩾103 we have a⩾β (as a2−β2=5(ϵ−103)(ϵ+21)⩾0 there), so the right side is unbounded in d.
A.4. Repeated visits and majorization
Proof [Proof of Theorem 9] Put h(y)=Ey[τw], so h(y)⩽tw; note tw⩾1, as h(y)⩾1 for y=w. By Proposition 2, Ew[τw+]=1/π(w).
Moment generating function. Take λ=ln(1+s) with s=6tw1, so that (1+s)τ=eλτ, and put c=1−1/6s=5tw1. We claim that for every y
Ey(1+s)τw⩽1+ch(y).
It suffices to show this with τw replaced by min{τw,T}, by induction on T, and then let T→∞ by monotone convergence. For T=0 and at y=w the left side is 1. For y=w, using h(y)=1+∑y′P(y,y′)h(y′) and the induction hypothesis at the next state,
Ey(1+s)min{τw,T+1}⩽(1+s)(1+c(h(y)−1))⩽1+ch(y),
where the last step is equivalent to s(h(y)−1)⩽61, and this holds as sh(y)⩽stw=61. Consequently Ey(1+s)τw⩽1+ctw=56.
Return time. After its first step, the return to w is a hitting time, and ∑yP(w,y)h(y)=Ewτw+−1=π(w)1−1, which is at most tw. So the claim gives
the middle step being the one above with h(y) replaced by π(w)1, valid since s(π(w)1−1)⩽stw=61. A return costs the mean 1/π(w), not tw: only the first visit pays for the hitting bound, which is why the costs are additive.
Tail. The k-th visit time is the first hitting time plus k−1 return times, and these are independent (strong Markov property). So the moment generating function of the visit time is Eeλτw(k)⩽
56e(k−1)c/π(w). By concavity, λ=ln(1+s)⩾twln(7/6)>tw0.154, since s⩽61. Chernoff's method (Markov's inequality for eλτ) gives, for every x⩾0,
P{τw(k)>x}⩽56exp(−λx+π(w)(k−1)c).
Put λ0=6.5tw1<λ. Then λ0c=1.3, so the exponent is at most −λ0(x−1.3π(w)k−1), which is the displayed bound. For the second form take x=1.3π(w)k−1+6.5twlnη2, which gives 56⋅2η<η. ■
Why a profile. Learning every window is like a coupon-collector problem with unequal coupons: heavy windows quickly appear, so the light ones dominate the cost. A union bound that treats all 2d windows as lightest costs a factor d. The profile is a histogram of the window masses: it counts how many windows lie below each mass level. In the worst case, the memoryless source, the masses are bdρk with ρ=a/b and exactly (kd) windows at level k: few windows are light, about d near the floor bd and about d2 one level up, and every further level multiplies the mass by ρ. So the failure probabilities are dominated by about d terms, which costs lnd rather than d. Theorem 10 makes this precise.
Lemma 19 (Mass profile for exponential sums) Let P∈Cϵ,d, ϵ>0, t>0, s=tbd and ρ=a/b. Then, with φ(y)=e−ty in Theorem 10,
the last step whenever s⩾2ϵb(1+lnd). Alternatively, with κ(ρ)=maxk⩾1kρ−k⩽elnρ1,
w∑e−tπ(w)⩽e⋅e−uwhenevers⩾κ(ρ)lnd+u,u⩾0,
and the coefficient κ(ρ) of lnd is sharp for the product sum.
Proof [Proof of Theorem 10 and Lemma 19] Extend the stationary window process to a stationary bit process (Xi). For a prefix z∈{0,1}j−1 with j⩽d, the conditional probability that the next bit is v is E[p(v∣W)∣X1⋯Xj−1=z] for the window W preceding it, an average of numbers in [b,a], so it lies in [b,a]; the same holds at the root. So the windows are the leaves of a binary tree of depth d, root mass 1, in which every node splits its mass as (p,1−p) with p∈[b,a]. Put Φj(x)=∑k=0j(kj)φ(xakbj−k), which is convex in x. We show by induction on j that every such tree of depth j and root mass x has ∑leavesφ(mass)⩽Φj(x). For j=0 this is an equality. For j⩾1 the root splits x into xp and x(1−p), and the two subtrees have depth j−1, so the leaf sum is at most
Φj−1(xp)+Φj−1(x(1−p)).
This is convex in p, so its maximum over [b,a] is attained at an endpoint; both endpoints give Φj−1(xa)+Φj−1(xb)=Φj(x) by Pascal's rule. Taking x=1, j=d proves the first claim; for φ(y)=e−ty, with ρ=a/b and s=tbd (so that takbd−k=sρk), it reads ∑we−tπ(w)⩽
∑k(kd)e−sρk. Now Bernoulli's inequality ρk⩾1+k(ρ−1), ρ−1=2ϵ/b, and the binomial theorem give
The term k=j alone, with j maximising kρ−k, shows that s⩾κlnd−O(1) is necessary. Finally kρ−k=ye−y/lnρ with y=klnρ and ye−y⩽e−1, so κ(ρ)⩽1/(elnρ).
A.5. Learning upper and lower bounds
Lemma 20 (Maximal Chernoff bound for i.i.d. coins) Let Z1,Z2,… be i.i.d. Bern(q),0<q<1, and 0<γ⩽1 and cγ=2+32γ⩽38. Then for every k⩾1
P{∃j⩾k:j1i⩽j∑Zi−q⩾γq}⩽2e−kqγ2/cγ.
Proof Time-uniform bounds of this type are standard (Howard et al., 2020); we give the short proof. Upper tail. Let r=q(1+γ); if r>1 the event is empty. Put Sj=∑i⩽jZi and τ=inf{j⩾k:Sj⩾jr}. For a length-j sequence z with Sj⩾jr, the likelihood ratio of the r-coin to the q-coin is
Pq{z}Pr{z}=(qr)Sj(1−q1−r)j−Sj⩾ejkl(r,q),
since the logarithm is increasing in Sj (as r>q) and equals jkl(r,q) at Sj=jr. The event {τ=j} depends on Z1,…,Zj only and implies Sj⩾jr, so Pq{τ=j}⩽e−jkl(r,q)Pr{τ=j}. Summing over these disjoint events,
Pq{τ<∞}⩽e−kkl(r,q)j⩾k∑Pr{τ=j}⩽e−kkl(r,q).
Lower tail: the same with r=q(1−γ), τ=inf{j⩾k:Sj⩽jr}. Finally, as lnx⩾1−1/x, kl(r,q)⩾qh(r/q) with h(x)=xlnx−x+1, and h(1+γ)⩾γ2/cγ (Bernstein's form) and h(1−γ)⩾γ2/2⩾γ2/cγ for 0⩽γ⩽1.
Proof [Proof of Theorem 12] Write K=8(mγ+Bd). Fix a window w and let q⩽21 be the probability of its rarer outcome, so q⩾b. The bits ξj after the visits are i.i.d. draws from p(⋅∣w) (strong Markov property), and η∈(0,1) is the failure probability we aim for.
Step 1: enough visits give accuracy. Let k=⌈316mγlnη4⌉. By Lemma 20, the rarer outcome has relative error at most γ at all visit counts j⩾k at once, except with probability 2e−kqγ2/cγ. Since qγ2/cγ⩾83bγ2=8mγ3a⩾16mγ3, this is at most 2η. Because the bound is uniform in j⩾k, nothing is assumed about how the number of visits depends on the bits. The other outcome has no larger relative error, as the two estimates sum to 1 and 1−q⩾q.
Step 2: the visits come early. Apply Theorem 9 with η/2 and tw⩽Bd/π(w) (Theorem 7). Since k−1<316mγlnη4, with probability at least 1−2η we observe k visits by the time
τw(k)<π(w)Alnη4,A=7mγ+6.5Bd.
So Nw(n)⩾k as soon as (n−1)π(w)⩾Alnη4.
Step 3: the bound as a function of n. Steps 1 and 2 give P{error at w}⩽η whenever x:=nπ(w)⩾1+Alnη4 (as π(w)⩽1). Choose η=4e−(x−1)/A and cap the probability at 1:
P{error at w}⩽min{1,4e−(x−1)/A}⩽4e−x/(A+1/ln4).
Indeed, put A′=A+1/ln4; for x⩽A′ln4 the right side is at least 1, and for x⩾A′ln4 we have (x−1)/A⩾x/A′. Finally A′⩽7mγ+7.3Bd⩽K, because Bd⩾1. For numerical sufficient lengths one may keep the unrounded K⋆=(5acγmγ+Bd)/ln67+ln41, which takes k=⌈(cγmγ/a)lnη4⌉ in Step 1. As a side note, Bernstein's inequality for martingales (Freedman, 1975) estimates the transition more accurately than the Chernoff form used here and improves the constant in front of mγ by a factor of at least 58.
Summation. The sum ∑w4e−nπ(w)/K is at most 4⋅1.445e−s with s=nbd/K by Lemma 19, provided s⩾2ϵb(1+lnd); it is at most δ once also s⩾ln(6/δ). (Unrounded: s−de−2se/b⩾lnδ4.) Since Bd⩽C(ϵ) for ϵ<103 and mγ≍γ−2, this is the stated bound.
Lemma 21 (Divergence–visit identity) Let P0,P1∈Cϵ,d agree except in the row of a single window w0, where p0(1∣w0)=q and p1(1∣w0)=q′. Then, for any common initial state,
Proof [Proof of Lemma 21] By the chain rule for relative entropy, the divergence of the two n-step path laws is the sum over the steps t=0,…,n−1 of the expected one-step divergence at the current state. The kernels differ only in the row of w0, so only steps leaving w0 contribute, each by KL(Bern(q)∥Bern(q′)). Here Nw0(n) counts the visits at times 0,…,n−1.
Proof [Proof of Theorem 13] Alternatives. Let P0 be the memoryless chain with p(0∣⋅)≡b, started at 1d. For j=2,…,d let wj=0j−110d−j, of mass q=abd−1=(a/b)bd under P0, and let Pj differ from P0 only in the row of wj, where p(0∣wj)=b′=b(1+2.2γ). Since γ⩽ϵ/4 we have b′⩽b(1+0.55ϵ)⩽21⩽a, so Pj∈Cϵ,d. (We skip w1=10d−1: it could be visited before time d, whereas every wj with j⩾2 begins with 0, so it cannot occur until the initial 1d has been shifted out.)
Decoding. Suppose Equation (2) holds with probability ⩾1−δ on every Pj. On Pj it gives p^(0∣wj)⩾b′(1−γ)>b(1+γ) (as (1+2.2γ)(1−γ)>1+γ for γ<111, and γ⩽121), and
p^(0∣wi)⩽b(1+γ) for i=j. So the unique j^ with p^(0∣wj)>b(1+γ) equals j with probability ⩾1−δ⩾43.
Fano. Let d⩾16. For J uniform on {2,…,d} and the trajectory X, Fano's inequality (Cover and Thomas, 2006) with d−1 alternatives and error probability pe⩽41 gives I(J;X)⩾(1−pe)ln(d−1)−h(pe), where h(p)=−plnp−(1−p)ln(1−p); this decreases in pe⩽21, so
I(J;X)⩾43ln(d−1)−h(41)⩾21ln(d+1)(d⩾16);
On the other hand I(J;X)⩽d−11∑jKL(Pj(n)∥P0(n)), and by Lemma 21
as b′⩽21, so that t(1−t)⩾b(1−b) on [b,b′]. Visit count. A proper border of wj (a suffix equal to a prefix) consists of zeros only, so it has length at most (d−1)/2; hence two visits to wj are more than d/2 steps apart. A path of d steps that ends at wj therefore leaves wj at most once: two earlier visits followed by the endpoint would need two return gaps of total length more than d. So the likelihood ratio of Pj to P0 along it is at most b′/b=1+2.2γ. The path ending in wj from a given state is unique and has probability q under P0. Therefore Pj(Wt=wj)⩽(1+2.2γ)q for t⩾d, while no visit occurs before time d:
EPj[Nwj(n)]⩽(1+2.2γ)(n−d)+q⩽1.19nq,
as 1+2.2γ⩽1+122.2⩽1.19.
Conclusion. Combining, 21ln(d+1)⩽a2.42γ2b⋅1.19nq. Since q=(a/b)bd, this reads 21ln(d+1)⩽2.42⋅1.19γ2nbd, and 2⋅2.42⋅1.19<5.76<6, so
n⩾6γ2bd1ln(d+1)(d⩾16).
Confidence term (two points). Let P0 be as above and P1 differ from it only in the row of 0d, with p(0∣0d)=b(1+2.2γ); P1∈Cϵ,d as above. The accuracy events for p(0∣0d) are disjoint, as b(1+γ)<b(1+2.2γ)(1−γ) for γ<111. From the start 1d, the window 0d is visited at time t only if t⩾d, and then with probability bd under P0, so EP0N0d(n)=(n−d)+bd⩽nbd. Put r=b(1+2.2γ). Since γ⩽ϵ/4, we have b⩽r⩽21, and hence
By Lemma 21, KL(P0(n)∥P1(n))⩽(n−d)+bd⋅2.42γ2b/a. The estimator induces a test with both errors at most δ, so data processing gives KL(P0(n)∥P1(n))⩾Lδ:=(1−2δ)lnδ1−δ. The sharp uniform comparison is
Indeed, the ratio is (1−2δ)(1+ln(1−δ)/ln(1/δ)), a product of positive decreasing functions on (0,1/4], so its minimum is at δ=1/4. The coefficient 25ln3/(121ln4) is approximately 0.16374. For d⩾16 we have n⩾Aγ−2b−dln(d+1) and n⩾Bγ−2b−dlnδ1 with A=61, B=121ln425ln3. Since max{Ax,By}⩾A+BAB(x+y), this gives the theorem with A+BAB=0.0826…⩾201. For d<16 we have ln(d+1)⩽ln16=2ln4⩽2lnδ1, so the confidence bound alone gives n⩾3Bγ−2b−d[ln(d+1)+lnδ1], and B/3=0.0546…⩾201. Nothing in the argument depends on ϵ beyond γ⩽min{ϵ/4,121}.
Table 2: Trace lengths for relative accuracy γ=1% at confidence 0.99, for sources with bias at most ϵ=0.05 (worst case: the memoryless chain). Necessary: no estimator can succeed with fewer bits (Theorem 29 at the rarest window, C(0.05)⩽2.31). Sufficient: the guarantee of the standard estimator, Theorem 12 with the constant K⋆ of its proof and the sum over windows evaluated on the memoryless chain, the worst case (Theorem 10).
Source
d
trace used
necessary
sufficient
verdict
Intel Ivy Bridge entropy source
12
not disclosed
5.6×108
6.4×109
—
Ring-oscillator TRNG (OpenTRNG)
8
106
2.3×107
2.5×108
underpowered
Multi-ring oscillator jitter
8
106
2.3×107
2.5×108
underpowered
Appendix B. Additional results
This appendix collects results that are minor or auxiliary, and the tools behind Theorem 5.
B.1. A quantitative audit of published traces
Every step of the entropy-certification pipeline has been studied except the first. Given a known kernel, computing the entropy rate is routine; given a fitted kernel, the downstream conditioner and DRBG have provable-security analyses. What is missing is the statistics of the fit, and in particular whether the rare windows, which a min-entropy bound is most sensitive to, have been observed often enough to be resolved at all.
Published trace lengths, audited. Table 2 applies our bounds to published validations: the sample size they need was not computable before, and now it is.
For the d=8 rows the statement is concrete. At ϵ=0.05 the rarest window of the memoryless chain carries stationary mass (21−ϵ)8=1.7×10−3, so 106 bits give it about 1700 observations. At confidence 0.99 the standard estimator then guarantees relative accuracy no better than about 17%, while Theorem 29 shows that no estimator can certify better than about 4.5% (the value of γ at which the necessary length equals 106). A 1% target needs at least 2.3×107 bits, 23 times the trace, and the standard guarantee needs 2.5×108. The verdict is therefore underpowered, not merely unjustified: the necessary length alone exceeds the trace, so no analysis of these 106 bits can support the claim. The gap between 2.3×107 and 2.5×108 is the price of the constants in Theorem 12 and of the union over windows; it does not affect the verdict. The conclusion does not depend on a strongly biased source: the rarest window of any chain has mass at most 2−d, and Corollary 30 gives, for ϵ=0.06, a necessary length of 7.9×106 bits for γ=1% and d=8 for every source in the class, including the ideal unbiased one. The modelling choice is not wrong, but a trace of this size has to be planned for; a validation that does not disclose its length cannot be checked against it.
The necessary length can be sharpened slightly. On the memoryless chain, the comparison chain that is i.i.d. except after 0d (a “trapdoor” chain) has explicitly computable visit counts, so the count in Lemma 21 is exact: this removes C(ϵ) and the restriction ϵ<103, but improves the length by only 0.2% at these parameters, and we do not use it.
Min-entropy to 0.01. A relative accuracy γ on every transition moves the min-entropy rate by up to log21−γ1 bits per bit. At γ=1% this is 0.0145, so the fit-then-compute route resolves the
Table 3: Necessary trace length (Proposition 22) for resolving the min-entropy rate to η=0.01 bit per bit at confidence 0.99, ϵ=0.05 (necessary, independent of ϵ above 0.007); and the best resolution η that any procedure could certify from the trace used (best η).
Source
d
trace used
necessary
best η
verdict
Ring-oscillator TRNG (OpenTRNG)
8
106
1.2×107
0.034
underpowered
Multi-ring oscillator jitter
8
106
1.2×107
0.034
underpowered
Intel Ivy Bridge entropy source
12
undisclosed
1.9×108
—
—
rate to η=0.01 only if γ⩽0.69%. The lower bound can be applied to the min-entropy itself. Proposition 22 exhibits a source in the class whose min-entropy rate is set by a single row, at a window of mass about 2−d; no procedure, whatever its route, can resolve that rate to η=0.01 at confidence 0.99 with fewer bits than in Table 3.
The quantity a security claim needs is the min-entropy rate of the source,
H(P)=−ℓ→∞limℓ1log2x∈{0,1}ℓmaxPP{X1⋯Xℓ=x}.
The lower bound applies to it directly. Let Px be the chain that is a fair coin at every window except 0d, where p(0∣0d)=x∈[21,21+ϵ]. Its min-entropy rate is set by one row, H(Px)=−log2x: every step has weight 21, x or 1−x, so every path of length L has probability at most xL−d, while the path 0L has probability π(0d)xL−d.
Proposition 22 (Min-entropy to resolution η) Let δ∈(0,21) and η>0 with v:=22η and v/2<a (that is, ϵ>22η−1−21≈ηln2), and put Lδ=(1−2δ)lnδ1−δ. Every procedure that, with probability at least 1−δ, outputs an estimate within η of the min-entropy rate on every chain of Cϵ,d (in particular on the fair source P1/2 and on Pv/2) needs, from the initial state 1d,
n≥d+−ln[v(2−v)]2d+1Lδ,
and from any initial state at least d+2d+1(−ln[v(2−v)]Lδ−1). Moreover −ln[v(2−v)]∼4ln22η2 as η→0, so n⋆≳2dη−2.
Intuition. A single row decides the min-entropy: the fair source has rate 1, and a source that is fair except that 0d repeats zero with probability 22η−1 has rate 1−2η, so a ±η guarantee must tell the two apart. They differ only in the one window 0d, which a fair source visits once in 2d bits, and each visit is one coin flip with bias ≈2ηln2. Bias does not help: the hardness holds for every ϵ>22η−1−21, and starts from the ideal source.
Proposition 22 concerns procedures that are correct on every chain of the class, as a certification is; it does not say that every source is this hard.
Proof [Proof of Proposition 22] Let P0=P1/2 (i.i.d. fair bits) and P1=Pv/2; both lie in Cϵ,d since 21⩽2v<a. Their rates are 1 and −log22v=1−2η, which differ by 2η, so the events Ei={∣H^−H(Pi)∣⩽η} meet in at most one point. Since v/2<a, the value v/2+θ is still allowed for small θ>0; with it in place of v/2 the events are disjoint (correctness is required on every chain of Cϵ,d), and we let θ↓0, all bounds being continuous. Then P0(E0)⩾1−δ and P1(E0)⩽P1(E1c)⩽δ, so the data-processing inequality gives
KL(P0(n)∥P1(n))⩾kl(1−δ,δ)=Lδ.
By Lemma 21 the left side equals EP0[N0d(n)] KL(Bern( 21)) ∥Bern(2v)), and KL(Bern( 21)) ∥Bern(2v)) = −21ln[v(2−v)]. Under P0 the bits are i.i.d. fair, and from 1d the window 0d cannot occur before time d, so EP0[N0d(n)]=(n−d)+2−d. From an arbitrary start it is at most (n−d)+2−d+∑t<d2−t<(n−d)+2−d+2. Solving gives the claim; the expansion follows from −ln[v(2−v)]=−ln(1−(v−1)2)∼(v−1)2∼(2ηln2)2.
B.2. General oscillation framework
For any real function let osc(f):=supf−inff. We will need two measures of shrinkage of transition laws.
For a chain P the Dobrushin ergodicity coefficient is
δ(P)≜x,ymaxdTV(P(x,⋅),P(y,⋅)),
It controls the discrepancy between one-step measures with different starts: δ(P)=0 means all rows coincide (the chain forgets its start at once), while δ(P)=1 means that two starting points can have disjoint supports. Equivalently, it measures the overlap of transfer laws with different starts
c(P)≜x,yminz∑min(P(x,z),P(y,z)).
It is also the contraction factor for oscillation: osc(Pg)⩽δ(P)osc(g) for every function g. The column spread (column discrepancy) is
Ωs(w)≜oscPs(⋅,w)=xmaxPs(x,w)−xminPs(x,w).
It measures how much the probability of being at w at time s still depends on the start; note Ωs(w)⩽δ(Ps). This is Dobrushin's oscillation applied to a single column. In the classical Markov–Doeblin proof of convergence one tracks Ms(w)=maxxPs(x,w) and ms(w)=minxPs(x,w) and shows that Ms(w)−ms(w)=Ωs(w) shrinks geometrically, squeezing both towards π(w).
The Green function is defined as
Gn(x,y)≜t=0∑n−1Pt(x,y),
and counts the expected occupancies: visits to y during times 0,…,n−1 when starting from x. In equilibrium it equals nπ(y); the point of the next results is that the start x changes it only by an additive constant.
Throughout, P is a transition matrix on a countable set with δ(PL)<1 for some L⩾1 (for a finite irreducible aperiodic chain this holds for all large L, since PL is then entrywise positive),
π is its stationary law, and τw=inf{t⩾0:Wt=w} is the hitting time of a state w. Kac's formula (Proposition 2) gives the mean return time to w as 1/π(w). We ask when the mean hitting time from an arbitrary start is of the same order, that is, when π(w)Eu[τw]≲1. Two different overlaps of distributions μ,ν appear, and we keep them apart: the overlap ∑zmin{μ(z),ν(z)}=1−dTV(μ,ν), which governs how fast two starts merge, and the Hellinger affinity ∑zμ(z)ν(z), which we use to verify it for finite-memory sources.
Explicit bound from block overlap. The head-tail bound of Corollary 6 is explicit in terms of two local quantities.
Corollary 23 (Explicit bound from block overlap) Fix a block length L⩾1 and suppose that the block overlap
Intuition. In the first block a walker started anywhere collects no more visits to w than one started at w, which is at most SL(w). After it the chance of standing on w is at most rL(w) whatever the start, so every later spread is at most rL(w), and the geometric series has L/cL terms. The tools (oscillation contraction, Green function) and the discussion of SL and rL are in Appendix B.2.
The proofs of this paragraph are in Appendix A. The block overlap is the Dobrushin coefficient:
Relation to Dobrushin's coefficient. The block overlap is Dobrushin's ergodicity coefficient in disguise: cL=1−δ(PL). It is implied by a Doeblin minorization PL(x,⋅)⩾cν (then cL⩾c), but is weaker. What differs is the use. Classically δ(PL) is a contraction factor, so cL small means slow mixing: relaxation time of order L/cL, here exponentially large in d (of order β−2d). Here it enters multiplied by rL(w), which is tiny for the rare window w; the product LrL(w)/cL stays bounded when a<β2 although the chain is far from mixed on that scale.
The two local quantities. SL(w)=GL−1(w,w) is the Green function of the chain started at w and stopped after L steps (Levin–Peres–Wilmer, (9.16)): the expected number of visits to w during the first block, counting the start. Intuition: it is the cost of sitting on the target. A chain that starts at w may keep returning to w before it can be said to have left, and these early returns are the only visits that cannot be attributed to the random start of a block. It is at least 1, and it cannot be taken over an infinite horizon, since Gn(w,w)∼nπ(w) diverges (the fundamental matrix subtracts π(w) per step to repair this); the block length L is the cut-off. The quantity rL(w)=supxPL(x,w)=∥PL(⋅,w)∥∞ is the largest probability of standing on w after one block, over all starts. Intuition:
it is the worst-case landing probability, that is, how concentrated a block law can be at w. It is at least π(w), because π(w)=∑xπ(x)PL(x,w), and it is the quantity that cL is paired with: after the first block, every further block contributes at most rL(w) per step, and the geometric series over blocks has L/cL terms in total. For order-d sources the unique-path structure gives rd(w)⩽ad and Sd(w)⩽1/(1−a) (Lemma 17).
The theorem makes no assumption on the structure of P. For a chain with uniform stationary law on m states, rL(w)≈1/m and the bound is SL(w)+L/(cLm).
Theorem 24 (Finite-memory sources from the block overlap) Let P be an irreducible aperiodic sliding-window chain of order d over a finite alphabet Σ: the state is the window s∈Σd of the last d symbols, and the next symbol v is drawn from p(⋅∣s). Suppose that sups,vp(v∣s)⩽a<1, put b:=infs,vp(v∣s)⩾0, and suppose that the block overlap cd:=minx,y∑zmin{Pd(x,z),Pd(y,z)} is positive. Then for all windows u,w and all n⩾0,
Intuition. We only have to bound the column spreads Ωs(w)=oscPs(⋅,w) of Theorem 5, and for a shift chain they are small for a simple reason: a window can equal w at time s only if the last min(s,d) symbols typed equal a given string, and every symbol is at most a likely. So Ωs(w)⩽as for 1⩽s<d, whatever the start (and there is nothing to gain from the lower end of the oscillation, since some start cannot reach w at all). From time d on, every value Ps(x,w) is an average of products of d conditionals, hence lies in [bd,ad], so Ωs(w)⩽ad−bd. The only global input is the contraction factor 1−cd per block of d steps, which multiplies the d spreads of the second block. The overlap cd can be certified in different ways; the Hellinger affinity of the conditionals is one (Lemma 25, used for Corollary 26), and for the biased binary class an exact comparison with two reference coins (Theorem 4, used for Theorem 7) gives the sharp rate.
Proof [Proof of Theorem 24] Apply Corollary 6 with L=d, for which δ(Pd)=1−cd<1, and write Ωs(w)=Ms(w)−ms(w) with Ms(w)=maxxPs(x,w) and ms(w)=minxPs(x,w). Before time d, Ω0(w)⩽1, and for 1⩽s<d, Lemma 17 gives Ωs(w)⩽Ms(w)⩽as. (Here ms(w)=0, so this is sharp.) From time d on. By the unique-path structure Pd(z,w) is a product of d conditionals, so bd⩽Pd(z,w)⩽ad for every z. For s⩾d, Ps(x,w)=∑zPs−d(x,z)Pd(z,w) is an average of these values, so ms(w)⩾bd and Ms(w)⩽ad, that is Ωs(w)⩽ad−bd. Hence
Theorem 5 gives ∣Gn(u,w)−nπ(w)∣⩽oscGn(⋅,w)⩽Bd and π(w)Eu[τw]⩽liminfnoscGn(⋅,w)⩽Bd.
Lemma 25 (Block overlap) Let β be the infimum over pairs of windows of the Hellinger affinity ∑vp(v∣s)p(v∣s′). For all x,y, with μ=Pd(x,⋅) and ν=Pd(y,⋅),
v∑min{μ(v),ν(v)}⩾1−1−β2d⩾21β2d.
Proof The endpoint is the string v∈Σd of new symbols, and μ(v)=∏j=1dp(vj∣xj⋯xdv1⋯vj−1), similarly for ν with y. Sum μν over vd first: given v1,…,vd−1 the two factors are conditionals given two windows, so the sum is at least β times the corresponding expression for d−1 symbols. Iterating, the Hellinger affinity of the block laws satisfies BC(μ,ν)=∑vμ(v)ν(v)⩾βd. Le Cam's inequality dTV⩽1−BC2 gives the first bound, since the overlap is 1−dTV, and 1−1−s⩾s/2 the second.
Intuition. Two walkers meet if they type the same d new symbols. Each symbol is a conditional coin, and two such coins agree with probability at least the affinity β in the Hellinger sense, so the d symbols agree jointly with probability about β2d, the square of the Hellinger affinity βd of the block laws (Le Cam's inequality is where this square is lost).
Explicit local bounds. Proof [Proof of Corollary 23] Since cL>0, Corollary 6 applies; it remains to estimate head and tail. Head. By the strong Markov property, for m⩽LGm(x,w)=Ex[1{τw<m}Gm−τw(w,w)]⩽Gm(w,w)⩽SL(w), because Gm is nondecreasing in m. So Gm(⋅,w) takes values in [0,SL(w)] and HL(w)⩽SL(w). Tail. For j⩾0 and every x,0⩽PL+j(x,w)=∑zPj(x,z)PL(z,w)⩽rL(w), so ΩL+j(w)⩽rL(w), and ∑j<LΩL+j(w)/(1−δ(PL))⩽LrL(w)/cL. Thus oscGn(⋅,w)⩽SL(w)+LrL(w)/cL for every n, and Theorem 5 gives the first claim. For the second, ∑t=0nPt(u,w)=Gn+1(u,w)⩽(n+1)π(w)+SL(w)+LrL(w)/cL.
Corollary 26 (Finite-memory sources with bounded predictability and conditional affinity)
Let P be an irreducible aperiodic sliding-window chain of order d over a finite alphabet Σ: the state is the window s∈Σd of the last d symbols, and the next symbol v is drawn from p(⋅∣s). Suppose that
Intuition. Only the last d symbols form the state, so landing on w means typing one specific string, and every symbol is at most a likely: this controls Sd(w) and rd(w). Two starts have overlapping block laws if they can type the same d new symbols. Each symbol is a conditional coin, and two such coins have Hellinger affinity at least β, so the d symbols coincide with probability of order β2d (the square of the product of affinities, because we pass from affinity to overlap). The price is the product of the two numbers, ad visits per step times β−2d blocks to overlap, and it stays bounded in d when a<β2, i.e. when overlap is faster than the return scale a−d. Mixing can be exponentially slow here, so no argument through mixing can give such a bound.
We call a<β2 a sufficient criterion: it makes the bound Bd uniform in d, and says nothing about the true hitting behaviour of a source that violates it. The criterion is not tied to a binary alphabet or to our class. For example, an i.i.d. source with P{1}=0.8 has β=1, so the bound is uniform although the source is far from unbiased; only sources whose conditionals are both extreme and far apart are excluded. Neither number alone suffices: a deterministic chain has β=1 but a=1.
For the biased binary class the block overlap is not only bounded below: it is determined exactly. Recall that δ(Pd) is the largest total-variation distance between the laws of the next d bits of two starts, and that 1−δ(Pd)=cd is the block overlap.
Affinity criterion. Proof [Proof of Corollary 26] Apply Theorem 24 with b=0 and cd⩾1−1−β2d (Lemma 25); this is the bound Bd(a,β). If a<β2, then 1−1−β2d⩾21β2d gives Bd(a,β)⩽1−a1+2dθd with θ=a/β2<1, and supx>0xθx=1/(eln(1/θ)) gives the constant. If a⩾β2, the second term of Bd is at least d(a/β2)d⩾d, because 1−1−s⩽s; so the bound is no longer uniform in d.
Remark 27 (Other overlap estimates) The threshold 103 cannot be improved (Theorem 8), and the exponent βd of cd is the Chernoff exponent. Weaker overlap estimates give smaller ranges: the Hellinger–Le Cam bound of Lemma 25 has rate β2 and gives a<β2, i.e. ϵ<41 (this is the criterion of Corollary 26, valid for general alphabets); the Bretagnolle–Huber bound (Bretagnolle and Huber, 1979) cd⩾21e−dKL has rate e−2ϵlnρ and gives only ϵ≲0.204; the total-variation constant (1−2ϵ)d gives only ϵ<61.
B.3. Proof for expander graphs
The statement is Corollary 15 in Section 4.7; it is an application of the general block bound Corollary 23.
Expander graphs. Proof [Proof of Corollary 15] Let Π=m111⊤. The matrix P is symmetric, and on 1⊥ its eigenvalues have absolute value at most λ∗, so ∥(Pt−Π)v∥2⩽λ∗t∥v∥2. Hence, for vertices x,y and t⩾0, by Cauchy–Schwarz,
whose only root in [0,21) is 103: it is negative before, zero there and positive after.
Remark 28 (Size near the threshold) Let Δ=103−ϵ>0 and λ=ln(β/a). Then 2.3Δ⩽λ⩽3.13Δ, because λ is smooth with λ(103)=0 and λ′(103)=−1−4ϵ22∣ϵ=3/10≈−3.13 (checked numerically on [0,103)). For ϵ⩾103 one has ln(a/β)⩾3(ϵ−103), which gives the second line of the box in the introduction.
The true worst case. Apply Theorem 8 with oddd≈1/(2λ): Hit(ϵ)⩾4β2πϵsupdoddde−λd≳λ−1/2≳Δ−1/2, while away from the threshold Hit(ϵ)⩾b1⩾2 (iid chain). The upper bound is Hit(ϵ)⩽C(ϵ)≲Δ−3/2 (below). The upper power 23 is 1 for the d block steps plus 21 for the overlap (Theorem 3); the lower power 21 is the d of the majority chain of Theorem 8.
The explicit constant. For C(ϵ)=supdBd(ϵ) the power 23 is attained:
C(ϵ)≍1+λ−3/2≍Δ−3/2(0⩽ϵ<103),
with absolute constants. We give two proofs of the upper bound; the lower bound is the same in both.
Proof 1: elementary, no integrals. For even d=2m, keep only the central term of the overlap, cd⩾(m2m)(ab)m⩾β2m/(2m), because (m2m)⩾4m/(2m) and 4ab=β2. For odd d use cd=cd+1 (Theorem 3(i)). Since β−2m⩽β−d−1 and m⩽d, in both cases
Bd⩽b1+cddad⩽b1+β2d3/2e−λd.
With supx>0x3/2e−λx=(3/2eλ)3/2 this gives C(ϵ)⩽b1+β2(2eλ3)3/2≲1+λ−3/2, as β⩾0.8.
Proof 2. Theorem 3(iii) keeps 1+4mϵ2 instead of m and gives the closed form of Theorem 7, with the smallest constants (about 15 instead of 21 at ϵ=41).
The lower bound. For even d the largest binomial atom is at most 1/πm and ∑jt∣j∣⩽2ϵ1, so cd⩽βd/(ϵ2πd) (this is the elementary half of Theorem 3), hence
Bd⩾ϵ2π(1−(b/a)d)d3/2e−λd.
Let 41⩽ϵ<103, so that ϵ⩾41 and b/a⩽31, and take the even integer d=2⌈1/(2λ)⌉. Then d⩾1/λ and λd<1+2λ<2, so C(ϵ)⩾6ϵ22πλ−3/2. For ϵ<41 the quantity λ−3/2 is bounded, while C(ϵ)⩾supd(1−ad)/b=1/b⩾2.
This concerns the explicit bound; whether the true worst hitting time grows like Δ−3/2 is open. Numerically C(ϵ)/λ−3/2→K∗≈0.385.
Harder proof (constant 31, sketch). Keep d as a real variable x and do not maximize over it: the claim is an explicit inequality in (x,ϵ), which interval bisection in Wolfram Language shows to hold for ϵ⩽0.14, x⩽80. The tail x⩾80 is negligible there since λ⩾ln23, and for ϵ⩾0.14 the second bound above with λ⩾2.53Δ is decided by Resolve. Since C(0)=2 forces K⩾2⋅0.33/2=0.3286, the constant 31 is essentially optimal for this method.
B.5. Instance-wise lower bound
The lower bounds rest on the divergence identity of Lemma 21. Per observation, KL(p(1+γ)∥p)∼21γ2p2I(p) as γ→0, where I(p)=1/(p(1−p)) is the Fisher information; this is the source of the factor γ−2. For small δ the leading term of Theorem 29 is within a factor of about two of the 2mγln(2/δ) observations of a window that the estimator needs (Chernoff).
Theorem 29 (Sample complexity, lower bound) Let ϵ<103, δ∈(0,21) and γ<21. Let P∈Cϵ,d, let w0 be any window, and let q=min{p(0∣w0),p(1∣w0)}. Assume q′=q1−γ1+γ<21+ϵ (strictly), and put
Then every procedure that satisfies Equation (2) with probability at least 1−δ on every chain of Cϵ,d (in particular on P and on the chain P′ obtained by changing the row of w0 so that the less likely outcome has probability q′) needs
n⩾1−γ1−2γ⋅π(w0)Λ−C(ϵ).
Moreover
Λ⩾qγ2(1−γ)2(1−q′)ln4δ(1−δ)1,
so Λ∼qγ21−qln4δ(1−δ)1 as γ→0, which for the rarest window of the memoryless chain (q=21−ϵ) is ∼mγln4δ(1−δ)1.
Intuition. A trajectory shows about nπ(w) coin flips at window w, and telling two coins with relative gap γ apart takes about mγ flips. Theorem 7 is what guarantees that no start can show many more than nπ(w) flips, so the visit count in Lemma 21 is controlled without any mixing assumption. Proof [Proof of Theorem 29] Three chains. Let P0=P, let P1=P′, and let Q be P with the less likely outcome x0 of w0 given probability qm instead of q. All three lie in Cϵ,d, differ only in the row of w0, and Q is the midpoint. Let Ei be the event that the output satisfies ∣p^(x0∣w0)/qi−1∣⩽γ, with q0=q and q1=q′. Since q′(1−γ)=q(1+γ), the events E0 and E1 meet at most in the single value q(1+γ). Since q′<21+ϵ, the value q′+θ is still allowed in Cϵ,d for small θ>0, and with q′+θ in place of q′ the two events are disjoint; we run the argument for q′+θ and let θ↓0, all bounds being continuous in q′. By assumption (correctness on every chain of Cϵ,d) Pi(Ei)⩾1−δ.
Change of measure. By disjointness Q(E0)+Q(E1)⩽1, so Q(Ei)⩽21 for some i. The data-processing inequality for the indicator of Ei, together with monotonicity of the binary divergence, gives
By Lemma 21 applied to Q and Pi, the left side equals EQ[Nw0(n)]KL(Bern(qm)∥Bern(qi))⩽EQ[Nw0(n)]κ. Hence
EQ[Nw0(n)]⩾Λ.
Visit count. By the occupation bound in Theorem 7, applied to Q∈Cϵ,d from any starting state, EQ[Nw0(n)]⩽nπQ(w0)+C(ϵ).
Stationary mass of the midpoint chain. Let hx be the mean time to hit w0 from the successor of w0 that appends outcome x. These times do not depend on the row of w0, because the walk stops at w0. By Kac, for a chain that gives outcome x0 probability r, 1/π(w0)=1+rhx0+(1−r)hy0, where y0 is the other outcome. Therefore
since (1−q)hy0⩽Ew0τw0+=1/πP(w0). As qm−q=qγ/(1−γ) and q⩽21, we get (qm−q)/(1−q)⩽γ/(1−γ) and so πQ(w0)⩽πP(w0)1−2γ1−γ.
Conclusion. Combining, Λ⩽nπP(w0)1−2γ1−γ+C(ϵ), which is the claimed bound.
The bound on Λ. By Taylor's formula with Lagrange remainder, KL(Bern(x)∥Bern(y))⩽(x−y)2/(2mintt(1−t)) with t between x and y. Here qm−q=q′−qm=qγ/(1−γ) and, by concavity, t(1−t)⩾q(1−q′) on [q,q′]. Thus κ⩽qγ2/(2(1−γ)2(1−q′)), which gives the stated lower bound on Λ.
Corollary 30 (Source-independent necessary length) Let ϵ<103 and γ<ϵ/(1+ϵ). Then for every chain in Cϵ,d, every procedure as in Theorem 29 needs
n⩾1−γ1−2γ2d(γ2(1−γ)(1−3γ)ln4δ(1−δ)1−C(ϵ)).
Proof [Proof of Corollary 30] Apply Theorem 29 at the rarest window w0, for which π(w0)⩽2−d. For q⩽21 the condition q′<21+ϵ holds as soon as 211−γ1+γ<21+ϵ, i.e. γ<ϵ/(1+ϵ). Finally (1−q′)/q=1/q−(1+γ)/(1−γ) is decreasing in q, so for q⩽21 it is at least (1−3γ)/(1−γ), and the lower bound on Λ becomes γ2(1−γ)(1−3γ)ln4δ(1−δ)1.