Theorem: CategoryTheory.Idempotents.Equivalence.isIdempotentComplete
File: Mathlib/CategoryTheory/Idempotents/Basic.lean

tactic: refine' ⟨_⟩
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
⊢ IsIdempotentComplete D

tactic: intro X' p hp
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
⊢ ∀ (X : D) (p : X ⟶ X), p ≫ p = p → ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

tactic: let φ := ε.counitIso.symm.app X'
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

tactic: erw [split_iff_of_iso φ p (φ.inv ≫ p ≫ φ.hom)
    (by
      slice_rhs 1 2 => rw [φ.hom_inv_id]
      rw [id_comp])]
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

tactic: rcases IsIdempotentComplete.idempotents_split (ε.inverse.obj X') (ε.inverse.map p)
    (by rw [← ε.inverse.map_comp, hp]) with
  ⟨Y, i, e, ⟨h₁, h₂⟩⟩
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
⊢ ∃ Y' i' e', i' ≫ e' = 𝟙 Y' ∧ e' ≫ i' = φ.inv ≫ p ≫ φ.hom

tactic: use ε.functor.obj Y, ε.functor.map i, ε.functor.map e
state_before: case intro.intro.intro.intro
C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
Y : C
i : Y ⟶ ε.inverse.obj X'
e : ε.inverse.obj X' ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = ε.inverse.map p
⊢ ∃ Y' i' e', i' ≫ e' = 𝟙 Y' ∧ e' ≫ i' = φ.inv ≫ p ≫ φ.hom

tactic: constructor
state_before: case intro.intro.intro.intro
C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
Y : C
i : Y ⟶ ε.inverse.obj X'
e : ε.inverse.obj X' ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = ε.inverse.map p
⊢ ε.functor.map i ≫ ε.functor.map e = 𝟙 (ε.functor.obj Y) ∧ ε.functor.map e ≫ ε.functor.map i = φ.inv ≫ p ≫ φ.hom

tactic: slice_rhs 1 2 => rw [φ.hom_inv_id]
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
⊢ p ≫ φ.hom = φ.hom ≫ φ.inv ≫ p ≫ φ.hom

tactic: rw [id_comp]
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
⊢ p ≫ φ.hom = (𝟙 ((𝟭 D).obj X') ≫ p) ≫ φ.hom

tactic: rw [← ε.inverse.map_comp, hp]
state_before: C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
⊢ ε.inverse.map p ≫ ε.inverse.map p = ε.inverse.map p

tactic: rw [← ε.functor.map_comp, h₁, ε.functor.map_id]
state_before: case intro.intro.intro.intro.left
C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
Y : C
i : Y ⟶ ε.inverse.obj X'
e : ε.inverse.obj X' ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = ε.inverse.map p
⊢ ε.functor.map i ≫ ε.functor.map e = 𝟙 (ε.functor.obj Y)

tactic: simp only [← ε.functor.map_comp, h₂, Equivalence.fun_inv_map]
state_before: case intro.intro.intro.intro.right
C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
Y : C
i : Y ⟶ ε.inverse.obj X'
e : ε.inverse.obj X' ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = ε.inverse.map p
⊢ ε.functor.map e ≫ ε.functor.map i = φ.inv ≫ p ≫ φ.hom

tactic: rfl
state_before: case intro.intro.intro.intro.right
C : Type u_4
inst✝¹ : Category C
D : Type u_1
inst✝ : Category D
ε : C ≌ D
h : IsIdempotentComplete C
X' : D
p : X' ⟶ X'
hp : p ≫ p = p
φ : (𝟭 D).obj X' ≅ (ε.inverse ⋙ ε.functor).obj X' := ε.counitIso.symm.app X'
Y : C
i : Y ⟶ ε.inverse.obj X'
e : ε.inverse.obj X' ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = ε.inverse.map p
⊢ (Equivalence.counit ε).app X' ≫ p ≫ (Equivalence.counitInv ε).app X' =
    (ε.counitIso.symm.app X').inv ≫ p ≫ (ε.counitIso.symm.app X').hom