l3lab/ntp-mathlib huggingface dataset:
theorem mono_of_epi_of_mono_of_mono' (hR₁ : R₁.map' 0 2 = 0)
    (hR₁' : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact)
    (h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
    Mono (app' φ 2) := by
  apply mono_of_cancel_zero
  intro A f₂ h₁
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, NatTrans.naturality, reassoc_of% h₁,
      zero_comp, zero_comp]
  obtain ⟨A₁, π₁, _, f₁, hf₁⟩ := (hR₁'.exact 0).exact_up_to_refinements f₂ h₂
  dsimp at hf₁
  have h₃ : (f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [assoc, ← NatTrans.naturality, ← reassoc_of% hf₁, h₁, comp_zero]
  obtain ⟨A₂, π₂, _, g₀, hg₀⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₃
  obtain ⟨A₃, π₃, _, f₀, hf₀⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
  have h₄ : f₀ ≫ R₁.map' 0 1 = π₃ ≫ π₂ ≫ f₁ := by
    rw [← cancel_mono (app' φ 1 _), assoc, assoc, assoc, NatTrans.naturality,
      ← reassoc_of% hf₀, hg₀]
    rfl
  

Proof state:
case h.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : map' R₁ 0 2 = 0
hR₁' : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
h₀ : Epi (app' φ 0)
h₁✝ : Mono (app' φ 1)
h₃✝ : Mono (app' φ 3)
A : C
f₂ : A ⟶ obj' R₁ 2
h₁ : f₂ ≫ app' φ 2 = 0
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₁ : C
π₁ : A₁ ⟶ A
w✝² : Epi π₁
f₁ : A₁ ⟶ (sc (mk₂ (map' R₁ 1 2) (map' R₁ 2 3)) (_ : IsComplex (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))) 0).X₁
hf₁ :
  π₁ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
h₃ : (f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝¹ : Epi π₂
g₀ : A₂ ⟶ (sc (mk₂ (map' R₂ 0 1) (map' R₂ 1 2)) (_ : IsComplex (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))) 0).X₁
hg₀ :
  π₂ ≫ f₁ ≫ app' φ 1 = g₀ ≫ (sc (mk₂ (map' R₂ 0 1) (map' R₂ 1 2)) (_ : IsComplex (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))) 0).f
A₃ : C
π₃ : A₃ ⟶ A₂
w✝ : Epi π₃
f₀ : A₃ ⟶ obj' R₁ 0
hf₀ : π₃ ≫ g₀ = f₀ ≫ app' φ 0
h₄ : f₀ ≫ map' R₁ 0 1 = π₃ ≫ π₂ ≫ f₁
⊢ f₂ = 0

Next tactic:
rw [← cancel_epi π₁, comp_zero, hf₁, ← cancel_epi π₂, ← cancel_epi π₃, comp_zero,
    comp_zero, ← reassoc_of% h₄, ← R₁.map'_comp 0 1 2, hR₁, comp_zero]
theorem mono_of_epi_of_mono_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
    (h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
    Mono (app' φ 2) :=
  mono_of_epi_of_mono_of_mono' φ
    (by 

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact R₁
hR₂ : ComposableArrows.Exact R₂
h₀ : Epi (app' φ 0)
h₁ : Mono (app' φ 1)
h₃ : Mono (app' φ 3)
⊢ map' R₁ 0 2 = 0

Next tactic:
simpa only [R₁.map'_comp 0 1 2] using hR₁.toIsComplex.zero 0
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂ : Epi (app' φ 2)
h₃ : Mono (app' φ 3)
⊢ Epi (app' φ 1)

Next tactic:
rw [epi_iff_surjective_up_to_refinements]
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂ : Epi (app' φ 2)
h₃ : Mono (app' φ 3)
⊢ ∀ ⦃A : C⦄ (y : A ⟶ obj' R₂ 1), ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ y = x ≫ app' φ 1

Next tactic:
intro A g₁
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂ : Epi (app' φ 2)
h₃ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  

Proof state:
case intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂ : Epi (app' φ 2)
h₃ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂ : Epi (app' φ 2)
h₃ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
⊢ f₂ ≫ map' R₁ 2 3 = 0

Next tactic:
rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  

Proof state:
case intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝¹ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝ : Epi π₂
f₁ : A₂ ⟶ (sc (mk₂ (map' R₁ 1 2) (map' R₁ 2 3)) (_ : IsComplex (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))) 0).X₁
h₃ : π₂ ≫ f₂ = f₁ ≫ (sc (mk₂ (map' R₁ 1 2) (map' R₁ 2 3)) (_ : IsComplex (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))) 0).f
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
dsimp at f₁ h₃
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝¹ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝ : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    

Proof state:
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝¹ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝ : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
⊢ (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0

Next tactic:
rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝¹ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝ : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
  obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝² : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝¹ : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0
A₃ : C
π₃ : A₃ ⟶ A₂
w✝ : Epi π₃
g₀ : A₃ ⟶ (sc (mk₂ (map' R₂ 0 1) (map' R₂ 1 2)) (_ : IsComplex (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))) 0).X₁
h₅ :
  π₃ ≫ (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) =
    g₀ ≫ (sc (mk₂ (map' R₂ 0 1) (map' R₂ 1 2)) (_ : IsComplex (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))) 0).f
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
dsimp at g₀ h₅
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
  obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
  dsimp at g₀ h₅
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝² : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝¹ : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0
A₃ : C
π₃ : A₃ ⟶ A₂
w✝ : Epi π₃
g₀ : A₃ ⟶ R₂.obj 0
h₅ :
  π₃ ≫ (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ φ.app 1) =
    g₀ ≫ R₂.map (homOfLE (_ : { val := 0, isLt := (_ : 0 < 3 + 1) } ≤ { val := 1, isLt := (_ : 1 < 3 + 1) }))
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
rw [comp_sub] at h₅
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
  obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
  dsimp at g₀ h₅
  rw [comp_sub] at h₅
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝² : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝¹ : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0
A₃ : C
π₃ : A₃ ⟶ A₂
w✝ : Epi π₃
g₀ : A₃ ⟶ R₂.obj 0
h₅ :
  π₃ ≫ π₂ ≫ π₁ ≫ g₁ - π₃ ≫ f₁ ≫ φ.app 1 =
    g₀ ≫ R₂.map (homOfLE (_ : { val := 0, isLt := (_ : 0 < 3 + 1) } ≤ { val := 1, isLt := (_ : 1 < 3 + 1) }))
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
obtain ⟨A₄, π₄, _, f₀, h₆⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
theorem epi_of_epi_of_epi_of_mono'
    (hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
    (hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
    (h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
    Epi (app' φ 1) := by
  rw [epi_iff_surjective_up_to_refinements]
  intro A g₁
  obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
    surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
  have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
    rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
      ← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
  obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
  dsimp at f₁ h₃
  have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
    rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
  obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
  dsimp at g₀ h₅
  rw [comp_sub] at h₅
  obtain ⟨A₄, π₄, _, f₀, h₆⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
C : Type u_1
inst✝¹ : Category.{u_2, u_1} C
inst✝ : Abelian C
R₁ R₂ : ComposableArrows C 3
φ : R₁ ⟶ R₂
hR₁ : ComposableArrows.Exact (mk₂ (map' R₁ 1 2) (map' R₁ 2 3))
hR₂ : ComposableArrows.Exact (mk₂ (map' R₂ 0 1) (map' R₂ 1 2))
hR₂' : map' R₂ 1 3 = 0
h₀ : Epi (app' φ 0)
h₂✝ : Epi (app' φ 2)
h₃✝ : Mono (app' φ 3)
A : C
g₁ : A ⟶ obj' R₂ 1
A₁ : C
π₁ : A₁ ⟶ A
w✝³ : Epi π₁
f₂ : A₁ ⟶ obj' R₁ 2
h₁ : π₁ ≫ g₁ ≫ map' R₂ 1 2 = f₂ ≫ app' φ 2
h₂ : f₂ ≫ map' R₁ 2 3 = 0
A₂ : C
π₂ : A₂ ⟶ A₁
w✝² : Epi π₂
f₁ : A₂ ⟶ R₁.obj 1
h₃ : π₂ ≫ f₂ = f₁ ≫ R₁.map (homOfLE (_ : { val := 1, isLt := (_ : 1 < 3 + 1) } ≤ { val := 2, isLt := (_ : 2 < 3 + 1) }))
h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1) ≫ map' R₂ 1 2 = 0
A₃ : C
π₃ : A₃ ⟶ A₂
w✝¹ : Epi π₃
g₀ : A₃ ⟶ R₂.obj 0
h₅ :
  π₃ ≫ π₂ ≫ π₁ ≫ g₁ - π₃ ≫ f₁ ≫ φ.app 1 =
    g₀ ≫ R₂.map (homOfLE (_ : { val := 0, isLt := (_ : 0 < 3 + 1) } ≤ { val := 1, isLt := (_ : 1 < 3 + 1) }))
A₄ : C
π₄ : A₄ ⟶ A₃
w✝ : Epi π₄
f₀ : A₄ ⟶ obj' R₁ 0
h₆ : π₄ ≫ g₀ = f₀ ≫ app' φ 0
⊢ ∃ A' π, ∃ (_ : Epi π), ∃ x, π ≫ g₁ = x ≫ app' φ 1

Next tactic:
refine' ⟨A₄, π₄ ≫ π₃ ≫ π₂ ≫ π₁, inferInstance,
    π₄ ≫ π₃ ≫ f₁ + f₀ ≫ (by exact R₁.map' 0 1), _⟩