l3lab/ntp-mathlib huggingface dataset:
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X Y Z : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ ⁅X, Y + Z⁆ f✝ = (⁅X, Y⁆ + ⁅X, Z⁆) f✝

Next tactic:
simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X Y Z : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ X (Y f✝) + X (Z f✝) - (Y (X f✝) + Z (X f✝)) = X (Y f✝) - Y (X f✝) + (X (Z f✝) - Z (X f✝))

Next tactic:
ring
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_self X := by 

Proof state:
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X : LeftInvariantDerivation I G
⊢ ⁅X, X⁆ = 0

Next tactic:
ext1
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_self X := by ext1; 

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ ⁅X, X⁆ f✝ = 0 f✝

Next tactic:
simp only [commutator_apply, sub_self]
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_self X := by ext1; simp only [commutator_apply, sub_self]; 

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ 0 = 0 f✝

Next tactic:
rfl
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_self X := by ext1; simp only [commutator_apply, sub_self]; rfl
  leibniz_lie X Y Z := by
    

Proof state:
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X Y Z : LeftInvariantDerivation I G
⊢ ⁅X, ⁅Y, Z⁆⁆ = ⁅⁅X, Y⁆, Z⁆ + ⁅Y, ⁅X, Z⁆⁆

Next tactic:
ext1
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_self X := by ext1; simp only [commutator_apply, sub_self]; rfl
  leibniz_lie X Y Z := by
    ext1
    

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X Y Z : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ ⁅X, ⁅Y, Z⁆⁆ f✝ = (⁅⁅X, Y⁆, Z⁆ + ⁅Y, ⁅X, Z⁆⁆) f✝

Next tactic:
simp only [commutator_apply, coe_add, coe_sub, map_sub, Pi.add_apply]
instance : LieRing (LeftInvariantDerivation I G) where
  add_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_add X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, Pi.add_apply, map_add]
    ring
  lie_self X := by ext1; simp only [commutator_apply, sub_self]; rfl
  leibniz_lie X Y Z := by
    ext1
    simp only [commutator_apply, coe_add, coe_sub, map_sub, Pi.add_apply]
    

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r : 𝕜
X✝ Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
X Y Z : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ X (Y (Z f✝)) - X (Z (Y f✝)) - (Y (Z (X f✝)) - Z (Y (X f✝))) =
    X (Y (Z f✝)) - Y (X (Z f✝)) - (Z (X (Y f✝)) - Z (Y (X f✝))) +
      (Y (X (Z f✝)) - Y (Z (X f✝)) - (X (Z (Y f✝)) - Z (X (Y f✝))))

Next tactic:
ring
instance : LieAlgebra 𝕜 (LeftInvariantDerivation I G) where
  lie_smul r Y Z := by
    

Proof state:
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r✝ : 𝕜
X Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
r : 𝕜
Y Z : LeftInvariantDerivation I G
⊢ ⁅Y, r • Z⁆ = r • ⁅Y, Z⁆

Next tactic:
ext1
instance : LieAlgebra 𝕜 (LeftInvariantDerivation I G) where
  lie_smul r Y Z := by
    ext1
    

Proof state:
case h
𝕜 : Type u_1
inst✝⁹ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace 𝕜 E
H : Type u_3
inst✝⁶ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
G : Type u_4
inst✝⁵ : TopologicalSpace G
inst✝⁴ : ChartedSpace H G
inst✝³ : Monoid G
inst✝² : SmoothMul I G
g h : G
M : Type u_5
inst✝¹ : TopologicalSpace M
inst✝ : ChartedSpace H M
x : M
r✝ : 𝕜
X Y✝ : LeftInvariantDerivation I G
f f' : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
r : 𝕜
Y Z : LeftInvariantDerivation I G
f✝ : C^⊤⟮I, G; 𝓘(𝕜, 𝕜), 𝕜⟯
⊢ ⁅Y, r • Z⁆ f✝ = (r • ⁅Y, Z⁆) f✝

Next tactic:
simp only [commutator_apply, map_smul, smul_sub, coe_smul, Pi.smul_apply]
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
⊢ IsIdempotentComplete (J ⥤ C)

Next tactic:
refine' ⟨fun F p hp => _⟩
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

Next tactic:
have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

Next tactic:
haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

