File: Mathlib/Algebra/Homology/HomologySequence.lean

full_name: HomologicalComplex.opcyclesToCycles
code: /-- 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 
goal: K.opcycles i ⟶ K.cycles j

full_name: HomologicalComplex.opcyclesToCycles_iCycles
code: @[reassoc (attr := simp)]
lemma opcyclesToCycles_iCycles : K.opcyclesToCycles i j ≫ K.iCycles j = K.fromOpcycles i j 
goal: K.opcyclesToCycles i j ≫ K.iCycles j = K.fromOpcycles i j

full_name: HomologicalComplex.pOpcycles_opcyclesToCycles_iCycles
code: @[reassoc]
lemma pOpcycles_opcyclesToCycles_iCycles :
    K.pOpcycles i ≫ K.opcyclesToCycles i j ≫ K.iCycles j = K.d i j 
goal: K.pOpcycles i ≫ K.opcyclesToCycles i j ≫ K.iCycles j = K.d i j

full_name: HomologicalComplex.pOpcycles_opcyclesToCycles
code: @[reassoc (attr := simp)]
lemma pOpcycles_opcyclesToCycles :
    K.pOpcycles i ≫ K.opcyclesToCycles i j = K.toCycles i j 
goal: K.pOpcycles i ≫ K.opcyclesToCycles i j = K.toCycles i j

full_name: HomologicalComplex.homologyι_opcyclesToCycles
code: @[reassoc (attr := simp)]
lemma homologyι_opcyclesToCycles :
    K.homologyι i ≫ K.opcyclesToCycles i j = 0 
goal: K.homologyι i ≫ K.opcyclesToCycles i j = 0

full_name: HomologicalComplex.opcyclesToCycles_homologyπ
code: @[reassoc (attr := simp)]
lemma opcyclesToCycles_homologyπ :
    K.opcyclesToCycles i j ≫ K.homologyπ j = 0 
goal: K.opcyclesToCycles i j ≫ K.homologyπ j = 0

full_name: HomologicalComplex.opcyclesToCycles_naturality
code: @[reassoc (attr := simp)]
lemma opcyclesToCycles_naturality :
    opcyclesMap φ i ≫ opcyclesToCycles L i j = opcyclesToCycles K i j ≫ cyclesMap φ j 
goal: HomologicalComplex.opcyclesMap φ i ≫ L.opcyclesToCycles i j = K.opcyclesToCycles i j ≫ HomologicalComplex.cyclesMap φ j

full_name: HomologicalComplex.natTransOpCyclesToCycles
code: /-- The natural transformation `K.opcyclesToCycles i j : K.opcycles i ⟶ K.cycles j` for all
`K : HomologicalComplex C c`. -/
@[simps]
noncomputable def natTransOpCyclesToCycles [CategoryWithHomology C] :
    opcyclesFunctor C c i ⟶ cyclesFunctor C c j 
goal: HomologicalComplex.opcyclesFunctor C c i ⟶ HomologicalComplex.cyclesFunctor C c j

full_name: HomologicalComplex.natTransOpCyclesToCycles_app
code: /-- The natural transformation `K.opcyclesToCycles i j : K.opcycles i ⟶ K.cycles j` for all
`K : HomologicalComplex C c`. -/
@[simps]
noncomputable def natTransOpCyclesToCycles [CategoryWithHomology C] :
    opcyclesFunctor C c i ⟶ cyclesFunctor C c j 
goal: (HomologicalComplex.natTransOpCyclesToCycles C c i j).app K = K.opcyclesToCycles i j

