l3lab/ntp-mathlib huggingface dataset:
/-- The diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j` is exact
when `c.Rel i j`. -/
lemma composableArrows₃_exact [CategoryWithHomology C] :
    (composableArrows₃ K i j).Exact := by
  let S := ShortComplex.mk (K.homologyι i) (K.opcyclesToCycles i j) (by simp)
  let S' := ShortComplex.mk (K.homologyι i) (K.fromOpcycles i j) (by simp)
  let ι : S ⟶ S' :=
    { τ₁ := 𝟙 _
      τ₂ := 𝟙 _
      τ₃ := K.iCycles j }
  have hS : S.Exact := by
    rw [ShortComplex.exact_iff_of_epi_of_isIso_of_mono ι]
    exact S'.exact_of_f_is_kernel (K.homologyIsKernel i j (c.next_eq' hij))
  let T := ShortComplex.mk (K.opcyclesToCycles i j) (K.homologyπ j) (by simp)
  let T' := ShortComplex.mk (K.toCycles i j) (K.homologyπ j) (by simp)
  let π : T' ⟶ T :=
    { τ₁ := K.pOpcycles i
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
  have hT : T.Exact := by
    

Proof state:
C : Type u_1
ι✝ : Type u_2
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι✝
K : HomologicalComplex C c
i j : ι✝
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
S : ShortComplex C :=
  ShortComplex.mk (homologyι K i) (opcyclesToCycles K i j) (_ : homologyι K i ≫ opcyclesToCycles K i j = 0)
S' : ShortComplex C := ShortComplex.mk (homologyι K i) (fromOpcycles K i j) (_ : homologyι K i ≫ fromOpcycles K i j = 0)
ι : S ⟶ S' := ShortComplex.Hom.mk (𝟙 S.X₁) (𝟙 S.X₂) (iCycles K j)
hS : ShortComplex.Exact S
T : ShortComplex C :=
  ShortComplex.mk (opcyclesToCycles K i j) (homologyπ K j) (_ : opcyclesToCycles K i j ≫ homologyπ K j = 0)
T' : ShortComplex C := ShortComplex.mk (toCycles K i j) (homologyπ K j) (_ : toCycles K i j ≫ homologyπ K j = 0)
π : T' ⟶ T := ShortComplex.Hom.mk (pOpcycles K i) (𝟙 T'.X₂) (𝟙 T'.X₃)
⊢ ShortComplex.Exact T

Next tactic:
rw [← ShortComplex.exact_iff_of_epi_of_isIso_of_mono π]
/-- The diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j` is exact
when `c.Rel i j`. -/
lemma composableArrows₃_exact [CategoryWithHomology C] :
    (composableArrows₃ K i j).Exact := by
  let S := ShortComplex.mk (K.homologyι i) (K.opcyclesToCycles i j) (by simp)
  let S' := ShortComplex.mk (K.homologyι i) (K.fromOpcycles i j) (by simp)
  let ι : S ⟶ S' :=
    { τ₁ := 𝟙 _
      τ₂ := 𝟙 _
      τ₃ := K.iCycles j }
  have hS : S.Exact := by
    rw [ShortComplex.exact_iff_of_epi_of_isIso_of_mono ι]
    exact S'.exact_of_f_is_kernel (K.homologyIsKernel i j (c.next_eq' hij))
  let T := ShortComplex.mk (K.opcyclesToCycles i j) (K.homologyπ j) (by simp)
  let T' := ShortComplex.mk (K.toCycles i j) (K.homologyπ j) (by simp)
  let π : T' ⟶ T :=
    { τ₁ := K.pOpcycles i
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
  have hT : T.Exact := by
    rw [← ShortComplex.exact_iff_of_epi_of_isIso_of_mono π]
    

Proof state:
C : Type u_1
ι✝ : Type u_2
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι✝
K : HomologicalComplex C c
i j : ι✝
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
S : ShortComplex C :=
  ShortComplex.mk (homologyι K i) (opcyclesToCycles K i j) (_ : homologyι K i ≫ opcyclesToCycles K i j = 0)
S' : ShortComplex C := ShortComplex.mk (homologyι K i) (fromOpcycles K i j) (_ : homologyι K i ≫ fromOpcycles K i j = 0)
ι : S ⟶ S' := ShortComplex.Hom.mk (𝟙 S.X₁) (𝟙 S.X₂) (iCycles K j)
hS : ShortComplex.Exact S
T : ShortComplex C :=
  ShortComplex.mk (opcyclesToCycles K i j) (homologyπ K j) (_ : opcyclesToCycles K i j ≫ homologyπ K j = 0)
T' : ShortComplex C := ShortComplex.mk (toCycles K i j) (homologyπ K j) (_ : toCycles K i j ≫ homologyπ K j = 0)
π : T' ⟶ T := ShortComplex.Hom.mk (pOpcycles K i) (𝟙 T'.X₂) (𝟙 T'.X₃)
⊢ ShortComplex.Exact T'

Next tactic:
exact T'.exact_of_g_is_cokernel (K.homologyIsCokernel i j (c.prev_eq' hij))
/-- The diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j` is exact
when `c.Rel i j`. -/
lemma composableArrows₃_exact [CategoryWithHomology C] :
    (composableArrows₃ K i j).Exact := by
  let S := ShortComplex.mk (K.homologyι i) (K.opcyclesToCycles i j) (by simp)
  let S' := ShortComplex.mk (K.homologyι i) (K.fromOpcycles i j) (by simp)
  let ι : S ⟶ S' :=
    { τ₁ := 𝟙 _
      τ₂ := 𝟙 _
      τ₃ := K.iCycles j }
  have hS : S.Exact := by
    rw [ShortComplex.exact_iff_of_epi_of_isIso_of_mono ι]
    exact S'.exact_of_f_is_kernel (K.homologyIsKernel i j (c.next_eq' hij))
  let T := ShortComplex.mk (K.opcyclesToCycles i j) (K.homologyπ j) (by simp)
  let T' := ShortComplex.mk (K.toCycles i j) (K.homologyπ j) (by simp)
  let π : T' ⟶ T :=
    { τ₁ := K.pOpcycles i
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
  have hT : T.Exact := by
    rw [← ShortComplex.exact_iff_of_epi_of_isIso_of_mono π]
    exact T'.exact_of_g_is_cokernel (K.homologyIsCokernel i j (c.prev_eq' hij))
  

Proof state:
C : Type u_1
ι✝ : Type u_2
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι✝
K : HomologicalComplex C c
i j : ι✝
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
S : ShortComplex C :=
  ShortComplex.mk (homologyι K i) (opcyclesToCycles K i j) (_ : homologyι K i ≫ opcyclesToCycles K i j = 0)
S' : ShortComplex C := ShortComplex.mk (homologyι K i) (fromOpcycles K i j) (_ : homologyι K i ≫ fromOpcycles K i j = 0)
ι : S ⟶ S' := ShortComplex.Hom.mk (𝟙 S.X₁) (𝟙 S.X₂) (iCycles K j)
hS : ShortComplex.Exact S
T : ShortComplex C :=
  ShortComplex.mk (opcyclesToCycles K i j) (homologyπ K j) (_ : opcyclesToCycles K i j ≫ homologyπ K j = 0)
T' : ShortComplex C := ShortComplex.mk (toCycles K i j) (homologyπ K j) (_ : toCycles K i j ≫ homologyπ K j = 0)
π : T' ⟶ T := ShortComplex.Hom.mk (pOpcycles K i) (𝟙 T'.X₂) (𝟙 T'.X₃)
hT : ShortComplex.Exact T
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
apply ComposableArrows.exact_of_δ₀
/-- The diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j` is exact
when `c.Rel i j`. -/
lemma composableArrows₃_exact [CategoryWithHomology C] :
    (composableArrows₃ K i j).Exact := by
  let S := ShortComplex.mk (K.homologyι i) (K.opcyclesToCycles i j) (by simp)
  let S' := ShortComplex.mk (K.homologyι i) (K.fromOpcycles i j) (by simp)
  let ι : S ⟶ S' :=
    { τ₁ := 𝟙 _
      τ₂ := 𝟙 _
      τ₃ := K.iCycles j }
  have hS : S.Exact := by
    rw [ShortComplex.exact_iff_of_epi_of_isIso_of_mono ι]
    exact S'.exact_of_f_is_kernel (K.homologyIsKernel i j (c.next_eq' hij))
  let T := ShortComplex.mk (K.opcyclesToCycles i j) (K.homologyπ j) (by simp)
  let T' := ShortComplex.mk (K.toCycles i j) (K.homologyπ j) (by simp)
  let π : T' ⟶ T :=
    { τ₁ := K.pOpcycles i
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
  have hT : T.Exact := by
    rw [← ShortComplex.exact_iff_of_epi_of_isIso_of_mono π]
    exact T'.exact_of_g_is_cokernel (K.homologyIsCokernel i j (c.prev_eq' hij))
  apply ComposableArrows.exact_of_δ₀
  · 

