Theorem: CategoryTheory.Idempotents.isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent
File: Mathlib/CategoryTheory/Idempotents/Basic.lean

tactic: constructor
state_before: C : Type u_1
inst✝ : Category C
⊢ IsIdempotentComplete C ↔ ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p

tactic: intro
state_before: case mp
C : Type u_1
inst✝ : Category C
⊢ IsIdempotentComplete C → ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p

tactic: intro X p hp
state_before: case mp
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
⊢ ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p

tactic: rcases IsIdempotentComplete.idempotents_split X p hp with ⟨Y, i, e, ⟨h₁, h₂⟩⟩
state_before: case mp
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
⊢ HasEqualizer (𝟙 X) p

tactic: rw [comp_id, ← h₂, ← assoc, h₁, id_comp]
state_before: C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
⊢ i ≫ 𝟙 X = i ≫ p

tactic: apply Fork.IsLimit.mk'
state_before: C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
⊢ IsLimit (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p))

tactic: intro s
state_before: case create
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
⊢ (s : Fork (𝟙 X) p) →
    { l //
      l ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s ∧
        ∀
          {m :
            ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
              ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj
                WalkingParallelPair.zero},
          m ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s → m = l }

tactic: refine' ⟨s.ι ≫ e, _⟩
state_before: case create
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
⊢ { l //
    l ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s ∧
      ∀
        {m :
          ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
            ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj
              WalkingParallelPair.zero},
        m ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s → m = l }

tactic: constructor
state_before: case create
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
⊢ (Fork.ι s ≫ e) ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s ∧
    ∀
      {m :
        ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
          ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj WalkingParallelPair.zero},
      m ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s → m = Fork.ι s ≫ e

tactic: erw [assoc, h₂, ← Limits.Fork.condition s, comp_id]
state_before: case create.left
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
⊢ (Fork.ι s ≫ e) ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s

tactic: intro m hm
state_before: case create.right
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
⊢ ∀
    {m :
      ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
        ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj WalkingParallelPair.zero},
    m ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s → m = Fork.ι s ≫ e

tactic: rw [Fork.ι_ofι] at hm
state_before: case create.right
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
m :
  ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
    ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj WalkingParallelPair.zero
hm : m ≫ Fork.ι (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)) = Fork.ι s
⊢ m = Fork.ι s ≫ e

tactic: rw [← hm]
state_before: case create.right
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
m :
  ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
    ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj WalkingParallelPair.zero
hm : m ≫ i = Fork.ι s
⊢ m = Fork.ι s ≫ e

tactic: simp only [← hm, assoc, h₁]
state_before: case create.right
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
m :
  ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
    ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj WalkingParallelPair.zero
hm : m ≫ i = Fork.ι s
⊢ m = (m ≫ i) ≫ e

tactic: exact (comp_id m).symm
state_before: case create.right
C : Type u_1
inst✝ : Category C
a✝ : IsIdempotentComplete C
X : C
p : X ⟶ X
hp : p ≫ p = p
Y : C
i : Y ⟶ X
e : X ⟶ Y
h₁ : i ≫ e = 𝟙 Y
h₂ : e ≫ i = p
s : Fork (𝟙 X) p
m :
  ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.zero ⟶
    ((Functor.const WalkingParallelPair).obj (Fork.ofι i (_ : i ≫ 𝟙 X = i ≫ p)).pt).obj WalkingParallelPair.zero
hm : m ≫ i = Fork.ι s
⊢ m = m ≫ 𝟙 Y

tactic: intro h
state_before: case mpr
C : Type u_1
inst✝ : Category C
⊢ (∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p) → IsIdempotentComplete C

tactic: refine' ⟨_⟩
state_before: case mpr
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
⊢ IsIdempotentComplete C

tactic: intro X p hp
state_before: case mpr
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
⊢ ∀ (X : C) (p : X ⟶ X), p ≫ p = p → ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

tactic: haveI : HasEqualizer (𝟙 X) p := h X p hp
state_before: case mpr
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
X : C
p : X ⟶ X
hp : p ≫ p = p
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

tactic: refine' ⟨equalizer (𝟙 X) p, equalizer.ι (𝟙 X) p,
  equalizer.lift p (show p ≫ 𝟙 X = p ≫ p by rw [hp, comp_id]), _, equalizer.lift_ι _ _⟩
state_before: case mpr
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
X : C
p : X ⟶ X
hp : p ≫ p = p
this : HasEqualizer (𝟙 X) p
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

tactic: apply equalizer.hom_ext
state_before: case mpr
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
X : C
p : X ⟶ X
hp : p ≫ p = p
this : HasEqualizer (𝟙 X) p
⊢ equalizer.ι (𝟙 X) p ≫ equalizer.lift p (_ : p ≫ 𝟙 X = p ≫ p) = 𝟙 (equalizer (𝟙 X) p)

tactic: simp only [assoc, limit.lift_π, Eq.ndrec, id_eq, eq_mpr_eq_cast, Fork.ofι_pt,
  Fork.ofι_π_app, id_comp]
state_before: case mpr.h
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
X : C
p : X ⟶ X
hp : p ≫ p = p
this : HasEqualizer (𝟙 X) p
⊢ (equalizer.ι (𝟙 X) p ≫ equalizer.lift p (_ : p ≫ 𝟙 X = p ≫ p)) ≫ equalizer.ι (𝟙 X) p =
    𝟙 (equalizer (𝟙 X) p) ≫ equalizer.ι (𝟙 X) p

tactic: rw [← equalizer.condition, comp_id]
state_before: case mpr.h
C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
X : C
p : X ⟶ X
hp : p ≫ p = p
this : HasEqualizer (𝟙 X) p
⊢ equalizer.ι (𝟙 X) p ≫ p = equalizer.ι (𝟙 X) p

tactic: rw [hp, comp_id]
state_before: C : Type u_1
inst✝ : Category C
h : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
X : C
p : X ⟶ X
hp : p ≫ p = p
this : HasEqualizer (𝟙 X) p
⊢ p ≫ 𝟙 X = p ≫ p