LeanMachineLearning

Learning.measurable_stepsUntil๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
Learning.measurable_stepsUntil.{u_1, u_3} {๐“ : Type u_1} {ฮฉ : Type u_3} {m๐“ : MeasurableSpace ๐“} {mฮฉ : MeasurableSpace ฮฉ} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} [MeasurableSingletonClass ๐“] (hA : โˆ€ (n : โ„•), Measurable (A n)) (a : ๐“) (m : โ„•) : Measurable (stepsUntil A a m)
Learning.measurable_stepsUntil.{u_1, u_3} {๐“ : Type u_1} {ฮฉ : Type u_3} {m๐“ : MeasurableSpace ๐“} {mฮฉ : MeasurableSpace ฮฉ} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} [MeasurableSingletonClass ๐“] (hA : โˆ€ (n : โ„•), Measurable (A n)) (a : ๐“) (m : โ„•) : Measurable (stepsUntil A a m)

Code

lemma measurable_stepsUntil [MeasurableSingletonClass ๐“]
    (hA : โˆ€ n, Measurable (A n)) (a : ๐“) (m : โ„•) :
    Measurable (stepsUntil A a m)
Proof
by
  classical
  have h_union : {h' : ฮฉ | โˆƒ s, pullCount A a (s + 1) h' = m}
      = โ‹ƒ s : โ„•, {h' | pullCount A a (s + 1) h' = m} := by ext; simp
  have h_meas_set : MeasurableSet {h' : ฮฉ | โˆƒ s, pullCount A a (s + 1) h' = m} := by
    rw [h_union]
    refine MeasurableSet.iUnion fun s โ†ฆ (measurableSet_singleton _).preimage ?_
    exact measurable_pullCount hA a (s + 1)
  suffices Measurable fun k โ†ฆ if h : k โˆˆ {k' | โˆƒ s, pullCount A a (s + 1) k' = m}
      then (Nat.find h : โ„•โˆž) else โŠค by
    convert this with ฯ‰
    rw [stepsUntil_eq_dite a m ฯ‰]
    rfl
  refine Measurable.dite (s := {k' : ฮฉ | โˆƒ s, pullCount A a (s + 1) k' = m})
    (f := fun x โ†ฆ (Nat.find x.2 : โ„•โˆž)) (g := fun _ โ†ฆ โŠค) ?_ (by fun_prop) h_meas_set
  refine Measurable.coe_nat_enat ?_
  refine measurable_find _ fun k โ†ฆ ?_
  suffices MeasurableSet {x : ฮฉ | pullCount A a (k + 1) x = m} by
    have : Subtype.val '' {x : {k' : ฮฉ |
          โˆƒ s, pullCount A a (s + 1) k' = m} | pullCount A a (k + 1) (x : ฮฉ) = m}
        = {x : ฮฉ | pullCount A a (k + 1) x = m} := by
      ext x
      simp only [Set.mem_ofPred_eq, Set.coe_ofPred, Set.mem_image, Subtype.exists, exists_and_left,
        exists_prop, exists_eq_right_right, and_iff_left_iff_imp]
      exact fun h โ†ฆ โŸจ_, hโŸฉ
    refine (MeasurableEmbedding.subtype_coe h_meas_set).measurableSet_image.mp ?_
    rw [this]
    exact (measurableSet_singleton _).preimage (by fun_prop)
  exact (measurableSet_singleton _).preimage (by fun_prop)

Actions: Source ยท Open Issue

Meaning last changed in v4.34.0-rc1-3-g2cf8f3b (2026-08-20).

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