Proof state:
case h
C : Type u_1
ι✝ : Type u_2
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι✝
K : HomologicalComplex C c
i j : ι✝
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
S : ShortComplex C :=
  ShortComplex.mk (homologyι K i) (opcyclesToCycles K i j) (_ : homologyι K i ≫ opcyclesToCycles K i j = 0)
S' : ShortComplex C := ShortComplex.mk (homologyι K i) (fromOpcycles K i j) (_ : homologyι K i ≫ fromOpcycles K i j = 0)
ι : S ⟶ S' := ShortComplex.Hom.mk (𝟙 S.X₁) (𝟙 S.X₂) (iCycles K j)
hS : ShortComplex.Exact S
T : ShortComplex C :=
  ShortComplex.mk (opcyclesToCycles K i j) (homologyπ K j) (_ : opcyclesToCycles K i j ≫ homologyπ K j = 0)
T' : ShortComplex C := ShortComplex.mk (toCycles K i j) (homologyπ K j) (_ : toCycles K i j ≫ homologyπ K j = 0)
π : T' ⟶ T := ShortComplex.Hom.mk (pOpcycles K i) (𝟙 T'.X₂) (𝟙 T'.X₃)
hT : ShortComplex.Exact T
⊢ ComposableArrows.Exact
    (ComposableArrows.mk₂ (ComposableArrows.map' (composableArrows₃ K i j) 0 1)
      (ComposableArrows.map' (composableArrows₃ K i j) 1 2))

Next tactic:
exact hS.exact_toComposableArrows
/-- The diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j` is exact
when `c.Rel i j`. -/
lemma composableArrows₃_exact [CategoryWithHomology C] :
    (composableArrows₃ K i j).Exact := by
  let S := ShortComplex.mk (K.homologyι i) (K.opcyclesToCycles i j) (by simp)
  let S' := ShortComplex.mk (K.homologyι i) (K.fromOpcycles i j) (by simp)
  let ι : S ⟶ S' :=
    { τ₁ := 𝟙 _
      τ₂ := 𝟙 _
      τ₃ := K.iCycles j }
  have hS : S.Exact := by
    rw [ShortComplex.exact_iff_of_epi_of_isIso_of_mono ι]
    exact S'.exact_of_f_is_kernel (K.homologyIsKernel i j (c.next_eq' hij))
  let T := ShortComplex.mk (K.opcyclesToCycles i j) (K.homologyπ j) (by simp)
  let T' := ShortComplex.mk (K.toCycles i j) (K.homologyπ j) (by simp)
  let π : T' ⟶ T :=
    { τ₁ := K.pOpcycles i
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
  have hT : T.Exact := by
    rw [← ShortComplex.exact_iff_of_epi_of_isIso_of_mono π]
    exact T'.exact_of_g_is_cokernel (K.homologyIsCokernel i j (c.prev_eq' hij))
  apply ComposableArrows.exact_of_δ₀
  · exact hS.exact_toComposableArrows
  · 

Proof state:
case h₀
C : Type u_1
ι✝ : Type u_2
inst✝² : Category.{u_3, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι✝
K : HomologicalComplex C c
i j : ι✝
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
S : ShortComplex C :=
  ShortComplex.mk (homologyι K i) (opcyclesToCycles K i j) (_ : homologyι K i ≫ opcyclesToCycles K i j = 0)
S' : ShortComplex C := ShortComplex.mk (homologyι K i) (fromOpcycles K i j) (_ : homologyι K i ≫ fromOpcycles K i j = 0)
ι : S ⟶ S' := ShortComplex.Hom.mk (𝟙 S.X₁) (𝟙 S.X₂) (iCycles K j)
hS : ShortComplex.Exact S
T : ShortComplex C :=
  ShortComplex.mk (opcyclesToCycles K i j) (homologyπ K j) (_ : opcyclesToCycles K i j ≫ homologyπ K j = 0)
T' : ShortComplex C := ShortComplex.mk (toCycles K i j) (homologyπ K j) (_ : toCycles K i j ≫ homologyπ K j = 0)
π : T' ⟶ T := ShortComplex.Hom.mk (pOpcycles K i) (𝟙 T'.X₂) (𝟙 T'.X₃)
hT : ShortComplex.Exact T
⊢ ComposableArrows.Exact (ComposableArrows.δ₀ (composableArrows₃ K i j))

Next tactic:
exact hT.exact_toComposableArrows
/-- The functor `HomologicalComplex C c ⥤ ComposableArrows C 3` that maps `K` to the
diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j`. -/
@[simps]
noncomputable def composableArrows₃Functor [CategoryWithHomology C] :
    HomologicalComplex C c ⥤ ComposableArrows C 3 where
  obj K := composableArrows₃ K i j
  map {K L} φ := ComposableArrows.homMk₃ (homologyMap φ i) (opcyclesMap φ i) (cyclesMap φ j)
    (homologyMap φ j) (by 

Proof state:
C : Type u_1
ι : Type u_2
inst✝² : Category.{?u.29655, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι
K✝ : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
K L : HomologicalComplex C c
φ : K ⟶ L
⊢ ComposableArrows.map' ((fun K => composableArrows₃ K i j) K) 0 1 ≫ opcyclesMap φ i =
    homologyMap φ i ≫ ComposableArrows.map' ((fun K => composableArrows₃ K i j) L) 0 1

Next tactic:
aesop_cat
/-- The functor `HomologicalComplex C c ⥤ ComposableArrows C 3` that maps `K` to the
diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j`. -/
@[simps]
noncomputable def composableArrows₃Functor [CategoryWithHomology C] :
    HomologicalComplex C c ⥤ ComposableArrows C 3 where
  obj K := composableArrows₃ K i j
  map {K L} φ := ComposableArrows.homMk₃ (homologyMap φ i) (opcyclesMap φ i) (cyclesMap φ j)
    (homologyMap φ j) (by aesop_cat) (by 

Proof state:
C : Type u_1
ι : Type u_2
inst✝² : Category.{?u.29655, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι
K✝ : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
K L : HomologicalComplex C c
φ : K ⟶ L
⊢ ComposableArrows.map' ((fun K => composableArrows₃ K i j) K) 1 2 ≫ cyclesMap φ j =
    opcyclesMap φ i ≫ ComposableArrows.map' ((fun K => composableArrows₃ K i j) L) 1 2

Next tactic:
aesop_cat
/-- The functor `HomologicalComplex C c ⥤ ComposableArrows C 3` that maps `K` to the
diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j`. -/
@[simps]
noncomputable def composableArrows₃Functor [CategoryWithHomology C] :
    HomologicalComplex C c ⥤ ComposableArrows C 3 where
  obj K := composableArrows₃ K i j
  map {K L} φ := ComposableArrows.homMk₃ (homologyMap φ i) (opcyclesMap φ i) (cyclesMap φ j)
    (homologyMap φ j) (by aesop_cat) (by aesop_cat) (by 

Proof state:
C : Type u_1
ι : Type u_2
inst✝² : Category.{?u.29655, u_1} C
inst✝¹ : Preadditive C
c : ComplexShape ι
K✝ : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝ : CategoryWithHomology C
K L : HomologicalComplex C c
φ : K ⟶ L
⊢ ComposableArrows.map' ((fun K => composableArrows₃ K i j) K) 2 3 ≫ homologyMap φ j =
    cyclesMap φ j ≫ ComposableArrows.map' ((fun K => composableArrows₃ K i j) L) 2 3

Next tactic:
aesop_cat
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by 

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{?u.112854, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
⊢ opcyclesMap S.f i ≫ opcyclesMap S.g i = 0

Next tactic:
rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero]
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
⊢ ShortComplex.Exact
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0))

Next tactic:
have : Epi (ShortComplex.map S (eval C c i)).g := by dsimp; infer_instance
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  have : Epi (ShortComplex.map S (eval C c i)).g := by 

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
⊢ Epi (ShortComplex.map S (eval C c i)).g

Next tactic:
dsimp
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  have : Epi (ShortComplex.map S (eval C c i)).g := by dsimp; 

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
⊢ Epi (Hom.f S.g i)

Next tactic:
infer_instance
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  have : Epi (ShortComplex.map S (eval C c i)).g := by dsimp; infer_instance
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
this : Epi (ShortComplex.map S (eval C c i)).g
⊢ ShortComplex.Exact
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0))

Next tactic:
have hj := (hS.map (HomologicalComplex.eval C c i)).gIsCokernel
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  have : Epi (ShortComplex.map S (eval C c i)).g := by dsimp; infer_instance
  have hj := (hS.map (HomologicalComplex.eval C c i)).gIsCokernel
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
this : Epi (ShortComplex.map S (eval C c i)).g
hj :
  IsColimit
    (CokernelCofork.ofπ (ShortComplex.map S (eval C c i)).g
      (_ : (ShortComplex.map S (eval C c i)).f ≫ (ShortComplex.map S (eval C c i)).g = 0))
⊢ ShortComplex.Exact
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0))

Next tactic:
apply ShortComplex.exact_of_g_is_cokernel
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  have : Epi (ShortComplex.map S (eval C c i)).g := by dsimp; infer_instance
  have hj := (hS.map (HomologicalComplex.eval C c i)).gIsCokernel
  apply ShortComplex.exact_of_g_is_cokernel
  

Proof state:
case hS
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
this : Epi (ShortComplex.map S (eval C c i)).g
hj :
  IsColimit
    (CokernelCofork.ofπ (ShortComplex.map S (eval C c i)).g
      (_ : (ShortComplex.map S (eval C c i)).f ≫ (ShortComplex.map S (eval C c i)).g = 0))
⊢ IsColimit
    (CokernelCofork.ofπ
      (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0)).g
      (_ :
        (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0)).f ≫
            (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
                (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0)).g =
          0))

