zzhisthebest/LeanBenchmark huggingface dataset:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory

theorem extracted_formal_statement_1.{u_2, u_1} {Ω : Type u_1} [inst : MeasurableSpace Ω] {μ : Measure Ω}
  [inst_1 : IsProbabilityMeasure μ] {𝓧 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} [hnonempty𝓧 : Nonempty 𝓧] {m : ℕ}
  {X' : Fin m → Ω → 𝓧} (hX'' : ∀ (i : Fin m), Measurable (X' i)) (hIndep' : iIndepFun X' μ) {f' : (Fin m → 𝓧) → ℝ}
  {c' : Fin m → ℝ} (hfι : ∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i)
  (hf'' : StronglyMeasurable f') {t : ℝ} (ht : t ≥ 0) (ht' : t * ∑ i, c' i ^ 2 ≤ 1) :
  let Y := fun k Xk => ∫ (x : Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else X' i ω) x ∂μ;
  ∀ (k : Fin m) (Xk : Fin ↑k → 𝓧) (x : 𝓧),
    Y k.succ (Fin.snoc Xk x) =
      ∫ (x_1 : Ω),
        (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' i ω) x_1 ∂μ := sorry

Tactic state before:
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsProbabilityMeasure μ
𝓧 : Type u_2
m𝓧 : MeasurableSpace 𝓧
hnonempty𝓧 : Nonempty 𝓧
m : ℕ
X' : Fin m → Ω → 𝓧
hX'' : ∀ (i : Fin m), Measurable (X' i)
hIndep' : iIndepFun X' μ
f' : (Fin m → 𝓧) → ℝ
c' : Fin m → ℝ
hfι : ∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i
hf'' : StronglyMeasurable f'
ε : ℝ
hε : ε > 0
t : ℝ
ht : t ≥ 0
ht' : t * ∑ i, c' i ^ 2 ≤ 1
Y : (k : Fin m.succ) → (Fin ↑k → 𝓧) → ℝ :=
  fun k Xk => ∫ (x : Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else X' i ω) x ∂μ
A : (k : Fin m) → (Fin ↑k → 𝓧) → ℝ :=
  fun k Xk =>
    ⨅ x, ∫ (x_1 : Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' i ω) x_1 ∂μ
B : (k : Fin m) → (Fin ↑k → 𝓧) → ℝ :=
  fun k Xk =>
    ⨆ x, ∫ (x_1 : Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' i ω) x_1 ∂μ
k : Fin m
Xk : Fin ↑k → 𝓧
x : 𝓧
⊢ Y k.succ (Fin.snoc Xk x) =
    ∫ (x_1 : Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' i ω) x_1 ∂μ

Tactic:
apply integral_congr_ae
    filter_upwards with ω
    apply congr rfl
    ext i
    if h : i.1 < k.1 then 
  have : i.1 < (Fin.succ k).1 := by dsimp; linarith
  rw [dif_pos this, dif_pos h]
  have : ⟨i.1, this⟩ = (⟨i.1, h⟩ : Fin k).castSucc := rfl
  rw [this]
  apply Fin.snoc_castSucc
else
  rw [dif_neg h]
  if h2 : i.1 = k.1 then 
    have : i.1 < (Fin.succ k).1 := by dsimp; linarith
    rw [dif_pos this, if_pos h2]
    have : ⟨i.1, this⟩ = Fin.last k := by
      apply Eq.symm
      apply Fin.eq_mk_iff_val_eq.mpr
      exact id (Eq.symm h2)
    rw [this]
    apply Fin.snoc_last
  else
    have : ¬(i.1 < (Fin.succ k).1) := by
      simp only [Fin.val_succ, not_lt]
      simp only [Fin.val_fin_lt, not_lt] at h
      apply Fin.val_add_one_le_of_lt
      exact lt_of_le_of_ne h fun a => h2 (congrArg Fin.val (id (Eq.symm a)))
    rw [dif_neg this, if_neg h2]

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory

theorem extracted_formal_statement_12.{u_3, u_2, u_1} {Ω : Type u_1} [inst : MeasurableSpace Ω] {μ : Measure Ω}
  [inst_1 : IsProbabilityMeasure μ] {𝓧 : Type u_2} {ι : Type u_3} [inst_2 : DecidableEq ι] {m𝓧 : MeasurableSpace 𝓧}
  [hnonempty𝓧 : Nonempty 𝓧] [inst_3 : Fintype ι] (X : ι → Ω → 𝓧) (hX : ∀ (i : ι), Measurable (X i))
  (hX' : iIndepFun X μ) (f : (ι → 𝓧) → ℝ) (c : ι → ℝ)
  (hf : ∀ (i : ι) (x : ι → 𝓧) (x' : 𝓧), |f x - f (Function.update x i x')| ≤ c i) (hf' : Measurable f) (ε : ℝ)
  (hε : ε > 0) (t : ℝ) (ht' : t * ∑ i, c i ^ 2 ≤ 1) :
  let m := Fintype.card ι;
  let ιm := Fintype.equivFinOfCardEq rfl;
  let X' := X ∘ ⇑ιm.symm;
  let f' := f ∘ fun s => s ∘ ⇑ιm;
  let c' := c ∘ ⇑ιm.symm;
  (∀ (X : Fin m → 𝓧) (k : Fin m) (x : 𝓧), Function.update X k x ∘ ⇑ιm = Function.update (X ∘ ⇑ιm) (ιm.symm k) x) →
    (∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i) →
      StronglyMeasurable f' →
        iIndepFun X' μ →
          (∀ (i : Fin m), Measurable (X (ιm.symm i))) →
            t * ∑ i', c' i' ^ 2 ≤ 1 →
              t ≥ 0 →
                (μ fun ω =>
                        (f' ∘ Function.swap fun i => X (ιm.symm i)) ω -
                            ∫ (x : Ω), (f' ∘ Function.swap fun i => X (ιm.symm i)) x ∂μ ≥
                          ε).toReal ≤
                    Real.exp (-2 * ε ^ 2 * t) →
                  ∀ (ω : Ω),
                    ((f ∘ fun s => s ∘ ⇑ιm) ∘ Function.swap fun i => X (ιm.symm i)) ω = (f ∘ Function.swap X) ω := sorry

Tactic state before:
case h
Ω : Type u_1
inst✝³ : MeasurableSpace Ω
μ : Measure Ω
inst✝² : IsProbabilityMeasure μ
𝓧 : Type u_2
ι : Type u_3
inst✝¹ : DecidableEq ι
m𝓧 : MeasurableSpace 𝓧
hnonempty𝓧 : Nonempty 𝓧
inst✝ : Fintype ι
X : ι → Ω → 𝓧
hX : ∀ (i : ι), Measurable (X i)
hX' : iIndepFun X μ
f : (ι → 𝓧) → ℝ
c : ι → ℝ
hf : ∀ (i : ι) (x : ι → 𝓧) (x' : 𝓧), |f x - f (Function.update x i x')| ≤ c i
hf' : Measurable f
ε : ℝ
hε : ε > 0
t : ℝ
ht' : t * ∑ i, c i ^ 2 ≤ 1
m : ℕ := Fintype.card ι
ιm : ι ≃ Fin m := Fintype.equivFinOfCardEq ⋯
X' : Fin m → Ω → 𝓧 := X ∘ ⇑ιm.symm
f' : (Fin m → 𝓧) → ℝ := f ∘ fun s => s ∘ ⇑ιm
c' : Fin m → ℝ := c ∘ ⇑ιm.symm
hequpdate : ∀ (X : Fin m → 𝓧) (k : Fin m) (x : 𝓧), Function.update X k x ∘ ⇑ιm = Function.update (X ∘ ⇑ιm) (ιm.symm k) x
hfι : ∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i
hf'' : StronglyMeasurable f'
hIndep' : iIndepFun X' μ
hX'' : ∀ (i : Fin m), Measurable (X (ιm.symm i))
ht'' : t * ∑ i', c' i' ^ 2 ≤ 1
ht : t ≥ 0
this :
  (μ fun ω =>
        (f' ∘ Function.swap fun i => X (ιm.symm i)) ω - ∫ (x : Ω), (f' ∘ Function.swap fun i => X (ιm.symm i)) x ∂μ ≥
          ε).toReal ≤
    Real.exp (-2 * ε ^ 2 * t)
ω : Ω
⊢ ((f ∘ fun s => s ∘ ⇑ιm) ∘ Function.swap fun i => X (ιm.symm i)) ω = (f ∘ Function.swap X) ω

Tactic:
simp only [Function.comp_apply, f']
    apply congrArg
    ext i
    dsimp [Function.swap]
    simp

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory

theorem extracted_formal_statement_13.{u_3, u_2, u_1} {Ω : Type u_1} [inst : MeasurableSpace Ω] {μ : Measure Ω}
  [inst_1 : IsProbabilityMeasure μ] {𝓧 : Type u_2} {ι : Type u_3} [inst_2 : DecidableEq ι] {m𝓧 : MeasurableSpace 𝓧}
  [hnonempty𝓧 : Nonempty 𝓧] [inst_3 : Fintype ι] (X : ι → Ω → 𝓧) (hX : ∀ (i : ι), Measurable (X i))
  (hX' : iIndepFun X μ) (f : (ι → 𝓧) → ℝ) (c : ι → ℝ)
  (hf : ∀ (i : ι) (x : ι → 𝓧) (x' : 𝓧), |f x - f (Function.update x i x')| ≤ c i) (hf' : Measurable f) (ε : ℝ)
  (hε : ε > 0) (t : ℝ) (ht' : t * ∑ i, c i ^ 2 ≤ 1) :
  let m := Fintype.card ι;
  let ιm := Fintype.equivFinOfCardEq rfl;
  let X' := X ∘ ⇑ιm.symm;
  let f' := f ∘ fun s => s ∘ ⇑ιm;
  let c' := c ∘ ⇑ιm.symm;
  (∀ (X : Fin m → 𝓧) (k : Fin m) (x : 𝓧), Function.update X k x ∘ ⇑ιm = Function.update (X ∘ ⇑ιm) (ιm.symm k) x) →
    (∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i) →
      StronglyMeasurable f' →
        iIndepFun X' μ →
          (∀ (i : Fin m), Measurable (X (ιm.symm i))) →
            t * ∑ i', c' i' ^ 2 ≤ 1 → ¬t ≥ 0 → 1 ≤ Real.exp (-2 * ε ^ 2 * t) := sorry

Tactic state before:
Ω : Type u_1
inst✝³ : MeasurableSpace Ω
μ : Measure Ω
inst✝² : IsProbabilityMeasure μ
𝓧 : Type u_2
ι : Type u_3
inst✝¹ : DecidableEq ι
m𝓧 : MeasurableSpace 𝓧
hnonempty𝓧 : Nonempty 𝓧
inst✝ : Fintype ι
X : ι → Ω → 𝓧
hX : ∀ (i : ι), Measurable (X i)
hX' : iIndepFun X μ
f : (ι → 𝓧) → ℝ
c : ι → ℝ
hf : ∀ (i : ι) (x : ι → 𝓧) (x' : 𝓧), |f x - f (Function.update x i x')| ≤ c i
hf' : Measurable f
ε : ℝ
hε : ε > 0
t : ℝ
ht' : t * ∑ i, c i ^ 2 ≤ 1
m : ℕ := Fintype.card ι
ιm : ι ≃ Fin m := Fintype.equivFinOfCardEq ⋯
X' : Fin m → Ω → 𝓧 := X ∘ ⇑ιm.symm
f' : (Fin m → 𝓧) → ℝ := f ∘ fun s => s ∘ ⇑ιm
c' : Fin m → ℝ := c ∘ ⇑ιm.symm
hequpdate : ∀ (X : Fin m → 𝓧) (k : Fin m) (x : 𝓧), Function.update X k x ∘ ⇑ιm = Function.update (X ∘ ⇑ιm) (ιm.symm k) x
hfι : ∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i
hf'' : StronglyMeasurable f'
hIndep' : iIndepFun X' μ
hX'' : ∀ (i : Fin m), Measurable (X (ιm.symm i))
ht'' : t * ∑ i', c' i' ^ 2 ≤ 1
ht : ¬t ≥ 0
⊢ 1 ≤ Real.exp (-2 * ε ^ 2 * t)

Tactic:
apply Real.one_le_exp
    simp only [ge_iff_le, not_le, f'] at ht
    apply mul_nonneg_of_nonpos_of_nonpos
    ·
  norm_num
  exact sq_nonneg ε
    · exact le_of_lt ht

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory

theorem extracted_formal_statement_14.{u_2, u_1} {Ω : Type u_1} [inst : MeasurableSpace Ω] {μ : Measure Ω}
  [inst_1 : IsProbabilityMeasure μ] {𝓧 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} [hnonempty𝓧 : Nonempty 𝓧] {m : ℕ}
  {X' : Ω → 𝓧} (hX'' : Measurable X') {f' : (Fin m → 𝓧) → ℝ} {c' : Fin m → ℝ}
  (hfι : ∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i)
  (hf'' : StronglyMeasurable f') {t : ℝ} (ht : t ≥ 0) (ht' : t * ∑ i, c' i ^ 2 ≤ 1)
  (hX''' : ∀ (i : Fin m), Measurable fun ω => X' (ω i)) :
  let Y := fun k Xk =>
    ∫ (x : Fin m → Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else X' (ω i)) x ∂Measure.pi fun x => μ;
  ∀ (k : Fin m) (Xk : Fin ↑k → 𝓧) (x : 𝓧),
    Y k.succ (Fin.snoc Xk x) =
      ∫ (x_1 : Fin m → Ω),
        (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' (ω i))
          x_1 ∂Measure.pi fun x => μ := sorry

Tactic state before:
Ω : Type u_1
inst✝¹ : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsProbabilityMeasure μ
𝓧 : Type u_2
m𝓧 : MeasurableSpace 𝓧
hnonempty𝓧 : Nonempty 𝓧
m : ℕ
X' : Ω → 𝓧
hX'' : Measurable X'
f' : (Fin m → 𝓧) → ℝ
c' : Fin m → ℝ
hfι : ∀ (i : Fin m) (x : Fin m → 𝓧) (x' : 𝓧), |f' x - f' (Function.update x i x')| ≤ c' i
hf'' : StronglyMeasurable f'
ε : ℝ
hε : ε ≥ 0
t : ℝ
ht : t ≥ 0
ht' : t * ∑ i, c' i ^ 2 ≤ 1
hX''' : ∀ (i : Fin m), Measurable fun ω => X' (ω i)
Y : (k : Fin m.succ) → (Fin ↑k → 𝓧) → ℝ :=
  fun k Xk =>
    ∫ (x : Fin m → Ω), (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else X' (ω i)) x ∂Measure.pi fun x => μ
A : (k : Fin m) → (Fin ↑k → 𝓧) → ℝ :=
  fun k Xk =>
    ⨅ x,
      ∫ (x_1 : Fin m → Ω),
        (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' (ω i))
          x_1 ∂Measure.pi fun x => μ
B : (k : Fin m) → (Fin ↑k → 𝓧) → ℝ :=
  fun k Xk =>
    ⨆ x,
      ∫ (x_1 : Fin m → Ω),
        (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' (ω i))
          x_1 ∂Measure.pi fun x => μ
k : Fin m
Xk : Fin ↑k → 𝓧
x : 𝓧
⊢ Y k.succ (Fin.snoc Xk x) =
    ∫ (x_1 : Fin m → Ω),
      (fun ω => f' fun i => if h : ↑i < ↑k then Xk ⟨↑i, h⟩ else if ↑i = ↑k then x else X' (ω i))
        x_1 ∂Measure.pi fun x => μ

Tactic:
apply integral_congr_ae
    filter_upwards with ω
    apply congr rfl
    ext i
    if h : i.1 < k.1 then 
  have : i.1 < (Fin.succ k).1 := by dsimp; linarith
  rw [dif_pos this, dif_pos h]
  have : ⟨i.1, this⟩ = (⟨i.1, h⟩ : Fin k).castSucc := rfl
  rw [this]
  apply Fin.snoc_castSucc
else
  rw [dif_neg h]
  if h2 : i.1 = k.1 then 
    have : i.1 < (Fin.succ k).1 := by dsimp; linarith
    rw [dif_pos this, if_pos h2]
    have : ⟨i.1, this⟩ = Fin.last k := by
      apply Eq.symm
      apply Fin.eq_mk_iff_val_eq.mpr
      exact id (Eq.symm h2)
    rw [this]
    apply Fin.snoc_last
  else
    have : ¬(i.1 < (Fin.succ k).1) := by
      simp only [Fin.val_succ, not_lt]
      simp only [Fin.val_fin_lt, not_lt] at h
      apply Fin.val_add_one_le_of_lt
      exact lt_of_le_of_ne h fun a => h2 (congrArg Fin.val (id (Eq.symm a)))
    rw [dif_neg this, if_neg h2]

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_0.{u} {Ω : Type u} [inst : MeasurableSpace Ω] {μ : Measure Ω}
  [inst_1 : IsProbabilityMeasure μ] {n : ℕ} (s : Fin (n + 1) → Set Ω) (hs : ∀ (i : Fin (n + 1)), MeasurableSet (s i))
  (this : (fun f x => Fin.snoc f.2 f.1 x) ⁻¹' Set.univ.pi s = s (Fin.last n) ×ˢ Set.univ.pi (s ∘ Fin.castSucc))
  (i : Fin (n + 1)) (h_original_goal : (if ↑i < n then μ (s i) else μ (s ↑n)) = μ (s i)) : i = Fin.last n := sorry

Tactic state before:
case e_f.h
Ω : Type u
inst✝¹ : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsProbabilityMeasure μ
n : ℕ
s : Fin (n + 1) → Set Ω
hs : ∀ (i : Fin (n + 1)), MeasurableSet (s i)
this : (fun f x => Fin.snoc f.2 f.1 x) ⁻¹' Set.univ.pi s = s (Fin.last n) ×ˢ Set.univ.pi (s ∘ Fin.castSucc)
i : Fin (n + 1)
⊢ (if ↑i < n then μ (s i) else μ (s ↑n)) = μ (s i)

Tactic:
simp only [Fin.natCast_eq_last, ite_eq_left_iff, not_lt]
    intro h
    congr
    apply congr_arg
    apply Eq.symm

Tactic state after:
[case e_f.h.h.e_6.h.h.h
 Ω : Type u
 inst✝¹ : MeasurableSpace Ω
 μ : Measure Ω
 inst✝ : IsProbabilityMeasure μ
 n : ℕ
 s : Fin (n + 1) → Set Ω
 hs : ∀ (i : Fin (n + 1)), MeasurableSet (s i)
 this : (fun f x => Fin.snoc f.2 f.1 x) ⁻¹' Set.univ.pi s = s (Fin.last n) ×ˢ Set.univ.pi (s ∘ Fin.castSucc)
 i : Fin (n + 1)
 h : n ≤ ↑i
 ⊢ i = Fin.last n]
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_1.{w, v, u} {Z : Type w} {ι : Type v} {f : ι → Z → ℝ} {Ω : Type u}
  [inst : MeasurableSpace Ω] {X : Ω → Z} {μ : Measure Ω} [inst_1 : IsProbabilityMeasure μ] [inst_2 : Countable ι]
  [inst_3 : Nonempty ι] (h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)) {b : ℝ} (h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b) {n : ℕ}
  {c : ι → ℝ} {C : ℝ} (hC : ∀ (I : ι), |c I| ≤ C) :
  Measurable fun ω => ⨆ I, ∑ i, (f I (X (ω.2 i).1) - f I (X (ω.2 i).2)) + (f I (X ω.1.1) - f I (X ω.1.2) + c I) := sorry

Tactic state before:
case left.hf
Z : Type w
ι : Type v
f : ι → Z → ℝ
Ω : Type u
inst✝³ : MeasurableSpace Ω
X : Ω → Z
μ : Measure Ω
inst✝² : IsProbabilityMeasure μ
inst✝¹ : Countable ι
inst✝ : Nonempty ι
h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)
b : ℝ
h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b
n : ℕ
c : ι → ℝ
C : ℝ
hC : ∀ (I : ι), |c I| ≤ C
⊢ Measurable fun ω => ⨆ I, ∑ i, (f I (X (ω.2 i).1) - f I (X (ω.2 i).2)) + (f I (X ω.1.1) - f I (X ω.1.2) + c I)

Tactic:
apply Measurable.iSup
    intro I
    apply Measurable.add
    ·
  apply (measurable_sum_part h𝓕).comp
  exact measurable_snd
    ·
  apply Measurable.add_const
  apply Measurable.sub
  · exact (h𝓕 I).comp <| measurable_fst.comp measurable_fst
  · exact (h𝓕 I).comp <| measurable_snd.comp measurable_fst

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_2.{w, v, u} {Z : Type w} {ι : Type v} {f : ι → Z → ℝ} {Ω : Type u}
  [inst : MeasurableSpace Ω] {X : Ω → Z} {μ : Measure Ω} [inst_1 : IsProbabilityMeasure μ] [inst_2 : Countable ι]
  [inst_3 : Nonempty ι] (h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)) {b : ℝ} (h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b) {n : ℕ}
  {c : ι → ℝ} {C : ℝ} (hC : ∀ (I : ι), |c I| ≤ C) (σ : Fin n → { x // x ∈ {-1, 1} }) (a : σ ∈ Finset.univ) :
  Measurable fun a =>
    ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (a.2 i).1) - f I (X (a.2 i).2)) + (f I (X a.1.1) - f I (X a.1.2) + c I) := sorry

Tactic state before:
case left.hf.hf.hf
Z : Type w
ι : Type v
f : ι → Z → ℝ
Ω : Type u
inst✝³ : MeasurableSpace Ω
X : Ω → Z
μ : Measure Ω
inst✝² : IsProbabilityMeasure μ
inst✝¹ : Countable ι
inst✝ : Nonempty ι
h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)
b : ℝ
h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b
n : ℕ
c : ι → ℝ
C : ℝ
hC : ∀ (I : ι), |c I| ≤ C
σ : Fin n → { x // x ∈ {-1, 1} }
a✝ : σ ∈ Finset.univ
⊢ Measurable fun a =>
    ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (a.2 i).1) - f I (X (a.2 i).2)) + (f I (X a.1.1) - f I (X a.1.2) + c I)

Tactic:
apply Measurable.iSup
    intro I
    apply Measurable.add
    ·
  apply Finset.measurable_sum Finset.univ
  intro i _
  apply Measurable.const_mul
  exact (measurable_sub_part h𝓕).comp measurable_snd
    ·
  apply Measurable.add_const
  apply Measurable.sub
  · exact (h𝓕 I).comp <| measurable_fst.comp measurable_fst
  · exact (h𝓕 I).comp <| measurable_snd.comp measurable_fst

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_3.{w, v, u} {Z : Type w} {ι : Type v} {f : ι → Z → ℝ} {Ω : Type u}
  [inst : MeasurableSpace Ω] {X : Ω → Z} {μ : Measure Ω} [inst_1 : IsProbabilityMeasure μ] {n : ℕ} (ω : Ω × Ω)
  [inst_2 : Countable ι] [inst_3 : Nonempty ι] (h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)) {b : ℝ}
  (h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b) {c : ι → ℝ} {C : ℝ} (hC : ∀ (I : ι), |c I| ≤ C) :
  let μ2n := Measure.pi fun x => μ.prod μ;
  2⁻¹ *
      ((∫ (x : Fin n → Ω × Ω),
          (fun ω' =>
              2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.2) - f I (X ω.1) + c I))
            x ∂Measure.pi fun x => μ.prod μ) +
        ∫ (x : Fin n → Ω × Ω),
          (fun ω' =>
              2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.1) - f I (X ω.2) + c I))
            x ∂Measure.pi fun x => μ.prod μ) =
    2⁻¹ *
      ∫ (x : Fin n → Ω × Ω),
        (fun ω' =>
            (2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.2) - f I (X ω.1) + c I)) +
              2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.1) - f I (X ω.2) + c I))
          x ∂μ2n := sorry

Tactic state before:
Z : Type w
ι : Type v
f : ι → Z → ℝ
Ω : Type u
inst✝³ : MeasurableSpace Ω
X : Ω → Z
μ : Measure Ω
inst✝² : IsProbabilityMeasure μ
n : ℕ
ω : Ω × Ω
inst✝¹ : Countable ι
inst✝ : Nonempty ι
h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)
b : ℝ
h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b
c : ι → ℝ
C : ℝ
hC : ∀ (I : ι), |c I| ≤ C
μ2n : Measure (Fin n → Ω × Ω) := Measure.pi fun x => μ.prod μ
⊢ 2⁻¹ *
      ((∫ (x : Fin n → Ω × Ω),
          (fun ω' =>
              2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.2) - f I (X ω.1) + c I))
            x ∂Measure.pi fun x => μ.prod μ) +
        ∫ (x : Fin n → Ω × Ω),
          (fun ω' =>
              2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.1) - f I (X ω.2) + c I))
            x ∂Measure.pi fun x => μ.prod μ) =
    2⁻¹ *
      ∫ (x : Fin n → Ω × Ω),
        (fun ω' =>
            (2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.2) - f I (X ω.1) + c I)) +
              2⁻¹ ^ n *
                ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X ω.1) - f I (X ω.2) + c I))
          x ∂μ2n

Tactic:
apply congr_arg
    apply Eq.symm
    apply integral_add
    · apply integrable₁ ω.swap h𝓕 h𝓕' hC
    · apply integrable₁ ω h𝓕 h𝓕' hC

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_0 (ε a b : ℝ) (m : ℕ) (hm : m > 0) (hε : ε > 0) (hab : b > a) :
  let g := fun t => -↑t * ε + ↑t ^ 2 * ↑m * (b - a) ^ 2 / 8;
  let t_min :=
    ⟨4 * ε / ((b - a) ^ 2 * ↑m),
      div_pos
        (mul_pos
          (Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat ℝ Nat.cast_zero)
            (Mathlib.Meta.NormNum.isNat_ofNat ℝ (Eq.refl 4)) (Eq.refl false))
          hε)
        (mul_pos (sq_pos_of_ne_zero (ne_of_gt (sub_pos.mpr hab))) (Nat.cast_pos.mpr hm))⟩;
  (∀ (t : { t // t > 0 }), g t = -↑t * ε + ↑t ^ 2 * ↑m * (b - a) ^ 2 / 8) →
    (∀ (t : { t // t > 0 }), g t = ↑m * (b - a) ^ 2 / 8 * (↑t - ↑t_min) ^ 2 - 2 * ε ^ 2 / ((b - a) ^ 2 * ↑m)) →
      (∀ (t : { t // t > 0 }), g t ≥ g t_min) →
        (∀ (t : { t // t > 0 }), rexp (g t) ≥ rexp (g t_min)) →
          g t_min = -2 * ε ^ 2 / ((b - a) ^ 2 * ↑m) →
            rexp (g t_min) = rexp (-2 * ε ^ 2 / ((b - a) ^ 2 * ↑m)) →
              ⨅ t, rexp (-↑t * ε + ↑t ^ 2 * ↑m * (b - a) ^ 2 / 8) = rexp (-2 * ε ^ 2 / ((b - a) ^ 2 * ↑m)) := sorry

Tactic state before:
ε a b : ℝ
m : ℕ
hm : m > 0
hε : ε > 0
hab : b > a
g : { t // t > 0 } → ℝ := fun t => -↑t * ε + ↑t ^ 2 * ↑m * (b - a) ^ 2 / 8
t_min : { t // t > 0 } := ⟨4 * ε / ((b - a) ^ 2 * ↑m), ⋯⟩
gt : ∀ (t : { t // t > 0 }), g t = -↑t * ε + ↑t ^ 2 * ↑m * (b - a) ^ 2 / 8
h_rewrite : ∀ (t : { t // t > 0 }), g t = ↑m * (b - a) ^ 2 / 8 * (↑t - ↑t_min) ^ 2 - 2 * ε ^ 2 / ((b - a) ^ 2 * ↑m)
h_inf : ∀ (t : { t // t > 0 }), g t ≥ g t_min
h_exp : ∀ (t : { t // t > 0 }), rexp (g t) ≥ rexp (g t_min)
h_g_tmin : g t_min = -2 * ε ^ 2 / ((b - a) ^ 2 * ↑m)
h_exp_tmin : rexp (g t_min) = rexp (-2 * ε ^ 2 / ((b - a) ^ 2 * ↑m))
⊢ ⨅ t, rexp (-↑t * ε + ↑t ^ 2 * ↑m * (b - a) ^ 2 / 8) = rexp (-2 * ε ^ 2 / ((b - a) ^ 2 * ↑m))

Tactic:
rw [← h_exp_tmin]
    have h_inf_rewrite :
  ⨅ t : { t : ℝ // t > 0 }, rexp (-t * ε + t ^ 2 * ↑m * (b - a) ^ 2 / 8) = ⨅ t : { t : ℝ // 0 < t }, rexp (g t) := by
  congr
    rw [h_inf_rewrite]
    have inf_eq_at_min (g : { t : ℝ // t > 0 } → ℝ) (t_min : { t : ℝ // t > 0 })
  (h_exp : ∀ t : { t : ℝ // t > 0 }, rexp (g t) ≥ rexp (g t_min)) :
  ⨅ t : { t : ℝ // t > 0 }, rexp (g t) = rexp (g t_min) :=
  by
  apply le_antisymm
  · have bdd : BddBelow (Set.range (fun t => rexp (g t))) :=
      by
      use rexp (g t_min)
      intro y hy
      rcases hy with ⟨t, rfl⟩
      exact h_exp t
    apply ciInf_le bdd
  · have positive_reals_nonempty : Nonempty { t : ℝ // t > 0 } := by exact ⟨⟨1, by norm_num⟩⟩
    apply le_ciInf
    intro t
    exact (h_exp t)
    exact inf_eq_at_min g t_min h_exp

Tactic state after:
import Mathlib
import FoML


open MeasureTheory Filter Finset Real

open scoped MeasureTheory ProbabilityTheory ENNReal NNReal

theorem extracted_formal_statement_0.{u_1} {Ω : Type u_1} {m : MeasurableSpace Ω} {μ : Measure Ω}
  [inst : IsFiniteMeasure μ] {X : Ω → ℝ} (t b : ℝ) (ht : t > 0) (hX : AEMeasurable X μ) (hb : ∀ᵐ (ω : Ω) ∂μ, X ω ≤ b)
  (b' : ∀ᵐ (ω : Ω) ∂μ, rexp (t * X ω) ≤ rexp (t * b)) (p : ∀ᵐ (ω : Ω) ∂μ, ↑‖rexp (t * X ω)‖₊ ≤ rexp (t * b)) :
  ∫⁻ (ω : Ω), ↑‖rexp (t * X ω)‖₊ ∂μ ≤ ∫⁻ (x : Ω), ↑‖rexp (t * b)‖₊ ∂μ := sorry

Tactic state before:
Ω : Type u_1
m : MeasurableSpace Ω
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
X : Ω → ℝ
t b : ℝ
ht : t > 0
hX : AEMeasurable X μ
hb : ∀ᵐ (ω : Ω) ∂μ, X ω ≤ b
b' : ∀ᵐ (ω : Ω) ∂μ, rexp (t * X ω) ≤ rexp (t * b)
p : ∀ᵐ (ω : Ω) ∂μ, ↑‖rexp (t * X ω)‖₊ ≤ rexp (t * b)
⊢ ∫⁻ (ω : Ω), ↑‖rexp (t * X ω)‖₊ ∂μ ≤ ∫⁻ (x : Ω), ↑‖rexp (t * b)‖₊ ∂μ

Tactic:
apply lintegral_mono_ae
    filter_upwards [p] with ω p
    simp only [ENNReal.coe_le_coe]
    rw [← (by simp : ‖rexp (t * b)‖₊ = rexp (t * b))] at p
    exact p

Tactic state after: