l3lab/ntp-mathlib huggingface dataset:
theorem isIntegral_stableUnderBaseChange : StableUnderBaseChange fun f => f.IsIntegral := by
  refine' StableUnderBaseChange.mk _ isIntegral_respectsIso _
  introv h x
  refine' TensorProduct.induction_on x _ _ _
  · apply isIntegral_zero
  · intro x y; 

Proof state:
case refine'_2
R S T : Type u_1
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
h : IsIntegral (algebraMap R T)
x✝ : S ⊗[R] T
x : S
y : T
⊢ IsIntegralElem includeLeftRingHom (x ⊗ₜ[R] y)

Next tactic:
exact IsIntegral.tmul x (h y)
theorem isIntegral_stableUnderBaseChange : StableUnderBaseChange fun f => f.IsIntegral := by
  refine' StableUnderBaseChange.mk _ isIntegral_respectsIso _
  introv h x
  refine' TensorProduct.induction_on x _ _ _
  · apply isIntegral_zero
  · intro x y; exact IsIntegral.tmul x (h y)
  · 

Proof state:
case refine'_3
R S T : Type u_1
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
h : IsIntegral (algebraMap R T)
x : S ⊗[R] T
⊢ ∀ (x y : S ⊗[R] T),
    IsIntegralElem includeLeftRingHom x →
      IsIntegralElem includeLeftRingHom y → IsIntegralElem includeLeftRingHom (x + y)

Next tactic:
intro x y hx hy
theorem isIntegral_stableUnderBaseChange : StableUnderBaseChange fun f => f.IsIntegral := by
  refine' StableUnderBaseChange.mk _ isIntegral_respectsIso _
  introv h x
  refine' TensorProduct.induction_on x _ _ _
  · apply isIntegral_zero
  · intro x y; exact IsIntegral.tmul x (h y)
  · intro x y hx hy; 

Proof state:
case refine'_3
R S T : Type u_1
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
h : IsIntegral (algebraMap R T)
x✝ x y : S ⊗[R] T
hx : IsIntegralElem includeLeftRingHom x
hy : IsIntegralElem includeLeftRingHom y
⊢ IsIntegralElem includeLeftRingHom (x + y)

