Lean module · Foundations
BanditRLProof.LowerBounds.InformationTheory
This file formalizes the finite prefix-code/entropy definitions, a Kraft adapter, the measure-KL and data-processing surfaces, and event testing used in Part IV, Chapter 14 of Lattimore--Szepesvári, *Bandit Algorithms*. Measure-level relative entropy is Mathlib's extended-real InformationTheory.klDiv. The project-local work keeps codeword regularity, absolute continuity, integrability, KL direction, Bernoulli endpoints, and the infinite-divergence branch explicit. It does not claim Huffman optimality or source coding.
Module map
Imports
BanditRLProof.Algorithms.KLUCBBernoulli
Imported by
BanditRLProof, BanditRLProof.LowerBounds.CodingEntropyBound, BanditRLProof.LowerBounds.CommonDensityKL, BanditRLProof.LowerBounds.FiniteDiscreteKL, BanditRLProof.LowerBounds.Minimax, BanditRLProof.LowerBounds.RelativeEntropyFiltration
Declarations
Open an item to read its exact compact statement and source link. Detailed teaching notes are linked when registered.
structure
BanditRLProof.LowerBounds.BinaryPrefixCode
Compiled
A finite-alphabet binary prefix code. Excluding the empty codeword is the regularity condition needed for concatenations of repeated messages to be uniquely decodable.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.BinaryPrefixCodeReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
structure BinaryPrefixCode (Symbol : Type*) where
theorem
BanditRLProof.LowerBounds.BinaryPrefixCode.uniquelyDecodable_range
Compiled
A prefix-free codebook with no empty codeword is uniquely decodable.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.BinaryPrefixCode.uniquelyDecodable_rangeReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem uniquelyDecodable_range (code : BinaryPrefixCode Symbol) : InformationTheory.UniquelyDecodable (Set.range code.encode)
def
BanditRLProof.LowerBounds.BinaryPrefixCode.codebook
Compiled
The finite set of codewords induced by a finite source alphabet.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.BinaryPrefixCode.codebookReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
noncomputable def codebook [Fintype Symbol] [DecidableEq Symbol] (code : BinaryPrefixCode Symbol) : Finset (List Bool)
theorem
BanditRLProof.LowerBounds.BinaryPrefixCode.coe_codebook
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.BinaryPrefixCode.coe_codebookReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem coe_codebook [Fintype Symbol] [DecidableEq Symbol] (code : BinaryPrefixCode Symbol) : (code.codebook : Set (List Bool)) = Set.range code.encode
theorem
BanditRLProof.LowerBounds.BinaryPrefixCode.kraft_inequality
Compiled
Kraft--McMillan for a finite binary prefix code, obtained by adapting the codebook to Mathlib's uniquely-decodable-code theorem.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.BinaryPrefixCode.kraft_inequalityReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem kraft_inequality [Fintype Symbol] [DecidableEq Symbol] (code : BinaryPrefixCode Symbol) : ∑ word ∈ code.codebook, (1 / 2 : Real) ^ word.length ≤ 1
def
BanditRLProof.LowerBounds.discreteEntropy
Compiled
Natural-log entropy (nats) of a finite supported mass function, Eq. (14.3).
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.discreteEntropyReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
noncomputable def discreteEntropy (support : Finset Symbol) (probability : Symbol → Real) : Real
def
BanditRLProof.LowerBounds.discreteEntropyBaseTwo
Compiled
Base-two entropy (bits) of a finite supported mass function.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.discreteEntropyBaseTwoReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
noncomputable def discreteEntropyBaseTwo (support : Finset Symbol) (probability : Symbol → Real) : Real
theorem
BanditRLProof.LowerBounds.discreteEntropyBaseTwo_eq_div_log_two
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.discreteEntropyBaseTwo_eq_div_log_twoReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem discreteEntropyBaseTwo_eq_div_log_two (support : Finset Symbol) (probability : Symbol → Real) : discreteEntropyBaseTwo support probability = discreteEntropy support probability / Real.log 2
theorem
BanditRLProof.LowerBounds.discreteEntropy_nonneg
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.discreteEntropy_nonnegReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem discreteEntropy_nonneg (support : Finset Symbol) (probability : Symbol → Real) (hprobability : ∀ symbol ∈ support, 0 ≤ probability symbol ∧ probability symbol ≤ 1) : 0 ≤ discreteEntropy support probability
def
BanditRLProof.LowerBounds.expectedCodeLength
Compiled
Expected binary codeword length, the objective in Eq. (14.1).
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.expectedCodeLengthReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
noncomputable def expectedCodeLength [Fintype Symbol] (probability : Symbol → Real) (code : BinaryPrefixCode Symbol) : Real
theorem
BanditRLProof.LowerBounds.expectedCodeLength_nonneg
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.expectedCodeLength_nonnegReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem expectedCodeLength_nonneg [Fintype Symbol] (probability : Symbol → Real) (code : BinaryPrefixCode Symbol) (hprobability : ∀ symbol, 0 ≤ probability symbol) : 0 ≤ expectedCodeLength probability code
abbrev
BanditRLProof.LowerBounds.relativeEntropy
Compiled
Chapter 14 relative entropy, with value `∞` on support mismatch or a non-integrable log-likelihood ratio.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropyReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
abbrev relativeEntropy {α : Type*} [MeasurableSpace α] (P Q : Measure α) : ENNReal
theorem
BanditRLProof.LowerBounds.relativeEntropy_of_absolutelyContinuous_of_integrable
Compiled
The finite regular branch of the Radon--Nikodym representation. The mass correction vanishes when `P` and `Q` are probability measures.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_of_absolutelyContinuous_of_integrableReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_of_absolutelyContinuous_of_integrable {α : Type*} [MeasurableSpace α] (P Q : Measure α) (hPQ : P ≪ Q) (hInt : Integrable (llr P Q) P) : relativeEntropy P Q = ENNReal.ofReal (∫ x, llr P Q x ∂P + Q.real univ - P.real univ)
theorem
BanditRLProof.LowerBounds.relativeEntropy_of_probability_absolutelyContinuous_of_integrable
Compiled
Probability-measure specialization of Theorem 14.1: the finite relative entropy is exactly the expected log likelihood ratio.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_of_probability_absolutelyContinuous_of_integrableReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_of_probability_absolutelyContinuous_of_integrable {α : Type*} [MeasurableSpace α] (P Q : Measure α) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] (hPQ : P ≪ Q) (hInt : Integrable (llr P Q) P) : relativeEntropy P Q = ENNReal.ofReal (∫ x, llr P Q x ∂P)
theorem
BanditRLProof.LowerBounds.relativeEntropy_eq_top_of_not_absolutelyContinuous
Compiled
The singular branch of Theorem 14.1.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_eq_top_of_not_absolutelyContinuousReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_eq_top_of_not_absolutelyContinuous {α : Type*} [MeasurableSpace α] {P Q : Measure α} (hPQ : ¬ P ≪ Q) : relativeEntropy P Q = ∞
theorem
BanditRLProof.LowerBounds.relativeEntropy_ne_top_iff
Compiled
Exact finiteness contract for the Mathlib representation of Chapter 14 relative entropy.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_ne_top_iffReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_ne_top_iff {α : Type*} [MeasurableSpace α] {P Q : Measure α} : relativeEntropy P Q ≠ ∞ ↔ P ≪ Q ∧ Integrable (llr P Q) P
theorem
BanditRLProof.LowerBounds.relativeEntropy_eq_zero_iff
Compiled
Relative entropy vanishes exactly when the finite measures agree.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_eq_zero_iffReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_eq_zero_iff {α : Type*} [MeasurableSpace α] {P Q : Measure α} [IsFiniteMeasure P] [IsFiniteMeasure Q] : relativeEntropy P Q = 0 ↔ P = Q
theorem
BanditRLProof.LowerBounds.relativeEntropy_trim_le
Compiled
Exercise 14.10 in its full sub-sigma-algebra form: forgetting measurable sets cannot increase relative entropy. The proof uses the Radon--Nikodym conditional-expectation identity and conditional Jensen for `klFun`.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_trim_leReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_trim_le {α : Type*} {m m₀ : MeasurableSpace α} {P Q : @Measure α m₀} [IsFiniteMeasure P] [IsFiniteMeasure Q] (hm : m ≤ m₀) : @relativeEntropy α m (P.trim hm) (Q.trim hm) ≤ @relativeEntropy α m₀ P Q
abbrev
BanditRLProof.LowerBounds.bernoulliRelativeEntropy
Compiled
The Bernoulli relative entropy from Eq. (14.4), reusing the project's exact support and endpoint convention.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.bernoulliRelativeEntropyReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
abbrev bernoulliRelativeEntropy (p q : Real) : ENNReal
theorem
BanditRLProof.LowerBounds.rnDeriv_restrict_restrict
Compiled
Restricting both laws to a measurable event preserves the original Radon--Nikodym derivative almost everywhere on that event.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.rnDeriv_restrict_restrictReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem rnDeriv_restrict_restrict {α : Type*} [MeasurableSpace α] {P Q : Measure α} [SigmaFinite P] [SigmaFinite Q] (hPQ : P ≪ Q) {A : Set α} (hA : MeasurableSet A) : (P.restrict A).rnDeriv (Q.restrict A) =ᵐ[Q.restrict A] P.rnDeriv Q
theorem
BanditRLProof.LowerBounds.relativeEntropy_restrict_add_compl
Compiled
Relative entropy splits exactly across an event and its complement. This is the two-cell partition identity used by the event data-processing proof.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.relativeEntropy_restrict_add_complReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem relativeEntropy_restrict_add_compl {α : Type*} [MeasurableSpace α] {P Q : Measure α} [IsFiniteMeasure P] [IsFiniteMeasure Q] (hPQ : P ≪ Q) {A : Set α} (hA : MeasurableSet A) : relativeEntropy P Q = relativeEntropy (P.restrict A) (Q.restrict A) + relativeEntropy (P.restrict Aᶜ) (Q.restrict Aᶜ)
theorem
BanditRLProof.LowerBounds.bernoulliKLCore_event_le
Compiled
Event data processing in the finite, non-singular Bernoulli branch. This is the quantitative core of Exercise 14.10 specialized to the sigma-algebra generated by one event.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.bernoulliKLCore_event_leReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem bernoulliKLCore_event_le {α : Type*} [MeasurableSpace α] {P Q : Measure α} [IsProbabilityMeasure P] [IsProbabilityMeasure Q] {A : Set α} (hA : MeasurableSet A) (hKL : relativeEntropy P Q ≠ ∞) (hQ0 : 0 < Q.real A) (hQ1 : Q.real A < 1) : KLUCB.bernoulliKLCore (P.real A) (Q.real A) ≤ (relativeEntropy P Q).toReal
theorem
BanditRLProof.LowerBounds.mul_sqrt_div_eq_sqrt_mul
Compiled Internal helper
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.mul_sqrt_div_eq_sqrt_mulReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
private theorem mul_sqrt_div_eq_sqrt_mul {a b : Real} (ha : 0 < a) (hb : 0 ≤ b) : a * Real.sqrt (b / a) = Real.sqrt (a * b)
theorem
BanditRLProof.LowerBounds.exp_neg_half_bernoulliKLCore_le_affinity
Compiled
The binary likelihood affinity dominates `exp(-d/2)`. This is the two-atom Jensen step in the source proof of Theorem 14.2.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exp_neg_half_bernoulliKLCore_le_affinityReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exp_neg_half_bernoulliKLCore_le_affinity {p q : Real} (hp0 : 0 < p) (hp1 : p < 1) (hq0 : 0 < q) (hq1 : q < 1) : Real.exp (-(KLUCB.bernoulliKLCore p q) / 2) ≤ Real.sqrt (p * q) + Real.sqrt ((1 - p) * (1 - q))
theorem
BanditRLProof.LowerBounds.half_binaryAffinity_sq_le_eventError
Compiled
The two-atom Le Cam overlap inequality in the orientation needed for an event `A`: the affinity squared, divided by two, is bounded by `p + (1 - q)`.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.half_binaryAffinity_sq_le_eventErrorReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem half_binaryAffinity_sq_le_eventError {p q : Real} (hp : KLUCB.IsBernoulliParameter p) (hq : KLUCB.IsBernoulliParameter q) : (1 / 2 : Real) * (Real.sqrt (p * q) + Real.sqrt ((1 - p) * (1 - q))) ^ 2 ≤ p + (1 - q)
theorem
BanditRLProof.LowerBounds.binaryBretagnolleHuberCore
Compiled
Bretagnolle--Huber for the finite analytic Bernoulli KL expression.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.binaryBretagnolleHuberCoreReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem binaryBretagnolleHuberCore {p q : Real} (hp : KLUCB.IsBernoulliParameter p) (hq0 : 0 < q) (hq1 : q < 1) : (1 / 2 : Real) * Real.exp (-KLUCB.bernoulliKLCore p q) ≤ p + (1 - q)
def
BanditRLProof.LowerBounds.bretagnolleHuberScale
Compiled
The source convention `exp(-∞)=0`, exposed as a real-valued testing scale so Theorem 14.2 remains unconditional.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.bretagnolleHuberScaleReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
noncomputable def bretagnolleHuberScale (d : ENNReal) : Real
theorem
BanditRLProof.LowerBounds.bretagnolleHuberScale_nonneg
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.bretagnolleHuberScale_nonnegReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem bretagnolleHuberScale_nonneg (d : ENNReal) : 0 ≤ bretagnolleHuberScale d
theorem
BanditRLProof.LowerBounds.binaryBretagnolleHuber
Compiled
Exact two-atom Bretagnolle--Huber inequality, including singular Bernoulli endpoints through the extended-real testing scale.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.binaryBretagnolleHuberReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem binaryBretagnolleHuber {p q : Real} (hp : KLUCB.IsBernoulliParameter p) (hq : KLUCB.IsBernoulliParameter q) : bretagnolleHuberScale (bernoulliRelativeEntropy p q) ≤ p + (1 - q)
theorem
BanditRLProof.LowerBounds.bernoulliRelativeEntropy_event_le
Compiled
Event-level binary data processing: observing only membership in `A` cannot increase the relative entropy.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.bernoulliRelativeEntropy_event_leReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem bernoulliRelativeEntropy_event_le {α : Type*} [MeasurableSpace α] {P Q : Measure α} [IsProbabilityMeasure P] [IsProbabilityMeasure Q] {A : Set α} (hA : MeasurableSet A) : bernoulliRelativeEntropy (P.real A) (Q.real A) ≤ relativeEntropy P Q
theorem
BanditRLProof.LowerBounds.bretagnolleHuberScale_antitone
Compiled
The Bretagnolle--Huber testing scale is antitone in its information argument.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.bretagnolleHuberScale_antitoneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem bretagnolleHuberScale_antitone {d D : ENNReal} (h : d ≤ D) : bretagnolleHuberScale D ≤ bretagnolleHuberScale d
theorem
BanditRLProof.LowerBounds.bretagnolleHuber
Compiled
*Bretagnolle--Huber inequality** (Lattimore--Szepesvári, Theorem 14.2). For any measurable event, the two testing errors are bounded below in the source KL direction `D(P,Q)`. The infinite-divergence case is included by `bretagnolleHuberScale`.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.bretagnolleHuberReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem bretagnolleHuber {α : Type*} [MeasurableSpace α] {P Q : Measure α} [IsProbabilityMeasure P] [IsProbabilityMeasure Q] {A : Set α} (hA : MeasurableSet A) : bretagnolleHuberScale (relativeEntropy P Q) ≤ P.real A + Q.real Aᶜ