LeanMachineLearning

Learning.measurable_comap_indicator_stepsUntil_eq๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
Learning.measurable_comap_indicator_stepsUntil_eq.{u_1, u_2, u_3} {๐“ : Type u_1} {R : Type u_2} {ฮฉ : Type u_3} {m๐“ : MeasurableSpace ๐“} {mR : MeasurableSpace R} {mฮฉ : MeasurableSpace ฮฉ} [DecidableEq ๐“] {alg : Algorithm ๐“ R} {env : Environment ๐“ R} {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R' : โ„• โ†’ ฮฉ โ†’ R} [MeasurableSingletonClass ๐“] (h : IsAlgEnvSeq A R' alg env P) (a : ๐“) (m n : โ„•) : Measurable (Set.indicator {ฯ‰ | stepsUntil A a m ฯ‰ = โ†‘n} fun x => 1)
Learning.measurable_comap_indicator_stepsUntil_eq.{u_1, u_2, u_3} {๐“ : Type u_1} {R : Type u_2} {ฮฉ : Type u_3} {m๐“ : MeasurableSpace ๐“} {mR : MeasurableSpace R} {mฮฉ : MeasurableSpace ฮฉ} [DecidableEq ๐“] {alg : Algorithm ๐“ R} {env : Environment ๐“ R} {P : MeasureTheory.Measure ฮฉ} [MeasureTheory.IsProbabilityMeasure P] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {R' : โ„• โ†’ ฮฉ โ†’ R} [MeasurableSingletonClass ๐“] (h : IsAlgEnvSeq A R' alg env P) (a : ๐“) (m n : โ„•) : Measurable (Set.indicator {ฯ‰ | stepsUntil A a m ฯ‰ = โ†‘n} fun x => 1)

Code

lemma measurable_comap_indicator_stepsUntil_eq [MeasurableSingletonClass ๐“]
    (h : IsAlgEnvSeq A R' alg env P) (a : ๐“) (m n : โ„•) :
    Measurable[MeasurableSpace.comap
        (fun ฯ‰ : ฮฉ โ†ฆ (history A R' (n-1) ฯ‰, A n ฯ‰)) inferInstance]
      ({ฯ‰ | stepsUntil A a m ฯ‰ = โ†‘n}.indicator fun _ โ†ฆ 1)
Proof
by
  by_cases hm : m = 0
  ยท simp only [hm]
    by_cases hn : n = 0
    ยท subst hn
      simp only [CharP.cast_eq_zero, stepsUntil_eq_zero_iff, ne_eq, true_and, zero_ne_one,
        false_and, or_false]
      refine Measurable.indicator measurable_const ?_
      refine (measurableSet_singleton _).compl.preimage ?_
      rw [measurable_iff_comap_le, Prod.instMeasurableSpace, MeasurableSpace.comap_prodMk]
      exact le_sup_of_le_right le_rfl
    ยท have : {ฯ‰ | stepsUntil A a 0 ฯ‰ = n} = โˆ… := by
        ext ฯ‰
        by_cases ha : A 0 ฯ‰ = a
        ยท simp [stepsUntil_zero_of_eq ha]
        ยท simp only [Set.mem_ofPred_eq, stepsUntil_zero_of_ne ha, Set.mem_empty_iff_false,
            iff_false]
          norm_cast
          exact Ne.symm hn
      simp [this]
  simp_rw [stepsUntil_eq_iff' hm]
  refine Measurable.indicator measurable_const ?_
  refine ((measurableSet_singleton _).preimage ?_).inter ((measurableSet_singleton _).preimage ?_)
  ยท rw [measurable_iff_comap_le, Prod.instMeasurableSpace, MeasurableSpace.comap_prodMk]
    exact le_sup_of_le_right le_rfl
  ยท rw [measurable_iff_comap_le, Prod.instMeasurableSpace, MeasurableSpace.comap_prodMk]
    refine le_sup_of_le_left ?_
    rw [โ† measurable_iff_comap_le]
    by_cases hn : n = 0
    ยท simp only [hn, pullCount_zero]
      exact measurable_const
    have h_meas := adapted_pullCount_add_one h a (n - 1)
    have : 1 โ‰ค n := by grind
    convert h_meas using 1
    ยท rfl
    ยท simp [Nat.sub_add_cancel this]

Actions: Source ยท Open Issue

Meaning last changed in v4.34.0-rc2-2-g4830b8c (2026-08-23), the 2th 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: 6 project declarations, 69 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.