Next tactic:
refine' CokernelCofork.IsColimit.ofπ' _ _  (fun {A} k hk => by
    dsimp at k hk ⊢
    have H := CokernelCofork.IsColimit.desc' hj (S.X₂.pOpcycles i ≫ k) (by
      dsimp
      rw [← p_opcyclesMap_assoc, hk, comp_zero])
    dsimp at H
    refine' ⟨S.X₃.descOpcycles H.1 _ rfl _, _⟩
    · rw [← cancel_epi (S.g.f (c.prev i)), comp_zero, Hom.comm_assoc, H.2,
        d_pOpcycles_assoc, zero_comp]
    · rw [← cancel_epi (S.X₂.pOpcycles i), opcyclesMap_comp_descOpcycles, p_descOpcycles, H.2])
/-- If `X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` is an exact sequence of homological complexes, then
`X₁.opcycles i ⟶ X₂.opcycles i ⟶ X₃.opcycles i ⟶ 0` is exact. This lemma states
the exactness at `X₂.opcycles i`, while the fact that `X₂.opcycles i ⟶ X₃.opcycles i`
is an epi is an instance. -/
lemma opcycles_right_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Epi S.g]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i)
      (by rw [← opcyclesMap_comp, S.zero, opcyclesMap_zero])).Exact := by
  have : Epi (ShortComplex.map S (eval C c i)).g := by dsimp; infer_instance
  have hj := (hS.map (HomologicalComplex.eval C c i)).gIsCokernel
  apply ShortComplex.exact_of_g_is_cokernel
  refine' CokernelCofork.IsColimit.ofπ' _ _  (fun {A} k hk => by
    

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : Abelian C
c : ComplexShape ι
S : ShortComplex (HomologicalComplex C c)
hS : ShortComplex.Exact S
inst✝³ : Epi S.g
i : ι
inst✝² : HasHomology S.X₁ i
inst✝¹ : HasHomology S.X₂ i
inst✝ : HasHomology S.X₃ i
this : Epi (ShortComplex.map S (eval C c i)).g
hj :
  IsColimit
    (CokernelCofork.ofπ (ShortComplex.map S (eval C c i)).g
      (_ : (ShortComplex.map S (eval C c i)).f ≫ (ShortComplex.map S (eval C c i)).g = 0))
A : C
k : (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0)).X₂ ⟶ A
hk : (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0)).f ≫ k = 0
⊢ { l //
    (ShortComplex.mk (opcyclesMap S.f i) (opcyclesMap S.g i) (_ : opcyclesMap S.f i ≫ opcyclesMap S.g i = 0)).g ≫ l =
      k }

Next tactic:
dsimp at k hk ⊢