-- Mathlib/Algebra/Homology/ShortComplex/Exact.lean
lemma exact_iff_epi [HasZeroObject C] (hg : S.g = 0) :
    S.Exact ↔ Epi S.f

Proof state:
case mpr
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
⊢ Epi S.f → S.Exact

Tactic:
intro

Result:
case mpr
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
a✝ : Epi S.f
⊢ S.Exact

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
h : S.Exact
⊢ Epi S.f

Tactic:
have := h.hasHomology

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
h : S.Exact
this : S.HasHomology
⊢ Epi S.f

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
⊢ S.Exact → Epi S.f

Tactic:
intro h

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
h : S.Exact
⊢ Epi S.f

Proof state:
case mpr
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
a✝ : Epi S.f
⊢ IsZero
    (HomologyData.ofIsColimitCokernelCofork S hg (CokernelCofork.ofπ 0 ⋯)
          (CokernelCofork.IsColimit.ofEpiOfIsZero (CokernelCofork.ofπ 0 ⋯) ⋯ ⋯)).left.H

Tactic:
exact isZero_zero C

Result:
no goals

Proof state:
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
⊢ S.Exact ↔ Epi S.f

Tactic:
constructor

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
⊢ S.Exact → Epi S.f

case mpr
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
⊢ Epi S.f → S.Exact

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this✝¹ : S.HasHomology
h : IsZero S.homology
this✝ : IsIso S.iCycles
this : Epi S.toCycles
⊢ Epi (S.toCycles ≫ S.iCycles)

Tactic:
apply epi_comp

Result:
no goals

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this✝ : S.HasHomology
h : IsZero S.homology
this : IsIso S.iCycles
⊢ Epi S.f

Tactic:
haveI : Epi S.toCycles := epi_of_isZero_cokernel' _ S.homologyIsCokernel h

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this✝¹ : S.HasHomology
h : IsZero S.homology
this✝ : IsIso S.iCycles
this : Epi S.toCycles
⊢ Epi S.f

Proof state:
case mpr
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
a✝ : Epi S.f
⊢ S.Exact

Tactic:
rw [(HomologyData.ofIsColimitCokernelCofork S hg _
  (CokernelCofork.IsColimit.ofEpiOfIsZero (CokernelCofork.ofπ (0 : S.X₂ ⟶ 0) comp_zero)
    inferInstance (isZero_zero C))).exact_iff]

Result:
case mpr
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
a✝ : Epi S.f
⊢ IsZero
    (HomologyData.ofIsColimitCokernelCofork S hg (CokernelCofork.ofπ 0 ⋯)
          (CokernelCofork.IsColimit.ofEpiOfIsZero (CokernelCofork.ofπ 0 ⋯) ⋯ ⋯)).left.H

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this : S.HasHomology
h : IsZero S.homology
⊢ Epi S.f

Tactic:
haveI := S.isIso_iCycles hg

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this✝ : S.HasHomology
h : IsZero S.homology
this : IsIso S.iCycles
⊢ Epi S.f

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this✝¹ : S.HasHomology
h : IsZero S.homology
this✝ : IsIso S.iCycles
this : Epi S.toCycles
⊢ Epi S.f

Tactic:
rw [← S.toCycles_i]

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this✝¹ : S.HasHomology
h : IsZero S.homology
this✝ : IsIso S.iCycles
this : Epi S.toCycles
⊢ Epi (S.toCycles ≫ S.iCycles)

Proof state:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
h : S.Exact
this : S.HasHomology
⊢ Epi S.f

Tactic:
simp only [exact_iff_isZero_homology] at h

Result:
case mp
C : Type u_1
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
S : ShortComplex C
inst✝ : HasZeroObject C
hg : S.g = 0
this : S.HasHomology
h : IsZero S.homology
⊢ Epi S.f