LeanMachineLearning

Bandits.ArrayModel.hasCondDistrib_action'๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
Bandits.ArrayModel.hasCondDistrib_action'.{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 (action alg (n + 1)) (fun x => hist alg x n) (Learning.Algorithm.policy alg n) (arrayMeasure ฮฝ)
Bandits.ArrayModel.hasCondDistrib_action'.{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 (action alg (n + 1)) (fun x => hist alg x n) (Learning.Algorithm.policy alg n) (arrayMeasure ฮฝ)

Code

lemma hasCondDistrib_action' (alg : Algorithm ๐“ R) (ฮฝ : Kernel ๐“ R) [IsMarkovKernel ฮฝ] (n : โ„•) :
    HasCondDistrib (action alg (n + 1)) (hist alg ยท n) (alg.policy n) (arrayMeasure ฮฝ)
Proof
by
  rw [action_add_one_eq]
  have h_fun ฯ‰ := algFunction_map alg n (hist alg ฯ‰ n)
  refine โŸจby fun_prop, ?_โŸฉ
  have h_indep : (arrayMeasure ฮฝ).map (fun ฯ‰ โ†ฆ (ฯ‰.1 (n + 1), hist alg ฯ‰ n)) =
      (โ„™).prod ((arrayMeasure ฮฝ).map (hist alg ยท n)) := by
    have h_indep' := indepFun_fst_add_one_hist alg ฮฝ n
    rw [indepFun_iff_map_prod_eq_prod_map_map (by fun_prop) (by fun_prop)] at h_indep'
    rw [h_indep']
    congr
    simp only [arrayMeasure]
    calc ((Measure.infinitePi fun x โ†ฆ โ„™).prod (streamMeasure ฮฝ)).map (fun ฯ‰ โ†ฆ ฯ‰.1 (n + 1))
    _ = (Measure.infinitePi fun x โ†ฆ โ„™).map (Function.eval (n + 1)) := by
      nth_rw 2 [โ† Measure.fst_prod (ฮผ := Measure.infinitePi fun x โ†ฆ โ„™)
        (ฮฝ := streamMeasure ฮฝ)]
      rw [Measure.fst, Measure.map_map (by fun_prop) (by fun_prop)]
      rfl
    _ = โ„™ := by rw [Measure.infinitePi_map_eval]
  have : (fun x โ†ฆ (hist alg x n, algFunction alg n (hist alg x n) (x.1 (n + 1)))) =
      (fun p โ†ฆ (p.2, algFunction alg n (p.2) (p.1))) โˆ˜ (fun x โ†ฆ (x.1 (n + 1), hist alg x n)) := rfl
  rw [this, โ† Measure.map_map (by fun_prop) (by fun_prop), h_indep]
  have : (โ„™ : Measure I).prod ((arrayMeasure ฮฝ).map (hist alg ยท n)) =
      ((Kernel.const _ โ„™) ร—โ‚– Kernel.id) โˆ˜โ‚˜ ((arrayMeasure ฮฝ).map (hist alg ยท n)) := by
    have h := Measure.compProd_const (ฮผ := (arrayMeasure ฮฝ).map (hist alg ยท n))
      (ฮฝ := (โ„™ : Measure I))
    rw [Measure.compProd_eq_comp_prod] at h
    rw [โ† Measure.prod_swap, โ† h, โ† Measure.deterministic_comp_eq_map (by fun_prop),
      Measure.comp_assoc, โ† Kernel.swap, Kernel.swap_prod]
  rw [this, โ† Measure.deterministic_comp_eq_map (by fun_prop),
    โ† Measure.deterministic_comp_eq_map (by fun_prop), Measure.compProd_eq_comp_prod,
    Measure.comp_assoc, Measure.comp_assoc, Measure.comp_assoc]
  congr 2
  ext ฯ‰ : 1
  simp only [Kernel.deterministic_comp_eq_map, Kernel.comp_deterministic_eq_comap, Kernel.coe_comap,
    Function.comp_apply]
  rw [Kernel.map_apply _ (by fun_prop), Kernel.prod_apply, Kernel.const_apply, Kernel.id_apply,
    Kernel.prod_apply, Kernel.id_apply, โ† h_fun]
  calc (((โ„™).prod (Measure.dirac (hist alg ฯ‰ n)))).map (fun p โ†ฆ (p.2, algFunction alg n p.2 p.1))
  _ = (((โ„™).prod (Measure.dirac (hist alg ฯ‰ n))).map Prod.swap).map
      (fun p โ†ฆ (p.1, algFunction alg n p.1 p.2)) := by
    rw [Measure.map_map (by fun_prop) (by fun_prop)]
    rfl
  _ = ((Measure.dirac (hist alg ฯ‰ n)).prod โ„™).map (fun p โ†ฆ (p.1, algFunction alg n p.1 p.2)) := by
    rw [Measure.prod_swap]
  _ = (Measure.dirac (hist alg ฯ‰ n)).prod ((โ„™).map (algFunction alg n (hist alg ฯ‰ n))) := by
    ext s hs
    rw [Measure.map_apply (by fun_prop) hs, Measure.prod_apply, lintegral_dirac, Measure.prod_apply,
      lintegral_dirac, Measure.map_apply (by fun_prop)]
    ยท congr
    ยท exact hs.preimage (by fun_prop)
    ยท exact hs
    ยท exact hs.preimage (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: 12 project declarations, 91 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.