Theorem: CategoryTheory.Limits.limit_π_isIso_of_is_strict_terminal
File: Mathlib/CategoryTheory/Limits/Shapes/StrictInitial.lean

tactic: refine' ⟨⟨limit.lift _ ⟨_, ⟨_, _⟩⟩, _, _⟩⟩
state_before: C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ IsIso (limit.π F i)

tactic: exact fun j =>
  dite (j = i)
    (fun h => eqToHom (by cases h; rfl))
    fun h => (H _ h).from _
state_before: case refine'_1
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ (X : J) → ((Functor.const J).obj (F.toPrefunctor.1 i)).obj X ⟶ F.obj X

tactic: cases h
state_before: C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j : J
h : j = i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j

tactic: rfl
state_before: case refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i

tactic: intro j k f
state_before: case refine'_2
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ ∀ ⦃X Y : J⦄ (f : X ⟶ Y),
    (((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
        if h : Y = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj Y = F.obj Y)
        else IsTerminal.from (H Y h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj Y)) =
      (if h : X = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj X = F.obj X)
        else IsTerminal.from (H X h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj X)) ≫
        F.map f

tactic: split_ifs with h h_1 h_1
state_before: case refine'_2
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j k : J
f : j ⟶ k
⊢ (((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      if h : k = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj k = F.obj k)
      else IsTerminal.from (H k h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj k)) =
    (if h : j = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j)
      else IsTerminal.from (H j h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j)) ≫
      F.map f

tactic: cases h
state_before: case refine'_2.inl.inl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j k : J
f : j ⟶ k
h : k = i
h_1 : j = i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj k = F.obj k) =
    eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j) ≫ F.map f

tactic: cases h_1
state_before: case refine'_2.inl.inl.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j : J
h_1 : j = i
f : j ⟶ i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) =
    eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j) ≫ F.map f

tactic: obtain rfl : f = 𝟙 _ := Subsingleton.elim _ _
state_before: case refine'_2.inl.inl.refl.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
f : i ⟶ i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) =
    eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) ≫ F.map f

tactic: simp
state_before: case refine'_2.inl.inl.refl.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map (𝟙 i) ≫
      eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) =
    eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) ≫ F.map (𝟙 i)

tactic: cases h
state_before: case refine'_2.inl.inr
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j k : J
f : j ⟶ k
h : k = i
h_1 : ¬j = i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj k = F.obj k) =
    IsTerminal.from (H j h_1) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) ≫ F.map f

tactic: erw [Category.comp_id]
state_before: case refine'_2.inl.inr.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j : J
h_1 : ¬j = i
f : j ⟶ i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) =
    IsTerminal.from (H j h_1) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) ≫ F.map f

tactic: haveI : IsIso (F.map f) := (H _ h_1).isIso_from _
state_before: case refine'_2.inl.inr.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j : J
h_1 : ¬j = i
f : j ⟶ i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f =
    IsTerminal.from (H j h_1) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) ≫ F.map f

tactic: rw [← IsIso.comp_inv_eq]
state_before: case refine'_2.inl.inr.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j : J
h_1 : ¬j = i
f : j ⟶ i
this : IsIso (F.map f)
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f =
    IsTerminal.from (H j h_1) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) ≫ F.map f

tactic: apply (H _ h_1).hom_ext
state_before: case refine'_2.inl.inr.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j : J
h_1 : ¬j = i
f : j ⟶ i
this : IsIso (F.map f)
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫ inv (F.map f) =
    IsTerminal.from (H j h_1) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j)

tactic: cases h_1
state_before: case refine'_2.inr.inl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j k : J
f : j ⟶ k
h : ¬k = i
h_1 : j = i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      IsTerminal.from (H k h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj k) =
    eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j) ≫ F.map f

tactic: apply (H _ h).hom_ext
state_before: case refine'_2.inr.inl.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
k : J
h : ¬k = i
f : i ⟶ k
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      IsTerminal.from (H k h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj k) =
    eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) ≫ F.map f

