# Asymptotic equipartition property

In information theory, the asymptotic equipartition property (AEP) is a general property of the output samples of a stochastic source. It is fundamental to the concept of typical set used in theories of compression.

Roughly speaking, the theorem states that although there are many series of results that may be produced by a random process, the one actually produced is most probably from a loosely defined set of outcomes that all have approximately the same chance of being the one actually realized. (This is a consequence of the law of large numbers and ergodic theory.) Although there are individual outcomes which have a higher probability than any outcome in this set, the vast number of outcomes in the set almost guarantees that the outcome will come from the set. One way of intuitively understanding the property is through Cramér's large deviation theorem, which states that the probability of a large deviation from mean decays exponentially with the number of samples. Such results are studied in large deviations theory; intuitively, it is the large deviations that would violate equipartition, but these are unlikely.

In the field of pseudorandom number generation, a candidate generator of undetermined quality whose output sequence lies too far outside the typical set by some statistical criteria is rejected as insufficiently random. Thus, although the typical set is loosely defined, practical notions arise concerning sufficient typicality.

## Definition

Given a discrete-time stationary ergodic stochastic process X on the probability space (Ω, B, p), AEP is an assertion that

${\displaystyle -{\frac {1}{n}}\log p(X_{1},X_{2},\dots ,X_{n})\to H(X)\quad {\text{ as }}\quad n\to \infty }$

where H(X) or simply H denotes the entropy rate of X, which must exist for all discrete-time stationary processes including the ergodic ones. AEP is proved for finite-valued (i.e. |Ω| < ∞) stationary ergodic stochastic processes in the Shannon–McMillan–Breiman theorem using the ergodic theory and for any i.i.d. sources directly using the law of large numbers in both the discrete-valued case (where H is simply the entropy of a symbol) and the continuous-valued case (where H is the differential entropy instead). The definition of AEP can also be extended for certain classes of continuous-time stochastic processes for which a typical set exists for long enough observation time. The convergence is proven almost sure in all cases.

## AEP for discrete-time i.i.d. sources

Given X is an i.i.d. source, its time series X1, ..., Xn is i.i.d. with entropy H(X) in the discrete-valued case and differential entropy in the continuous-valued case. The weak law of large numbers gives the AEP with convergence in probability,

${\displaystyle \lim _{n\to \infty }\Pr \left[\left|-{\frac {1}{n}}\log p(X_{1},X_{2},\ldots ,X_{n})-H(X)\right|>\epsilon \right]=0\qquad \forall \epsilon >0.}$

since the entropy is equal to the expectation of

${\displaystyle -{\frac {1}{n}}\log p(X_{1},X_{2},\ldots ,X_{n}).}$

The strong law of large numbers asserts the stronger almost sure convergence,

${\displaystyle \Pr \left[\lim _{n\to \infty }-{\frac {1}{n}}\log p(X_{1},X_{2},\ldots ,X_{n})=H(X)\right]=1}$

which implies the result from the weak law of large numbers.

## AEP for discrete-time finite-valued stationary ergodic sources

Consider a finite-valued sample space Ω, i.e. |Ω| < ∞, for the discrete-time stationary ergodic process ${\displaystyle X:=\{X_{n}\}}$ defined on the probability space (Ω, B, p). The AEP for such stochastic source, known as the Shannon-McMillan-Breiman theorem, can be shown using the sandwich proof by Algoet and Cover outlined as follows:

