Theorem: AlgebraicTopology.DoldKan.compatibility_N₂_N₁_karoubi
File: Mathlib/AlgebraicTopology/DoldKan/NReflectsIso.lean

tactic: refine' CategoryTheory.Functor.ext (fun P => _) fun P Q f => _
state_before: C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
⊢ N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor =
    karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
      N₁ ⋙
        (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
          Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)

tactic: refine' HomologicalComplex.ext _ _
state_before: case refine'_1
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
⊢ (N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P =
    (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
          N₁ ⋙
            (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
              Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
      P

tactic: ext n
state_before: case refine'_1.refine'_1
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
⊢ ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P).X =
    ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
            N₁ ⋙
              (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
        P).X

tactic: . rfl
state_before: case refine'_1.refine'_1.h.h_X
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
⊢ (HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) n).X =
    (HomologicalComplex.X
        ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
              N₁ ⋙
                (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                  Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
          P)
        n).X

tactic: dsimp
state_before: case refine'_1.refine'_1.h.h_p
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
⊢ (HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) n).p ≫
      eqToHom ?refine'_1.refine'_1.h.h_X =
    eqToHom ?refine'_1.refine'_1.h.h_X ≫
      (HomologicalComplex.X
          ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                N₁ ⋙
                  (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                    Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
            P)
          n).p

tactic: simp only [karoubi_PInfty_f, comp_id, PInfty_f_naturality, id_comp, eqToHom_refl]
state_before: case refine'_1.refine'_1.h.h_p
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
⊢ (HomologicalComplex.Hom.f PInfty n ≫ P.p.app [n].op) ≫ eqToHom ?refine'_1.refine'_1.h.h_X =
    eqToHom ?refine'_1.refine'_1.h.h_X ≫ (HomologicalComplex.Hom.f PInfty n).f

tactic: rfl
state_before: case refine'_1.refine'_1.h.h_X
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
⊢ (HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) n).X =
    (HomologicalComplex.X
        ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
              N₁ ⋙
                (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                  Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
          P)
        n).X

tactic: rintro _ n (rfl : n + 1 = _)
state_before: case refine'_1.refine'_2
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
⊢ ∀ (i j : ℕ),
    ComplexShape.Rel (ComplexShape.down ℕ) i j →
      HomologicalComplex.d ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) i j ≫
          eqToHom
            (_ :
              HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) j =
                HomologicalComplex.X
                  ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                        N₁ ⋙
                          (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                            Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                              (ComplexShape.down ℕ)).obj
                    P)
                  j) =
        eqToHom
            (_ :
              HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) i =
                HomologicalComplex.X
                  ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                        N₁ ⋙
                          (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                            Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                              (ComplexShape.down ℕ)).obj
                    P)
                  i) ≫
          HomologicalComplex.d
            ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                  N₁ ⋙
                    (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                      Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
              P)
            i j

tactic: ext
state_before: case refine'_1.refine'_2
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
⊢ HomologicalComplex.d ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) (n + 1) n ≫
      eqToHom
        (_ :
          HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) n =
            HomologicalComplex.X
              ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                    N₁ ⋙
                      (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                        Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
                P)
              n) =
    eqToHom
        (_ :
          HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) (n + 1) =
            HomologicalComplex.X
              ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                    N₁ ⋙
                      (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                        Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
                P)
              (n + 1)) ≫
      HomologicalComplex.d
        ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
              N₁ ⋙
                (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                  Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
          P)
        (n + 1) n

tactic: have h := (AlternatingFaceMapComplex.map P.p).comm (n + 1) n
state_before: case refine'_1.refine'_2.h
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
⊢ (HomologicalComplex.d ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) (n + 1) n ≫
        eqToHom
          (_ :
            HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) n =
              HomologicalComplex.X
                ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                      N₁ ⋙
                        (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                          Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                            (ComplexShape.down ℕ)).obj
                  P)
                n)).f =
    (eqToHom
          (_ :
            HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) (n + 1) =
              HomologicalComplex.X
                ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                      N₁ ⋙
                        (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                          Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                            (ComplexShape.down ℕ)).obj
                  P)
                (n + 1)) ≫
        HomologicalComplex.d
          ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                N₁ ⋙
                  (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                    Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
            P)
          (n + 1) n).f