tactic: apply (H _ h).hom_ext
state_before: case refine'_2.inr.inr
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j k : J
f : j ⟶ k
h : ¬k = i
h_1 : ¬j = i
⊢ ((Functor.const J).obj (F.toPrefunctor.1 i)).map f ≫
      IsTerminal.from (H k h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj k) =
    IsTerminal.from (H j h_1) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) ≫ F.map f

tactic: ext
state_before: case refine'_3
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ limit.π F i ≫
      limit.lift F
        { pt := F.toPrefunctor.1 i,
          π :=
            NatTrans.mk fun j =>
              if h : j = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j)
              else IsTerminal.from (H j h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) } =
    𝟙 (limit F)

tactic: rw [assoc, limit.lift_π]
state_before: case refine'_3.w
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j✝ : J
⊢ (limit.π F i ≫
        limit.lift F
          { pt := F.toPrefunctor.1 i,
            π :=
              NatTrans.mk fun j =>
                if h : j = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j)
                else IsTerminal.from (H j h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) }) ≫
      limit.π F j✝ =
    𝟙 (limit F) ≫ limit.π F j✝

tactic: dsimp only
state_before: case refine'_3.w
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j✝ : J
⊢ limit.π F i ≫
      { pt := F.toPrefunctor.1 i,
              π :=
                NatTrans.mk fun j =>
                  if h : j = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j)
                  else IsTerminal.from (H j h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) }.π.app
        j✝ =
    𝟙 (limit F) ≫ limit.π F j✝

tactic: split_ifs with h
state_before: case refine'_3.w
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j✝ : J
⊢ (limit.π F i ≫
      if h : j✝ = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j✝ = F.obj j✝)
      else IsTerminal.from (H j✝ h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j✝)) =
    𝟙 (limit F) ≫ limit.π F j✝

tactic: cases h
state_before: case refine'_3.w.inl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j✝ : J
h : j✝ = i
⊢ limit.π F i ≫ eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j✝ = F.obj j✝) =
    𝟙 (limit F) ≫ limit.π F j✝

tactic: rw [id_comp, eqToHom_refl]
state_before: case refine'_3.w.inl.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ limit.π F i ≫ eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj i = F.obj i) = 𝟙 (limit F) ≫ limit.π F i

tactic: exact comp_id _
state_before: case refine'_3.w.inl.refl
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ limit.π F i ≫ 𝟙 (((Functor.const J).obj (F.toPrefunctor.1 i)).obj i) = limit.π F i

tactic: apply (H _ h).hom_ext
state_before: case refine'_3.w.inr
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
j✝ : J
h : ¬j✝ = i
⊢ limit.π F i ≫ IsTerminal.from (H j✝ h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j✝) =
    𝟙 (limit F) ≫ limit.π F j✝

tactic: rw [limit.lift_π]
state_before: case refine'_4
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ limit.lift F
        { pt := F.toPrefunctor.1 i,
          π :=
            NatTrans.mk fun j =>
              if h : j = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j)
              else IsTerminal.from (H j h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) } ≫
      limit.π F i =
    𝟙 (F.obj i)

tactic: simp
state_before: case refine'_4
C : Type u
inst✝⁴ : Category C
inst✝³ : HasStrictTerminalObjects C
I : C
J : Type v
inst✝² : SmallCategory J
F : J ⥤ C
inst✝¹ : HasLimit F
i : J
H : (j : J) → j ≠ i → IsTerminal (F.obj j)
inst✝ : Subsingleton (i ⟶ i)
⊢ { pt := F.toPrefunctor.1 i,
            π :=
              NatTrans.mk fun j =>
                if h : j = i then eqToHom (_ : ((Functor.const J).obj (F.toPrefunctor.1 i)).obj j = F.obj j)
                else IsTerminal.from (H j h) (((Functor.const J).obj (F.toPrefunctor.1 i)).obj j) }.π.app
      i =
    𝟙 (F.obj i)