-- Mathlib/Algebra/Homology/TotalComplexShift.lean
/-- The compatibility isomorphisms of the total complex with the shifts
in both variables "commute" only up to a sign `(x * y).negOnePow`. -/
lemma totalShift₁Iso_trans_totalShift₂Iso :
    ((shiftFunctor₂ C y).obj K).totalShift₁Iso x ≪≫
      (shiftFunctor (CochainComplex C ℤ) x).mapIso (K.totalShift₂Iso y) =
    (x * y).negOnePow • (total.mapIso ((shiftFunctor₁₂CommIso C x y).app K) (up ℤ)) ≪≫
      ((shiftFunctor₁ C x).obj K).totalShift₂Iso y ≪≫
      (shiftFunctor _ y).mapIso (K.totalShift₁Iso x) ≪≫
      (shiftFunctorComm (CochainComplex C ℤ) x y).app _

Proof state:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ (n₁ * y + x * y).negOnePow • K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ =
    (n₁ * y + x * y).negOnePow •
      𝟙 ((K.X (n₁ + x)).X (n₂ + y)) ≫
        K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ ≫
          ((K.total (up ℤ)).XIsoOfEq ⋯).inv ≫ ((K.total (up ℤ)).XIsoOfEq ⋯).hom

Tactic:
rw [Iso.inv_hom_id, comp_id, id_comp]

Result:
no goals

Proof state:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ (n₁ * y + x * y).negOnePow •
      𝟙 ((K.X (n₁ + x)).X (n₂ + y)) ≫
        K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ ≫ 𝟙 ((K.total (up ℤ)).X (n + x + y)) =
    (n₁ * y + x * y).negOnePow •
      ((shiftFunctor₁ C x).obj K).ιTotal (up ℤ) n₁ (n₂ + y) (n + y) ⋯ ≫
        (K.totalShift₁Iso x).hom.f (n + y) ≫ ((shiftFunctorComm (CochainComplex C ℤ) x y).hom.app (K.total (up ℤ))).f n

Tactic:
rw [id_comp, comp_id,
  ι_totalShift₁Iso_hom_f_assoc _ x n₁ (n₂ + y) (n + y) (by omega) _ rfl (n + x + y) (by omega),
  CochainComplex.shiftFunctorComm_hom_app_f]

Result:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ (n₁ * y + x * y).negOnePow • K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ =
    (n₁ * y + x * y).negOnePow •
      (K.shiftFunctor₁XXIso n₁ x (n₁ + x) ⋯ (n₂ + y)).hom ≫
        K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ ≫
          (CochainComplex.shiftFunctorObjXIso (K.total (up ℤ)) x (n + y) (n + x + y) ⋯).inv ≫
            ((K.total (up ℤ)).XIsoOfEq ⋯).hom

Proof state:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ ((shiftFunctor₁ C x).obj ((shiftFunctor₂ C y).obj K)).ιTotal (up ℤ) n₁ n₂ n h ≫
      (((shiftFunctor₂ C y).obj K).totalShift₁Iso x).hom.f n ≫ (K.totalShift₂Iso y).hom.f (n + x) =
    ((shiftFunctor₁ C x).obj ((shiftFunctor₂ C y).obj K)).ιTotal (up ℤ) n₁ n₂ n h ≫
      ((x * y).negOnePow •
        (total.map ((shiftFunctor₁₂CommIso C x y).hom.app K) (up ℤ)).f n ≫
          (((shiftFunctor₁ C x).obj K).totalShift₂Iso y).hom.f n ≫
            (K.totalShift₁Iso x).hom.f (n + y) ≫
              ((shiftFunctorComm (CochainComplex C ℤ) x y).hom.app (K.total (up ℤ))).f n)

Tactic:
rw [Linear.comp_units_smul,ι_totalShift₁Iso_hom_f_assoc _ x n₁ n₂ n h _ rfl _ rfl,
  ιTotal_map_assoc, ι_totalShift₂Iso_hom_f_assoc _ y n₁ n₂ n h _ rfl _ rfl,
  Linear.units_smul_comp, Linear.comp_units_smul]

