Relative entropy (Definitions 10.5.1–10.5.2)
DefinitionWildeQIT_relEntropyDefinition 10.5.1 (Support). Let be a finite set. The support of a function is the subset of on which is non-zero: .
Definition 10.5.2 (Relative entropy). Let be a probability distribution on the alphabet and let . The relative entropy is
with the logarithm base and the convention that terms with contribute .
The relative entropy is the fundamental divergence of information theory: mutual information and conditional mutual information are relative entropies between a joint distribution and a product (or Markov) distribution, and its non-negativity (Theorem 10.7.1) and monotonicity under channels (Corollary 10.7.2) are the sources of all entropy inequalities of the chapter. Note that is only required to be a non-negative function, not a probability distribution.
Formalization Note. WildeQIT.relEntropy p q takes p : WildeQIT.FinDist α and an arbitrary real function q : α → ℝ and returns an extended real number (EReal): the real value coerced into EReal when Function.support p.prob ⊆ Function.support q (Mathlib's Function.support f = {x | f x ≠ 0} is exactly Definition 10.5.1), and ⊤ () otherwise. Terms with vanish automatically (Real.logb 2 0 = 0). Wilde's standing assumption is not built into the definition; theorems about carry it as an explicit hypothesis.
import Definitions.Def_WildeQIT_FinDist
import Mathlib.Analysis.SpecialFunctions.Log.Base
import Mathlib.Data.EReal.Basic
/-!
Wilde, *Quantum Information Theory* (2nd ed.), Definition 10.5.1 (Support) and
Definition 10.5.2 (Relative entropy). The support of `f : 𝒳 → ℝ` is `supp(f) = {x : f(x) ≠ 0}`
(Mathlib's `Function.support`). For a probability distribution `p` on `𝒳` and `q : 𝒳 → [0,∞)`,
`D(p‖q) ≡ ∑_x p(x) log (p(x)/q(x))` if `supp(p) ⊆ supp(q)`, and `+∞` otherwise.
-/
namespace WildeQIT
open Classical in
/-- Definition 10.5.2. The relative entropy `D(p‖q)` of a probability distribution `p` on `α`
with respect to a function `q : α → ℝ` (intended non-negative), in bits, as an extended real:
`D(p‖q) = ∑_x p(x) log₂ (p(x)/q(x))` when `supp p ⊆ supp q`, and `+∞` otherwise.
Here `supp f = {x | f x ≠ 0}` (Definition 10.5.1). Terms with `p(x) = 0` contribute `0`. -/
noncomputable def relEntropy {α : Type} [Fintype α] (p : FinDist α) (q : α → ℝ) : EReal :=
if Function.support p.prob ⊆ Function.support q then
((∑ x, p.prob x * Real.logb 2 (p.prob x / q x) : ℝ) : EReal)
else ⊤
end WildeQIT