Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§8.1.2, p. 73 — Thompson sampling matches the posterior law of the optimal action

Proved
TSTutorial.UCBDecomp.ts_prob_matching

by mikedeng1 · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

bayesian-banditsp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1probability-matchingthompson-sampling

Let x∗(θ)x^*(\theta)x∗(θ) be a measurable optimal action in the Bayesian model, and let π\piπ be Thompson sampling with the same tie-break. For every history hhh of sss periods and every action aaa,

Pr⁡π(Hs=h, xs+1=a)=Pr⁡π(Hs=h, x∗=a).\Pr_\pi(H_s=h,\ x_{s+1}=a) =\Pr_\pi(H_s=h,\ x^*=a).πPr​(Hs​=h, xs+1​=a)=πPr​(Hs​=h, x∗=a).

This is the probability-matching property used in equation (8.4): conditional on the observed past, the next Thompson-sampling action has the posterior distribution of the optimal action.

Formalization Note The action and outcome sets are finite; the parameter space remains general. The likelihood includes the policy's action probabilities and the outcome kernel. The posterior uses the prior and outcome likelihood, with no restriction on policy behavior at histories of zero evidence.

Preamble
import Mathlib
import Definitions.Def_TSTutorial_UCBDecomp_Setting

open MeasureTheory
open scoped BigOperators
Formal statement
namespace TSTutorial.UCBDecomp

variable {X Y Θ : Type*} [Fintype X] [DecidableEq X] [Nonempty X]
  [Fintype Y] [DecidableEq Y] [MeasurableSpace Θ]

/-- TS draws the next action from the conditional law of the optimal action (p. 73). -/
theorem ts_prob_matching (m : Model X Y Θ) (xStar : Θ → X)
    (hx : IsOptimalSelector m xStar) (π : Policy X Y)
    (hπ : IsThompsonSampling m xStar π) (s : ℕ)
    (h : Hist X Y s) (a : X) :
    (∑ y : Y, histProb m π (s + 1) (snoc h (a, y))) =
      jointProb m xStar π s a h := by sorry

end TSTutorial.UCBDecomp
Source
Russo, Van Roy, Kazerouni, Osband, Wen, A Tutorial on Thompson Sampling, Found. Trends Mach. Learn. 11(1) (2018), §8.1.2 p. 73, sentence following (8.4)
Human review
  • Endorsed by Shuze Chen · Oct 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me