InformationTheory

InformationTheory.Shannon.Stein.Achievability

source

Stein's lemma: achievability #

Stein's lemma for binary hypothesis testing (Cover–Thomas): the optimal type-II error of an n-sample test with type-I error at most ε decays exponentially in n at the rate of the Kullback–Leibler divergence klDiv P Q. This file develops the achievability (lower bound) side: the log-likelihood-ratio plumbing, the Stein-typical set, and the tensorization of the KL divergence.

Main definitions #

  • llrPmf P Q — the alphabet-side log-likelihood ratio log P{x} − log Q{x}.
  • logLikelihoodRatio P Q Xs i — the per-sample log-likelihood ratio along a process Xs.
  • steinTypicalSet P Q n ε — blocks whose empirical log-likelihood ratio is within ε of klDiv P Q.

Main statements #

  • stein_strong_law — the empirical mean of the log-likelihood ratio converges almost surely to (klDiv P Q).toReal.
  • stein_inProbability — the same convergence holds in probability.
  • stein_achievability — there exist ε-level tests whose type-II error decays at rate klDiv P Q.

Implementation notes #

  • The log-likelihood-ratio plumbing is obtained as the two-distribution specialization of the AEP development, which lets most measurability, identical-distribution, and independence lemmas be reused rather than reproved.
  • Over a finite alphabet α with 0 < Q.real {x} for every x, all quantities are expanded point-wise, avoiding the general Radon–Nikodym derivative machinery for product measures.

References #

  • T. M. Cover and J. A. Thomas, Elements of Information Theory (2nd ed.), Wiley, 2006.

Log-likelihood ratio plumbing #

noncomputable def

InformationTheory.Shannon.llrPmf

source
{α : Type u_2} [MeasurableSpace α] (P Q : MeasureTheory.Measure α) :
α

The alphabet-side log-likelihood ratio log P{x} − log Q{x}. On the support of P and assuming Q{x} > 0 for all x, this equals Real.log ((P.rnDeriv Q x).toReal).

