Created
May 4, 2025 15:34
-
-
Save gaxiiiiiiiiiiii/1b55aff0fae4b6d1c3135126081685c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Mathlib.tactic | |
import Mathlib.CategoryTheory.Limits.HasLimits | |
open CategoryTheory | |
open Limits | |
structure Elm [Category.{u, v} π] (X : πα΅α΅ β₯€ Type w) where | |
obj : π | |
elm : X.obj (Opposite.op obj) | |
@[ext] | |
structure ElmHom [Category.{u, v} π] (X : πα΅α΅ β₯€ Type w) (A B : Elm X) where | |
hom : A.obj βΆ B.obj | |
w : X.map (Quiver.Hom.op hom) B.elm = A.elm | |
instance Category [Category.{u, v} π] (X : πα΅α΅ β₯€ Type w) : Category (Elm X) | |
where | |
Hom := ElmHom X | |
id A := { | |
hom := π A.obj | |
w := by rw [op_id, X.map_id, types_id_apply] | |
} | |
comp {A B C} f g := { | |
hom := f.hom β« g.hom | |
w := by | |
rw [op_comp, X.map_comp, types_comp_apply] | |
rw [g.w, f.w] | |
} | |
id_comp {A B} f := by ext; simp | |
comp_id {A B} f := by ext; simp | |
assoc {A B C D} f g h := by ext; simp | |
def ElmP [Category.{u, v} π] (X : πα΅α΅ β₯€ Type w) : | |
Elm X β₯€ π | |
where | |
obj A := A.obj | |
map {A B} f := f.hom | |
map_id f := by | |
conv => arg 1; unfold CategoryStruct.id Category.toCategoryStruct _root_.Category; simp | |
map_comp {A B C} f g := by | |
conv => arg 1; unfold CategoryStruct.comp Category.toCategoryStruct _root_.Category; simp | |
def PresheafCocone [Category.{u, v} π] (X : πα΅α΅ β₯€ Type u) : | |
Cocone (ElmP X β yoneda) | |
:= { | |
pt := X | |
ΞΉ := { | |
app z := { | |
app A' := Ξ» F => X.map (Quiver.Hom.op F) z.elm | |
naturality i j u := by simp [yoneda]; ext f; simp | |
} | |
naturality z z' f := by | |
simp; ext A' g; simp at g; simp [ElmP] | |
rw [f.w] | |
} | |
} | |
def PresheafCocone_isColimit [Category.{u, v} π] (X : πα΅α΅ β₯€ Type u) : | |
IsColimit (PresheafCocone X) | |
:= { | |
desc C := { | |
app A' := by | |
simp [PresheafCocone]; intro XA' | |
exact (C.ΞΉ.app β¨A'.unop, XA'β©).app A' (π A'.unop) | |
naturality A' B' f := by | |
simp [PresheafCocone]; ext XA'; simp | |
set a : Elm X := β¨A'.unop, XA'β© | |
set b : Elm X := β¨B'.unop, X.map f XA'β© | |
change (C.ΞΉ.app b).app B' (π (Opposite.unop B')) = C.pt.map f ((C.ΞΉ.app a).app A' (π (Opposite.unop A'))) | |
let ab : b βΆ a := { | |
hom := f.unop | |
w := by | |
simp [a, b] | |
} | |
have EC := (C.ΞΉ.app a).naturality f | |
conv at EC => arg 1; arg 1; simp [ElmP, yoneda] | |
conv at EC => arg 2; simp | |
have E := congr_fun EC (π _); simp at E | |
have E' := C.ΞΉ.naturality ab | |
injection E' with E' | |
have EB' := congr_fun E' B'; simp [yoneda, ElmP, ab] at EB' | |
have := congr_fun EB' (π B'.unop); simp at this | |
rw [<- E, this] | |
} | |
fac C a := by | |
simp; ext B' f; simp [ElmP] at f; simp [PresheafCocone] | |
set b : Elm X := { obj := Opposite.unop B', elm := X.map f.op a.elm } | |
change (C.ΞΉ.app b).app B' (π (Opposite.unop B')) = (C.ΞΉ.app a).app B' f | |
let ab : b βΆ a := { | |
hom := f | |
w := by | |
simp [b] | |
} | |
have E' := C.ΞΉ.naturality ab | |
injection E' with E' | |
have EB' := congr_fun E' B'; simp [yoneda, ElmP, ab] at EB' | |
have E' := congr_fun EB' (π B'.unop); simp at E'; clear EB' | |
rw [E'] | |
uniq C m Hm := by | |
ext A' XA'; simp [PresheafCocone] at XA'; simp | |
have E := Hm β¨A'.unop, XA'β© | |
rw [<- E] | |
simp [PresheafCocone] | |
rw [X.map_id A']; simp | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment