l3lab/ntp-mathlib huggingface dataset:
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    

Proof state:
case h
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
⊢ ((Monad.μ β).app X ≫ Ultrafilter.lim) FF = (β.toFunctor.map Ultrafilter.lim ≫ Ultrafilter.lim) FF

Next tactic:
have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        exact c2 U P hP hU
      exact @c3 U (IsOpen.mem_nhds hU hx)
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      

Proof state:
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
⊢ ∀ (U : Set X), x ∈ U → IsOpen U → {G | U ∈ G} ∈ FF

Next tactic:
intro U hx hU
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      

Proof state:
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
U : Set X
hx : x ∈ U
hU : IsOpen U
⊢ {G | U ∈ G} ∈ FF

Next tactic:
suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        exact c2 U P hP hU
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        

Proof state:
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
U : Set X
hx : x ∈ U
hU : IsOpen U
this : Ultrafilter.lim ⁻¹' U ∈ FF
⊢ {G | U ∈ G} ∈ FF

Next tactic:
apply mem_of_superset this
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        

Proof state:
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
U : Set X
hx : x ∈ U
hU : IsOpen U
this : Ultrafilter.lim ⁻¹' U ∈ FF
⊢ Ultrafilter.lim ⁻¹' U ⊆ {G | U ∈ G}

Next tactic:
intro P hP
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        

Proof state:
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
U : Set X
hx : x ∈ U
hU : IsOpen U
this : Ultrafilter.lim ⁻¹' U ∈ FF
P : Ultrafilter X
hP : P ∈ Ultrafilter.lim ⁻¹' U
⊢ P ∈ {G | U ∈ G}

Next tactic:
exact c2 U P hP hU
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        exact c2 U P hP hU
      

Proof state:
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
U : Set X
hx : x ∈ U
hU : IsOpen U
⊢ Ultrafilter.lim ⁻¹' U ∈ FF

Next tactic:
exact @c3 U (IsOpen.mem_nhds hU hx)
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        exact c2 U P hP hU
      exact @c3 U (IsOpen.mem_nhds hU hx)
    

Proof state:
case h
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
c4 : ∀ (U : Set X), x ∈ U → IsOpen U → {G | U ∈ G} ∈ FF
⊢ ((Monad.μ β).app X ≫ Ultrafilter.lim) FF = (β.toFunctor.map Ultrafilter.lim ≫ Ultrafilter.lim) FF

Next tactic:
apply lim_eq
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        exact c2 U P hP hU
      exact @c3 U (IsOpen.mem_nhds hU hx)
    apply lim_eq
    

Proof state:
case h.h
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
c4 : ∀ (U : Set X), x ∈ U → IsOpen U → {G | U ∈ G} ∈ FF
⊢ ↑((Monad.μ β).app X FF) ≤ 𝓝 ((β.toFunctor.map Ultrafilter.lim ≫ Ultrafilter.lim) FF)

Next tactic:
rw [le_nhds_iff]
/-- Given any compact Hausdorff space, we construct a Compactum. -/
noncomputable def ofTopologicalSpace (X : Type*) [TopologicalSpace X] [CompactSpace X]
    [T2Space X] : Compactum where
  A := X
  a := Ultrafilter.lim
  unit := by
    ext x
    exact lim_eq (pure_le_nhds _)
  assoc := by
    ext FF
    change Ultrafilter (Ultrafilter X) at FF
    set x := (Ultrafilter.map Ultrafilter.lim FF).lim with c1
    have c2 : ∀ (U : Set X) (F : Ultrafilter X), F.lim ∈ U → IsOpen U → U ∈ F := by
      intro U F h1 hU
      exact isOpen_iff_ultrafilter.mp hU _ h1 _ (Ultrafilter.le_nhds_lim _)
    have c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x := by
      rw [le_nhds_iff]
      intro U hx hU
      exact mem_coe.2 (c2 _ _ (by rwa [← c1]) hU)
    have c4 : ∀ U : Set X, x ∈ U → IsOpen U → { G : Ultrafilter X | U ∈ G } ∈ FF := by
      intro U hx hU
      suffices Ultrafilter.lim ⁻¹' U ∈ FF by
        apply mem_of_superset this
        intro P hP
        exact c2 U P hP hU
      exact @c3 U (IsOpen.mem_nhds hU hx)
    apply lim_eq
    rw [le_nhds_iff]
    