full_name: HomologicalComplex.HomologySequence.composableArrows₃
code: /-- The diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j`. -/
@[simp]
noncomputable def composableArrows₃ [K.HasHomology i] [K.HasHomology j] :
    ComposableArrows C 3 
goal: CategoryTheory.ComposableArrows C 3

full_name: HomologicalComplex.HomologySequence.instMonoMap'ComposableArrows₃OfNatNat
code: instance [K.HasHomology i] [K.HasHomology j] :
    Mono ((composableArrows₃ K i j).map' 0 1) 
goal: CategoryTheory.Mono ((HomologicalComplex.HomologySequence.composableArrows₃ K i j).map' 0 1 ⋯ ⋯)

full_name: HomologicalComplex.HomologySequence.instEpiMap'ComposableArrows₃OfNatNat
code: instance [K.HasHomology i] [K.HasHomology j] :
    Epi ((composableArrows₃ K i j).map' 2 3) 
goal: CategoryTheory.Epi ((HomologicalComplex.HomologySequence.composableArrows₃ K i j).map' 2 3 ⋯ ⋯)

full_name: HomologicalComplex.HomologySequence.composableArrows₃_exact
code: /-- 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 
goal: (HomologicalComplex.HomologySequence.composableArrows₃ K i j).Exact

full_name: HomologicalComplex.HomologySequence.composableArrows₃Functor
code: /-- 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 
goal: HomologicalComplex C c ⥤ CategoryTheory.ComposableArrows C 3

full_name: HomologicalComplex.HomologySequence.composableArrows₃Functor_map
code: /-- 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 
goal: (HomologicalComplex.HomologySequence.composableArrows₃Functor C i j).map φ =
  CategoryTheory.ComposableArrows.homMk₃ (HomologicalComplex.homologyMap φ i) (HomologicalComplex.opcyclesMap φ i)
    (HomologicalComplex.cyclesMap φ j) (HomologicalComplex.homologyMap φ j) ⋯ ⋯ ⋯

full_name: HomologicalComplex.HomologySequence.composableArrows₃Functor_obj
code: /-- 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 
goal: (HomologicalComplex.HomologySequence.composableArrows₃Functor C i j).obj K =
  HomologicalComplex.HomologySequence.composableArrows₃ K i j

full_name: HomologicalComplex.opcycles_right_exact
code: /-- 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 
goal: (CategoryTheory.ShortComplex.mk (HomologicalComplex.opcyclesMap S.f i) (HomologicalComplex.opcyclesMap S.g i) ⋯).Exact

full_name: HomologicalComplex.cycles_left_exact
code: /-- If `0 ⟶ X₁ ⟶ X₂ ⟶ X₃` is an exact sequence of homological complex, then
`0 ⟶ X₁.cycles i ⟶ X₂.cycles i ⟶ X₃.cycles i` is exact. This lemma states
the exactness at `X₂.cycles i`, while the fact that `X₁.cycles i ⟶ X₂.cycles i`
is a mono is an instance. -/
lemma cycles_left_exact (S : ShortComplex (HomologicalComplex C c)) (hS : S.Exact) [Mono S.f]
    (i : ι) [S.X₁.HasHomology i] [S.X₂.HasHomology i] [S.X₃.HasHomology i] :
    (ShortComplex.mk (cyclesMap S.f i) (cyclesMap S.g i)
      (by rw [← cyclesMap_comp, S.zero, cyclesMap_zero])).Exact 
goal: (CategoryTheory.ShortComplex.mk (HomologicalComplex.cyclesMap S.f i) (HomologicalComplex.cyclesMap S.g i) ⋯).Exact

full_name: HomologicalComplex.HomologySequence.snakeInput_v₀₁
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).v₀₁ =
  S.mapNatTrans (HomologicalComplex.natTransHomologyι C c i)

full_name: HomologicalComplex.HomologySequence.snakeInput_v₂₃
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).v₂₃ =
  S.mapNatTrans (HomologicalComplex.natTransHomologyπ C c j)

full_name: HomologicalComplex.HomologySequence.snakeInput_L₁
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).L₁ =
  (HomologicalComplex.opcyclesFunctor C c i).mapShortComplex.obj S

full_name: HomologicalComplex.HomologySequence.snakeInput_L₀
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).L₀ =
  (HomologicalComplex.homologyFunctor C c i).mapShortComplex.obj S

full_name: HomologicalComplex.HomologySequence.snakeInput
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: CategoryTheory.ShortComplex.SnakeInput C

full_name: HomologicalComplex.HomologySequence.snakeInput_L₂
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).L₂ =
  (HomologicalComplex.cyclesFunctor C c j).mapShortComplex.obj S

full_name: HomologicalComplex.HomologySequence.snakeInput_L₃
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).L₃ =
  (HomologicalComplex.homologyFunctor C c j).mapShortComplex.obj S

full_name: HomologicalComplex.HomologySequence.snakeInput_v₁₂
code: /-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C 
goal: (HomologicalComplex.HomologySequence.snakeInput hS i j hij).v₁₂ =
  S.mapNatTrans (HomologicalComplex.natTransOpCyclesToCycles C c i j)

full_name: CategoryTheory.ShortComplex.ShortExact.δ
code: /-- The connecting homoomorphism `S.X₃.homology i ⟶ S.X₁.homology j` for a short exact
short complex `S`.  -/
noncomputable def δ : S.X₃.homology i ⟶ S.X₁.homology j 
goal: S.X₃.homology i ⟶ S.X₁.homology j

full_name: CategoryTheory.ShortComplex.ShortExact.δ_comp
code: @[reassoc (attr := simp)]
lemma δ_comp : hS.δ i j hij ≫ HomologicalComplex.homologyMap S.f j = 0 
goal: hS.δ i j hij ≫ HomologicalComplex.homologyMap S.f j = 0

full_name: CategoryTheory.ShortComplex.ShortExact.comp_δ
code: @[reassoc (attr := simp)]
lemma comp_δ : HomologicalComplex.homologyMap S.g i ≫ hS.δ i j hij = 0 
goal: HomologicalComplex.homologyMap S.g i ≫ hS.δ i j hij = 0

full_name: CategoryTheory.ShortComplex.ShortExact.homology_exact₁
code: /-- Exactness of `S.X₃.homology i ⟶ S.X₁.homology j ⟶ S.X₂.homology j`. -/
lemma homology_exact₁ : (ShortComplex.mk _ _ (δ_comp hS i j hij)).Exact 
goal: (CategoryTheory.ShortComplex.mk (hS.δ i j hij) (HomologicalComplex.homologyMap S.f j) ⋯).Exact

full_name: CategoryTheory.ShortComplex.ShortExact.homology_exact₂
code: /-- Exactness of `S.X₁.homology i ⟶ S.X₂.homology i ⟶ S.X₃.homology i`. -/
lemma homology_exact₂ : (ShortComplex.mk (HomologicalComplex.homologyMap S.f i)
    (HomologicalComplex.homologyMap S.g i) (by rw [← HomologicalComplex.homologyMap_comp,
      S.zero, HomologicalComplex.homologyMap_zero])).Exact 
goal: (CategoryTheory.ShortComplex.mk (HomologicalComplex.homologyMap S.f i) (HomologicalComplex.homologyMap S.g i) ⋯).Exact

full_name: CategoryTheory.ShortComplex.ShortExact.homology_exact₃
code: /-- Exactness of `S.X₂.homology i ⟶ S.X₃.homology i ⟶ S.X₁.homology j`. -/
lemma homology_exact₃ : (ShortComplex.mk _ _ (comp_δ hS i j hij)).Exact 
goal: (CategoryTheory.ShortComplex.mk (HomologicalComplex.homologyMap S.g i) (hS.δ i j hij) ⋯).Exact

full_name: CategoryTheory.ShortComplex.ShortExact.δ_eq'
code: lemma δ_eq' {A : C} (x₃ : A ⟶ S.X₃.homology i) (x₂ : A ⟶ S.X₂.opcycles i)
    (x₁ : A ⟶ S.X₁.cycles j)
    (h₂ : x₂ ≫ HomologicalComplex.opcyclesMap S.g i = x₃ ≫ S.X₃.homologyι i)
    (h₁ : x₁ ≫ HomologicalComplex.cyclesMap S.f j = x₂ ≫ S.X₂.opcyclesToCycles i j) :
    x₃ ≫ hS.δ i j hij = x₁ ≫ S.X₁.homologyπ j 
goal: x₃ ≫ hS.δ i j hij = x₁ ≫ S.X₁.homologyπ j

full_name: CategoryTheory.ShortComplex.ShortExact.δ_eq
code: lemma δ_eq {A : C} (x₃ : A ⟶ S.X₃.X i) (hx₃ : x₃ ≫ S.X₃.d i j = 0)
    (x₂ : A ⟶ S.X₂.X i) (hx₂ : x₂ ≫ S.g.f i = x₃)
    (x₁ : A ⟶ S.X₁.X j) (hx₁ : x₁ ≫ S.f.f j = x₂ ≫ S.X₂.d i j)
    (k : ι) (hk : c.next j = k) :
    S.X₃.liftCycles x₃ j (c.next_eq' hij) hx₃ ≫ S.X₃.homologyπ i ≫ hS.δ i j hij =
      S.X₁.liftCycles x₁ k hk (by
        have := hS.mono_f
        rw [← cancel_mono (S.f.f k), assoc, ← S.f.comm, reassoc_of% hx₁,
          d_comp_d, comp_zero, zero_comp]) ≫ S.X₁.homologyπ j 
goal: S.X₃.liftCycles x₃ j ⋯ hx₃ ≫ S.X₃.homologyπ i ≫ hS.δ i j hij = S.X₁.liftCycles x₁ k hk ⋯ ≫ S.X₁.homologyπ j