LeanMachineLearning

Bandits.ArrayModel.hasCondDistrib_reward'๐Ÿ”—

Lemma

The conditional distribution of the reward at time n + 1, given the history up to time n and the action at time n + 1, is equal to the kernel ฮฝ.

๐Ÿ”—theorem
Bandits.ArrayModel.hasCondDistrib_reward'.{u_1, u_2} {๐“ : Type u_1} {R : Type u_2} {m๐“ : MeasurableSpace ๐“} {mR : MeasurableSpace R} [Nonempty ๐“] [StandardBorelSpace ๐“] [DecidableEq ๐“] [Countable ๐“] [StandardBorelSpace R] [Nonempty R] (alg : Learning.Algorithm ๐“ R) (ฮฝ : ProbabilityTheory.Kernel ๐“ R) [ProbabilityTheory.IsMarkovKernel ฮฝ] (n : โ„•) : ProbabilityTheory.HasCondDistrib (reward alg (n + 1)) (fun ฯ‰ => (hist alg ฯ‰ n, action alg (n + 1) ฯ‰)) (ProbabilityTheory.Kernel.prodMkLeft (โ†ฅ(Finset.Iic n) โ†’ ๐“ ร— R) ฮฝ) (arrayMeasure ฮฝ)
Bandits.ArrayModel.hasCondDistrib_reward'.{u_1, u_2} {๐“ : Type u_1} {R : Type u_2} {m๐“ : MeasurableSpace ๐“} {mR : MeasurableSpace R} [Nonempty ๐“] [StandardBorelSpace ๐“] [DecidableEq ๐“] [Countable ๐“] [StandardBorelSpace R] [Nonempty R] (alg : Learning.Algorithm ๐“ R) (ฮฝ : ProbabilityTheory.Kernel ๐“ R) [ProbabilityTheory.IsMarkovKernel ฮฝ] (n : โ„•) : ProbabilityTheory.HasCondDistrib (reward alg (n + 1)) (fun ฯ‰ => (hist alg ฯ‰ n, action alg (n + 1) ฯ‰)) (ProbabilityTheory.Kernel.prodMkLeft (โ†ฅ(Finset.Iic n) โ†’ ๐“ ร— R) ฮฝ) (arrayMeasure ฮฝ)

Code

lemma hasCondDistrib_reward' (alg : Algorithm ๐“ R) (ฮฝ : Kernel ๐“ R) [IsMarkovKernel ฮฝ] (n : โ„•) :
    HasCondDistrib (reward alg (n + 1)) (fun ฯ‰ โ†ฆ (hist alg ฯ‰ n, action alg (n + 1) ฯ‰))
      (ฮฝ.prodMkLeft _) (arrayMeasure ฮฝ)
Proof
by
  let R' := reward alg (n + 1)
  let H := (hist alg ยท n)
  let A := action alg (n + 1)
  let P := fun ฯ‰ โ†ฆ pullCount (action alg) (action alg (n + 1) ฯ‰) (n + 1) ฯ‰
  have hP : Measurable P := measurable_pullCount_action_add_one alg n
  change HasCondDistrib R' (fun ฯ‰ โ†ฆ (H ฯ‰, A ฯ‰)) (ฮฝ.prodMkLeft _) _
  suffices HasCondDistrib R' (fun ฯ‰ โ†ฆ (A ฯ‰, H ฯ‰)) (ฮฝ.prodMkRight _) (arrayMeasure ฮฝ) by
    have h_eq : (fun ฯ‰ โ†ฆ (H ฯ‰, A ฯ‰)) = MeasurableEquiv.prodComm โˆ˜ (fun ฯ‰ โ†ฆ (A ฯ‰, H ฯ‰)) := rfl
    rw [h_eq]
    exact this.measurableEquiv_comp_right (ฮบ := ฮฝ.prodMkRight _) _
  suffices HasCondDistrib R' (fun ฯ‰ โ†ฆ ((A ฯ‰, H ฯ‰), P ฯ‰))
      ((ฮฝ.prodMkRight _).prodMkRight _) (arrayMeasure ฮฝ) by
    -- use that `P` is measurable wrt `(A, H)` to drop it from the conditioning
    have hP_meas :
        Measurable[MeasurableSpace.comap (fun ฯ‰ โ†ฆ (A ฯ‰, H ฯ‰)) inferInstance] P :=
      measurable_pullCount_action_add_one_hist alg n
    obtain โŸจf, hf_meas, hf_eqโŸฉ := hP_meas.exists_eq_measurable_comp
    simp only [hf_eq, Function.comp_apply] at this
    rwa [hasCondDistrib_prod_right_iff _ _ hf_meas] at this
  suffices HasCondDistrib R' (fun ฯ‰ โ†ฆ ((A ฯ‰, P ฯ‰), H ฯ‰))
      ((ฮฝ.prodMkRight _).prodMkRight _) (arrayMeasure ฮฝ) by
    let e : ((๐“ ร— โ„•) ร— (Iic n โ†’ ๐“ ร— R)) โ‰ƒแต ((๐“ ร— (Iic n โ†’ ๐“ ร— R)) ร— โ„•) :=
    { toFun := fun x โ†ฆ ((x.1.1, x.2), x.1.2)
      invFun := fun x โ†ฆ ((x.1.1, x.2), x.1.2)
      measurable_toFun := by simp only [Equiv.coe_fn_mk]; fun_prop
      measurable_invFun := by simp only [Equiv.symm_mk, Equiv.coe_fn_mk]; fun_prop }
    exact this.measurableEquiv_comp_right e
  suffices HasCondDistrib R' (fun ฯ‰ โ†ฆ (A ฯ‰, P ฯ‰)) (ฮฝ.prodMkRight _) (arrayMeasure ฮฝ) by
    have h_indep : H โŸ‚แตข[(fun ฯ‰ โ†ฆ (A ฯ‰, P ฯ‰)), (by fun_prop); arrayMeasure ฮฝ] R' :=
      (condIndepFun_reward_hist alg ฮฝ n).symm
    have h_condDistrib := this.condDistrib_eq
    rw [condIndepFun_iff_condDistrib_prod_ae_eq_prodMkRight (by fun_prop) (by fun_prop)
      (by fun_prop)] at h_indep
    refine hasCondDistrib_of_condDistrib_eq (by fun_prop) (by fun_prop) ?_
    refine h_indep.trans ?_
    rw [Filter.EventuallyEq, ae_map_iff] at h_condDistrib โŠข
    ยท simpa only [Kernel.prodMkRight_apply]
    ยท fun_prop
    ยท exact Kernel.measurableSet_eq _ _
    ยท fun_prop
    ยท exact Kernel.measurableSet_eq _ _
  exact hasCondDistrib_reward_pullCount_action alg ฮฝ n

Actions: Source ยท Open Issue

Meaning last changed in v4.34.0-rc2-1-g439785b (2026-08-23), 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: 13 project declarations, 92 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.