zzhisthebest/LeanBenchmark huggingface dataset:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_13.{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) (I : ι) : Measurable fun x => f I (X x.1.1) - f I (X x.1.2) := sorry

Tactic state before:
case left.hf.hf.hg.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
I : ι
⊢ Measurable fun x => f I (X x.1.1) - f I (X x.1.2)

Tactic:
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_14.{w, v, u} {Z : Type w} {ι : Type v} {f : ι → Z → ℝ} {Ω : Type u} {X : Ω → Z} {n : ℕ}
  [inst : Nonempty ι] {b : ℝ} (h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b) {c : ι → ℝ} {C : ℝ} (hC : ∀ (I : ι), |c I| ≤ C)
  (ω' : Fin n → Ω × Ω) :
  |2⁻¹ ^ n * ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + c I| ≤ ↑n * (b + b) + C := sorry

Tactic state before:
Z : Type w
ι : Type v
f : ι → Z → ℝ
Ω : Type u
X : Ω → Z
n : ℕ
inst✝ : Nonempty ι
b : ℝ
h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b
c : ι → ℝ
C : ℝ
hC : ∀ (I : ι), |c I| ≤ C
ω' : Fin n → Ω × Ω
⊢ |2⁻¹ ^ n * ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + c I| ≤ ↑n * (b + b) + C

Tactic:
rw [abs_mul, abs_of_pos (by simp)]
    have :
  |∑ σ : Fin n → ({-1, 1} : Finset ℤ), ⨆ I : ι, ∑ i : Fin n, (σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + c I| ≤
    2 ^ n * (n * (b + b) + C) :=
  by
  calc
    _ ≤
        ∑ σ : Fin n → ({-1, 1} : Finset ℤ),
          |⨆ I : ι, ∑ i : Fin n, (σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + c I| :=
      by apply Finset.abs_sum_le_sum_abs
    _ ≤ ∑ σ : Fin n → ({-1, 1} : Finset ℤ), (n * (b + b) + C) :=
      by
      apply Finset.sum_le_sum
      intro σ _
      apply bound_isum h𝓕' hC
    _ = (Finset.univ : Finset (Fin n → ({-1, 1} : Finset ℤ))).card • (n * (b + b) + C) := by
      exact Finset.sum_const (n * (b + b) + C)
    _ = _ :=
      by
      simp only [Int.reduceNeg, Finset.card_univ, Finset.mem_insert, Finset.mem_singleton, Fintype.card_pi,
        Fintype.card_coe, reduceCtorEq, not_false_eq_true, Finset.card_insert_of_not_mem, Finset.card_singleton,
        Nat.reduceAdd, Finset.prod_const, Fintype.card_fin, smul_add, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat]
      ring_nf
    calc
  _ ≤ 2⁻¹ ^ n * (2 ^ n * (n * (b + b) + C)) := mul_le_mul_of_nonneg_left this (by simp)
  _ = _ := by simp

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_15.{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)
  (σ : Fin n → { x // x ∈ {-1, 1} }) (a : σ ∈ Finset.univ) (I : ι) (i : Fin n) (a_1 : i ∈ Finset.univ) :
  Measurable fun x => f I (X (x i).1) - f I (X (x i).2) := sorry

Tactic state before:
case left.hf.hf.hf.hf.hf
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
σ : Fin n → { x // x ∈ {-1, 1} }
a✝¹ : σ ∈ Finset.univ
I : ι
i : Fin n
a✝ : i ∈ Finset.univ
⊢ Measurable fun x => f I (X (x i).1) - f I (X (x i).2)

Tactic:
apply Measurable.sub
    ·
  apply (h𝓕 I).comp
  apply measurable_fst.comp
  exact measurable_pi_apply i
    ·
  apply (h𝓕 I).comp
  apply measurable_snd.comp
  exact measurable_pi_apply i

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_16.{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)
  (h_original_goal :
    StronglyMeasurable fun a =>
      ∫ (x : Fin n → Ω × Ω),
        (fun ω' =>
            2⁻¹ ^ n *
              ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X a.1) - f I (X a.2) + c I))
          x ∂Measure.pi fun x => μ.prod μ) :
  Measurable fun x =>
    ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (x.2 i).1) - f I (X (x.2 i).2)) + (f I (X x.1.1) - f I (X 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
⊢ StronglyMeasurable fun a =>
    ∫ (x : Fin n → Ω × Ω),
      (fun ω' =>
          2⁻¹ ^ n * ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (ω' i).1) - f I (X (ω' i).2)) + (f I (X a.1) - f I (X a.2) + c I))
        x ∂Measure.pi fun x => μ.prod μ

Tactic:
apply
  @StronglyMeasurable.integral_prod_right' (Ω × Ω) (Fin n → (Ω × Ω)) ℝ _ _ (Measure.pi fun _ ↦ μ.prod μ) _ _ _
    (fun ω ↦
      (2⁻¹ ^ n *
        ∑ σ : Fin n → ({-1, 1} : Finset ℤ),
          ⨆ I, ∑ i : Fin n, ↑↑(σ 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)))
    apply Measurable.stronglyMeasurable
    apply Measurable.const_mul

Tactic state after:
[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
 ⊢ Measurable fun x =>
     ∑ σ, ⨆ I, ∑ i, ↑↑(σ i) * (f I (X (x.2 i).1) - f I (X (x.2 i).2)) + (f I (X x.1.1) - f I (X x.1.2) + c I)]
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_17.{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) (I : ι) :
  Measurable fun b =>
    ∑ i, ↑↑(σ i) * (f I (X (b.2 i).1) - f I (X (b.2 i).2)) + (f I (X b.1.1) - f I (X b.1.2) + c I) := sorry

Tactic state before:
case left.hf.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
I : ι
⊢ Measurable fun b => ∑ i, ↑↑(σ i) * (f I (X (b.2 i).1) - f I (X (b.2 i).2)) + (f I (X b.1.1) - f I (X b.1.2) + c I)

Tactic:
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
  to_theorem
    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_18.{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) (I : ι) :
  Measurable fun x => f I (X x.1.1) - f I (X x.1.2) := sorry

Tactic state before:
case left.hf.hf.hf.hf.hg.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
I : ι
⊢ Measurable fun x => f I (X x.1.1) - f I (X x.1.2)

Tactic:
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_19.{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) (ω' : Ω × Ω) :
  |∫ (x : Fin n → Ω × Ω),
        2⁻¹ ^ n *
          ∑ σ,
            ⨆ I,
              ∑ i, ↑↑(σ i) * (f I (X (x i).1) - f I (X (x i).2)) +
                (f I (X ω'.1) - f I (X ω'.2) + c I) ∂Measure.pi fun x => μ.prod μ| ≤
    ↑n * (b + b) + (b + b + C) := sorry

Tactic state before:
case right.h
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
ω' : Ω × Ω
⊢ |∫ (x : Fin n → Ω × Ω),
        2⁻¹ ^ n *
          ∑ σ,
            ⨆ I,
              ∑ i, ↑↑(σ i) * (f I (X (x i).1) - f I (X (x i).2)) +
                (f I (X ω'.1) - f I (X ω'.2) + c I) ∂Measure.pi fun x => μ.prod μ| ≤
    ↑n * (b + b) + (b + b + C)

Tactic:
apply abs_expectation_le_of_abs_le_const
    filter_upwards with ω
    exact bound_σsum h𝓕' (boundedness₀ h𝓕' hC ω') ω

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_20.{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 + 1) → { x // x ∈ {-1, 1} }) (a : σ ∈ Finset.univ) (I : ι)
  (h_original_goal : Measurable fun x => ↑↑(σ ↑n) * (f I (X x.1.1) - f I (X x.1.2))) :
  Measurable fun a => f I (X a.1.2) := sorry

Tactic state before:
case left.hf.hf.hf.hg.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 + 1) → { x // x ∈ {-1, 1} }
a✝ : σ ∈ Finset.univ
I : ι
⊢ Measurable fun x => ↑↑(σ ↑n) * (f I (X x.1.1) - f I (X x.1.2))

Tactic:
apply Measurable.const_mul
    apply Measurable.sub
    · exact (h𝓕 I).comp <| measurable_fst.comp measurable_fst

Tactic state after:
[case left.hf.hf.hf.hg.hf.hf.hg
 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 + 1) → { x // x ∈ {-1, 1} }
 a✝ : σ ∈ Finset.univ
 I : ι
 ⊢ Measurable fun a => f I (X a.1.2)]
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_21.{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 → Ω × Ω)) :
  |2⁻¹ ^ (n + 1) *
        ∑ σ,
          ⨆ I,
            ∑ i, ↑↑(σ ↑↑i) * (f I (X (ω.2 i).1) - f I (X (ω.2 i).2)) +
              (↑↑(σ ↑n) * (f I (X ω.1.1) - f I (X ω.1.2)) + c I)| ≤
    ↑n * (b + b) + (b + b + C) := sorry

Tactic state before:
case right.h
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 → Ω × Ω)
⊢ |2⁻¹ ^ (n + 1) *
        ∑ σ,
          ⨆ I,
            ∑ i, ↑↑(σ ↑↑i) * (f I (X (ω.2 i).1) - f I (X (ω.2 i).2)) +
              (↑↑(σ ↑n) * (f I (X ω.1.1) - f I (X ω.1.2)) + c I)| ≤
    ↑n * (b + b) + (b + b + C)

Tactic:
rw [abs_mul, abs_of_pos (by simp)]
    have :
  |∑ σ : Fin (n + 1) → ({-1, 1} : Finset ℤ),
        ⨆ I : ι,
          ∑ i : Fin n, (σ i) * (f I (X (ω.2 i).1) - f I (X (ω.2 i).2)) +
            ((σ ↑n) * (f I (X ω.1.1) - f I (X ω.1.2)) + c I)| ≤
    2 ^ (n + 1) * (n * (b + b) + (b + b + C)) :=
  by
  calc
    _ ≤
        ∑ σ : Fin (n + 1) → ({-1, 1} : Finset ℤ),
          |⨆ I : ι,
              ∑ i : Fin n, (σ i) * (f I (X (ω.2 i).1) - f I (X (ω.2 i).2)) +
                ((σ ↑n) * (f I (X ω.1.1) - f I (X ω.1.2)) + c I)| :=
      by apply Finset.abs_sum_le_sum_abs
    _ ≤ ∑ σ : Fin (n + 1) → ({-1, 1} : Finset ℤ), (n * (b + b) + (b + b + C)) :=
      by
      apply Finset.sum_le_sum
      intro σ _
      apply bound_isum h𝓕'
      exact boundedness₁ h𝓕' hC ω.1 (σ n)
    _ = (Finset.univ : Finset (Fin (n + 1) → ({-1, 1} : Finset ℤ))).card • (n * (b + b) + (b + b + C)) :=
      (Finset.sum_const (n * (b + b) + (b + b + C)))
    _ = _ :=
      by
      simp only [Int.reduceNeg, Finset.card_univ, Finset.mem_insert, Finset.mem_singleton, Fintype.card_pi,
        Fintype.card_coe, reduceCtorEq, not_false_eq_true, Finset.card_insert_of_not_mem, Finset.card_singleton,
        Nat.reduceAdd, Finset.prod_const, Fintype.card_fin, smul_add, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat]
      ring_nf
    calc
  _ ≤ 2⁻¹ ^ (n + 1) * (2 ^ (n + 1) * (n * (b + b) + (b + b + C))) := mul_le_mul_of_nonneg_left this (by simp)
  _ = _ := by simp

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_24.{w, v, u} {Z : Type w} {ι : Type v} {f : ι → Z → ℝ} {Ω : Type u}
  [inst : MeasurableSpace Ω] {X : Ω → Z} {μ : Measure Ω} [inst_1 : IsProbabilityMeasure μ] {n_1 : ℕ}
  [inst_2 : Countable ι] [inst_3 : Nonempty ι] (h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)) {b : ℝ}
  (h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b) (n : ℕ)
  (ih :
    ∀ (c : ι → ℝ),
      (∃ C, ∀ (I : ι), |c I| ≤ C) →
        (∫ (x : Fin n → Ω × Ω),
            (fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + 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)) + c I)
              x ∂Measure.pi fun x => μ.prod μ)
  (c : ι → ℝ) (C : ℝ) (hC : ∀ (I : ι), |c I| ≤ C) :
  let μ2n := Measure.pi fun x => μ.prod μ;
  ∫ (x : Fin (n + 1) → Ω × Ω),
      (fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + c I)
        x ∂Measure.map (⇑(Fin.snocEquiv fun x => Ω × Ω)) ((μ.prod μ).prod μ2n) =
    ∫ (x : (Ω × Ω) × (Fin n → Ω × Ω)),
      ((fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + c I) ∘ ⇑(Fin.snocEquiv fun x => Ω × Ω))
        x ∂(μ.prod μ).prod μ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