tactic: dsimp [N₂, karoubiChainComplexEquivalence,
  KaroubiHomologicalComplexEquivalence.Functor.obj] at h ⊢
state_before: case refine'_1.refine'_2.h
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
h :
  HomologicalComplex.Hom.f (AlternatingFaceMapComplex.map P.p) (n + 1) ≫
      HomologicalComplex.d (AlternatingFaceMapComplex.obj P.X) (n + 1) n =
    HomologicalComplex.d (AlternatingFaceMapComplex.obj P.X) (n + 1) n ≫
      HomologicalComplex.Hom.f (AlternatingFaceMapComplex.map P.p) n
⊢ (HomologicalComplex.d ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) (n + 1) n ≫
        eqToHom
          (_ :
            HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) n =
              HomologicalComplex.X
                ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                      N₁ ⋙
                        (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                          Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                            (ComplexShape.down ℕ)).obj
                  P)
                n)).f =
    (eqToHom
          (_ :
            HomologicalComplex.X ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P) (n + 1) =
              HomologicalComplex.X
                ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                      N₁ ⋙
                        (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                          Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                            (ComplexShape.down ℕ)).obj
                  P)
                (n + 1)) ≫
        HomologicalComplex.d
          ((karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                N₁ ⋙
                  (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                    Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
            P)
          (n + 1) n).f

tactic: simp only [assoc, Karoubi.eqToHom_f, eqToHom_refl, comp_id,
  karoubi_alternatingFaceMapComplex_d, karoubi_PInfty_f,
  ← HomologicalComplex.Hom.comm_assoc, ← h, app_idem_assoc]
state_before: case refine'_1.refine'_2.h
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P : Karoubi (SimplicialObject C)
n : ℕ
h :
  P.p.app [n + 1].op ≫ HomologicalComplex.d (AlternatingFaceMapComplex.obj P.X) (n + 1) n =
    HomologicalComplex.d (AlternatingFaceMapComplex.obj P.X) (n + 1) n ≫ P.p.app [n].op
⊢ ((HomologicalComplex.Hom.f PInfty (n + 1) ≫ P.p.app [n + 1].op) ≫
        HomologicalComplex.d (AlternatingFaceMapComplex.obj P.X) (n + 1) n) ≫
      (eqToHom
          (_ :
            Karoubi.mk (P.X.obj [n].op) (HomologicalComplex.Hom.f PInfty n ≫ P.p.app [n].op) =
              HomologicalComplex.X
                ((Functor.mapHomologicalComplex (KaroubiKaroubi.inverse C) (ComplexShape.down ℕ)).obj
                  (HomologicalComplex.mk
                    (fun n =>
                      Karoubi.mk ((KaroubiFunctorCategoryEmbedding.obj P).obj [n].op)
                        (HomologicalComplex.Hom.f PInfty n))
                    fun i j =>
                    Karoubi.Hom.mk
                      (HomologicalComplex.Hom.f PInfty i ≫
                        HomologicalComplex.d (AlternatingFaceMapComplex.obj (KaroubiFunctorCategoryEmbedding.obj P)) i
                          j)))
                n)).f =
    (eqToHom
          (_ :
            Karoubi.mk (P.X.obj [n + 1].op) (HomologicalComplex.Hom.f PInfty (n + 1) ≫ P.p.app [n + 1].op) =
              HomologicalComplex.X
                ((Functor.mapHomologicalComplex (KaroubiKaroubi.inverse C) (ComplexShape.down ℕ)).obj
                  (HomologicalComplex.mk
                    (fun n =>
                      Karoubi.mk ((KaroubiFunctorCategoryEmbedding.obj P).obj [n].op)
                        (HomologicalComplex.Hom.f PInfty n))
                    fun i j =>
                    Karoubi.Hom.mk
                      (HomologicalComplex.Hom.f PInfty i ≫
                        HomologicalComplex.d (AlternatingFaceMapComplex.obj (KaroubiFunctorCategoryEmbedding.obj P)) i
                          j)))
                (n + 1))).f ≫
      (HomologicalComplex.Hom.f PInfty (n + 1)).f ≫
        (HomologicalComplex.d (AlternatingFaceMapComplex.obj (KaroubiFunctorCategoryEmbedding.obj P)) (n + 1) n).f

tactic: ext n
state_before: case refine'_2
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P Q : Karoubi (SimplicialObject C)
f : P ⟶ Q
⊢ (N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).map f =
    eqToHom
        (_ :
          (N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P =
            (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                  N₁ ⋙
                    (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                      Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
              P) ≫
      (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
              N₁ ⋙
                (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                  Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).map
          f ≫
        eqToHom
          (_ :
            (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                    N₁ ⋙
                      (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                        Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).obj
                Q =
              (N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj Q)

tactic: dsimp [KaroubiKaroubi.inverse, Functor.mapHomologicalComplex]
state_before: case refine'_2.h.h
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P Q : Karoubi (SimplicialObject C)
f : P ⟶ Q
n : ℕ
⊢ (HomologicalComplex.Hom.f ((N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).map f) n).f =
    (HomologicalComplex.Hom.f
        (eqToHom
            (_ :
              (N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj P =
                (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                      N₁ ⋙
                        (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                          Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                            (ComplexShape.down ℕ)).obj
                  P) ≫
          (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                  N₁ ⋙
                    (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                      Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse (ComplexShape.down ℕ)).map
              f ≫
            eqToHom
              (_ :
                (karoubiFunctorCategoryEmbedding SimplexCategoryᵒᵖ C ⋙
                        N₁ ⋙
                          (karoubiChainComplexEquivalence (Karoubi C) ℕ).functor ⋙
                            Functor.mapHomologicalComplex (KaroubiKaroubi.equivalence C).inverse
                              (ComplexShape.down ℕ)).obj
                    Q =
                  (N₂ ⋙ (karoubiChainComplexEquivalence C ℕ).functor).obj Q))
        n).f

tactic: simp only [karoubi_PInfty_f, HomologicalComplex.eqToHom_f, Karoubi.eqToHom_f,
  assoc, comp_id, PInfty_f_naturality, app_p_comp,
  karoubiChainComplexEquivalence_functor_obj_X_p, N₂_obj_p_f, eqToHom_refl,
  PInfty_f_naturality_assoc, app_comp_p, PInfty_f_idem_assoc]
state_before: case refine'_2.h.h
C : Type u_1
inst✝¹ : Category C
inst✝ : Preadditive C
P Q : Karoubi (SimplicialObject C)
f : P ⟶ Q
n : ℕ
⊢ HomologicalComplex.Hom.f PInfty n ≫ f.f.app [n].op =
    (HomologicalComplex.Hom.f
          (eqToHom
            (_ :
              (karoubiChainComplexEquivalence C ℕ).functor.obj (N₂.obj P) =
                HomologicalComplex.mk (fun i => Karoubi.mk (P.X.obj [i].op) (HomologicalComplex.Hom.f PInfty i).f)
                  fun i j =>
                  Karoubi.Hom.mk
                    (HomologicalComplex.d
                          ((karoubiChainComplexEquivalence (Karoubi C) ℕ).functor.obj
                            (N₁.obj (KaroubiFunctorCategoryEmbedding.obj P)))
                          i j).f.f))
          n).f ≫
      ((HomologicalComplex.Hom.f PInfty n).f ≫ f.f.app [n].op) ≫
        (HomologicalComplex.Hom.f
            (eqToHom
              (_ :
                (HomologicalComplex.mk (fun i => Karoubi.mk (Q.X.obj [i].op) (HomologicalComplex.Hom.f PInfty i).f)
                    fun i j =>
                    Karoubi.Hom.mk
                      (HomologicalComplex.d
                            ((karoubiChainComplexEquivalence (Karoubi C) ℕ).functor.obj
                              (N₁.obj (KaroubiFunctorCategoryEmbedding.obj Q)))
                            i j).f.f) =
                  (karoubiChainComplexEquivalence C ℕ).functor.obj (N₂.obj Q)))
            n).f