l3lab/ntp-mathlib huggingface dataset:
set_option synthInstance.maxHeartbeats 30000 in
/-- The Stone-Weierstrass approximation theorem, `IsROrC` version, that a star subalgebra `A` of
`C(X, 𝕜)`, where `X` is a compact topological space and `IsROrC 𝕜`, is dense if it separates
points. -/
theorem ContinuousMap.starSubalgebra_topologicalClosure_eq_top_of_separatesPoints
    (A : StarSubalgebra 𝕜 C(X, 𝕜)) (hA : A.SeparatesPoints) : A.topologicalClosure = ⊤ := by
  rw [StarSubalgebra.eq_top_iff]
  -- Let `I` be the natural inclusion of `C(X, ℝ)` into `C(X, 𝕜)`
  let I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ofRealClm.compLeftContinuous ℝ X
  -- The main point of the proof is that its range (i.e., every real-valued function) is contained
  -- in the closure of `A`
  have key : LinearMap.range I ≤ (A.toSubmodule.restrictScalars ℝ).topologicalClosure := by
    -- Let `A₀` be the subalgebra of `C(X, ℝ)` consisting of `A`'s purely real elements; it is the
    -- preimage of `A` under `I`.  In this argument we only need its submodule structure.
    let A₀ : Submodule ℝ C(X, ℝ) := (A.toSubmodule.restrictScalars ℝ).comap I
    -- By `Subalgebra.SeparatesPoints.isROrC_to_real`, this subalgebra also separates points, so
    -- we may apply the real Stone-Weierstrass result to it.
    have SW : A₀.topologicalClosure = ⊤ :=
      haveI := subalgebra_topologicalClosure_eq_top_of_separatesPoints _ hA.isROrC_to_real
      congr_arg Subalgebra.toSubmodule this
    rw [← Submodule.map_top, ← SW]
    -- So it suffices to prove that the image under `I` of the closure of `A₀` is contained in the
    -- closure of `A`, which follows by abstract nonsense
    have h₁ := A₀.topologicalClosure_map ((@ofRealClm 𝕜 _).compLeftContinuousCompact X)
    have h₂ := (A.toSubmodule.restrictScalars ℝ).map_comap_le I
    exact h₁.trans (Submodule.topologicalClosure_mono h₂)
  -- In particular, for a function `f` in `C(X, 𝕜)`, the real and imaginary parts of `f` are in the
  -- closure of `A`
  intro f
  let f_re : C(X, ℝ) := (⟨IsROrC.re, IsROrC.reClm.continuous⟩ : C(𝕜, ℝ)).comp f
  let f_im : C(X, ℝ) := (⟨IsROrC.im, IsROrC.imClm.continuous⟩ : C(𝕜, ℝ)).comp f
  have h_f_re : I f_re ∈ A.topologicalClosure := key ⟨f_re, rfl⟩
  have h_f_im : I f_im ∈ A.topologicalClosure := key ⟨f_im, rfl⟩
  -- So `f_re + I • f_im` is in the closure of `A`
  have := A.topologicalClosure.add_mem h_f_re (A.topologicalClosure.smul_mem h_f_im IsROrC.I)
  rw [StarSubalgebra.mem_toSubalgebra] at this
  convert this
  -- And this, of course, is just `f`
  

