l3lab/ntp-mathlib huggingface dataset:
theorem stoneCech_hom_ext {g₁ g₂ : StoneCech α → γ'} (h₁ : Continuous g₁) (h₂ : Continuous g₂)
    (h : g₁ ∘ stoneCechUnit = g₂ ∘ stoneCechUnit) : g₁ = g₂ := by
  apply Continuous.ext_on denseRange_stoneCechUnit h₁ h₂
  rintro x ⟨x, rfl⟩
  

Proof state:
case intro
α : Type u
inst✝⁵ : TopologicalSpace α
γ : Type u
inst✝⁴ : TopologicalSpace γ
inst✝³ : T2Space γ
inst✝² : CompactSpace γ
γ' : Type u
inst✝¹ : TopologicalSpace γ'
inst✝ : T2Space γ'
f : α → γ
hf : Continuous f
g₁ g₂ : StoneCech α → γ'
h₁ : Continuous g₁
h₂ : Continuous g₂
h : g₁ ∘ stoneCechUnit = g₂ ∘ stoneCechUnit
x : α
⊢ g₁ (stoneCechUnit x) = g₂ (stoneCechUnit x)

Next tactic:
apply congr_fun h x
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f u = Ultrafilter.extend f (pure x)

Next tactic:
skip
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f u = Ultrafilter.extend f (pure x)

Next tactic:
trans f x
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; 

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f u = f x
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ f x = Ultrafilter.extend f (pure x)

Next tactic:
swap
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; swap; 

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ f x = Ultrafilter.extend f (pure x)
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f u = f x

Next tactic:
symm
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; swap; symm
  

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f (pure x) = f x
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f u = f x

Next tactic:
all_goals refine' ultrafilter_extend_eq_iff.mpr (le_trans (map_mono _) (hf.tendsto _))
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; swap; symm
  all_goals 

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f (pure x) = f x

Next tactic:
refine' ultrafilter_extend_eq_iff.mpr (le_trans (map_mono _) (hf.tendsto _))
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; swap; symm
  all_goals 

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f u = f x

Next tactic:
refine' ultrafilter_extend_eq_iff.mpr (le_trans (map_mono _) (hf.tendsto _))
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; swap; symm
  all_goals refine' ultrafilter_extend_eq_iff.mpr (le_trans (map_mono _) (hf.tendsto _))
  · 

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ ↑(pure x) ≤ 𝓝 x

Next tactic:
apply pure_le_nhds
theorem convergent_eqv_pure {u : Ultrafilter α} {x : α} (ux : ↑u ≤ 𝓝 x) : u ≈ pure x :=
  fun γ tγ h₁ h₂ f hf => by
  skip
  trans f x; swap; symm
  all_goals refine' ultrafilter_extend_eq_iff.mpr (le_trans (map_mono _) (hf.tendsto _))
  · apply pure_le_nhds
  · 

Proof state:
α : Type u
inst✝ : TopologicalSpace α
u : Ultrafilter α
x : α
ux : ↑u ≤ 𝓝 x
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ ↑u ≤ 𝓝 x

Next tactic:
exact ux
theorem continuous_stoneCechUnit : Continuous (stoneCechUnit : α → StoneCech α) :=
  continuous_iff_ultrafilter.mpr fun x g gx => by
    

Proof state:
α : Type u
inst✝ : TopologicalSpace α
x : α
g : Ultrafilter α
gx : ↑g ≤ 𝓝 x
⊢ Tendsto stoneCechUnit (↑g) (𝓝 (stoneCechUnit x))

Next tactic:
have : (g.map pure).toFilter ≤ 𝓝 g := by
      rw [ultrafilter_converges_iff]
      exact (bind_pure _).symm
theorem continuous_stoneCechUnit : Continuous (stoneCechUnit : α → StoneCech α) :=
  continuous_iff_ultrafilter.mpr fun x g gx => by
    have : (g.map pure).toFilter ≤ 𝓝 g := by
      

Proof state:
α : Type u
inst✝ : TopologicalSpace α
x : α
g : Ultrafilter α
gx : ↑g ≤ 𝓝 x
⊢ ↑(Ultrafilter.map pure g) ≤ 𝓝 g

Next tactic:
rw [ultrafilter_converges_iff]
theorem continuous_stoneCechUnit : Continuous (stoneCechUnit : α → StoneCech α) :=
  continuous_iff_ultrafilter.mpr fun x g gx => by
    have : (g.map pure).toFilter ≤ 𝓝 g := by
      rw [ultrafilter_converges_iff]
      

Proof state:
α : Type u
inst✝ : TopologicalSpace α
x : α
g : Ultrafilter α
gx : ↑g ≤ 𝓝 x
⊢ g = joinM (Ultrafilter.map pure g)

Next tactic:
exact (bind_pure _).symm
theorem continuous_stoneCechUnit : Continuous (stoneCechUnit : α → StoneCech α) :=
  continuous_iff_ultrafilter.mpr fun x g gx => by
    have : (g.map pure).toFilter ≤ 𝓝 g := by
      rw [ultrafilter_converges_iff]
      exact (bind_pure _).symm
    

Proof state:
α : Type u
inst✝ : TopologicalSpace α
x : α
g : Ultrafilter α
gx : ↑g ≤ 𝓝 x
this : ↑(Ultrafilter.map pure g) ≤ 𝓝 g
⊢ Tendsto stoneCechUnit (↑g) (𝓝 (stoneCechUnit x))

Next tactic:
have : (g.map stoneCechUnit : Filter (StoneCech α)) ≤ 𝓝 ⟦g⟧ :=
      continuousAt_iff_ultrafilter.mp (continuous_quotient_mk'.tendsto g) _ this
theorem continuous_stoneCechUnit : Continuous (stoneCechUnit : α → StoneCech α) :=
  continuous_iff_ultrafilter.mpr fun x g gx => by
    have : (g.map pure).toFilter ≤ 𝓝 g := by
      rw [ultrafilter_converges_iff]
      exact (bind_pure _).symm
    have : (g.map stoneCechUnit : Filter (StoneCech α)) ≤ 𝓝 ⟦g⟧ :=
      continuousAt_iff_ultrafilter.mp (continuous_quotient_mk'.tendsto g) _ this
    

Proof state:
α : Type u
inst✝ : TopologicalSpace α
x : α
g : Ultrafilter α
gx : ↑g ≤ 𝓝 x
this✝ : ↑(Ultrafilter.map pure g) ≤ 𝓝 g
this : ↑(Ultrafilter.map stoneCechUnit g) ≤ 𝓝 ⟦g⟧
⊢ Tendsto stoneCechUnit (↑g) (𝓝 (stoneCechUnit x))

Next tactic:
rwa [show ⟦g⟧ = ⟦pure x⟧ from Quotient.sound <| convergent_eqv_pure gx] at this
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  

Proof state:
α : Type u
inst✝ : TopologicalSpace α
⊢ T2Space (StoneCech α)

Next tactic:
rw [t2_iff_ultrafilter]
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  

Proof state:
α : Type u
inst✝ : TopologicalSpace α
⊢ ∀ {x y : StoneCech α} (f : Ultrafilter (StoneCech α)), ↑f ≤ 𝓝 x → ↑f ≤ 𝓝 y → x = y

Next tactic:
rintro ⟨x⟩ ⟨y⟩ g gx gy
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  

Proof state:
case mk.mk
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
⊢ Quot.mk Setoid.r x = Quot.mk Setoid.r y

Next tactic:
apply Quotient.sound
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  apply Quotient.sound
  

Proof state:
case mk.mk.a
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
⊢ x ≈ y

Next tactic:
intro γ tγ h₁ h₂ f hf
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  apply Quotient.sound
  intro γ tγ h₁ h₂ f hf
  

Proof state:
case mk.mk.a
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f x = Ultrafilter.extend f y

Next tactic:
skip
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  apply Quotient.sound
  intro γ tγ h₁ h₂ f hf
  skip
  

Proof state:
case mk.mk.a
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
⊢ Ultrafilter.extend f x = Ultrafilter.extend f y

Next tactic:
let ff := stoneCechExtend hf
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  apply Quotient.sound
  intro γ tγ h₁ h₂ f hf
  skip
  let ff := stoneCechExtend hf
  

Proof state:
case mk.mk.a
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
ff : StoneCech α → γ := stoneCechExtend hf
⊢ Ultrafilter.extend f x = Ultrafilter.extend f y

Next tactic:
change ff ⟦x⟧ = ff ⟦y⟧
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  apply Quotient.sound
  intro γ tγ h₁ h₂ f hf
  skip
  let ff := stoneCechExtend hf
  change ff ⟦x⟧ = ff ⟦y⟧
  

Proof state:
case mk.mk.a
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
ff : StoneCech α → γ := stoneCechExtend hf
⊢ ff ⟦x⟧ = ff ⟦y⟧

Next tactic:
have lim := fun (z : Ultrafilter α) (gz : (g : Filter (StoneCech α)) ≤ 𝓝 ⟦z⟧) =>
    ((continuous_stoneCechExtend hf).tendsto _).mono_left gz
instance StoneCech.t2Space : T2Space (StoneCech α) := by
  rw [t2_iff_ultrafilter]
  rintro ⟨x⟩ ⟨y⟩ g gx gy
  apply Quotient.sound
  intro γ tγ h₁ h₂ f hf
  skip
  let ff := stoneCechExtend hf
  change ff ⟦x⟧ = ff ⟦y⟧
  have lim := fun (z : Ultrafilter α) (gz : (g : Filter (StoneCech α)) ≤ 𝓝 ⟦z⟧) =>
    ((continuous_stoneCechExtend hf).tendsto _).mono_left gz
  

Proof state:
case mk.mk.a
α : Type u
inst✝ : TopologicalSpace α
x✝ : StoneCech α
x : Ultrafilter α
y✝ : StoneCech α
y : Ultrafilter α
g : Ultrafilter (StoneCech α)
gx : ↑g ≤ 𝓝 (Quot.mk Setoid.r x)
gy : ↑g ≤ 𝓝 (Quot.mk Setoid.r y)
γ : Type u
tγ : TopologicalSpace γ
h₁ : T2Space γ
h₂ : CompactSpace γ
f : α → γ
hf : Continuous f
ff : StoneCech α → γ := stoneCechExtend hf
lim : ∀ (z : Ultrafilter α), ↑g ≤ 𝓝 ⟦z⟧ → Tendsto (stoneCechExtend hf) (↑g) (𝓝 (stoneCechExtend hf ⟦z⟧))
⊢ ff ⟦x⟧ = ff ⟦y⟧

Next tactic:
exact tendsto_nhds_unique (lim x gx) (lim y gy)
@[reassoc (attr := simp)]
lemma idem_f (P : Karoubi (Karoubi C)) : P.p.f ≫ P.p.f = P.p.f := by
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
P : Karoubi (Karoubi C)
⊢ P.p.f ≫ P.p.f = P.p.f

Next tactic:
simpa only [hom_ext_iff, comp_f] using P.idem
@[reassoc]
lemma p_comm_f {P Q : Karoubi (Karoubi C)} (f : P ⟶ Q) : P.p.f ≫ f.f.f = f.f.f ≫ Q.p.f := by
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
P Q : Karoubi (Karoubi C)
f : P ⟶ Q
⊢ P.p.f ≫ f.f.f = f.f.f ≫ Q.p.f

Next tactic:
simpa only [hom_ext_iff, comp_f] using p_comm f
/-- The canonical functor `Karoubi (Karoubi C) ⥤ Karoubi C` -/
@[simps]
def inverse : Karoubi (Karoubi C) ⥤ Karoubi C where
  obj P := ⟨P.X.X, P.p.f, by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.1704, u_1} C
P : Karoubi (Karoubi C)
⊢ P.p.f ≫ P.p.f = P.p.f

Next tactic:
simpa only [hom_ext_iff] using P.idem
/-- The canonical functor `Karoubi (Karoubi C) ⥤ Karoubi C` -/
@[simps]
def inverse : Karoubi (Karoubi C) ⥤ Karoubi C where
  obj P := ⟨P.X.X, P.p.f, by simpa only [hom_ext_iff] using P.idem⟩
  map f := ⟨f.f.f, by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.1704, u_1} C
X✝ Y✝ : Karoubi (Karoubi C)
f : X✝ ⟶ Y✝
⊢ f.f.f = ((fun P => Karoubi.mk P.X.X P.p.f) X✝).p ≫ f.f.f ≫ ((fun P => Karoubi.mk P.X.X P.p.f) Y✝).p

Next tactic:
simpa only [hom_ext_iff] using f.comm
/-- The unit isomorphism of the equivalence -/
@[simps!]
def unitIso : 𝟭 (Karoubi C) ≅ toKaroubi (Karoubi C) ⋙ inverse C :=
  eqToIso (Functor.ext (by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.7678, u_1} C
⊢ ∀ (X : Karoubi C), (𝟭 (Karoubi C)).obj X = (toKaroubi (Karoubi C) ⋙ inverse C).obj X

Next tactic:
aesop_cat
/-- The unit isomorphism of the equivalence -/
@[simps!]
def unitIso : 𝟭 (Karoubi C) ≅ toKaroubi (Karoubi C) ⋙ inverse C :=
  eqToIso (Functor.ext (by aesop_cat) (by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.7678, u_1} C
⊢ ∀ (X Y : Karoubi C) (f : X ⟶ Y),
    (𝟭 (Karoubi C)).map f =
      eqToHom (_ : (𝟭 (Karoubi C)).obj X = (toKaroubi (Karoubi C) ⋙ inverse C).obj X) ≫
        (toKaroubi (Karoubi C) ⋙ inverse C).map f ≫
          eqToHom (_ : (toKaroubi (Karoubi C) ⋙ inverse C).obj Y = (𝟭 (Karoubi C)).obj Y)

Next tactic:
aesop_cat
/-- The counit isomorphism of the equivalence -/
@[simps]
def counitIso : inverse C ⋙ toKaroubi (Karoubi C) ≅ 𝟭 (Karoubi (Karoubi C)) where
  hom :=
    { app := fun P =>
        { f :=
            { f := P.p.1
              comm := by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.11819, u_1} C
P : Karoubi (Karoubi C)
⊢ P.p.f = ((inverse C ⋙ toKaroubi (Karoubi C)).obj P).X.p ≫ P.p.f ≫ ((𝟭 (Karoubi (Karoubi C))).obj P).X.p

Next tactic:
simp
/-- The counit isomorphism of the equivalence -/
@[simps]
def counitIso : inverse C ⋙ toKaroubi (Karoubi C) ≅ 𝟭 (Karoubi (Karoubi C)) where
  hom :=
    { app := fun P =>
        { f :=
            { f := P.p.1
              comm := by simp }
          comm := by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.11819, u_1} C
P : Karoubi (Karoubi C)
⊢ Hom.mk P.p.f = ((inverse C ⋙ toKaroubi (Karoubi C)).obj P).p ≫ Hom.mk P.p.f ≫ ((𝟭 (Karoubi (Karoubi C))).obj P).p

Next tactic:
simp
/-- The counit isomorphism of the equivalence -/
@[simps]
def counitIso : inverse C ⋙ toKaroubi (Karoubi C) ≅ 𝟭 (Karoubi (Karoubi C)) where
  hom :=
    { app := fun P =>
        { f :=
            { f := P.p.1
              comm := by simp }
          comm := by simp } }
  inv :=
    { app := fun P =>
        { f :=
            { f := P.p.1
              comm := by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.11819, u_1} C
P : Karoubi (Karoubi C)
⊢ P.p.f = ((𝟭 (Karoubi (Karoubi C))).obj P).X.p ≫ P.p.f ≫ ((inverse C ⋙ toKaroubi (Karoubi C)).obj P).X.p

Next tactic:
simp
/-- The counit isomorphism of the equivalence -/
@[simps]
def counitIso : inverse C ⋙ toKaroubi (Karoubi C) ≅ 𝟭 (Karoubi (Karoubi C)) where
  hom :=
    { app := fun P =>
        { f :=
            { f := P.p.1
              comm := by simp }
          comm := by simp } }
  inv :=
    { app := fun P =>
        { f :=
            { f := P.p.1
              comm := by simp }
          comm := by 

Proof state:
C : Type u_1
inst✝ : Category.{?u.11819, u_1} C
P : Karoubi (Karoubi C)
⊢ Hom.mk P.p.f = ((𝟭 (Karoubi (Karoubi C))).obj P).p ≫ Hom.mk P.p.f ≫ ((inverse C ⋙ toKaroubi (Karoubi C)).obj P).p

Next tactic:
simp
/-- Riesz's lemma, which usually states that it is possible to find a
vector with norm 1 whose distance to a closed proper subspace is
arbitrarily close to 1. The statement here is in terms of multiples of
norms, since in general the existence of an element of norm exactly 1
is not guaranteed. For a variant giving an element with norm in `[1, R]`, see
`riesz_lemma_of_norm_lt`. -/
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
    (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
  

Proof state:
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
F : Subspace 𝕜 E
hFc : IsClosed ↑F
hF : ∃ x, x ∉ F
r : ℝ
hr : r < 1
⊢ ∃ x₀ ∉ F, ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖

Next tactic:
classical
    obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
    let d := Metric.infDist x F
    have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩
    have hdp : 0 < d :=
      lt_of_le_of_ne Metric.infDist_nonneg fun heq =>
        hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm)
    let r' := max r 2⁻¹
    have hr' : r' < 1 := by
      simp only [ge_iff_le, max_lt_iff, hr, true_and]
      norm_num
    have hlt : 0 < r' := lt_of_lt_of_le (by norm_num) (le_max_right r 2⁻¹)
    have hdlt : d < d / r' := (lt_div_iff hlt).mpr ((mul_lt_iff_lt_one_right hdp).2 hr')
    obtain ⟨y₀, hy₀F, hxy₀⟩ : ∃ y ∈ F, dist x y < d / r' := (Metric.infDist_lt_iff hFn).mp hdlt
    have x_ne_y₀ : x - y₀ ∉ F := by
      by_contra h
      have : x - y₀ + y₀ ∈ F := F.add_mem h hy₀F
      simp only [neg_add_cancel_right, sub_eq_add_neg] at this
      exact hx this
    refine' ⟨x - y₀, x_ne_y₀, fun y hy => le_of_lt _⟩
    have hy₀y : y₀ + y ∈ F := F.add_mem hy₀F hy
    calc
      r * ‖x - y₀‖ ≤ r' * ‖x - y₀‖ := by gcongr; apply le_max_left
      _ < d := by
        rw [← dist_eq_norm]
        exact (lt_div_iff' hlt).1 hxy₀
      _ ≤ dist x (y₀ + y) := (Metric.infDist_le_dist_of_mem hy₀y)
      _ = ‖x - y₀ - y‖ := by rw [sub_sub, dist_eq_norm]
/-- Riesz's lemma, which usually states that it is possible to find a
vector with norm 1 whose distance to a closed proper subspace is
arbitrarily close to 1. The statement here is in terms of multiples of
norms, since in general the existence of an element of norm exactly 1
is not guaranteed. For a variant giving an element with norm in `[1, R]`, see
`riesz_lemma_of_norm_lt`. -/
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
    (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
  classical
    

Proof state:
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
F : Subspace 𝕜 E
hFc : IsClosed ↑F
hF : ∃ x, x ∉ F
r : ℝ
hr : r < 1
⊢ ∃ x₀ ∉ F, ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖

Next tactic:
obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
/-- Riesz's lemma, which usually states that it is possible to find a
vector with norm 1 whose distance to a closed proper subspace is
arbitrarily close to 1. The statement here is in terms of multiples of
norms, since in general the existence of an element of norm exactly 1
is not guaranteed. For a variant giving an element with norm in `[1, R]`, see
`riesz_lemma_of_norm_lt`. -/
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
    (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
  classical
    obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
    

Proof state:
case intro
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
F : Subspace 𝕜 E
hFc : IsClosed ↑F
r : ℝ
hr : r < 1
x : E
hx : x ∉ F
⊢ ∃ x₀ ∉ F, ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖

Next tactic:
let d := Metric.infDist x F
/-- Riesz's lemma, which usually states that it is possible to find a
vector with norm 1 whose distance to a closed proper subspace is
arbitrarily close to 1. The statement here is in terms of multiples of
norms, since in general the existence of an element of norm exactly 1
is not guaranteed. For a variant giving an element with norm in `[1, R]`, see
`riesz_lemma_of_norm_lt`. -/
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
    (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
  classical
    obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
    let d := Metric.infDist x F
    

Proof state:
case intro
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
F : Subspace 𝕜 E
hFc : IsClosed ↑F
r : ℝ
hr : r < 1
x : E
hx : x ∉ F
d : ℝ := infDist x ↑F
⊢ ∃ x₀ ∉ F, ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖

Next tactic:
have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩
/-- Riesz's lemma, which usually states that it is possible to find a
vector with norm 1 whose distance to a closed proper subspace is
arbitrarily close to 1. The statement here is in terms of multiples of
norms, since in general the existence of an element of norm exactly 1
is not guaranteed. For a variant giving an element with norm in `[1, R]`, see
`riesz_lemma_of_norm_lt`. -/
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
    (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
  classical
    obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
    let d := Metric.infDist x F
    have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩
    

Proof state:
case intro
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
F : Subspace 𝕜 E
hFc : IsClosed ↑F
r : ℝ
hr : r < 1
x : E
hx : x ∉ F
d : ℝ := infDist x ↑F
hFn : Set.Nonempty ↑F
⊢ ∃ x₀ ∉ F, ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖

Next tactic:
have hdp : 0 < d :=
      lt_of_le_of_ne Metric.infDist_nonneg fun heq =>
        hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm)
/-- Riesz's lemma, which usually states that it is possible to find a
vector with norm 1 whose distance to a closed proper subspace is
arbitrarily close to 1. The statement here is in terms of multiples of
norms, since in general the existence of an element of norm exactly 1
is not guaranteed. For a variant giving an element with norm in `[1, R]`, see
`riesz_lemma_of_norm_lt`. -/
theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ}
    (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by
  classical
    obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF
    let d := Metric.infDist x F
    have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩
    have hdp : 0 < d :=
      lt_of_le_of_ne Metric.infDist_nonneg fun heq =>
        hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm)
    

Proof state:
case intro
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
F : Subspace 𝕜 E
hFc : IsClosed ↑F
r : ℝ
hr : r < 1
x : E
hx : x ∉ F
d : ℝ := infDist x ↑F
hFn : Set.Nonempty ↑F
hdp : 0 < d
⊢ ∃ x₀ ∉ F, ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖

Next tactic:
let r' := max r 2⁻¹