InformationTheory

InformationTheory.Shannon.ChannelCoding.Basic

source

Channel coding theorem — primitive definitions #

Main definitions #

  • Channel α β := Kernel α β (DMC, one-symbol).
  • Code M n α β: encoder–decoder bundle for a block code of length n with M codewords.
  • Code.errorProbAt: point-wise error probability for message m.
  • Code.averageErrorProb: average error probability under a uniform message distribution.
  • mutualInfoOfChannel: mutual information I(X; Y) under input distribution p and channel W.
  • Jointly typical set definitions and associated probability bounds.

Implementation notes #

References #

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

Channel (DMC) #

abbrev

InformationTheory.Shannon.ChannelCoding.Channel

source
@[reducible, inline]
(α : Type u_3) (β : Type u_4) [MeasurableSpace α] [MeasurableSpace β] :
Type (max u_3 u_4)

A discrete memoryless channel (DMC) is just a (Markov) kernel α → Measure β. Markov-ness is requested as a separate type-class hypothesis on the user side, so the definition itself stays the bare Kernel.

Equations
Instances For
    Used by
      noncomputable def

      InformationTheory.Shannon.ChannelCoding.jointDistribution

      source
      {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] (p : MeasureTheory.Measure α) (W : Channel α β) :

      Channel joint distribution under input law p: p ⊗ₘ W is the joint distribution of (X, Y) when X ∼ p and Y | X ∼ W X. Lives in Measure (α × β).

      Equations
      Instances For
        Used by
          theorem

          InformationTheory.Shannon.ChannelCoding.jointDistribution_def

          source
          @[simp]
          {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] (p : MeasureTheory.Measure α) (W : Channel α β) :
          Used by
            instance

            InformationTheory.Shannon.ChannelCoding.jointDistribution.instIsProbabilityMeasure

            source

            For a Markov kernel W and probability input p, the joint p ⊗ₘ W is a probability measure.

            Used by
              noncomputable def

              InformationTheory.Shannon.ChannelCoding.outputDistribution

              source
              {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] (p : MeasureTheory.Measure α) (W : Channel α β) :

              The output distribution of the channel under input p: q := p ⊗ₘ W projected to β, i.e. the second marginal. Used for the channel-output marginal q(y) = ∑ₓ p(x) W(y|x).

              Equations
              Instances For
                Used by
                  instance

                  InformationTheory.Shannon.ChannelCoding.outputDistribution.instIsProbabilityMeasure

                  source
                  Used by
                    noncomputable def

                    InformationTheory.Shannon.ChannelCoding.mutualInfoOfChannel

                    source
                    {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] (p : MeasureTheory.Measure α) (W : Channel α β) :

                    The mutual information of (X, Y) ∼ p ⊗ₘ W. Defined as klDiv (p ⊗ₘ W) (p ⊗ q) where q := outputDistribution p W. Equivalent to the standard mutualInfo of any random variable pair drawn from p ⊗ₘ W.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Used by
                        theorem

                        InformationTheory.Shannon.ChannelCoding.mutualInfoOfChannel_def

                        source
                        @[simp]
                        Used by
                          theorem

                          InformationTheory.Shannon.ChannelCoding.mutualInfoOfChannel_eq_mutualInfo_prod

                          source

                          mutualInfoOfChannel equals MI of the joint coordinates. Unfolds the klDiv-defined mutualInfoOfChannel p W into the canonical mutualInfo (jointDistribution p W) Prod.fst Prod.snd. Used as the bridge from the channel-side formulation to the joint-distribution-side three-term identity.

                          Used by
                            theorem

                            InformationTheory.Shannon.ChannelCoding.mutualInfoOfChannel_eq_HX_add_HY_sub_HZ

                            source

                            Entropy ↔ mutual-information bridge for the channel. The channel mutual information equals the three-term form H(X) + H(Y) − H(X, Y) on the joint distribution p ⊗ₘ W, where H is the discrete Shannon entropy and H(X, Y) := entropy (p ⊗ₘ W) id is the joint entropy on α × β.

                            Composing this with entropy_eq_of_identDistrib lets the achievability consumer rewrite the joint-AEP exponent H(jointSeq Xs Ys 0) − H(Xs 0) − H(Ys 0) = −(mutualInfoOfChannel p W).toReal once the i.i.d. ambient μ := Measure.infinitePi (jointDistribution p W) is plumbed in (so that μ.map (Xs 0) = p, etc.).

                            Used by

                              Block code #

                              structure

                              InformationTheory.Shannon.ChannelCoding.Code

                              source
                              (M n : ) (α : Type u_3) (β : Type u_4) [MeasurableSpace α] [MeasurableSpace β] :
                              Type (max u_3 u_4)

                              A block code of length n with M messages over input alphabet α and output alphabet β: a deterministic encoder Fin M → (Fin n → α) and decoder (Fin n → β) → Fin M.

                              We bundle no measurability fields: on finite (or MeasurableSingletonClass) alphabets all functions are automatically measurable, so requiring fields would only force the caller to discharge measurable_of_finite redundantly.

                              • encoder : Fin MFin nα
                              • decoder : (Fin nβ)Fin M
                              Instances For
                                Used by
                                  def

                                  InformationTheory.Shannon.ChannelCoding.Code.decodingRegion

                                  source
                                  {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } (c : Code M n α β) (m : Fin M) :
                                  Set (Fin nβ)

                                  The decoding region for message m: {y : Fin n → β | decoder y = m}.

                                  Equations
                                  Instances For
                                    Used by
                                      theorem

                                      InformationTheory.Shannon.ChannelCoding.Code.mem_decodingRegion

                                      source
                                      @[simp]
                                      {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } (c : Code M n α β) (m : Fin M) (y : Fin nβ) :
                                      Used by
                                        theorem

                                        InformationTheory.Shannon.ChannelCoding.Code.measurableSet_decodingRegion

                                        source
                                        {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } [Fintype β] [MeasurableSingletonClass β] (c : Code M n α β) (m : Fin M) :

                                        Decoding regions are measurable on a MeasurableSingletonClass output alphabet (every set is then measurable).

                                        Used by
                                          def

                                          InformationTheory.Shannon.ChannelCoding.Code.errorEvent

                                          source
                                          {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } (c : Code M n α β) (m : Fin M) :
                                          Set (Fin nβ)

                                          The complement of the decoding region for m ("error event" for m given the output y): {y | decoder y ≠ m}.

                                          Equations
                                          Instances For
                                            Used by
                                              theorem

                                              InformationTheory.Shannon.ChannelCoding.Code.mem_errorEvent

                                              source
                                              @[simp]
                                              {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } (c : Code M n α β) (m : Fin M) (y : Fin nβ) :
                                              Used by

                                                Block-code error probability #

                                                noncomputable def

                                                InformationTheory.Shannon.ChannelCoding.Code.errorProbAt

                                                source
                                                {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } (c : Code M n α β) (W : Channel α β) (m : Fin M) :

                                                Pointwise error probability when message m is sent through the channel W applied symbol-wise to encoder m. We model the channel output distribution given x : Fin n → α as Measure.pi (i ↦ W (x i)) — the canonical "memoryless extension" of W to length n blocks.

                                                Equations
                                                Instances For
                                                  Used by
                                                    noncomputable def

                                                    InformationTheory.Shannon.ChannelCoding.Code.averageErrorProb

                                                    source
                                                    {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } (c : Code M n α β) (W : Channel α β) :

                                                    Average error probability under a uniform message: (1/M) ∑ m, errorProbAt c W m. For M = 0 we set this to 0 (the sum is empty).

                                                    Equations
                                                    Instances For
                                                      Used by
                                                        theorem

                                                        InformationTheory.Shannon.ChannelCoding.Code.averageErrorProb_le_one

                                                        source
                                                        {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {M n : } [Nonempty β] (c : Code M n α β) (W : Channel α β) [ProbabilityTheory.IsMarkovKernel W] :

                                                        The average error probability is bounded above by 1 (each errorProbAt ≤ 1 for a Markov kernel; summing over M terms and dividing by M keeps the bound).

                                                        Used by

                                                          Jointly typical set (definitions + bounds (a), (b), (c)) #

                                                          Cover-Thomas. The jointly typical set is the intersection of three single-axis typical conditions (X, Y, and (X, Y) jointly). Bounds (a) and (b) follow directly from the AEP single-axis theorems (typicalSet_prob_tendsto_one and typicalSet_card_le) applied to the joint sequence i ↦ (Xs i, Ys i). The "independent-pair" bound (c) is the genuinely new ingredient.

                                                          The "marginal sequence" formulation Xs : ℕ → Ω → α, Ys : ℕ → Ω → β matches the AEP plumbing in AEP/Basic/Core.lean. The joint sequence is Zs i ω := (Xs i ω, Ys i ω).

                                                          noncomputable def

                                                          InformationTheory.Shannon.ChannelCoding.jointSequence

                                                          source
                                                          {α : Type u_1} {β : Type u_2} {Ω : Type u_3} (Xs : Ωα) (Ys : Ωβ) :
                                                          Ωα × β

                                                          Joint sequence over the product alphabet α × β.

                                                          Equations
                                                          Instances For
                                                            Used by
                                                              theorem

                                                              InformationTheory.Shannon.ChannelCoding.jointSequence_apply

                                                              source
                                                              @[simp]
                                                              {α : Type u_1} {β : Type u_2} {Ω : Type u_3} (Xs : Ωα) (Ys : Ωβ) (i : ) (ω : Ω) :
                                                              jointSequence Xs Ys i ω = (Xs i ω, Ys i ω)
                                                              Used by
                                                                theorem

                                                                InformationTheory.Shannon.ChannelCoding.measurable_jointSequence

                                                                source
                                                                {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] {Ω : Type u_3} [MeasurableSpace Ω] (Xs : Ωα) (Ys : Ωβ) (hXs : ∀ (i : ), Measurable (Xs i)) (hYs : ∀ (i : ), Measurable (Ys i)) (i : ) :
                                                                Used by
                                                                  noncomputable def

                                                                  InformationTheory.Shannon.ChannelCoding.jointlyTypicalSet

                                                                  source
                                                                  {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [Fintype β] {Ω : Type u_3} [MeasurableSpace Ω] (μ : MeasureTheory.Measure Ω) (Xs : Ωα) (Ys : Ωβ) (n : ) (ε : ) :
                                                                  Set ((Fin nα) × (Fin nβ))

                                                                  The jointly typical set A_ε^n ⊆ (Fin n → α) × (Fin n → β): pairs (x, y) whose empirical entropies of X, Y, and (X, Y) are all within ε of the true entropies.

                                                                  Implementation: the X-typical condition uses the marginal sequence Xs (via InformationTheory.Shannon.typicalSet μ Xs n ε), the Y-typical condition uses Ys, and the joint-typical condition uses the joint sequence Zs := jointSequence Xs Ys over the product alphabet α × β. We package this as the preimage of the three single-axis typical sets under the natural reshape (Fin n → α × β) ≃ (Fin n → α) × (Fin n → β).

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    Used by
                                                                      theorem

                                                                      InformationTheory.Shannon.ChannelCoding.mem_jointlyTypicalSet_iff

                                                                      source
                                                                      {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [Fintype β] {Ω : Type u_3} [MeasurableSpace Ω] (μ : MeasureTheory.Measure Ω) (Xs : Ωα) (Ys : Ωβ) (n : ) (ε : ) (x : Fin nα) (y : Fin nβ) :
                                                                      (x, y) jointlyTypicalSet μ Xs Ys n ε x typicalSet μ Xs n ε y typicalSet μ Ys n ε (fun (i : Fin n) => (x i, y i)) typicalSet μ (jointSequence Xs Ys) n ε
                                                                      Used by
                                                                        theorem

                                                                        InformationTheory.Shannon.ChannelCoding.measurableSet_jointlyTypicalSet

                                                                        source
                                                                        {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [MeasurableSingletonClass α] [Fintype β] [MeasurableSingletonClass β] {Ω : Type u_3} [MeasurableSpace Ω] (μ : MeasureTheory.Measure Ω) (Xs : Ωα) (Ys : Ωβ) (n : ) (ε : ) :

                                                                        The jointly typical set is measurable (finite product alphabet).

                                                                        Used by
                                                                          theorem

                                                                          InformationTheory.Shannon.ChannelCoding.jointlyTypicalSet_finite

                                                                          source
                                                                          {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [Fintype β] {Ω : Type u_3} [MeasurableSpace Ω] (μ : MeasureTheory.Measure Ω) (Xs : Ωα) (Ys : Ωβ) (n : ) (ε : ) :
                                                                          (jointlyTypicalSet μ Xs Ys n ε).Finite

                                                                          The jointly typical set is finite (it lives in a finite ambient space).

                                                                          Used by
                                                                            theorem

                                                                            InformationTheory.Shannon.ChannelCoding.jointlyTypicalSet_card_le

                                                                            source
                                                                            {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [MeasurableSingletonClass α] [Fintype β] [MeasurableSingletonClass β] {Ω : Type u_3} [MeasurableSpace Ω] [Nonempty α] [Nonempty β] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (Xs : Ωα) (Ys : Ωβ) (hXs : ∀ (i : ), Measurable (Xs i)) (hYs : ∀ (i : ), Measurable (Ys i)) (hpos : ∀ (p : α × β), 0 < (MeasureTheory.Measure.map (jointSequence Xs Ys 0) μ).real {p}) (n : ) {ε : } ( : 0 < ε) :
                                                                            .toFinset.card Real.exp (n * (entropy μ (jointSequence Xs Ys 0) + ε))

                                                                            Bound (b): size of the jointly typical set. The size is bounded by the size of the joint single-axis typical set, at most exp(n · (H(X, Y) + ε)).

                                                                            This bounds |A_ε^n| by the cardinality of the joint typical set, which is a strictly weaker (larger) bound than 2^{n(H(X,Y)+ε)} but suffices for the channel coding argument.

                                                                            Used by
                                                                              theorem

                                                                              InformationTheory.Shannon.ChannelCoding.jointlyTypicalSet_prob_tendsto_one

                                                                              source
                                                                              {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [MeasurableSingletonClass α] [Fintype β] [MeasurableSingletonClass β] {Ω : Type u_3} [MeasurableSpace Ω] [Nonempty α] [Nonempty β] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (Xs : Ωα) (Ys : Ωβ) (hXs : ∀ (i : ), Measurable (Xs i)) (hYs : ∀ (i : ), Measurable (Ys i)) (hindepX : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Xs i) (Xs j) μ) (hidentX : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (hindepY : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (Ys i) (Ys j) μ) (hidentY : ∀ (i : ), ProbabilityTheory.IdentDistrib (Ys i) (Ys 0) μ μ) (hindepZ : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (jointSequence Xs Ys i) (jointSequence Xs Ys j) μ) (hidentZ : ∀ (i : ), ProbabilityTheory.IdentDistrib (jointSequence Xs Ys i) (jointSequence Xs Ys 0) μ μ) {ε : } ( : 0 < ε) :
                                                                              Filter.Tendsto (fun (n : ) => μ {ω : Ω | (jointRV Xs n ω, jointRV Ys n ω) jointlyTypicalSet μ Xs Ys n ε}) Filter.atTop (nhds 1)

                                                                              Bound (a): joint AEP probability. The probability that the block-joint pair (X^n, Y^n) lies in the jointly typical set tends to 1.

                                                                              Used by
                                                                                theorem

                                                                                InformationTheory.Shannon.ChannelCoding.jointlyTypicalSet_indep_prob_le

                                                                                source
                                                                                {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSpace β] [Fintype α] [MeasurableSingletonClass α] [Fintype β] [MeasurableSingletonClass β] {Ω : Type u_3} [MeasurableSpace Ω] [Nonempty α] [Nonempty β] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] (Xs : Ωα) (Ys : Ωβ) (hXs : ∀ (i : ), Measurable (Xs i)) (hYs : ∀ (i : ), Measurable (Ys i)) (hindepX_full : ProbabilityTheory.iIndepFun (fun (i : ) => Xs i) μ) (hidentX : ∀ (i : ), ProbabilityTheory.IdentDistrib (Xs i) (Xs 0) μ μ) (hindepY_full : ProbabilityTheory.iIndepFun (fun (i : ) => Ys i) μ) (hidentY : ∀ (i : ), ProbabilityTheory.IdentDistrib (Ys i) (Ys 0) μ μ) (hposX : ∀ (x : α), 0 < (MeasureTheory.Measure.map (Xs 0) μ).real {x}) (hposY : ∀ (y : β), 0 < (MeasureTheory.Measure.map (Ys 0) μ).real {y}) (hposZ : ∀ (p : α × β), 0 < (MeasureTheory.Measure.map (jointSequence Xs Ys 0) μ).real {p}) (n : ) {ε : } ( : 0 < ε) :
                                                                                ((MeasureTheory.Measure.map (jointRV Xs n) μ).prod (MeasureTheory.Measure.map (jointRV Ys n) μ)).real (jointlyTypicalSet μ Xs Ys n ε) Real.exp (n * (entropy μ (jointSequence Xs Ys 0) - entropy μ (Xs 0) - entropy μ (Ys 0) + 3 * ε))

                                                                                Bound (c): independent-pair probability. The probability under the product measure μX^n × μY^n (where μX^n := μ.map (jointRV Xs n) and similarly for Y) that (X̃, Y) lies in the jointly typical set is bounded by exp(-n(I - 3ε)) (in the log form: exp(n · (H(X,Y) - H(X) - H(Y) + 3ε))).

                                                                                Mutual independence (iIndepFun) along each of the X and Y axes is required to factorise the block laws μ.map (jointRV Xs n) = Measure.pi (μ.map (Xs ·)). The joint axis identification (hidentZ) is not required for this bound (it is required only by the random-codebook average downstream of this lemma).

                                                                                Used by