Next tactic:
exact IsIntegral.add hx hy
/-- The morphism `K.opcycles i ⟶ K.cycles j` that is induced by `K.d i j`. -/
noncomputable def opcyclesToCycles [K.HasHomology i] [K.HasHomology j] :
    K.opcycles i ⟶ K.cycles j :=
  K.liftCycles (K.fromOpcycles i j) _ rfl (by 

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁷ : Category.{?u.280, u_1} C
inst✝⁶ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝⁵ : HasHomology K i
inst✝⁴ : HasHomology K j
inst✝³ : HasHomology L i
inst✝² : HasHomology L j
inst✝¹ : HasHomology K i
inst✝ : HasHomology K j
⊢ fromOpcycles K i j ≫ d K j (ComplexShape.next c j) = 0

Next tactic:
simp
@[reassoc (attr := simp)]
lemma opcyclesToCycles_iCycles : K.opcyclesToCycles i j ≫ K.iCycles j = K.fromOpcycles i j := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ opcyclesToCycles K i j ≫ iCycles K j = fromOpcycles K i j

Next tactic:
dsimp only [opcyclesToCycles]
@[reassoc (attr := simp)]
lemma opcyclesToCycles_iCycles : K.opcyclesToCycles i j ≫ K.iCycles j = K.fromOpcycles i j := by
  dsimp only [opcyclesToCycles]
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ liftCycles K (fromOpcycles K i j) (ComplexShape.next c j) (_ : ComplexShape.next c j = ComplexShape.next c j)
        (_ : fromOpcycles K i j ≫ d K j (ComplexShape.next c j) = 0) ≫
      iCycles K j =
    fromOpcycles K i j

Next tactic:
simp
@[reassoc]
lemma pOpcycles_opcyclesToCycles_iCycles :
    K.pOpcycles i ≫ K.opcyclesToCycles i j ≫ K.iCycles j = K.d i j := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ pOpcycles K i ≫ opcyclesToCycles K i j ≫ iCycles K j = d K i j

Next tactic:
simp [opcyclesToCycles]
@[reassoc (attr := simp)]
lemma pOpcycles_opcyclesToCycles :
    K.pOpcycles i ≫ K.opcyclesToCycles i j = K.toCycles i j := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ pOpcycles K i ≫ opcyclesToCycles K i j = toCycles K i j

Next tactic:
simp only [← cancel_mono (K.iCycles j), assoc, opcyclesToCycles_iCycles,
    p_fromOpcycles, toCycles_i]
@[reassoc (attr := simp)]
lemma homologyι_opcyclesToCycles :
    K.homologyι i ≫ K.opcyclesToCycles i j = 0 := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ homologyι K i ≫ opcyclesToCycles K i j = 0

Next tactic:
simp only [← cancel_mono (K.iCycles j), assoc, opcyclesToCycles_iCycles,
    homologyι_comp_fromOpcycles, zero_comp]
@[reassoc (attr := simp)]
lemma opcyclesToCycles_homologyπ :
    K.opcyclesToCycles i j ≫ K.homologyπ j = 0 := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ opcyclesToCycles K i j ≫ homologyπ K j = 0

Next tactic:
simp only [← cancel_epi (K.pOpcycles i),
    pOpcycles_opcyclesToCycles_assoc, toCycles_comp_homologyπ, comp_zero]
@[reassoc (attr := simp)]
lemma opcyclesToCycles_naturality :
    opcyclesMap φ i ≫ opcyclesToCycles L i j = opcyclesToCycles K i j ≫ cyclesMap φ j := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝⁵ : Category.{u_3, u_1} C
inst✝⁴ : HasZeroMorphisms C
c : ComplexShape ι
K L : HomologicalComplex C c
φ : K ⟶ L
i j : ι
inst✝³ : HasHomology K i
inst✝² : HasHomology K j
inst✝¹ : HasHomology L i
inst✝ : HasHomology L j
⊢ opcyclesMap φ i ≫ opcyclesToCycles L i j = opcyclesToCycles K i j ≫ cyclesMap φ j

Next tactic:
simp only [← cancel_mono (L.iCycles j), ← cancel_epi (K.pOpcycles i),
    assoc, p_opcyclesMap_assoc, pOpcycles_opcyclesToCycles_iCycles, Hom.comm, cyclesMap_i,
    pOpcycles_opcyclesToCycles_iCycles_assoc]
instance [K.HasHomology i] [K.HasHomology j] :
    Mono ((composableArrows₃ K i j).map' 0 1) := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝³ : Category.{?u.13001, u_1} C
inst✝² : Preadditive C
c : ComplexShape ι
K : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝¹ : HasHomology K i
inst✝ : HasHomology K j
⊢ Mono (ComposableArrows.map' (composableArrows₃ K i j) 0 1)

Next tactic:
dsimp
instance [K.HasHomology i] [K.HasHomology j] :
    Mono ((composableArrows₃ K i j).map' 0 1) := by
  dsimp
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝³ : Category.{?u.13001, u_1} C
inst✝² : Preadditive C
c : ComplexShape ι
K : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝¹ : HasHomology K i
inst✝ : HasHomology K j
⊢ Mono (homologyι K i)

Next tactic:
infer_instance
instance [K.HasHomology i] [K.HasHomology j] :
    Epi ((composableArrows₃ K i j).map' 2 3) := by
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝³ : Category.{?u.17512, u_1} C
inst✝² : Preadditive C
c : ComplexShape ι
K : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝¹ : HasHomology K i
inst✝ : HasHomology K j
⊢ Epi (ComposableArrows.map' (composableArrows₃ K i j) 2 3)

Next tactic:
dsimp
instance [K.HasHomology i] [K.HasHomology j] :
    Epi ((composableArrows₃ K i j).map' 2 3) := by
  dsimp
  

Proof state:
C : Type u_1
ι : Type u_2
inst✝³ : Category.{?u.17512, u_1} C
inst✝² : Preadditive C
c : ComplexShape ι
K : HomologicalComplex C c
i j : ι
hij : ComplexShape.Rel c i j
inst✝¹ : HasHomology K i
inst✝ : HasHomology K j
⊢ Epi (homologyπ K j)

Next tactic:
infer_instance
/-- 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
  

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
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
let S := ShortComplex.mk (K.homologyι i) (K.opcyclesToCycles i j) (by simp)
/-- 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 

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
⊢ homologyι K i ≫ opcyclesToCycles K i j = 0

Next tactic:
simp
/-- 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)
  

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)
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
let S' := ShortComplex.mk (K.homologyι i) (K.fromOpcycles i j) (by simp)
/-- 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 

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)
⊢ homologyι K i ≫ fromOpcycles K i j = 0

Next tactic:
simp
/-- 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)
  

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)
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
let ι : S ⟶ S' :=
    { τ₁ := 𝟙 _
      τ₂ := 𝟙 _
      τ₃ := K.iCycles j }
/-- 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 }
  

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)
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
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))
/-- 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
    

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)
⊢ ShortComplex.Exact S

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 ι]
    

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)
⊢ ShortComplex.Exact S'

Next tactic:
exact S'.exact_of_f_is_kernel (K.homologyIsKernel i j (c.next_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))
  

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
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
let T := ShortComplex.mk (K.opcyclesToCycles i j) (K.homologyπ j) (by simp)
/-- 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 

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
⊢ opcyclesToCycles K i j ≫ homologyπ K j = 0

Next tactic:
simp
/-- 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)
  

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)
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
let T' := ShortComplex.mk (K.toCycles i j) (K.homologyπ j) (by simp)
/-- 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 

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)
⊢ toCycles K i j ≫ homologyπ K j = 0

Next tactic:
simp
/-- 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)
  

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)
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
let π : T' ⟶ T :=
    { τ₁ := K.pOpcycles i
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
/-- 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
      τ₂ := 𝟙 _
      τ₃ := 𝟙 _ }
  

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₃)
⊢ ComposableArrows.Exact (composableArrows₃ K i j)

Next tactic:
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))