LeanMachineLearning

Bandits.TS.p0_tsAlgorithmšŸ”—

Lemma

From the authors

The first action of Thompson sampling is sampled according to its probability of being optimal under the prior over environments.

Types
  • š“” : Type u_2MeasurableSpace š“”A measurable space is a space equipped with a σ-algebra.StandardBorelSpace š“”A standard Borel space is a measurable space arising as the Borel sets of some Polish topology.Nonempty š“”
Given
  • K : ā„•NeZero K
  • Q : MeasureTheory.Measure š“”A measure is defined to be an outer measure that is countably additive on measurable sets, with the additional assumption that the outer measure is the canonical extension of the restricted measure.MeasureTheory.IsProbabilityMeasure QA measure μ is called a probability measure if μ univ = 1.
  • Īŗ : ProbabilityTheory.Kernel (š“” Ɨ Fin K) ā„A kernel from a measurable space α to another measurable space β is a measurable function Īŗ : α → Measure β.ProbabilityTheory.IsMarkovKernel ĪŗA kernel is a Markov kernel if every measure in its image is a probability measure.
Then
(tsAlgorithm Q Īŗ).p0 () = MeasureTheory.Measure.map (Learning.IsBayesAlgEnvSeq.bestAction Īŗ id) Q
Code
lemma TS.p0_tsAlgorithm :
    (tsAlgorithm Q Īŗ).p0 () = Q.map (bestAction Īŗ id)
Proof
by
  rw [Algorithm.p0_apply]
  dsimp only [tsAlgorithm]
  rw [TS.policy, Kernel.prodMkRight_apply, Kernel.map_apply _ (by fun_prop),
    IT.bayesTrajMeasurePosterior_zero, Kernel.const_apply]

Meaning last changed in v4.35.0-rc2-1-g61e506b (2026-09-22), the 5th 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: 35 project declarations, 102 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.