Proof state:
case h.h
X : Type u_1
inst✝² : TopologicalSpace X
inst✝¹ : CompactSpace X
inst✝ : T2Space X
FF : Ultrafilter (Ultrafilter X)
x : X := Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c1 : x = Ultrafilter.lim (Ultrafilter.map Ultrafilter.lim FF)
c2 : ∀ (U : Set X) (F : Ultrafilter X), Ultrafilter.lim F ∈ U → IsOpen U → U ∈ F
c3 : ↑(Ultrafilter.map Ultrafilter.lim FF) ≤ 𝓝 x
c4 : ∀ (U : Set X), x ∈ U → IsOpen U → {G | U ∈ G} ∈ FF
⊢ ∀ (s : Set X), (β.toFunctor.map Ultrafilter.lim ≫ Ultrafilter.lim) FF ∈ s → IsOpen s → s ∈ ↑((Monad.μ β).app X FF)

Next tactic:
exact c4
/-- Any continuous map between Compacta is a morphism of compacta. -/
def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y :=
  { f
    h := by
      

Proof state:
X Y : Compactum
f : X.A → Y.A
cont : Continuous f
⊢ β.toFunctor.map f ≫ Y.a = X.a ≫ f

Next tactic:
rw [continuous_iff_ultrafilter] at cont
/-- Any continuous map between Compacta is a morphism of compacta. -/
def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y :=
  { f
    h := by
      rw [continuous_iff_ultrafilter] at cont
      

Proof state:
X Y : Compactum
f : X.A → Y.A
cont : ∀ (x : X.A) (g : Ultrafilter X.A), ↑g ≤ 𝓝 x → Tendsto f (↑g) (𝓝 (f x))
⊢ β.toFunctor.map f ≫ Y.a = X.a ≫ f

Next tactic:
ext (F : Ultrafilter X)
/-- Any continuous map between Compacta is a morphism of compacta. -/
def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y :=
  { f
    h := by
      rw [continuous_iff_ultrafilter] at cont
      ext (F : Ultrafilter X)
      

Proof state:
case h
X Y : Compactum
f : X.A → Y.A
cont : ∀ (x : X.A) (g : Ultrafilter X.A), ↑g ≤ 𝓝 x → Tendsto f (↑g) (𝓝 (f x))
F : Ultrafilter X.A
⊢ (β.toFunctor.map f ≫ Y.a) F = (X.a ≫ f) F

Next tactic:
specialize cont (X.str F) F (le_nhds_of_str_eq F (X.str F) rfl)
/-- Any continuous map between Compacta is a morphism of compacta. -/
def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y :=
  { f
    h := by
      rw [continuous_iff_ultrafilter] at cont
      ext (F : Ultrafilter X)
      specialize cont (X.str F) F (le_nhds_of_str_eq F (X.str F) rfl)
      

Proof state:
case h
X Y : Compactum
f : X.A → Y.A
F : Ultrafilter X.A
cont : Tendsto f (↑F) (𝓝 (f (str X F)))
⊢ (β.toFunctor.map f ≫ Y.a) F = (X.a ≫ f) F

Next tactic:
simp only [types_comp_apply, ofTypeFunctor_map]
/-- Any continuous map between Compacta is a morphism of compacta. -/
def homOfContinuous {X Y : Compactum} (f : X → Y) (cont : Continuous f) : X ⟶ Y :=
  { f
    h := by
      rw [continuous_iff_ultrafilter] at cont
      ext (F : Ultrafilter X)
      specialize cont (X.str F) F (le_nhds_of_str_eq F (X.str F) rfl)
      simp only [types_comp_apply, ofTypeFunctor_map]
      

Proof state:
case h
X Y : Compactum
f : X.A → Y.A
F : Ultrafilter X.A
cont : Tendsto f (↑F) (𝓝 (f (str X F)))
⊢ Monad.Algebra.a Y (β.toFunctor.map f F) = f (Monad.Algebra.a X F)

Next tactic:
exact str_eq_of_le_nhds (Ultrafilter.map f F) _ cont
/-- The functor `compactumToCompHaus` is faithful. -/
theorem faithful : Faithful compactumToCompHaus where
  -- Porting note: this used to be obviously (though it consumed a bit of memory)
  map_injective := by
    

Proof state:
⊢ ∀ {X Y : Compactum}, Function.Injective compactumToCompHaus.map

Next tactic:
intro _ _ _ _ h
/-- The functor `compactumToCompHaus` is faithful. -/
theorem faithful : Faithful compactumToCompHaus where
  -- Porting note: this used to be obviously (though it consumed a bit of memory)
  map_injective := by
    intro _ _ _ _ h
    -- Porting note: ext gets confused by coercion using forget
    

Proof state:
X✝ Y✝ : Compactum
a₁✝ a₂✝ : X✝ ⟶ Y✝
h : compactumToCompHaus.map a₁✝ = compactumToCompHaus.map a₂✝
⊢ a₁✝ = a₂✝

Next tactic:
apply Monad.Algebra.Hom.ext
/-- The functor `compactumToCompHaus` is faithful. -/
theorem faithful : Faithful compactumToCompHaus where
  -- Porting note: this used to be obviously (though it consumed a bit of memory)
  map_injective := by
    intro _ _ _ _ h
    -- Porting note: ext gets confused by coercion using forget
    apply Monad.Algebra.Hom.ext
    

Proof state:
case f
X✝ Y✝ : Compactum
a₁✝ a₂✝ : X✝ ⟶ Y✝
h : compactumToCompHaus.map a₁✝ = compactumToCompHaus.map a₂✝
⊢ a₁✝.f = a₂✝.f

Next tactic:
apply congrArg (fun f => f.toFun) h
/-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/
def isoOfTopologicalSpace {D : CompHaus} :
    compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where
  hom :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h => by
          

Proof state:
D : CompHaus
x✝ : Set ↑D.toTop
h : IsOpen x✝
⊢ IsOpen (id ⁻¹' x✝)

Next tactic:
rw [isOpen_iff_ultrafilter'] at h
/-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/
def isoOfTopologicalSpace {D : CompHaus} :
    compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where
  hom :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h => by
          rw [isOpen_iff_ultrafilter'] at h
          

Proof state:
D : CompHaus
x✝ : Set ↑D.toTop
h : ∀ (F : Ultrafilter ↑D.toTop), Ultrafilter.lim F ∈ x✝ → x✝ ∈ ↑F
⊢ IsOpen (id ⁻¹' x✝)

Next tactic:
exact h
/-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/
def isoOfTopologicalSpace {D : CompHaus} :
    compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where
  hom :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h => by
          rw [isOpen_iff_ultrafilter'] at h
          exact h }
  inv :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h1 => by
          

Proof state:
D : CompHaus
x✝ : Set ↑(compactumToCompHaus.obj (Compactum.ofTopologicalSpace ↑D.toTop)).toTop
h1 : IsOpen x✝
⊢ IsOpen (id ⁻¹' x✝)

Next tactic:
rw [isOpen_iff_ultrafilter']
/-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/
def isoOfTopologicalSpace {D : CompHaus} :
    compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where
  hom :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h => by
          rw [isOpen_iff_ultrafilter'] at h
          exact h }
  inv :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h1 => by
          rw [isOpen_iff_ultrafilter']
          

Proof state:
D : CompHaus
x✝ : Set ↑(compactumToCompHaus.obj (Compactum.ofTopologicalSpace ↑D.toTop)).toTop
h1 : IsOpen x✝
⊢ ∀ (F : Ultrafilter ↑D.toTop), Ultrafilter.lim F ∈ id ⁻¹' x✝ → id ⁻¹' x✝ ∈ ↑F

Next tactic:
intro _ h2
/-- This definition is used to prove essential surjectivity of `compactumToCompHaus`. -/
def isoOfTopologicalSpace {D : CompHaus} :
    compactumToCompHaus.obj (Compactum.ofTopologicalSpace D) ≅ D where
  hom :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h => by
          rw [isOpen_iff_ultrafilter'] at h
          exact h }
  inv :=
    { toFun := id
      continuous_toFun :=
        continuous_def.2 fun _ h1 => by
          rw [isOpen_iff_ultrafilter']
          intro _ h2
          

Proof state:
D : CompHaus
x✝ : Set ↑(compactumToCompHaus.obj (Compactum.ofTopologicalSpace ↑D.toTop)).toTop
h1 : IsOpen x✝
F✝ : Ultrafilter ↑D.toTop
h2 : Ultrafilter.lim F✝ ∈ id ⁻¹' x✝
⊢ id ⁻¹' x✝ ∈ ↑F✝

Next tactic:
exact h1 _ h2
/-- The functor `compactumToCompHaus` is an equivalence of categories. -/
noncomputable instance isEquivalence : IsEquivalence compactumToCompHaus := by
  

Proof state:
⊢ IsEquivalence compactumToCompHaus

Next tactic:
have := compactumToCompHaus.full
/-- The functor `compactumToCompHaus` is an equivalence of categories. -/
noncomputable instance isEquivalence : IsEquivalence compactumToCompHaus := by
  have := compactumToCompHaus.full
  

Proof state:
this : Full compactumToCompHaus
⊢ IsEquivalence compactumToCompHaus

Next tactic:
have := compactumToCompHaus.faithful
/-- The functor `compactumToCompHaus` is an equivalence of categories. -/
noncomputable instance isEquivalence : IsEquivalence compactumToCompHaus := by
  have := compactumToCompHaus.full
  have := compactumToCompHaus.faithful
  

Proof state:
this✝ : Full compactumToCompHaus
this : Faithful compactumToCompHaus
⊢ IsEquivalence compactumToCompHaus

Next tactic:
have := compactumToCompHaus.essSurj
/-- The functor `compactumToCompHaus` is an equivalence of categories. -/
noncomputable instance isEquivalence : IsEquivalence compactumToCompHaus := by
  have := compactumToCompHaus.full
  have := compactumToCompHaus.faithful
  have := compactumToCompHaus.essSurj
  

Proof state:
this✝¹ : Full compactumToCompHaus
this✝ : Faithful compactumToCompHaus
this : EssSurj compactumToCompHaus
⊢ IsEquivalence compactumToCompHaus

Next tactic:
apply Equivalence.ofFullyFaithfullyEssSurj _
noncomputable instance CompHaus.forgetCreatesLimits : CreatesLimits (forget CompHaus) := by
  

Proof state:
⊢ CreatesLimits (forget CompHaus)

Next tactic:
let e : forget CompHaus ≅ compactumToCompHaus.inv ⋙ Compactum.forget :=
    (((forget CompHaus).leftUnitor.symm ≪≫
    isoWhiskerRight compactumToCompHaus.asEquivalence.symm.unitIso (forget CompHaus)) ≪≫
    compactumToCompHaus.inv.associator compactumToCompHaus (forget CompHaus)) ≪≫
    isoWhiskerLeft _ compactumToCompHausCompForget