n : ℕ
ih :
  ∀ (c : ι → ℝ),
    (∃ C, ∀ (I : ι), |c I| ≤ C) →
      (∫ (x : Fin n → Ω × Ω),
          (fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + 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)) + c I)
            x ∂Measure.pi fun x => μ.prod μ
c : ι → ℝ
C : ℝ
hC : ∀ (I : ι), |c I| ≤ C
μ2n : Measure (Fin n → Ω × Ω) := Measure.pi fun x => μ.prod μ
⊢ ∫ (x : Fin (n + 1) → Ω × Ω),
      (fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + c I)
        x ∂Measure.map (⇑(Fin.snocEquiv fun x => Ω × Ω)) ((μ.prod μ).prod μ2n) =
    ∫ (x : (Ω × Ω) × (Fin n → Ω × Ω)),
      ((fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + c I) ∘ ⇑(Fin.snocEquiv fun x => Ω × Ω))
        x ∂(μ.prod μ).prod μ2n

Tactic:
apply integral_map
    ·
  apply Measurable.aemeasurable
  dsimp [Fin.snocEquiv]
  exact measurable_snocEquiv
    ·
  apply Measurable.aestronglyMeasurable
  exact measurable₀ h𝓕 (n + 1) c

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

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

Tactic:
apply Eq.symm
    apply integral_prod
    exact integrable₃ h𝓕 h𝓕' hC