Equations
Instances For
    Used by
      theorem

      InformationTheory.Shannon.measurable_llrPmf

      source
      Used by
        noncomputable def

        InformationTheory.Shannon.logLikelihoodRatio

        source
        {Ω : Type u_1} {α : Type u_2} [MeasurableSpace α] (P Q : MeasureTheory.Measure α) (Xs : Ωα) (i : ) :
        Ω

        Per-symbol log-likelihood ratio: llrPmf P Q (Xs i ω).

        Equations
        Instances For
          Used by
            theorem

            InformationTheory.Shannon.logLikelihoodRatio_eq_comp

            source
            {Ω : Type u_1} {α : Type u_2} [MeasurableSpace α] (P Q : MeasureTheory.Measure α) (Xs : Ωα) (i : ) :
            logLikelihoodRatio P Q Xs i = llrPmf P Q Xs i
            Used by
              theorem

              InformationTheory.Shannon.measurable_logLikelihoodRatio

              source
              {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (P Q : MeasureTheory.Measure α) (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (i : ) :
              Used by
                theorem

                InformationTheory.Shannon.integrable_logLikelihoodRatio

                source
                {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (P Q : MeasureTheory.Measure α) (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (i : ) :
                Used by
                  theorem

                  InformationTheory.Shannon.integral_logLikelihoodRatio_under_P

                  source
                  {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (P Q : MeasureTheory.Measure α) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (hMap : MeasureTheory.Measure.map (Xs 0) μ = P) (hPQ : P.AbsolutelyContinuous Q) (hQpos : ∀ (x : α), 0 < Q.real {x}) :
                  (ω : Ω), logLikelihoodRatio P Q Xs 0 ω μ = (klDiv P Q).toReal

                  The expected log-likelihood ratio under P equals (klDiv P Q).toReal.

                  Used by
                    theorem

                    InformationTheory.Shannon.identDistrib_logLikelihoodRatio

                    source
                    {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) (P Q : MeasureTheory.Measure α) (Xs : Ωα) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (i : ) :
                    Used by
                      theorem

                      InformationTheory.Shannon.indepFun_logLikelihoodRatio

                      source
                      {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) (P Q : MeasureTheory.Measure α) (Xs : Ωα) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Xs i) (Xs j) μ) :
                      Used by
                        theorem

                        InformationTheory.Shannon.stein_strong_law

                        source
                        {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (P Q : MeasureTheory.Measure α) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Xs i) (Xs j) μ) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (hMap : MeasureTheory.Measure.map (Xs 0) μ = P) (hPQ : P.AbsolutelyContinuous Q) (hQpos : ∀ (x : α), 0 < Q.real {x}) :
                        ∀ᵐ (ω : Ω) μ, Filter.Tendsto (fun (n : ) => (∑ iFinset.range n, logLikelihoodRatio P Q Xs i ω) / n) Filter.atTop (nhds (klDiv P Q).toReal)

                        The empirical mean of the per-sample log-likelihood ratio converges almost surely to (klDiv P Q).toReal.

                        Used by
                          theorem

                          InformationTheory.Shannon.stein_inProbability

                          source
                          {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (P Q : MeasureTheory.Measure α) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Xs i) (Xs j) μ) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (hMap : MeasureTheory.Measure.map (Xs 0) μ = P) (hPQ : P.AbsolutelyContinuous Q) (hQpos : ∀ (x : α), 0 < Q.real {x}) {ε : } ( : 0 < ε) :
                          Filter.Tendsto (fun (n : ) => μ {ω : Ω | ε |(∑ iFinset.range n, logLikelihoodRatio P Q Xs i ω) / n - (klDiv P Q).toReal|}) Filter.atTop (nhds 0)

                          The empirical mean of the log-likelihood ratio converges to (klDiv P Q).toReal in probability.

                          Used by

                            Stein-typical set and achievability #

                            noncomputable def

                            InformationTheory.Shannon.steinTypicalSet

                            source
                            {α : Type u_2} [MeasurableSpace α] (P Q : MeasureTheory.Measure α) (n : ) (ε : ) :
                            Set (Fin nα)

                            The Stein-typical set: blocks x : Fin n → α whose empirical log-likelihood ratio is within ε of (klDiv P Q).toReal.

                            Equations
                            Instances For
                              Used by
                                theorem

                                InformationTheory.Shannon.mem_steinTypicalSet_iff

                                source
                                {α : Type u_2} [MeasurableSpace α] (P Q : MeasureTheory.Measure α) (n : ) (ε : ) (x : Fin nα) :
                                x steinTypicalSet P Q n ε |(∑ i : Fin n, llrPmf P Q (x i)) / n - (klDiv P Q).toReal| < ε
                                Used by
                                  theorem

                                  InformationTheory.Shannon.measurableSet_steinTypicalSet

                                  source
                                  {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (P Q : MeasureTheory.Measure α) (n : ) (ε : ) :
                                  Used by
                                    theorem

                                    InformationTheory.Shannon.steinTypicalSet_P_prob_tendsto_one

                                    source
                                    {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [Nonempty α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (P Q : MeasureTheory.Measure α) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Xs i) (Xs j) μ) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (hMap : MeasureTheory.Measure.map (Xs 0) μ = P) (hPQ : P.AbsolutelyContinuous Q) (hQpos : ∀ (x : α), 0 < Q.real {x}) {ε : } ( : 0 < ε) :
                                    Filter.Tendsto (fun (n : ) => μ {ω : Ω | jointRV Xs n ω steinTypicalSet P Q n ε}) Filter.atTop (nhds 1)

                                    Under P, the probability that a block lands in the Stein-typical set tends to 1.

                                    Used by
                                      theorem

                                      InformationTheory.Shannon.steinTypicalSet_Q_prob_le

                                      source
                                      {α : Type u_2} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (P Q : MeasureTheory.Measure α) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (hPpos : ∀ (x : α), 0 < P.real {x}) (hQpos : ∀ (x : α), 0 < Q.real {x}) (n : ) (ε : ) :
                                      ((MeasureTheory.Measure.pi fun (x : Fin n) => Q) (steinTypicalSet P Q n ε)).toReal Real.exp (-(n * ((klDiv P Q).toReal - ε)))

                                      The Qⁿ-mass of the Stein-typical set is at most exp(-n · ((klDiv P Q).toReal − ε)).

                                      Used by
                                        theorem

                                        InformationTheory.Shannon.stein_achievability

                                        source
                                        {Ω : Type u_1} [MeasurableSpace Ω] {α : Type u_2} [Fintype α] [Nonempty α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (P Q : MeasureTheory.Measure α) [MeasureTheory.IsProbabilityMeasure P] [MeasureTheory.IsProbabilityMeasure Q] (Xs : Ωα) (hXs : ∀ (i : ), Measurable (Xs i)) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Xs i) (Xs j) μ) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (hMap : MeasureTheory.Measure.map (Xs 0) μ = P) (hMapJoint : ∀ (n : ), MeasureTheory.Measure.map (jointRV Xs n) μ = MeasureTheory.Measure.pi fun (x : Fin n) => P) (hPpos : ∀ (x : α), 0 < P.real {x}) (hPQ : P.AbsolutelyContinuous Q) (hQpos : ∀ (x : α), 0 < Q.real {x}) {ε δ : } ( : 0 < ε) (_hε1 : ε < 1) ( : 0 < δ) :
                                        ∀ᶠ (n : ) in Filter.atTop, ∃ (s : Set (Fin nα)), MeasurableSet s ((MeasureTheory.Measure.pi fun (x : Fin n) => P) s).toReal ε -(1 / n) * Real.log ((MeasureTheory.Measure.pi fun (x : Fin n) => Q) s).toReal (klDiv P Q).toReal - δ

                                        Stein's lemma (achievability): eventually there exist ε-level tests whose type-II error decays as exp(-n · ((klDiv P Q).toReal − δ)). The statement is in product-measure form; the translation from the random-variable form is supplied by the hypothesis hMapJoint : μ.map (jointRV Xs n) = Measure.pi (fun _ : Fin n => P).

                                        Used by

                                          Tensorization of the KL divergence #

                                          The KL divergence between i.i.d. product measures factorizes as n times the single-sample KL divergence: klDiv (Π_{Fin n} P) (Π_{Fin n} Q) = n · klDiv P Q.

                                          theorem

                                          InformationTheory.Shannon.klDiv_pi_zero

                                          source

                                          Base case of the KL tensorization: the product measures over Fin 0 → α agree, so their KL divergence is 0.

                                          Used by
                                            theorem

                                            InformationTheory.Shannon.klDiv_pi_succ

                                            source

                                            Step case of the KL tensorization: klDiv (Π_{n+1} P) (Π_{n+1} Q) = klDiv P Q + klDiv (Π_n P) (Π_n Q).

                                            Used by
                                              theorem

                                              InformationTheory.Shannon.klDiv_pi_eq_n_smul

                                              source

                                              KL tensorization: klDiv (Π_{Fin n} P) (Π_{Fin n} Q) = n · klDiv P Q.

                                              Used by