Next tactic:
let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by 

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
j j' : J
φ : j ⟶ j'
⊢ (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
    (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j'

Next tactic:
rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
Y : J ⥤ C :=
  Functor.mk
    { obj := fun j => equalizer (𝟙 (F.obj j)) (p.app j),
      map := fun {j j'} φ =>
        equalizer.lift (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ)
          (_ :
            (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
              (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j') }
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

Next tactic:
let i : Y ⟶ F :=
    { app := fun j => equalizer.ι _ _
      naturality := fun _ _ _ => by rw [equalizer.lift_ι] }
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
  let i : Y ⟶ F :=
    { app := fun j => equalizer.ι _ _
      naturality := fun _ _ _ => by 

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
Y : J ⥤ C :=
  Functor.mk
    { obj := fun j => equalizer (𝟙 (F.obj j)) (p.app j),
      map := fun {j j'} φ =>
        equalizer.lift (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ)
          (_ :
            (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
              (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j') }
x✝² x✝¹ : J
x✝ : x✝² ⟶ x✝¹
⊢ Y.map x✝ ≫ (fun j => equalizer.ι (𝟙 (F.obj j)) (p.app j)) x✝¹ =
    (fun j => equalizer.ι (𝟙 (F.obj j)) (p.app j)) x✝² ≫ F.map x✝

Next tactic:
rw [equalizer.lift_ι]
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
  let i : Y ⟶ F :=
    { app := fun j => equalizer.ι _ _
      naturality := fun _ _ _ => by rw [equalizer.lift_ι] }
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
Y : J ⥤ C :=
  Functor.mk
    { obj := fun j => equalizer (𝟙 (F.obj j)) (p.app j),
      map := fun {j j'} φ =>
        equalizer.lift (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ)
          (_ :
            (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
              (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j') }
i : Y ⟶ F := NatTrans.mk fun j => equalizer.ι (𝟙 (F.obj j)) (p.app j)
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

Next tactic:
let e : F ⟶ Y :=
    { app := fun j =>
        equalizer.lift (p.app j) (by simpa only [comp_id] using (congr_app hp j).symm)
      naturality := fun j j' φ => equalizer.hom_ext (by simp) }
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
  let i : Y ⟶ F :=
    { app := fun j => equalizer.ι _ _
      naturality := fun _ _ _ => by rw [equalizer.lift_ι] }
  let e : F ⟶ Y :=
    { app := fun j =>
        equalizer.lift (p.app j) (by 

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
Y : J ⥤ C :=
  Functor.mk
    { obj := fun j => equalizer (𝟙 (F.obj j)) (p.app j),
      map := fun {j j'} φ =>
        equalizer.lift (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ)
          (_ :
            (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
              (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j') }
i : Y ⟶ F := NatTrans.mk fun j => equalizer.ι (𝟙 (F.obj j)) (p.app j)
j : J
⊢ p.app j ≫ 𝟙 (F.obj j) = p.app j ≫ p.app j

Next tactic:
simpa only [comp_id] using (congr_app hp j).symm
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
  let i : Y ⟶ F :=
    { app := fun j => equalizer.ι _ _
      naturality := fun _ _ _ => by rw [equalizer.lift_ι] }
  let e : F ⟶ Y :=
    { app := fun j =>
        equalizer.lift (p.app j) (by simpa only [comp_id] using (congr_app hp j).symm)
      naturality := fun j j' φ => equalizer.hom_ext (by 

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
Y : J ⥤ C :=
  Functor.mk
    { obj := fun j => equalizer (𝟙 (F.obj j)) (p.app j),
      map := fun {j j'} φ =>
        equalizer.lift (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ)
          (_ :
            (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
              (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j') }
i : Y ⟶ F := NatTrans.mk fun j => equalizer.ι (𝟙 (F.obj j)) (p.app j)
j j' : J
φ : j ⟶ j'
⊢ (F.map φ ≫ (fun j => equalizer.lift (p.app j) (_ : p.app j ≫ 𝟙 (F.obj j) = p.app j ≫ p.app j)) j') ≫
      equalizer.ι (𝟙 (F.obj j')) (p.app j') =
    ((fun j => equalizer.lift (p.app j) (_ : p.app j ≫ 𝟙 (F.obj j) = p.app j ≫ p.app j)) j ≫ Y.map φ) ≫
      equalizer.ι (𝟙 (F.obj j')) (p.app j')

Next tactic:
simp
instance functor_category_isIdempotentComplete [IsIdempotentComplete C] :
    IsIdempotentComplete (J ⥤ C) := by
  refine' ⟨fun F p hp => _⟩
  have hC := (isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent C).mp inferInstance
  haveI : ∀ j : J, HasEqualizer (𝟙 _) (p.app j) := fun j => hC _ _ (congr_app hp j)
  /- We construct the direct factor `Y` associated to `p : F ⟶ F` by computing
      the equalizer of the identity and `p.app j` on each object `(j : J)`.  -/
  let Y : J ⥤ C :=
    { obj := fun j => Limits.equalizer (𝟙 _) (p.app j)
      map := fun {j j'} φ =>
        equalizer.lift (Limits.equalizer.ι (𝟙 _) (p.app j) ≫ F.map φ)
          (by rw [comp_id, assoc, p.naturality φ, ← assoc, ← Limits.equalizer.condition, comp_id]) }
  let i : Y ⟶ F :=
    { app := fun j => equalizer.ι _ _
      naturality := fun _ _ _ => by rw [equalizer.lift_ι] }
  let e : F ⟶ Y :=
    { app := fun j =>
        equalizer.lift (p.app j) (by simpa only [comp_id] using (congr_app hp j).symm)
      naturality := fun j j' φ => equalizer.hom_ext (by simp) }
  

Proof state:
J : Type u_1
C : Type u_2
inst✝² : Category.{?u.4050, u_1} J
inst✝¹ : Category.{?u.4054, u_2} C
P Q : Karoubi (J ⥤ C)
f : P ⟶ Q
X : J
inst✝ : IsIdempotentComplete C
F : J ⥤ C
p : F ⟶ F
hp : p ≫ p = p
hC : ∀ (X : C) (p : X ⟶ X), p ≫ p = p → HasEqualizer (𝟙 X) p
this : ∀ (j : J), HasEqualizer (𝟙 (F.obj j)) (p.app j)
Y : J ⥤ C :=
  Functor.mk
    { obj := fun j => equalizer (𝟙 (F.obj j)) (p.app j),
      map := fun {j j'} φ =>
        equalizer.lift (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ)
          (_ :
            (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ 𝟙 (F.obj j') =
              (equalizer.ι (𝟙 (F.obj j)) (p.app j) ≫ F.map φ) ≫ p.app j') }
i : Y ⟶ F := NatTrans.mk fun j => equalizer.ι (𝟙 (F.obj j)) (p.app j)
e : F ⟶ Y := NatTrans.mk fun j => equalizer.lift (p.app j) (_ : p.app j ≫ 𝟙 (F.obj j) = p.app j ≫ p.app j)
⊢ ∃ Y i e, i ≫ e = 𝟙 Y ∧ e ≫ i = p

Next tactic:
use Y, i, e