LeanMachineLearning

Learning.measurable_rewardByCountUntil_of๐Ÿ”—

Lemma

From the authors

Measurability of rewardByCountUntil A R' t with respect to a ฯƒ-algebra m for which the actions and rewards before time t and the auxiliary array are measurable.

Types
  • ๐“ : Type u_2m๐“ : MeasurableSpace ๐“A measurable space is a space equipped with a ฯƒ-algebra.DecidableEq ๐“MeasurableEq ๐“Typeclass for a measurable space ฮฑ for which the diagonal of ฮฑ ร— ฮฑ is measurable.
  • R : Type u_3mR : MeasurableSpace R
  • ฮฉ : Type u_4m : MeasurableSpace (ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R))
Given
  • A : โ„• โ†’ ฮฉ โ†’ ๐“
  • R' : โ„• โ†’ ฮฉ โ†’ R
  • t : โ„•
Assuming
  • hA : โˆ€ i < t, Measurable fun ฯ‰ => A i ฯ‰.1A function f between measurable spaces is measurable if the preimage of every measurable set is measurable.
  • hR : โˆ€ i < t, Measurable fun ฯ‰ => R' i ฯ‰.1
  • hZ : Measurable Prod.snd
Then
Measurable (rewardByCountUntil A R' t)
Code
lemma measurable_rewardByCountUntil_of {m : MeasurableSpace (ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R))}
    [MeasurableEq ๐“] (t : โ„•)
    (hA : โˆ€ i < t, Measurable[m] (fun ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R) โ†ฆ A i ฯ‰.1))
    (hR : โˆ€ i < t, Measurable[m] (fun ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R) โ†ฆ R' i ฯ‰.1))
    (hZ : Measurable[m] (Prod.snd : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R) โ†’ โ„• โ†’ ๐“ โ†’ R)) :
    Measurable[m] (rewardByCountUntil A R' t)
Proof
by
  induction t with
  | zero =>
    have : rewardByCountUntil A R' 0 = (fun z (p : ๐“ ร— โ„•) โ†ฆ z (p.2 + 1) p.1) โˆ˜ Prod.snd := rfl
    rw [this]
    exact Measurable.comp (by fun_prop) hZ
  | succ t ih =>
    have ht : t < t + 1 := Nat.lt_succ_self t
    have ih := ih (fun i hi โ†ฆ hA i (hi.trans ht)) (fun i hi โ†ฆ hR i (hi.trans ht))
    have hg : Measurable[m] (fun ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R) โ†ฆ
        (A t ฯ‰.1, pullCount A (A t ฯ‰.1) t ฯ‰.1)) := by
      refine Measurable.prodMk (hA t ht) ?_
      simp_rw [pullCount_eq_sum]
      refine Finset.measurable_sum _ fun s hs โ†ฆ Measurable.ite ?_ measurable_const measurable_const
      exact measurableSet_eq_fun (hA s ((Finset.mem_range.1 hs).trans ht)) (hA t ht)
    refine measurable_pi_iff.2 fun p โ†ฆ ?_
    simp_rw [rewardByCountUntil_add_one, Function.update_apply]
    refine Measurable.ite ?_ (hR t ht) ((measurable_pi_apply p).comp ih)
    have h_set : {ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R) | p = (A t ฯ‰.1, pullCount A (A t ฯ‰.1) t ฯ‰.1)}
        = (fun ฯ‰ : ฮฉ ร— (โ„• โ†’ ๐“ โ†’ R) โ†ฆ (A t ฯ‰.1, pullCount A (A t ฯ‰.1) t ฯ‰.1)) โปยน' {p} := by
      ext ฯ‰
      simp [eq_comm]
    rw [h_set]
    exact hg (measurableSet_singleton p)

New in v4.34.0-rc2-31-g21d7e67 (2026-09-07), and its meaning has not changed since.

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: 2 project declarations, 29 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.