LeanMachineLearning

Bandits.TS.hasCondDistrib_action๐Ÿ”—

Lemma

If Thompson sampling has the correct prior over environments, then the conditional distribution of the next action given the history so far is equal to the conditional distribution of the best action given the history so far.

๐Ÿ”—theorem
Bandits.TS.hasCondDistrib_action.{u_1, u_2} {K : โ„•} [Nonempty (Fin K)] {ฮฉ : Type u_1} [MeasurableSpace ฮฉ] {๐“” : Type u_2} [MeasurableSpace ๐“”] [StandardBorelSpace ๐“”] [Nonempty ๐“”] {E : ฮฉ โ†’ ๐“”} {A : โ„• โ†’ ฮฉ โ†’ Fin K} {R : โ„• โ†’ ฮฉ โ†’ โ„} {Q : MeasureTheory.Measure ๐“”} [MeasureTheory.IsProbabilityMeasure Q] {ฮบ : ProbabilityTheory.Kernel (๐“” ร— Fin K) โ„} [ProbabilityTheory.IsMarkovKernel ฮบ] {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] (hK : 0 < K) (h : Learning.IsBayesAlgEnvSeq Q ฮบ (tsAlgorithm hK Q ฮบ) E A R P) (n : โ„•) : ProbabilityTheory.HasCondDistrib (A (n + 1)) (Learning.history A R n) ๐“›[Learning.IsBayesAlgEnvSeq.bestAction ฮบ E | Learning.history A R n; P] P
Bandits.TS.hasCondDistrib_action.{u_1, u_2} {K : โ„•} [Nonempty (Fin K)] {ฮฉ : Type u_1} [MeasurableSpace ฮฉ] {๐“” : Type u_2} [MeasurableSpace ๐“”] [StandardBorelSpace ๐“”] [Nonempty ๐“”] {E : ฮฉ โ†’ ๐“”} {A : โ„• โ†’ ฮฉ โ†’ Fin K} {R : โ„• โ†’ ฮฉ โ†’ โ„} {Q : MeasureTheory.Measure ๐“”} [MeasureTheory.IsProbabilityMeasure Q] {ฮบ : ProbabilityTheory.Kernel (๐“” ร— Fin K) โ„} [ProbabilityTheory.IsMarkovKernel ฮบ] {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] (hK : 0 < K) (h : Learning.IsBayesAlgEnvSeq Q ฮบ (tsAlgorithm hK Q ฮบ) E A R P) (n : โ„•) : ProbabilityTheory.HasCondDistrib (A (n + 1)) (Learning.history A R n) ๐“›[Learning.IsBayesAlgEnvSeq.bestAction ฮบ E | Learning.history A R n; P] P

Code

lemma TS.hasCondDistrib_action (hK : 0 < K) (h : IsBayesAlgEnvSeq Q ฮบ (tsAlgorithm hK Q ฮบ) E A R P)
    (n : โ„•) :
    HasCondDistrib (A (n + 1)) (history A R n)
      (condDistrib (bestAction ฮบ E) (history A R n) P) P where
  aemeasurable
Proof
((measurable_history h.measurable_action h.measurable_feedback n).prodMk
      (h.measurable_action (n + 1))).aemeasurable
  map_eq := by
    have hm : Measurable (bestAction ฮบ id) := by fun_prop
    rw [(h.hasCondDistrib_action' n).map_eq]
    refine Measure.compProd_congr ?_
    calc
      _ =แต[P.map (history A R n)]
          (IT.bayesTrajMeasurePosterior Q ฮบ uniformAlgorithm n).map (bestAction ฮบ id) := by rfl
      _ =แต[P.map (history A R n)]
          (condDistrib E (history A R n) P).map (bestAction ฮบ id) := by
          filter_upwards [(h.hasCondDistrib_env_history
            (IT.isBayesAlgEnvSeq_bayesTrajMeasure Q ฮบ uniformAlgorithm)
            absolutelyContinuous_uniformAlgorithm n).condDistrib_eq] with _ hc
          simp_rw [Kernel.map_apply _ hm, IT.bayesTrajMeasurePosterior, hc]
      _ =แต[P.map (history A R n)]
          condDistrib (bestAction ฮบ E) (history A R n) P :=
          (condDistrib_comp (history A R n) h.measurable_param.aemeasurable hm).symm

Actions: 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: 21 project declarations, 96 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.