LeanMachineLearning

Bandits.ArrayModel.indepFun_snd_hist_condπŸ”—

Lemma

No docstring.

πŸ”—theorem
Bandits.ArrayModel.indepFun_snd_hist_cond.{u_1, u_2} {𝓐 : Type u_1} {R : Type u_2} {m𝓐 : MeasurableSpace 𝓐} {mR : MeasurableSpace R} [Nonempty 𝓐] [StandardBorelSpace 𝓐] [DecidableEq 𝓐] [StandardBorelSpace R] [Nonempty R] [Countable 𝓐] (alg : Learning.Algorithm 𝓐 R) (Ξ½ : ProbabilityTheory.Kernel 𝓐 R) [ProbabilityTheory.IsMarkovKernel Ξ½] (a : 𝓐) (n m : β„•) : ProbabilityTheory.IndepFun (fun Ο‰ => Prod.snd Ο‰ m a) (fun x => hist alg x n) (arrayMeasure Ξ½)[|(fun Ο‰ => (action alg (n + 1) Ο‰, Learning.pullCount (action alg) (action alg (n + 1) Ο‰) (n + 1) Ο‰)) ⁻¹' {(a, m)}]
Bandits.ArrayModel.indepFun_snd_hist_cond.{u_1, u_2} {𝓐 : Type u_1} {R : Type u_2} {m𝓐 : MeasurableSpace 𝓐} {mR : MeasurableSpace R} [Nonempty 𝓐] [StandardBorelSpace 𝓐] [DecidableEq 𝓐] [StandardBorelSpace R] [Nonempty R] [Countable 𝓐] (alg : Learning.Algorithm 𝓐 R) (Ξ½ : ProbabilityTheory.Kernel 𝓐 R) [ProbabilityTheory.IsMarkovKernel Ξ½] (a : 𝓐) (n m : β„•) : ProbabilityTheory.IndepFun (fun Ο‰ => Prod.snd Ο‰ m a) (fun x => hist alg x n) (arrayMeasure Ξ½)[|(fun Ο‰ => (action alg (n + 1) Ο‰, Learning.pullCount (action alg) (action alg (n + 1) Ο‰) (n + 1) Ο‰)) ⁻¹' {(a, m)}]

Code

lemma indepFun_snd_hist_cond [Countable 𝓐] (alg : Algorithm 𝓐 R)
    (Ξ½ : Kernel 𝓐 R) [IsMarkovKernel Ξ½] (a : 𝓐) (n m : β„•) :
    (fun Ο‰ ↦ Ο‰.2 m a) βŸ‚α΅’[(arrayMeasure Ξ½)[|(fun Ο‰ ↦ (action alg (n + 1) Ο‰,
      pullCount (action alg) (action alg (n + 1) Ο‰) (n + 1) Ο‰)) ⁻¹' {(a, m)}]]
    (hist alg Β· n)
Proof
by
  have h_meas := measurable_hist_truePast alg a n
  refine IndepFun.of_measurable_right ?_ h_meas
  have h_ae_eq : truePast alg a n =ᡐ[(arrayMeasure Ξ½)[|(fun Ο‰ ↦ (action alg (n + 1) Ο‰,
        pullCount (action alg) (action alg (n + 1) Ο‰) (n + 1) Ο‰)) ⁻¹' {(a, m)}]]
      (fun Ο‰ ↦ (Ο‰.1, fun k b ↦ if b = a then if m β‰  0 then Ο‰.2 (min k (m - 1)) b
        else Nonempty.some inferInstance else Ο‰.2 k b)) := by
    refine ae_cond_of_forall_mem ?_ fun x hx ↦ ?_
    Β· refine (measurableSet_singleton _).preimage ?_
      have h_meas_pc : Measurable fun Ο‰ ↦
          pullCount (action alg) (action alg (n + 1) Ο‰) (n + 1) Ο‰ := by
        change Measurable ((fun p : (probSpace 𝓐 R) Γ— 𝓐 ↦ pullCount (action alg) p.2 (n + 1) p.1) ∘
          (fun Ο‰ : probSpace 𝓐 R ↦ (Ο‰, action alg (n + 1) Ο‰)))
        exact (measurable_uncurry_pullCount (by fun_prop) _).comp (by fun_prop)
      fun_prop
    simp only [Set.mem_preimage, Set.mem_singleton_iff, Prod.mk.injEq] at hx
    simp only [truePast]
    congr with i b
    by_cases hb : b = a
    Β· simp only [hb, ↓reduceIte]
      simp only [hx.1, true_and] at hx
      congr!
    Β· simp [hb]
  refine IndepFun.congr ?_ EventuallyEq.rfl h_ae_eq.symm
  suffices (fun Ο‰ ↦ Ο‰.2 m a) βŸ‚α΅’[(arrayMeasure Ξ½)[|(({Ο‰ | action alg (n + 1) Ο‰ = a ∧
        pullCount (action alg) a (n + 1) Ο‰ = m}).indicator (fun _ ↦ 1)) ⁻¹' {1}]]
      fun Ο‰ ↦ (Ο‰.1, fun k b ↦ if b = a then if m β‰  0 then Ο‰.2 (min k (m - 1)) b
        else Nonempty.some inferInstance else Ο‰.2 k b) by
    convert this using 1
    congr!
    congr with Ο‰
    simp only [Set.mem_preimage, Set.mem_singleton_iff, Prod.mk.injEq, Set.indicator_apply,
      Set.mem_ofPred_eq, ite_eq_left_iff, not_and, zero_ne_one, imp_false,
      Classical.not_imp, Decidable.not_not, and_congr_right_iff]
    intro ha
    simp [ha]
  have h_meas := measurable_stepsUntil alg a m n
  obtain ⟨f, hf, hf_eq⟩ := h_meas.exists_eq_measurable_comp
  simp_rw [hf_eq]
  refine indepFun_cond_comp (Z := f) (z := 1) ?_ ?_ hf
  Β· exact indepFun_snd_apply_aux Ξ½ a m
  Β· refine Measurable.prodMk (by fun_prop) ?_
    simp_rw [measurable_pi_iff]
    intro i b
    refine Measurable.ite (MeasurableSet.const _) ?_ (by fun_prop)
    refine Measurable.ite (MeasurableSet.const _) (by fun_prop) (by fun_prop)

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, 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.