• Let x denote some measurable set x = X(A) for some AB
• Parameterize the joint probability by n and x as
${\displaystyle j(n,x):=p\left(x_{0}^{n-1}\right).}$
• Parameterize the conditional probability by i, k and x as
${\displaystyle c(i,k,x):=p\left(x_{i}\mid x_{i-k}^{i-1}\right).}$
• Take the limit of the conditional probability as k → ∞ and denote it as
${\displaystyle c(i,x):=p\left(x_{i}\mid x_{-\infty }^{i-1}\right).}$
• Argue the two notions of entropy rate
${\displaystyle \lim _{n\to \infty }\mathrm {E} [-\log j(n,X)]\quad {\text{and}}\quad \lim _{n\to \infty }\mathrm {E} [-\log c(n,n,X)]}$
exist and are equal for any stationary process including the stationary ergodic process X. Denote it as H.
• Argue that both
{\displaystyle {\begin{aligned}c(i,k,X)&:=\left\{p\left(X_{i}\mid X_{i-k}^{i-1}\right)\right\}\\c(i,X)&:=\left\{p\left(X_{i}\mid X_{-\infty }^{i-1}\right)\right\}\end{aligned}}}
where i is the time index, are stationary ergodic processes, whose sample means converge almost surely to some values denoted by Hk and H respectively.
• Define the k-th order Markov approximation to the probability ${\displaystyle a(n,k,x)}$ as
${\displaystyle a(n,k,x):=p\left(X_{0}^{k-1}\right)\prod _{i=k}^{n-1}p\left(X_{i}\mid X_{i-k}^{i-1}\right)=j(k,x)\prod _{i=k}^{n-1}c(i,k,x)}$
• Argue that ${\displaystyle a(n,k,X(\Omega ))}$ is finite from the finite-value assumption.
• Express ${\displaystyle -{\frac {1}{n}}\log a(n,k,X)}$ in terms of the sample mean of ${\displaystyle c(i,k,X)}$ and show that it converges almost surely to Hk
• Define the probability measure
${\displaystyle a(n,x):=p\left(x_{0}^{n-1}\mid x_{-\infty }^{-1}\right).}$
• Express ${\displaystyle -{\frac {1}{n}}\log a(n,X)}$ in terms of the sample mean of ${\displaystyle c(i,X)}$ and show that it converges almost surely to H.
• Argue that ${\displaystyle H^{k}\searrow H}$ as k → ∞ using the stationarity of the process.
• Argue that H = H using the Lévy's martingale convergence theorem and the finite-value assumption.
• Show that
${\displaystyle \mathrm {E} \left[{\frac {a(n,k,X)}{j(n,X)}}\right]=a(n,k,X(\Omega ))}$
which is finite as argued before.
• Show that
${\displaystyle \mathrm {E} \left[{\frac {j(n,X)}{a(n,X)}}\right]=1}$
by conditioning on the infinite past ${\displaystyle X_{-\infty }^{-1}}$ and iterating the expectation.
• Show that
${\displaystyle \forall \alpha \in \mathbb {R} \ :\ \Pr \left[{\frac {a(n,k,X)}{j(n,X)}}\geq \alpha \right]\leq {\frac {a(n,k,X(\Omega ))}{\alpha }}}$
using the Markov's inequality and the expectation derived previously.
• Similarly, show that
${\displaystyle \forall \alpha \in \mathbb {R} \ :\ \Pr \left[{\frac {j(n,X)}{a(n,X)}}\geq \alpha \right]\leq {\frac {1}{\alpha }},}$
which is equivalent to
${\displaystyle \forall \alpha \in \mathbb {R} \ :\ \Pr \left[{\frac {1}{n}}\log {\frac {j(n,X)}{a(n,X)}}\geq {\frac {1}{n}}\log \alpha \right]\leq {\frac {1}{\alpha }}.}$
• Show that limsup of
${\displaystyle {\frac {1}{n}}\log {\frac {a(n,k,X)}{j(n,X)}}\quad {\text{and}}\quad {\frac {1}{n}}\log {\frac {j(n,X)}{a(n,X)}}}$
are non-positive almost surely by setting α = nβ for any β > 1 and applying the Borel–Cantelli lemma.
• Show that liminf and limsup of
${\displaystyle -{\frac {1}{n}}\log j(n,X)}$
are lower and upper bounded almost surely by H and Hk respectively by breaking up the logarithms in the previous result.
• Complete the proof by pointing out that the upper and lower bounds are shown previously to approach H as k → ∞.

## AEP for non-stationary discrete-time source producing independent symbols

The assumptions of stationarity/ergodicity/identical distribution of random variables is not essential for the AEP to hold. Indeed, as is quite clear intuitively, the AEP requires only some form of the law of large numbers to hold, which is fairly general. However, the expression needs to be suitably generalized, and the conditions need to be formulated precisely.