Proof state:
case h.e'_4
𝕜 : Type u_1
X : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤ Submodule.topologicalClosure (Submodule.restrictScalars ℝ (Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ⇑re) f
f_im : C(X, ℝ) := comp (mk ⇑im) f
h_f_re : I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : I f_im ∈ StarSubalgebra.topologicalClosure A
this : I f_re + IsROrC.I • I f_im ∈ StarSubalgebra.topologicalClosure A
⊢ f = I f_re + IsROrC.I • I f_im

Next tactic:
ext
/-- Continuous algebra homomorphisms from `C(s, ℝ)` into an `ℝ`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.algHom_ext_map_X {A : Type*} [Ring A]
    [Algebra ℝ A] [TopologicalSpace A] [T2Space A] {s : Set ℝ} [CompactSpace s]
    {φ ψ : C(s, ℝ) →ₐ[ℝ] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  

Proof state:
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
⊢ φ = ψ

Next tactic:
suffices (⊤ : Subalgebra ℝ C(s, ℝ)) ≤ AlgHom.equalizer φ ψ from
    AlgHom.ext fun x => this (by trivial)
/-- Continuous algebra homomorphisms from `C(s, ℝ)` into an `ℝ`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.algHom_ext_map_X {A : Type*} [Ring A]
    [Algebra ℝ A] [TopologicalSpace A] [T2Space A] {s : Set ℝ} [CompactSpace s]
    {φ ψ : C(s, ℝ) →ₐ[ℝ] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  suffices (⊤ : Subalgebra ℝ C(s, ℝ)) ≤ AlgHom.equalizer φ ψ from
    AlgHom.ext fun x => this (by 

Proof state:
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
this : ⊤ ≤ AlgHom.equalizer φ ψ
x : C(↑s, ℝ)
⊢ x ∈ ⊤

Next tactic:
trivial
/-- Continuous algebra homomorphisms from `C(s, ℝ)` into an `ℝ`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.algHom_ext_map_X {A : Type*} [Ring A]
    [Algebra ℝ A] [TopologicalSpace A] [T2Space A] {s : Set ℝ} [CompactSpace s]
    {φ ψ : C(s, ℝ) →ₐ[ℝ] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  suffices (⊤ : Subalgebra ℝ C(s, ℝ)) ≤ AlgHom.equalizer φ ψ from
    AlgHom.ext fun x => this (by trivial)
  

Proof state:
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
⊢ ⊤ ≤ AlgHom.equalizer φ ψ

Next tactic:
rw [← polynomialFunctions.topologicalClosure s]
/-- Continuous algebra homomorphisms from `C(s, ℝ)` into an `ℝ`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.algHom_ext_map_X {A : Type*} [Ring A]
    [Algebra ℝ A] [TopologicalSpace A] [T2Space A] {s : Set ℝ} [CompactSpace s]
    {φ ψ : C(s, ℝ) →ₐ[ℝ] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  suffices (⊤ : Subalgebra ℝ C(s, ℝ)) ≤ AlgHom.equalizer φ ψ from
    AlgHom.ext fun x => this (by trivial)
  rw [← polynomialFunctions.topologicalClosure s]
  

Proof state:
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
⊢ Subalgebra.topologicalClosure (polynomialFunctions s) ≤ AlgHom.equalizer φ ψ

Next tactic:
exact Subalgebra.topologicalClosure_minimal (polynomialFunctions s)
    (polynomialFunctions.le_equalizer s φ ψ h) (isClosed_eq hφ hψ)
/-- Continuous star algebra homomorphisms from `C(s, 𝕜)` into a star `𝕜`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.starAlgHom_ext_map_X {𝕜 A : Type*} [IsROrC 𝕜] [Ring A] [StarRing A]
    [Algebra 𝕜 A] [TopologicalSpace A] [T2Space A] {s : Set 𝕜} [CompactSpace s]
    {φ ψ : C(s, 𝕜) →⋆ₐ[𝕜] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  

Proof state:
𝕜 : Type u_1
A : Type u_2
inst✝⁶ : IsROrC 𝕜
inst✝⁵ : Ring A
inst✝⁴ : StarRing A
inst✝³ : Algebra 𝕜 A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set 𝕜
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, 𝕜) →⋆ₐ[𝕜] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
⊢ φ = ψ

Next tactic:
suffices (⊤ : StarSubalgebra 𝕜 C(s, 𝕜)) ≤ StarAlgHom.equalizer φ ψ from
    StarAlgHom.ext fun x => this mem_top
/-- Continuous star algebra homomorphisms from `C(s, 𝕜)` into a star `𝕜`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.starAlgHom_ext_map_X {𝕜 A : Type*} [IsROrC 𝕜] [Ring A] [StarRing A]
    [Algebra 𝕜 A] [TopologicalSpace A] [T2Space A] {s : Set 𝕜} [CompactSpace s]
    {φ ψ : C(s, 𝕜) →⋆ₐ[𝕜] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  suffices (⊤ : StarSubalgebra 𝕜 C(s, 𝕜)) ≤ StarAlgHom.equalizer φ ψ from
    StarAlgHom.ext fun x => this mem_top
  

Proof state:
𝕜 : Type u_1
A : Type u_2
inst✝⁶ : IsROrC 𝕜
inst✝⁵ : Ring A
inst✝⁴ : StarRing A
inst✝³ : Algebra 𝕜 A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set 𝕜
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, 𝕜) →⋆ₐ[𝕜] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
⊢ ⊤ ≤ StarAlgHom.equalizer φ ψ

Next tactic:
rw [← polynomialFunctions.starClosure_topologicalClosure s]
/-- Continuous star algebra homomorphisms from `C(s, 𝕜)` into a star `𝕜`-algebra `A` which agree
at `X : 𝕜[X]` (interpreted as a continuous map) are, in fact, equal. -/
@[ext]
theorem ContinuousMap.starAlgHom_ext_map_X {𝕜 A : Type*} [IsROrC 𝕜] [Ring A] [StarRing A]
    [Algebra 𝕜 A] [TopologicalSpace A] [T2Space A] {s : Set 𝕜} [CompactSpace s]
    {φ ψ : C(s, 𝕜) →⋆ₐ[𝕜] A} (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (toContinuousMapOnAlgHom s X) = ψ (toContinuousMapOnAlgHom s X)) : φ = ψ := by
  suffices (⊤ : StarSubalgebra 𝕜 C(s, 𝕜)) ≤ StarAlgHom.equalizer φ ψ from
    StarAlgHom.ext fun x => this mem_top
  rw [← polynomialFunctions.starClosure_topologicalClosure s]
  

Proof state:
𝕜 : Type u_1
A : Type u_2
inst✝⁶ : IsROrC 𝕜
inst✝⁵ : Ring A
inst✝⁴ : StarRing A
inst✝³ : Algebra 𝕜 A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set 𝕜
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, 𝕜) →⋆ₐ[𝕜] A
hφ : Continuous ⇑φ
hψ : Continuous ⇑ψ
h : φ ((toContinuousMapOnAlgHom s) X) = ψ ((toContinuousMapOnAlgHom s) X)
⊢ topologicalClosure (Subalgebra.starClosure (polynomialFunctions s)) ≤ StarAlgHom.equalizer φ ψ

Next tactic:
exact StarSubalgebra.topologicalClosure_minimal
    (polynomialFunctions.starClosure_le_equalizer s φ ψ h) (isClosed_eq hφ hψ)
/-- `Cat` is a strict bicategory. -/
instance bicategory.strict : Bicategory.Strict Cat.{v, u} where
  id_comp {C} {D} F := by 

Proof state:
C D : Cat
F : C ⟶ D
⊢ 𝟙 C ≫ F = F

Next tactic:
cases F
/-- `Cat` is a strict bicategory. -/
instance bicategory.strict : Bicategory.Strict Cat.{v, u} where
  id_comp {C} {D} F := by cases F; 

Proof state:
case mk
C D : Cat
toPrefunctor✝ : ↑C ⥤q ↑D
map_id✝ : ∀ (X : ↑C), toPrefunctor✝.map (𝟙 X) = 𝟙 (toPrefunctor✝.obj X)
map_comp✝ :
  ∀ {X Y Z : ↑C} (f : X ⟶ Y) (g : Y ⟶ Z), toPrefunctor✝.map (f ≫ g) = toPrefunctor✝.map f ≫ toPrefunctor✝.map g
⊢ 𝟙 C ≫ Functor.mk toPrefunctor✝ = Functor.mk toPrefunctor✝

Next tactic:
rfl
/-- `Cat` is a strict bicategory. -/
instance bicategory.strict : Bicategory.Strict Cat.{v, u} where
  id_comp {C} {D} F := by cases F; rfl
  comp_id {C} {D} F := by 

Proof state:
C D : Cat
F : C ⟶ D
⊢ F ≫ 𝟙 D = F

Next tactic:
cases F
/-- `Cat` is a strict bicategory. -/
instance bicategory.strict : Bicategory.Strict Cat.{v, u} where
  id_comp {C} {D} F := by cases F; rfl
  comp_id {C} {D} F := by cases F; 

Proof state:
case mk
C D : Cat
toPrefunctor✝ : ↑C ⥤q ↑D
map_id✝ : ∀ (X : ↑C), toPrefunctor✝.map (𝟙 X) = 𝟙 (toPrefunctor✝.obj X)
map_comp✝ :
  ∀ {X Y Z : ↑C} (f : X ⟶ Y) (g : Y ⟶ Z), toPrefunctor✝.map (f ≫ g) = toPrefunctor✝.map f ≫ toPrefunctor✝.map g
⊢ Functor.mk toPrefunctor✝ ≫ 𝟙 D = Functor.mk toPrefunctor✝

Next tactic:
rfl
/-- `Cat` is a strict bicategory. -/
instance bicategory.strict : Bicategory.Strict Cat.{v, u} where
  id_comp {C} {D} F := by cases F; rfl
  comp_id {C} {D} F := by cases F; rfl
  assoc := by 

Proof state:
⊢ ∀ {a b c d : Cat} (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d), (f ≫ g) ≫ h = f ≫ g ≫ h

Next tactic:
intros
/-- `Cat` is a strict bicategory. -/
instance bicategory.strict : Bicategory.Strict Cat.{v, u} where
  id_comp {C} {D} F := by cases F; rfl
  comp_id {C} {D} F := by cases F; rfl
  assoc := by intros; 

Proof state:
a✝ b✝ c✝ d✝ : Cat
f✝ : a✝ ⟶ b✝
g✝ : b✝ ⟶ c✝
h✝ : c✝ ⟶ d✝
⊢ (f✝ ≫ g✝) ≫ h✝ = f✝ ≫ g✝ ≫ h✝

Next tactic:
rfl
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    

Proof state:
X Y : Type u
f : X ⟶ Y
⊢ (fun X => Cat.of (Discrete X)) X ⟶ (fun X => Cat.of (Discrete X)) Y

Next tactic:
dsimp
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    

Proof state:
X Y : Type u
f : X ⟶ Y
⊢ Cat.of (Discrete X) ⟶ Cat.of (Discrete Y)

Next tactic:
exact Discrete.functor (Discrete.mk ∘ f)
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    

Proof state:
X : Type u
⊢ { obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map (𝟙 X) =
    𝟙 ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X)

Next tactic:
apply Functor.ext
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · 

Proof state:
case h_map
X : Type u
⊢ autoParam
    (∀
      (X_1 Y :
        ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X))
      (f : X_1 ⟶ Y),
      ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
              (𝟙 X)).map
          f =
        eqToHom (_ : ?F.obj X_1 = ?G.obj X_1) ≫
          (𝟙
                  ({ obj := fun X => Cat.of (Discrete X),
                        map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
                    X)).map
              f ≫
            eqToHom
              (_ :
                (𝟙
                        ({ obj := fun X => Cat.of (Discrete X),
                              map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
                          X)).obj
                    Y =
                  ({ obj := fun X => Cat.of (Discrete X),
                            map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                        (𝟙 X)).obj
                    Y))
    _auto✝

Next tactic:
intro X Y f
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      

Proof state:
case h_map
X✝ : Type u
X Y : ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X✝)
f : X ⟶ Y
⊢ ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
          (𝟙 X✝)).map
      f =
    eqToHom (_ : ?F.obj X = ?G.obj X) ≫
      (𝟙
              ({ obj := fun X => Cat.of (Discrete X),
                    map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
                X✝)).map
          f ≫
        eqToHom
          (_ :
            (𝟙
                    ({ obj := fun X => Cat.of (Discrete X),
                          map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
                      X✝)).obj
                Y =
              ({ obj := fun X => Cat.of (Discrete X),
                        map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                    (𝟙 X✝)).obj
                Y)

Next tactic:
cases f
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      cases f
      

Proof state:
case h_map.up
X✝ : Type u
X Y : ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X✝)
down✝ : PLift (X.as = Y.as)
⊢ ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
          (𝟙 X✝)).map
      { down := down✝ } =
    eqToHom (_ : ?F.obj X = ?G.obj X) ≫
      (𝟙
              ({ obj := fun X => Cat.of (Discrete X),
                    map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
                X✝)).map
          { down := down✝ } ≫
        eqToHom
          (_ :
            (𝟙
                    ({ obj := fun X => Cat.of (Discrete X),
                          map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
                      X✝)).obj
                Y =
              ({ obj := fun X => Cat.of (Discrete X),
                        map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                    (𝟙 X✝)).obj
                Y)

Next tactic:
simp only [id_eq, eqToHom_refl, Cat.id_map, Category.comp_id, Category.id_comp]
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      cases f
      simp only [id_eq, eqToHom_refl, Cat.id_map, Category.comp_id, Category.id_comp]
      

Proof state:
case h_map.up
X✝ : Type u
X Y : ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X✝)
down✝ : PLift (X.as = Y.as)
⊢ (Discrete.functor (Discrete.mk ∘ 𝟙 X✝)).map { down := down✝ } = { down := down✝ }

Next tactic:
apply ULift.ext
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      cases f
      simp only [id_eq, eqToHom_refl, Cat.id_map, Category.comp_id, Category.id_comp]
      apply ULift.ext
      

Proof state:
case h_map.up.h
X✝ : Type u
X Y : ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X✝)
down✝ : PLift (X.as = Y.as)
⊢ ((Discrete.functor (Discrete.mk ∘ 𝟙 X✝)).map { down := down✝ }).down = { down := down✝ }.down

Next tactic:
aesop_cat
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      cases f
      simp only [id_eq, eqToHom_refl, Cat.id_map, Category.comp_id, Category.id_comp]
      apply ULift.ext
      aesop_cat
    · 

Proof state:
case h_obj
X : Type u
⊢ ∀
    (X_1 :
      ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X)),
    ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
            (𝟙 X)).obj
        X_1 =
      (𝟙
            ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
              X)).obj
        X_1

Next tactic:
aesop_cat
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      cases f
      simp only [id_eq, eqToHom_refl, Cat.id_map, Category.comp_id, Category.id_comp]
      apply ULift.ext
      aesop_cat
    · aesop_cat
  map_comp f g := by 

Proof state:
X✝ Y✝ Z✝ : Type u
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
⊢ { obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map (f ≫ g) =
    { obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map f ≫
      { obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map g

Next tactic:
apply Functor.ext
/-- Embedding `Type` into `Cat` as discrete categories.

This ought to be modelled as a 2-functor!
-/
@[simps]
def typeToCat : Type u ⥤ Cat where
  obj X := Cat.of (Discrete X)
  map := fun {X} {Y} f => by
    dsimp
    exact Discrete.functor (Discrete.mk ∘ f)
  map_id X := by
    apply Functor.ext
    · intro X Y f
      cases f
      simp only [id_eq, eqToHom_refl, Cat.id_map, Category.comp_id, Category.id_comp]
      apply ULift.ext
      aesop_cat
    · aesop_cat
  map_comp f g := by apply Functor.ext; 

Proof state:
case h_map
X✝ Y✝ Z✝ : Type u
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
⊢ autoParam
    (∀
      (X Y :
        ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj
            X✝))
      (f_1 : X ⟶ Y),
      ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
              (f ≫ g)).map
          f_1 =
        eqToHom (_ : ?F.obj X = ?G.obj X) ≫
          ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                    f ≫
                  { obj := fun X => Cat.of (Discrete X),
                        map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                    g).map
              f_1 ≫
            eqToHom
              (_ :
                ({ obj := fun X => Cat.of (Discrete X),
                              map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                          f ≫
                        { obj := fun X => Cat.of (Discrete X),
                              map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                          g).obj
                    Y =
                  ({ obj := fun X => Cat.of (Discrete X),
                            map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
                        (f ≫ g)).obj
                    Y))
    _auto✝
case h_obj
X✝ Y✝ Z✝ : Type u
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
⊢ ∀
    (X :
      ↑({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.obj X✝)),
    ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
            (f ≫ g)).obj
        X =
      ({ obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map f ≫
            { obj := fun X => Cat.of (Discrete X), map := fun {X Y} f => id (Discrete.functor (Discrete.mk ∘ f)) }.map
              g).obj
        X

Next tactic:
aesop_cat
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    

Proof state:
⊢ ∀ {X Y : Type u} (f : typeToCat.obj X ⟶ typeToCat.obj Y),
    typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) f) = f

Next tactic:
intro X Y F