Documentation

LeanPool.Shannon1948Formalization.Entropy.Joint

Shannon.Entropy.Joint #

Joint distributions on product types, marginals, conditional entropy, and the chain rule for Shannon entropy.

These definitions and theorems support the Section 6 properties by providing the infrastructure for multi-variable entropy identities.

Main definitions #

Main results #

Marginals and product distributions #

First marginal: (marginalFst p)(a) = ∑_b p(a, b).

Equations
Instances For

    Second marginal: (marginalSnd p)(b) = ∑_a p(a, b).

    Equations
    Instances For
      def LeanPool.Shannon1948Formalization.prodDist {α β : Type} [Fintype α] [Fintype β] (p : ProbDist α) (q : ProbDist β) :
      ProbDist (α × β)

      Product distribution: (prodDist p q)(a, b) = p(a) * q(b).

      Equations
      Instances For

        Independence, conditional entropy, mutual information #

        A joint distribution is independent when it factors as the product of its marginals.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          noncomputable def LeanPool.Shannon1948Formalization.condEntropy {α β : Type} [Fintype α] [Fintype β] (p : ProbDist (α × β)) :

          Conditional entropy H_X(Y) = -∑_{x,y} p(x,y) log(p(x,y) / p_X(x)).

          This measures the average remaining uncertainty in Y once X is known. The formula uses Lean's 0 / 0 = 0 and log 0 = 0 conventions: when p_X(x) = 0 we also have p(x,y) = 0, so the term vanishes.

          Equations
          Instances For
            noncomputable def LeanPool.Shannon1948Formalization.mutualInfo {α β : Type} [Fintype α] [Fintype β] (p : ProbDist (α × β)) :

            Mutual information I(X;Y) = H(X) + H(Y) - H(X,Y).

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

              Support lemmas #

              theorem LeanPool.Shannon1948Formalization.prob_eq_zero_of_marginalFst_eq_zero {α β : Type} [Fintype α] [Fintype β] (p : ProbDist (α × β)) (a : α) (ha : (marginalFst p) a = 0) (b : β) :
              p (a, b) = 0

              If a first marginal is zero, every joint probability with that first coordinate is zero (since the marginal is a sum of nonnegative terms).

              theorem LeanPool.Shannon1948Formalization.marginalFst_pos_of_prob_pos {α β : Type} [Fintype α] [Fintype β] (p : ProbDist (α × β)) (a : α) (b : β) (h : 0 < p (a, b)) :
              0 < (marginalFst p) a

              A positive joint probability implies a positive first marginal.

              Marginals of product distributions #

              The first marginal of a product distribution recovers the first factor.

              The second marginal of a product distribution recovers the second factor.

              Chain rule #

              Chain rule for entropy: H(X,Y) = H(X) + H_X(Y).

              The proof expands H(X) over the product type by distributing the marginal weight, then combines termwise using log(p/m) = log p - log m.

              Product distribution entropy #

              Additivity for independent distributions: H(X × Y) = H(X) + H(Y).

              The proof uses log(p(a) * q(b)) = log p(a) + log q(b) for each nonzero term, then separates the double sum using ∑ qᵢ = 1 and ∑ pᵢ = 1.