Bandits.TS.integral_regret_le
If Thompson sampling has the correct prior over environments and every environment has K
actions, each of which has a corresponding reward between l and u that is sub-Gaussian with
variance proxy Ο2 after its mean is subtracted, then the Bayesian regret at time n is at most
(2 * K + 1) * (u - l) + 8 * β(Ο2 * K * n * Real.log n).
Bandits.TS.integral_regret_le.{u_1, u_2} {K : β} [Nonempty (Fin K)] {l u Ο2 : β} {Ξ© : Type u_1} [MeasurableSpace Ξ©] {π : Type u_2} [MeasurableSpace π] [StandardBorelSpace π] [Nonempty π] {Q : MeasureTheory.Measure π} [MeasureTheory.IsProbabilityMeasure Q] {ΞΊ : ProbabilityTheory.Kernel (π Γ Fin K) β} [ProbabilityTheory.IsMarkovKernel ΞΊ] {E : Ξ© β π} {A : β β Ξ© β Fin K} {R : β β Ξ© β β} {P : MeasureTheory.Measure Ξ©} [MeasureTheory.IsProbabilityMeasure P] (hK : 0 < K) (h : Learning.IsBayesAlgEnvSeq Q ΞΊ (tsAlgorithm hK Q ΞΊ) E A R P) (hlu : l β€ u) (hm : β (e : π) (a : Fin K), β« (x : β), id x βΞΊ (e, a) β Set.Icc l u) (hΟ2 : 0 < Ο2) (hs : β (e : π) (a : Fin K), ProbabilityTheory.HasSubgaussianMGF (fun x => x - β« (x : β), id x βΞΊ (e, a)) β¨Ο2, β―β© (ΞΊ (e, a))) (n : β) : β« (x : Ξ©), Learning.IsBayesAlgEnvSeq.regret ΞΊ E A n x βP β€ (2 * βK + 1) * (u - l) + 8 * β(Ο2 * βK * βn * Real.log βn)Bandits.TS.integral_regret_le.{u_1, u_2} {K : β} [Nonempty (Fin K)] {l u Ο2 : β} {Ξ© : Type u_1} [MeasurableSpace Ξ©] {π : Type u_2} [MeasurableSpace π] [StandardBorelSpace π] [Nonempty π] {Q : MeasureTheory.Measure π} [MeasureTheory.IsProbabilityMeasure Q] {ΞΊ : ProbabilityTheory.Kernel (π Γ Fin K) β} [ProbabilityTheory.IsMarkovKernel ΞΊ] {E : Ξ© β π} {A : β β Ξ© β Fin K} {R : β β Ξ© β β} {P : MeasureTheory.Measure Ξ©} [MeasureTheory.IsProbabilityMeasure P] (hK : 0 < K) (h : Learning.IsBayesAlgEnvSeq Q ΞΊ (tsAlgorithm hK Q ΞΊ) E A R P) (hlu : l β€ u) (hm : β (e : π) (a : Fin K), β« (x : β), id x βΞΊ (e, a) β Set.Icc l u) (hΟ2 : 0 < Ο2) (hs : β (e : π) (a : Fin K), ProbabilityTheory.HasSubgaussianMGF (fun x => x - β« (x : β), id x βΞΊ (e, a)) β¨Ο2, β―β© (ΞΊ (e, a))) (n : β) : β« (x : Ξ©), Learning.IsBayesAlgEnvSeq.regret ΞΊ E A n x βP β€ (2 * βK + 1) * (u - l) + 8 * β(Ο2 * βK * βn * Real.log βn)
Code
theorem integral_regret_le (hK : 0 < K) (h : IsBayesAlgEnvSeq Q ΞΊ (tsAlgorithm hK Q ΞΊ) E A R P)
(hlu : l β€ u) (hm : β e a, (ΞΊ (e, a))[id] β (Set.Icc l u)) (hΟ2 : 0 < Ο2)
(hs : β e a, HasSubgaussianMGF (fun x β¦ x - (ΞΊ (e, a))[id]) β¨Ο2, hΟ2.leβ© (ΞΊ (e, a))) (n : β) :
P[IsBayesAlgEnvSeq.regret ΞΊ E A n]
β€ (2 * K + 1) * (u - l) + 8 * β(Ο2 * K * n * Real.log n)Proof
by
by_cases hn : n = 0
Β· simp [hn, IsBayesAlgEnvSeq.regret, Bandits.regret]
nlinarith
have hΞ΄ : (0 : β) < 1 / n ^ 2 := by positivity
calc P[IsBayesAlgEnvSeq.regret ΞΊ E A n]
= _ :=
integral_regret_eq_add hK h hm n
_ β€ _ :=
add_le_add
(integral_sum_range_actionMean_bestAction_sub_ucb_bestAction_le h hlu hm hΟ2 hs hΞ΄ n)
(integral_sum_range_ucb_action_sub_actionMean_action_le h hlu hm hΟ2 hs hΞ΄ n)
_ = K * (u - l) + (K + 1) * (u - l) * ((n - 1) / n)
+ 4 * β((2 : β) ^ 2 * (Ο2 * K * n * Real.log n)) := by
field_simp
rw [Real.log_pow]
ring_nf
_ = K * (u - l) + (K + 1) * (u - l) * ((n - 1) / n) + 8 * β(Ο2 * K * n * Real.log n) := by
rw [Real.sqrt_mul (by positivity), Real.sqrt_sq (by norm_num)]
ring
_ β€ K * (u - l) + (K + 1) * (u - l) * 1 + 8 * β(Ο2 * K * n * Real.log n) := by -- loose
have : 0 β€ u - l := sub_nonneg.2 hlu
gcongr
rw [div_le_one (by positivity)]
linarith
_ = _ := by
ringActions: Source Β· Open Issue
Meaning last changed in v4.34.0-rc2-1-g439785b (2026-08-23), the 4th recorded change.
Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file Β· open it in the Lean web editor.
Dependency graph
Audit surface: 23 project declarations, 126 external constants
β Proved: no sorry anywhere in its closure
This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.