Result:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ (((shiftFunctor₂ C y).obj K).shiftFunctor₁XXIso n₁ x (n₁ + x) ⋯ n₂).hom ≫
      ((shiftFunctor₂ C y).obj K).ιTotal (up ℤ) (n₁ + x) n₂ (n + x) ⋯ ≫
        (CochainComplex.shiftFunctorObjXIso (((shiftFunctor₂ C y).obj K).total (up ℤ)) x n (n + x) ⋯).inv ≫
          (K.totalShift₂Iso y).hom.f (n + x) =
    (x * y).negOnePow •
      (n₁ * y).negOnePow •
        (((shiftFunctor₁₂CommIso C x y).hom.app K).f n₁).f n₂ ≫
          ((((shiftFunctor₁ C x).obj K).shiftFunctor₂XXIso n₁ n₂ y (n₂ + y) ⋯).hom ≫
              ((shiftFunctor₁ C x).obj K).ιTotal (up ℤ) n₁ (n₂ + y) (n + y) ⋯ ≫
                (CochainComplex.shiftFunctorObjXIso (((shiftFunctor₁ C x).obj K).total (up ℤ)) y n (n + y) ⋯).inv) ≫
            (K.totalShift₁Iso x).hom.f (n + y) ≫
              ((shiftFunctorComm (CochainComplex C ℤ) x y).hom.app (K.total (up ℤ))).f n

Proof state:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : (up ℤ).π (up ℤ) (up ℤ) (n₁, n₂) = n
⊢ ((shiftFunctor₁ C x).obj ((shiftFunctor₂ C y).obj K)).ιTotal (up ℤ) n₁ n₂ n h ≫
      (((shiftFunctor₂ C y).obj K).totalShift₁Iso x ≪≫
              (shiftFunctor (CochainComplex C ℤ) x).mapIso (K.totalShift₂Iso y)).hom.f
        n =
    ((shiftFunctor₁ C x).obj ((shiftFunctor₂ C y).obj K)).ιTotal (up ℤ) n₁ n₂ n h ≫
      ((x * y).negOnePow •
              total.mapIso ((shiftFunctor₁₂CommIso C x y).app K) (up ℤ) ≪≫
                ((shiftFunctor₁ C x).obj K).totalShift₂Iso y ≪≫
                  (shiftFunctor (HomologicalComplex C (up ℤ)) y).mapIso (K.totalShift₁Iso x) ≪≫
                    (shiftFunctorComm (CochainComplex C ℤ) x y).app (K.total (up ℤ))).hom.f
        n

Tactic:
dsimp at h ⊢

Result:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ ((shiftFunctor₁ C x).obj ((shiftFunctor₂ C y).obj K)).ιTotal (up ℤ) n₁ n₂ n h ≫
      (((shiftFunctor₂ C y).obj K).totalShift₁Iso x).hom.f n ≫ (K.totalShift₂Iso y).hom.f (n + x) =
    ((shiftFunctor₁ C x).obj ((shiftFunctor₂ C y).obj K)).ιTotal (up ℤ) n₁ n₂ n h ≫
      ((x * y).negOnePow •
        (total.map ((shiftFunctor₁₂CommIso C x y).hom.app K) (up ℤ)).f n ≫
          (((shiftFunctor₁ C x).obj K).totalShift₂Iso y).hom.f n ≫
            (K.totalShift₁Iso x).hom.f (n + y) ≫
              ((shiftFunctorComm (CochainComplex C ℤ) x y).hom.app (K.total (up ℤ))).f n)

Proof state:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ (n₁ * y + x * y).negOnePow •
      (K.shiftFunctor₂XXIso (n₁ + x) n₂ y (n₂ + y) ⋯).hom ≫
        K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ ≫
          (CochainComplex.shiftFunctorObjXIso (K.total (up ℤ)) y (n + x) (n + x + y) ⋯).inv =
    (n₁ * y + x * y).negOnePow •
      ((shiftFunctor₁ C x).obj K).ιTotal (up ℤ) n₁ (n₂ + y) (n + y) ⋯ ≫
        (K.totalShift₁Iso x).hom.f (n + y) ≫ ((shiftFunctorComm (CochainComplex C ℤ) x y).hom.app (K.total (up ℤ))).f n

Tactic:
dsimp

Result:
case w.h.h
C : Type u_1
inst✝² : Category.{u_2, u_1} C
inst✝¹ : Preadditive C
K : HomologicalComplex₂ C (up ℤ) (up ℤ)
x y : ℤ
inst✝ : K.HasTotal (up ℤ)
n n₁ n₂ : ℤ
h : n₁ + n₂ = n
⊢ (n₁ * y + x * y).negOnePow •
      𝟙 ((K.X (n₁ + x)).X (n₂ + y)) ≫
        K.ιTotal (up ℤ) (n₁ + x) (n₂ + y) (n + x + y) ⋯ ≫ 𝟙 ((K.total (up ℤ)).X (n + x + y)) =
    (n₁ * y + x * y).negOnePow •
      ((shiftFunctor₁ C x).obj K).ιTotal (up ℤ) n₁ (n₂ + y) (n + y) ⋯ ≫
        (K.totalShift₁Iso x).hom.f (n + y) ≫ ((shiftFunctorComm (CochainComplex C ℤ) x y).hom.app (K.total (up ℤ))).f n