InformationTheory.Shannon.TypedRV
Typed random variable API #
An opt-in notation layer that allows writing H(μ; X), H(μ; X | Y), I(μ; X ; Y),
I(μ; X ; Y | Z), and D(μ; X ∥ Y) directly in the style of Cover–Thomas.
Main definitions #
condEntropy— re-export ofMeasureFano.condEntropyinto theShannonnamespace.klDivRV— KL divergence between two random variables:klDiv (μ.map X) (μ.map Y).differentialEntropyRV— differential entropy of a real-valued random variable.
Main statements #
klDivRV_def—klDivRV μ X Y = klDiv (μ.map X) (μ.map Y)(byrfl).entropy_nonneg_rv—0 ≤ entropy μ X.mutualInfo_comm_rv—I(X; Y) = I(Y; X).mutualInfo_le_of_postprocess_rv— data processing inequality.
Implementation notes #
The internal representations (entropy, mutualInfo, condMutualInfo,
MeasureFano.condEntropy, differentialEntropy, klDiv) are unchanged; only thin alias
definitions and notation are added.
Notation is scoped[InformationTheory.Shannon] so that only call sites that open scoped InformationTheory.Shannon can see it.
The notation uses H(μ; X) / I(μ; X ; Y) forms with explicit μ because the
_ anonymous-placeholder approach cannot synthesize μ from context at notation3
body evaluation time. Precedence :max makes each notation an atomic high-precedence
term, avoiding parse errors in expressions like 0 ≤ H(μ; X).
The separator in D(μ; X ∥ Y) is ∥ (U+2225 PARALLEL TO), distinct from the norm
delimiter ‖ (U+2016 DOUBLE VERTICAL LINE), to avoid token conflicts.
Type-class constraints required by each notation propagate to the call site:
H(μ; X)/H(μ; X | Y)require[Fintype α] [DecidableEq α] [Nonempty α] [MeasurableSpace α] [MeasurableSingletonClass α].I(μ; X ; Y)requires[MeasurableSpace α] [MeasurableSpace β].I(μ; X ; Y | Z)additionally requires[StandardBorelSpace α] [Nonempty α] [StandardBorelSpace β] [Nonempty β].D(μ; X ∥ Y)requires[MeasurableSpace α].
Re-export: MeasureFano.condEntropy #
InformationTheory.Shannon.condEntropy
sourceRe-export InformationTheory.MeasureFano.condEntropy into the
InformationTheory.Shannon namespace, so the notation H(X | Y) resolves here.
Internal definition is unchanged.
Equations
Instances For
Used by
KL divergence (typed RV form, 1-measure) #
InformationTheory.Shannon.klDivRV
sourceKL divergence between two random variables on a common ambient measure μ:
klDivRV μ X Y := klDiv (μ.map X) (μ.map Y).
This is the 1-measure form of the textbook D(X ‖ Y). The 2-measure form
(klDiv (μ.map X) (ν.map Y)) is not provided here.
Equations
Instances For
Used by
InformationTheory.Shannon.klDivRV_def
sourceklDivRV μ X Y = klDiv (μ.map X) (μ.map Y) by definition.
Used by
Differential entropy (typed RV form) #
InformationTheory.Shannon.differentialEntropyRV
sourceDifferential entropy of a real-valued random variable on ambient (Ω, μ):
differentialEntropyRV μ X := differentialEntropy (μ.map X).
Equations
Instances For
Used by
Notation #
InformationTheory.Shannon.«termH(_;_)»
sourceEquations
- One or more equations did not get rendered due to their size.
Instances For
Used by
InformationTheory.Shannon.«termH(_;_|_)»
sourceEquations
- One or more equations did not get rendered due to their size.
Instances For
Used by
InformationTheory.Shannon.«termI(_;_;_)»
sourceEquations
- One or more equations did not get rendered due to their size.
Instances For
Used by
InformationTheory.Shannon.«termI(_;_;_|_)»
sourceEquations
- One or more equations did not get rendered due to their size.
Instances For
Used by
InformationTheory.Shannon.«termD(_;_∥_)»
sourceEquations
- One or more equations did not get rendered due to their size.
Instances For
Used by
Sanity examples #
Typed-form main lemmas #
One-line aliases of the measure-form lemmas. The _rv suffix avoids name conflicts
with the bare names.
Entropy #
InformationTheory.Shannon.entropy_nonneg_rv
sourceH(X) ≥ 0.
Used by
Mutual information #
InformationTheory.Shannon.mutualInfo_comm_rv
sourceI(X; Y) = I(Y; X) (Cover–Thomas).
Used by
Data processing inequality #
InformationTheory.Shannon.mutualInfo_le_of_postprocess_rv
sourceData processing inequality: post-processing cannot increase mutual information.
I(X; f(Y)) ≤ I(X; Y) — Cover–Thomas.