Tactic state after:
import Mathlib
import FoML


open MeasureTheory ProbabilityTheory Real

theorem extracted_formal_statement_29.{w, v, u} {Z : Type w} {ι : Type v} {f : ι → Z → ℝ} {Ω : Type u}
  [inst : MeasurableSpace Ω] {X : Ω → Z} {μ : Measure Ω} [inst_1 : IsProbabilityMeasure μ] {n_1 : ℕ}
  [inst_2 : Countable ι] [inst_3 : Nonempty ι] (h𝓕 : ∀ (I : ι), Measurable (f I ∘ X)) {b : ℝ}
  (h𝓕' : ∀ (I : ι) (z : Z), |f I z| ≤ b) (n : ℕ)
  (ih :
    ∀ (c : ι → ℝ),
      (∃ C, ∀ (I : ι), |c I| ≤ C) →
        (∫ (x : Fin n → Ω × Ω),
            (fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + 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)) + c I)
              x ∂Measure.pi fun x => μ.prod μ)
  (c : ι → ℝ) (C : ℝ) (hC : ∀ (I : ι), |c I| ≤ C) (ω : (Ω × Ω) × (Fin n → Ω × Ω)) (σ : Signs (n + 1)) (I : ι)
  (i : Fin (n + 1)) (h : ↑i < n) :
  ↑↑(σ i) *
      (f I (X (if h : ↑i < n then ω.2 (i.castLT h) else ω.1).1) -
        f I (X (if h : ↑i < n then ω.2 (i.castLT h) else ω.1).2)) =
    if h : ↑i < n then ↑↑(σ ↑↑i) * (f I (X (ω.2 (i.castLT h)).1) - f I (X (ω.2 (i.castLT h)).2))
    else ↑↑(σ ↑n) * (f I (X ω.1.1) - f I (X ω.1.2)) := 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