We assume that the source is producing independent symbols, with possibly different output statistics at each instant. We assume that the statistics of the process are known completely, that is, the marginal distribution of the process seen at each time instant is known. The joint distribution is just the product of marginals. Then, under the condition (which can be relaxed) that ${\displaystyle \mathrm {Var} [\log[[p(X_{i})]]] for all i, for some M > 0, the following holds (AEP):

${\displaystyle \lim _{n\to \infty }\Pr \left[\,\left|-{\frac {1}{n}}\log p(X_{1},X_{2},\ldots ,X_{n})-{\overline {H}}_{n}(X)\right|<\epsilon \right]=1\qquad \forall \epsilon >0}$

where

${\displaystyle {\overline {H}}_{n}(X)={\frac {1}{n}}H(X_{1},X_{2},\ldots ,X_{n})}$

### Proof

The proof follows from a simple application of Markov's inequality (applied to second moment of ${\displaystyle \log(p(X_{i}))}$.

{\displaystyle {\begin{aligned}\Pr \left[\left|-{\frac {1}{n}}\log p(X_{1},X_{2},\ldots ,X_{n})-{\overline {H}}(X)\right|>\epsilon \right]&\leq {\frac {1}{n^{2}\epsilon ^{2}}}\mathrm {Var} \left[\sum _{i=1}^{n}\left(\log(p(X_{i})\right)^{2}\right]\\&\leq {\frac {M}{n\epsilon ^{2}}}\to 0{\text{ as }}n\to \infty \end{aligned}}}

It is obvious that the proof holds if any moment ${\displaystyle \mathrm {E} \left[|\log[[p(Xi)]]|^{r}\right]}$ is uniformly bounded for r > 1 (again by Markov's inequality applied to r-th moment). ${\displaystyle \Box {}}$

Even this condition is not necessary, but given a non-stationary random process, it should not be difficult to test whether the AEP holds using the above method.

### Applications for AEP for non-stationary source producing independent symbols

The AEP for non-stationary discrete-time independent process leads us to (among other results) source coding theorem for non-stationary source (with independent output symbols) and channel coding theorem for non-stationary memoryless channels.

#### Source coding theorem

The source coding theorem for discrete time non-stationary independent sources can be found here: source coding theorem

#### Channel coding theorem

The channel coding theorem for discrete time non-stationary memoryless channels can be found here: noisy channel coding theorem

## AEP for certain continuous-time stationary ergodic sources

Discrete-time functions can be interpolated to continuous-time functions. If such interpolation f is measurable, we may define the continuous-time stationary process accordingly as ${\displaystyle {\tilde {X}}:=f\circ X}$. If AEP holds for the discrete-time process, as in the i.i.d. or finite-valued stationary ergodic cases shown above, it automatically holds for the continuous-time stationary process derived from it by some measurable interpolation. i.e.

${\displaystyle -{\frac {1}{n}}\log p({\tilde {X}}_{0}^{\tau })\to H(X)}$

where n corresponds to the degree of freedom in time τ. ${\displaystyle nH(X)/\tau }$ and H(X) are the entropy per unit time and per degree of freedom respectively, defined by Shannon.

An important class of such continuous-time stationary process is the bandlimited stationary ergodic process with the sample space being a subset of the continuous ${\displaystyle {\mathcal {L}}_{2}}$ functions. AEP holds if the process is white, in which case the time samples are i.i.d., or there exists T > 1/2W, where W is the nominal bandwidth, such that the T-spaced time samples take values in a finite set, in which case we have the discrete-time finite-valued stationary ergodic process.

Any time-invariant operations also preserves AEP, stationarity and ergodicity and we may easily turn a stationary process to non-stationary without losing AEP by nulling out a finite number of time samples in the process.

## Category theory

A category theoretic definition for the equipartition property is given by Gromov[1] Given a sequence of Cartesian powers ${\displaystyle P^{N}=P\times \cdots \times P}$ of a measure space P, this sequence admits an asymptotically equivalent sequence HN of homogeneous measure spaces (i.e. all sets have the same measure; all morphisms are invariant under the group of automorphisms, and thus factor as a morphism to the terminal object) .

The above requires a definition of asymptotic equivalence. This is given in terms of a distance function, giving how much an injective correspondence differs from an isomorphism. An injective correspondence ${\displaystyle \pi :P\to Q}$ is a partially defined map that is a bijection; that is, it is a bijection between a subset ${\displaystyle P'\subset P}$ and ${\displaystyle Q'\subset Q}$. Then define

${\displaystyle |P-Q|_{\pi }=|P\smallsetminus P'|+|Q\smallsetminus Q'|}$

where |S| denotes the measure of a set S. In what follows, the measure of P and Q are taken to be 1, so that the measure spaces are probability spaces. This distance ${\displaystyle |P-Q|_{\pi }}$ is commonly known as the earth mover's distance or Wasserstein metric.

Similarly, define

${\displaystyle |\log P:Q|_{\pi }={\frac {\sup _{p\in P^{'}}|\log p-\log \pi (p)|}{\log \min \left(|\operatorname {set} (P^{'})|,|\operatorname {set} (Q^{'})|\right)}}}$

with ${\displaystyle |\operatorname {set} (P)|}$ taken to be the counting measure on P. Thus, this definition requires that P be a finite measure space. Finally, let

${\displaystyle {\text{dist}}_{\pi }(P,Q)=|P-Q|_{\pi }+|\log P:Q|_{\pi }}$

A sequence of injective correspondences ${\displaystyle \pi _{N}:P_{N}\to Q_{N}}$ are then asymptotically equivalent when

${\displaystyle {\text{dist}}_{\pi _{N}}(P_{N},Q_{N})\to 0\quad {\text{ as }}\quad N\to \infty }$

Given a homogenous space sequence HN that is asymptotically equivalent to PN, the entropy H(P) of P may be taken as

${\displaystyle H(P)=\lim _{N\to \infty }{\frac {1}{N}}|set(H_{N})|}$