LeanMachineLearning

Bandits.indepFun_update_rewardByCountUntil_evalšŸ”—

Lemma

From the authors

The array rewardByCountUntil A R t with the entry (b, k) erased is independent of the entry (k + 1, b) of the auxiliary array.

Types
  • š“ : Type u_1mš“ : MeasurableSpace š“A measurable space is a space equipped with a σ-algebra.DecidableEq š“MeasurableSingletonClass š“A typeclass mixin for MeasurableSpaces such that each singleton is measurable.Countable š“A type α is countable if there exists an injective map α → ā„•.
  • Ī© : Type u_2mĪ© : MeasurableSpace Ī©
Given
  • A : ā„• → Ī© → š“
  • R : ā„• → Ī© → ā„
  • ν : ProbabilityTheory.Kernel š“ ā„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.
  • μ : 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 μA measure μ is called a probability measure if μ univ = 1.
  • t : ā„•
  • b : š“
  • k : ā„•
Assuming
  • hA : āˆ€ (n : ā„•), Measurable (A n)A function f between measurable spaces is measurable if the preimage of every measurable set is measurable.
  • hR : āˆ€ (n : ā„•), Measurable (R n)
Then
ProbabilityTheory.IndepFun (fun ω => Function.update (Learning.rewardByCountUntil A R t ω) (b, k) 0)
  (fun ω => ω.2 (k + 1) b) (μ.prod (streamMeasure ν))
Two functions are independent if the two measurable space structures they generate are independent.
Code
lemma indepFun_update_rewardByCountUntil_eval [Countable š“] (hA : āˆ€ n, Measurable (A n))
    (hR : āˆ€ n, Measurable (R n)) (μ : Measure Ī©) [IsProbabilityMeasure μ] (t : ā„•) (b : š“) (k : ā„•) :
    (fun ω ↦ Function.update (rewardByCountUntil A R t ω) (b, k) 0)
      āŸ‚įµ¢[μ.prod (streamMeasure ν)] (fun ω ↦ ω.2 (k + 1) b)
Proof
by
  refine ((indepFun_snd_apply_prod_streamMeasure_update μ ν (k + 1) b 0).of_measurable_right
    ?_).symm
  have h_eq : (fun ω : Ī© Ɨ (ā„• → š“ → ā„) ↦ Function.update (rewardByCountUntil A R t ω) (b, k) 0)
      = (fun ω ↦ Function.update (rewardByCountUntil A R t ω) (b, k) 0)
        ∘ (fun ω ↦ (ω.1, fun i c ↦ if i = k + 1 ∧ c = b then 0 else ω.2 i c)) := by
    ext ⟨x, z⟩ p
    simp only [Function.comp_apply]
    by_cases hp : p = (b, k)
    Ā· rw [hp, Function.update_self, Function.update_self]
    Ā· rw [Function.update_of_ne hp, Function.update_of_ne hp]
      refine rewardByCountUntil_congr t p ?_
      split_ifs with hc
      Ā· exact absurd (Prod.ext hc.2 (by have := hc.1; omega)) hp
      Ā· rfl
  rw [h_eq]
  exact measurable_comp_comap _
    (measurable_update_left.comp (measurable_rewardByCountUntil hA hR t))

Meaning last changed in v4.34.0-rc2-76-g565f652 (2026-09-10).

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: 3 project declarations, 42 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.