InformationTheory

InformationTheory.Shannon.EntropyRate

source

Entropy rate of a stationary process #

For a stationary process p : StationaryProcess μ α on a finite alphabet α, the block entropy is H_n := H(X_0, …, X_{n-1}) and the entropy rate is H := lim_{n → ∞} H_n / n (Cover–Thomas). Existence of the limit is the principal content of this file.

The Birkhoff ergodic theorem and the Shannon–McMillan–Breiman theorem build on entropyRate defined here.

Main definitions #

Main statements #

noncomputable def

InformationTheory.Shannon.blockEntropy

source
{Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] (μ : MeasureTheory.Measure Ω) (p : StationaryProcess μ α) (n : ) :

Block entropy H(X_0, …, X_{n-1}) of a stationary process.

Equations
Instances For
    Used by
      noncomputable def

      InformationTheory.Shannon.conditionalEntropyTail

      source

      The per-step conditional entropy H(X_n | X_0, …, X_{n-1}). Decreasing in n for a stationary process.

      Equations
      Instances For
        Used by
          noncomputable def

          InformationTheory.Shannon.entropyRate

          source
          {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] (μ : MeasureTheory.Measure Ω) (p : StationaryProcess μ α) :

          Entropy rate lim H(X_0, …, X_{n-1}) / n (Cover-Thomas). Existence proven by entropyRate_exists_of_stationary.

          Equations
          Instances For
            Used by
              noncomputable def

              InformationTheory.Shannon.entropyRate₂

              source
              {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] (μ : MeasureTheory.Measure Ω) (p : StationaryProcess μ α) :

              The base-2 (bit) entropy rate: the natural-log entropyRate divided by Real.log 2, i.e. the entropy rate measured in bits/symbol. This is the target the LZ78 bit-rate lz78GreedyEncodingLength/n converges to (the LZ78 encoding length uses LZ78Phrase.bitLength = Nat.log 2 …, a base-2 code length, so its per-symbol rate is in bits, whereas entropyRate is in nats).

              Equations
              Instances For
                Used by

                  Chain rule #

                  H_{n+1} = H_n + H(X_n | X_{<n}), the engine of the existence proof.

                  theorem

                  InformationTheory.Shannon.blockEntropy_succ_chain_rule

                  source

                  Chain rule for block entropy: H_{n+1} = H_n + H(X_n | X_{<n}).

                  Strategy: apply MeasurableEquiv.piFinSuccAbove α (Fin.last n) (forward direction) to blockRV (n+1) ω = fun i => obs i ω, getting (obs n ω, fun j : Fin n => obs ((Fin.last n).succAbove j) ω) = (obs n ω, blockRV n ω). Then use prodComm to swap to (blockRV n ω, obs n ω) and apply entropy_pair_eq_entropy_add_condEntropy for the chain rule.

                  Used by

                    Antitonicity of conditionalEntropyTail #

                    H(X_{n+1} | X_0, …, X_n) ≤ H(X_n | X_0, …, X_{n-1}). Proof:

                    1. By stationarity (apply shift T), the joint pushforward μ.map (X_n, (X_0, …, X_{n-1})) equals μ.map (X_{n+1}, (X_1, …, X_n)), so the corresponding conditional entropies coincide (via condDistrib_map).
                    2. By conditioning monotonicity (condEntropy_le_condEntropy_of_pair), H(X_{n+1} | (X_0, (X_1, …, X_n))) ≤ H(X_{n+1} | (X_1, …, X_n)). The conditioner (X_0, (X_1, …, X_n)) reshapes to blockRV (n+1) via MeasurableEquiv.piFinSuccAbove ... 0 + prodComm.
                    theorem

                    InformationTheory.Shannon.condEntropy_eq_pushforward

                    source
                    {Ω : Type u_1} [MeasurableSpace Ω] {β : Type u_3} {γ : Type u_4} [Fintype β] [Nonempty β] [MeasurableSpace β] [MeasurableSingletonClass β] [MeasurableSpace γ] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (Xs : Ωβ) (Yo : Ωγ) (hXs : Measurable Xs) (hYo : Measurable Yo) :

                    Conditional entropy H(Xs | Yo) depends only on the joint pushforward μ.map (fun ω => (Xs ω, Yo ω)).

                    Used by
                      theorem

                      InformationTheory.Shannon.conditionalEntropyTail_antitone

                      source
                      Used by
                        theorem

                        InformationTheory.Shannon.conditionalEntropyTail_nonneg

                        source

                        Conditional entropy on a finite alphabet is bounded above by log |α|, hence the tail is uniformly bounded. We only need 0 ≤ tail for the existence proof.

                        Used by

                          Existence of the entropy rate #

                          We show Tendsto (blockEntropy μ p n / n) atTop (𝓝 H) for some H, by the following route:

                          theorem

                          InformationTheory.Shannon.blockEntropy_zero

                          source

                          blockEntropy μ p 0 = 0 (the empty block is constant).

                          Used by
                            theorem

                            InformationTheory.Shannon.blockEntropy_eq_sum_conditionalEntropyTail

                            source

                            Block entropy expanded as a sum of conditional entropy tails (iterated chain rule).

                            Used by
                              theorem

                              InformationTheory.Shannon.entropyRate_exists_of_stationary

                              source
                              {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [Nonempty α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (p : StationaryProcess μ α) :
                              ∃ (H : ), Filter.Tendsto (fun (n : ) => blockEntropy μ p n / n) Filter.atTop (nhds H)

                              The entropy rate exists, i.e. blockEntropy μ p n / n converges.

                              Strategy: the chain rule + antitonicity say tail n is antitone and nonneg, hence converges to some L. By Cesàro, (1/n) ∑_{i<n} tail i → L. By the chain rule, this equals blockEntropy μ p n / n.

                              Used by

                                Equality with lim conditionalEntropyTail #

                                Tendsto (conditionalEntropyTail μ p) atTop (𝓝 (entropyRate μ p)).

                                Strategy: the chain rule + Cesàro gives blockEntropy / n → L = lim tail. The entropyRate is the limit of blockEntropy / n (Filter.limUnder of a convergent sequence equals the limit). The two limits agree by uniqueness.

                                theorem

                                InformationTheory.Shannon.entropyRate_eq_lim_condEntropy

                                source
                                Used by