n : ℕ
ih :
  ∀ (c : ι → ℝ),
    (∃ C, ∀ (I : ι), |c I| ≤ C) →
      (∫ (x : Fin n → Ω × Ω),
          (fun ω => ⨆ I, ∑ i, (f I (X (ω i).1) - f I (X (ω i).2)) + 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)) + c I)
            x ∂Measure.pi fun x => μ.prod μ
c : ι → ℝ
C : ℝ
hC : ∀ (I : ι), |c I| ≤ C
μ2n : Measure (Fin n → Ω × Ω) := Measure.pi fun x => μ.prod μ
ω : (Ω × Ω) × (Fin n → Ω × Ω)
σ : Signs (n + 1)
I : ι
i : Fin (n + 1)
h : ↑i < n
⊢ ↑↑(σ i) *
      (f I (X (if h : ↑i < n then ω.2 (i.castLT h) else ω.1).1) -
        f I (X (if h : ↑i < n then ω.2 (i.castLT h) else ω.1).2)) =
    if h : ↑i < n then ↑↑(σ ↑↑i) * (f I (X (ω.2 (i.castLT h)).1) - f I (X (ω.2 (i.castLT h)).2))
    else ↑↑(σ ↑n) * (f I (X ω.1.1) - f I (X ω.1.2))

Tactic:
rw [dif_pos h, dif_pos h]
    congr
    exact Eq.symm (Fin.cast_val_eq_self i)

Tactic state after: