l3lab/ntp-mathlib huggingface dataset:
/-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
    (hf : Submartingale f ℱ μ) : ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ := by
  by_cases hab : a < b
  · simp_rw [upcrossings]
    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) := by
      intro N
      rw [ofReal_integral_eq_lintegral_ofReal]
      · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
    rw [lintegral_iSup']
    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
      intro N
      rw [(by simp :
          ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
      · simp_rw [NNReal.coe_nat_cast]
        exact (ENNReal.ofReal_le_ofReal
          (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
            (le_iSup (α := ℝ≥0∞) _ N)
      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
    · exact fun n => measurable_from_top.comp_aemeasurable
        (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
    · 

Proof state:
case pos.h_mono
Ω : Type u_1
ι : Type u_2
m0 : MeasurableSpace Ω
μ : Measure Ω
a✝ b✝ : ℝ
f : ℕ → Ω → ℝ
N n m : ℕ
ω : Ω
ℱ : Filtration ℕ m0
inst✝ : IsFiniteMeasure μ
a b : ℝ
hf : Submartingale f ℱ μ
hab : a < b
this : ∀ (N : ℕ), ∫⁻ (ω : Ω), ENNReal.ofReal (f N ω - a)⁺ ∂μ = ENNReal.ofReal (∫ (ω : Ω), (f N ω - a)⁺ ∂μ)
⊢ ∀ᵐ (x : Ω) ∂μ, Monotone fun n => ↑(upcrossingsBefore a b f n x)

Next tactic:
refine' eventually_of_forall fun ω N M hNM => _
/-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
    (hf : Submartingale f ℱ μ) : ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ := by
  by_cases hab : a < b
  · simp_rw [upcrossings]
    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) := by
      intro N
      rw [ofReal_integral_eq_lintegral_ofReal]
      · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
    rw [lintegral_iSup']
    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
      intro N
      rw [(by simp :
          ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
      · simp_rw [NNReal.coe_nat_cast]
        exact (ENNReal.ofReal_le_ofReal
          (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
            (le_iSup (α := ℝ≥0∞) _ N)
      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
    · exact fun n => measurable_from_top.comp_aemeasurable
        (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
    · refine' eventually_of_forall fun ω N M hNM => _
      

Proof state:
case pos.h_mono
Ω : Type u_1
ι : Type u_2
m0 : MeasurableSpace Ω
μ : Measure Ω
a✝ b✝ : ℝ
f : ℕ → Ω → ℝ
N✝ n m : ℕ
ω✝ : Ω
ℱ : Filtration ℕ m0
inst✝ : IsFiniteMeasure μ
a b : ℝ
hf : Submartingale f ℱ μ
hab : a < b
this : ∀ (N : ℕ), ∫⁻ (ω : Ω), ENNReal.ofReal (f N ω - a)⁺ ∂μ = ENNReal.ofReal (∫ (ω : Ω), (f N ω - a)⁺ ∂μ)
ω : Ω
N M : ℕ
hNM : N ≤ M
⊢ (fun n => ↑(upcrossingsBefore a b f n ω)) N ≤ (fun n => ↑(upcrossingsBefore a b f n ω)) M

Next tactic:
rw [Nat.cast_le]
/-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
    (hf : Submartingale f ℱ μ) : ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ := by
  by_cases hab : a < b
  · simp_rw [upcrossings]
    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) := by
      intro N
      rw [ofReal_integral_eq_lintegral_ofReal]
      · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
    rw [lintegral_iSup']
    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
      intro N
      rw [(by simp :
          ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
      · simp_rw [NNReal.coe_nat_cast]
        exact (ENNReal.ofReal_le_ofReal
          (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
            (le_iSup (α := ℝ≥0∞) _ N)
      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
    · exact fun n => measurable_from_top.comp_aemeasurable
        (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
    · refine' eventually_of_forall fun ω N M hNM => _
      rw [Nat.cast_le]
      

Proof state:
case pos.h_mono
Ω : Type u_1
ι : Type u_2
m0 : MeasurableSpace Ω
μ : Measure Ω
a✝ b✝ : ℝ
f : ℕ → Ω → ℝ
N✝ n m : ℕ
ω✝ : Ω
ℱ : Filtration ℕ m0
inst✝ : IsFiniteMeasure μ
a b : ℝ
hf : Submartingale f ℱ μ
hab : a < b
this : ∀ (N : ℕ), ∫⁻ (ω : Ω), ENNReal.ofReal (f N ω - a)⁺ ∂μ = ENNReal.ofReal (∫ (ω : Ω), (f N ω - a)⁺ ∂μ)
ω : Ω
N M : ℕ
hNM : N ≤ M
⊢ upcrossingsBefore a b f N ω ≤ upcrossingsBefore a b f M ω

Next tactic:
exact upcrossingsBefore_mono hab hNM ω
/-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
    (hf : Submartingale f ℱ μ) : ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ := by
  by_cases hab : a < b
  · simp_rw [upcrossings]
    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) := by
      intro N
      rw [ofReal_integral_eq_lintegral_ofReal]
      · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
    rw [lintegral_iSup']
    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
      intro N
      rw [(by simp :
          ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
      · simp_rw [NNReal.coe_nat_cast]
        exact (ENNReal.ofReal_le_ofReal
          (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
            (le_iSup (α := ℝ≥0∞) _ N)
      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
    · exact fun n => measurable_from_top.comp_aemeasurable
        (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
    · refine' eventually_of_forall fun ω N M hNM => _
      rw [Nat.cast_le]
      exact upcrossingsBefore_mono hab hNM ω
  · 

Proof state:
case neg
Ω : Type u_1
ι : Type u_2
m0 : MeasurableSpace Ω
μ : Measure Ω
a✝ b✝ : ℝ
f : ℕ → Ω → ℝ
N n m : ℕ
ω : Ω
ℱ : Filtration ℕ m0
inst✝ : IsFiniteMeasure μ
a b : ℝ
hf : Submartingale f ℱ μ
hab : ¬a < b
⊢ ENNReal.ofReal (b - a) * ∫⁻ (ω : Ω), upcrossings a b f ω ∂μ ≤ ⨆ N, ∫⁻ (ω : Ω), ENNReal.ofReal (f N ω - a)⁺ ∂μ

Next tactic:
rw [not_lt, ← sub_nonpos] at hab
/-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
    (hf : Submartingale f ℱ μ) : ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ := by
  by_cases hab : a < b
  · simp_rw [upcrossings]
    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) := by
      intro N
      rw [ofReal_integral_eq_lintegral_ofReal]
      · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
    rw [lintegral_iSup']
    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
      intro N
      rw [(by simp :
          ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
      · simp_rw [NNReal.coe_nat_cast]
        exact (ENNReal.ofReal_le_ofReal
          (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
            (le_iSup (α := ℝ≥0∞) _ N)
      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
    · exact fun n => measurable_from_top.comp_aemeasurable
        (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
    · refine' eventually_of_forall fun ω N M hNM => _
      rw [Nat.cast_le]
      exact upcrossingsBefore_mono hab hNM ω
  · rw [not_lt, ← sub_nonpos] at hab
    

Proof state:
case neg
Ω : Type u_1
ι : Type u_2
m0 : MeasurableSpace Ω
μ : Measure Ω
a✝ b✝ : ℝ
f : ℕ → Ω → ℝ
N n m : ℕ
ω : Ω
ℱ : Filtration ℕ m0
inst✝ : IsFiniteMeasure μ
a b : ℝ
hf : Submartingale f ℱ μ
hab : b - a ≤ 0
⊢ ENNReal.ofReal (b - a) * ∫⁻ (ω : Ω), upcrossings a b f ω ∂μ ≤ ⨆ N, ∫⁻ (ω : Ω), ENNReal.ofReal (f N ω - a)⁺ ∂μ

Next tactic:
rw [ENNReal.ofReal_of_nonpos hab, zero_mul]
/-- A variant of Doob's upcrossing estimate obtained by taking the supremum on both sides. -/
theorem Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part [IsFiniteMeasure μ] (a b : ℝ)
    (hf : Submartingale f ℱ μ) : ENNReal.ofReal (b - a) * ∫⁻ ω, upcrossings a b f ω ∂μ ≤
      ⨆ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ := by
  by_cases hab : a < b
  · simp_rw [upcrossings]
    have : ∀ N, ∫⁻ ω, ENNReal.ofReal ((f N ω - a)⁺) ∂μ = ENNReal.ofReal (∫ ω, (f N ω - a)⁺ ∂μ) := by
      intro N
      rw [ofReal_integral_eq_lintegral_ofReal]
      · exact (hf.sub_martingale (martingale_const _ _ _)).pos.integrable _
      · exact eventually_of_forall fun ω => LatticeOrderedGroup.pos_nonneg _
    rw [lintegral_iSup']
    · simp_rw [this, ENNReal.mul_iSup, iSup_le_iff]
      intro N
      rw [(by simp :
          ∫⁻ ω, upcrossingsBefore a b f N ω ∂μ = ∫⁻ ω, ↑(upcrossingsBefore a b f N ω : ℝ≥0) ∂μ),
        lintegral_coe_eq_integral, ← ENNReal.ofReal_mul (sub_pos.2 hab).le]
      · simp_rw [NNReal.coe_nat_cast]
        exact (ENNReal.ofReal_le_ofReal
          (hf.mul_integral_upcrossingsBefore_le_integral_pos_part a b N)).trans
            (le_iSup (α := ℝ≥0∞) _ N)
      · simp only [NNReal.coe_nat_cast, hf.adapted.integrable_upcrossingsBefore hab]
    · exact fun n => measurable_from_top.comp_aemeasurable
        (hf.adapted.measurable_upcrossingsBefore hab).aemeasurable
    · refine' eventually_of_forall fun ω N M hNM => _
      rw [Nat.cast_le]
      exact upcrossingsBefore_mono hab hNM ω
  · rw [not_lt, ← sub_nonpos] at hab
    rw [ENNReal.ofReal_of_nonpos hab, zero_mul]
    

Proof state:
case neg
Ω : Type u_1
ι : Type u_2
m0 : MeasurableSpace Ω
μ : Measure Ω
a✝ b✝ : ℝ
f : ℕ → Ω → ℝ
N n m : ℕ
ω : Ω
ℱ : Filtration ℕ m0
inst✝ : IsFiniteMeasure μ
a b : ℝ
hf : Submartingale f ℱ μ
hab : b - a ≤ 0
⊢ 0 ≤ ⨆ N, ∫⁻ (ω : Ω), ENNReal.ofReal (f N ω - a)⁺ ∂μ

Next tactic:
exact zero_le _
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
⊢ ∀ (a b c : F ⟶ G), a + b + c = a + (b + c)

Next tactic:
intros
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ b✝ c✝ : F ⟶ G
⊢ a✝ + b✝ + c✝ = a✝ + (b✝ + c✝)

Next tactic:
ext
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        

Proof state:
case w.h
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ b✝ c✝ : F ⟶ G
x✝ : C
⊢ (a✝ + b✝ + c✝).app x✝ = (a✝ + (b✝ + c✝)).app x✝

Next tactic:
apply add_assoc
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
⊢ ∀ (a : F ⟶ G), 0 + a = a

Next tactic:
intros
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ : F ⟶ G
⊢ 0 + a✝ = a✝

Next tactic:
ext
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        

Proof state:
case w.h
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ : F ⟶ G
x✝ : C
⊢ (0 + a✝).app x✝ = a✝.app x✝

Next tactic:
apply zero_add
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
⊢ ∀ (a : F ⟶ G), a + 0 = a

Next tactic:
intros
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ : F ⟶ G
⊢ a✝ + 0 = a✝

Next tactic:
ext
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        

Proof state:
case w.h
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ : F ⟶ G
x✝ : C
⊢ (a✝ + 0).app x✝ = a✝.app x✝

Next tactic:
apply add_zero
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        ext
        apply add_comm
      sub_eq_add_neg := by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
⊢ ∀ (a b : F ⟶ G), a - b = a + -b

Next tactic:
intros
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        ext
        apply add_comm
      sub_eq_add_neg := by
        intros
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ b✝ : F ⟶ G
⊢ a✝ - b✝ = a✝ + -b✝

Next tactic:
ext
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        ext
        apply add_comm
      sub_eq_add_neg := by
        intros
        ext
        

Proof state:
case w.h
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ b✝ : F ⟶ G
x✝ : C
⊢ (a✝ - b✝).app x✝ = (a✝ + -b✝).app x✝

Next tactic:
apply sub_eq_add_neg
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        ext
        apply add_comm
      sub_eq_add_neg := by
        intros
        ext
        apply sub_eq_add_neg
      add_left_neg := by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
⊢ ∀ (a : F ⟶ G), -a + a = 0

Next tactic:
intros
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        ext
        apply add_comm
      sub_eq_add_neg := by
        intros
        ext
        apply sub_eq_add_neg
      add_left_neg := by
        intros
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ : F ⟶ G
⊢ -a✝ + a✝ = 0

Next tactic:
ext
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        ext
        apply add_comm
      sub_eq_add_neg := by
        intros
        ext
        apply sub_eq_add_neg
      add_left_neg := by
        intros
        ext
        

Proof state:
case w.h
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ : F ⟶ G
x✝ : C
⊢ (-a✝ + a✝).app x✝ = 0.app x✝

Next tactic:
apply add_left_neg
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
⊢ ∀ (a b : F ⟶ G), a + b = b + a

Next tactic:
intros
instance functorCategoryPreadditive : Preadditive (C ⥤ D)
    where
  homGroup F G :=
    { add := fun α β => { app := fun X => α.app X + β.app X }
      zero := { app := fun X => 0 }
      neg := fun α => { app := fun X => -α.app X }
      sub := fun α β => { app := fun X => α.app X - β.app X }
      add_assoc := by
        intros
        ext
        apply add_assoc
      zero_add := by
        intros
        ext
        apply zero_add
      add_zero := by
        intros
        ext
        apply add_zero
      add_comm := by
        intros
        

Proof state:
C : Type u_1
D : Type u_2
inst✝² : Category.{?u.38, u_1} C
inst✝¹ : Category.{?u.42, u_2} D
inst✝ : Preadditive D
F G : C ⥤ D
a✝ b✝ : F ⟶ G
⊢ a✝ + b✝ = b✝ + a✝

Next tactic:
ext