LeanMachineLearning

Learning.stepsUntil_eq_leastGE๐Ÿ”—

Lemma

No docstring.

๐Ÿ”—theorem
Learning.stepsUntil_eq_leastGE.{u_1, u_3} {๐“ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {m : โ„•} (a : ๐“) (hm : m โ‰  0) : stepsUntil A a m = MeasureTheory.leastGE (fun n ฯ‰ => pullCount A a (n + 1) ฯ‰) m
Learning.stepsUntil_eq_leastGE.{u_1, u_3} {๐“ : Type u_1} {ฮฉ : Type u_3} [DecidableEq ๐“] {A : โ„• โ†’ ฮฉ โ†’ ๐“} {m : โ„•} (a : ๐“) (hm : m โ‰  0) : stepsUntil A a m = MeasureTheory.leastGE (fun n ฯ‰ => pullCount A a (n + 1) ฯ‰) m

Code

lemma stepsUntil_eq_leastGE (a : ๐“) (hm : m โ‰  0) :
    stepsUntil A a m = leastGE (fun n (ฯ‰ : ฮฉ) โ†ฆ pullCount A a (n + 1) ฯ‰) m
Proof
by
  classical
  ext ฯ‰
  rw [stepsUntil_eq_dite]
  unfold leastGE hittingAfter
  simp only [Nat.bot_eq_zero, zero_le, Set.mem_Ici, true_and]
  have h_iff : (โˆƒ s, pullCount A a (s + 1) ฯ‰ = m) โ†” (โˆƒ s, m โ‰ค pullCount A a (s + 1) ฯ‰) := by
    refine โŸจfun โŸจs, hsโŸฉ โ†ฆ โŸจs, hs.geโŸฉ, fun โŸจs, hsโŸฉ โ†ฆ ?_โŸฉ
    exact exists_pullCount_eq_of_le hs hm
  by_cases h_exists : โˆƒ s, m โ‰ค pullCount A a (s + 1) ฯ‰
  swap; ยท simp_rw [h_iff]; simp [h_exists]
  rw [ite_eq_left h_exists, dite_eq_left]
  swap; ยท rwa [h_iff]
  simp only [ENat.some_eq_natCast, Nat.cast_inj]
  rw [Nat.find_eq_iff]
  constructor
  ยท apply le_antisymm
    ยท by_contra! h_contra
      obtain โŸจs, hsโŸฉ : โˆƒ s, pullCount A a (s + 1) ฯ‰ = m := exists_pullCount_eq_of_le h_contra.le hm
      rw [โ† hs] at h_contra
      refine h_contra.not_ge ?_
      gcongr
      exact csInf_le (by simp) (by simp)
    ยท exact Nat.sInf_mem (s := {j | m โ‰ค pullCount A a (j + 1) ฯ‰}) h_exists
  ยท intro n hn h_contra
    refine hn.not_ge ?_
    exact csInf_le (by simp) (by simp [h_contra])

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