Skip to content

Commit 2aeb41c

Browse files
committed
feat: API for multiequalizers in the category of types (#14340)
In this PR, we give a concrete characterization of limit multiforks in the category of types. This contribution was created as part of the AIM workshop "Formalizing algebraic geometry" in June 2024.
1 parent 5943c09 commit 2aeb41c

File tree

1 file changed

+85
-1
lines changed

1 file changed

+85
-1
lines changed

Mathlib/CategoryTheory/Limits/Shapes/Types.lean

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Mathlib.CategoryTheory.Limits.Types
77
import Mathlib.CategoryTheory.Limits.Shapes.Products
88
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
99
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
10+
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
1011
import Mathlib.CategoryTheory.ConcreteCategory.Basic
1112
import Mathlib.Tactic.CategoryTheory.Elementwise
1213
import Mathlib.Data.Set.Subsingleton
@@ -31,6 +32,7 @@ giving the expected definitional implementation:
3132
* the coequalizer of a pair of maps `(f, g)` is the quotient of `Y` by `∀ x : Y, f x ~ g x`
3233
* the pullback of `f : X ⟶ Z` and `g : Y ⟶ Z` is the subtype `{ p : X × Y // f p.1 = g p.2 }`
3334
of the product
35+
* multiequalizers
3436
3537
We first construct terms of `IsLimit` and `LimitCone`, and then provide isomorphisms with the
3638
types generated by the `HasLimit` API.
@@ -929,4 +931,86 @@ lemma pushoutCocone_inl_eq_inr_iff_of_isColimit {c : PushoutCocone f g} (hc : Is
929931

930932
end Pushout
931933

932-
end CategoryTheory.Limits.Types
934+
end Types
935+
936+
section Multiequalizer
937+
938+
variable (I : MulticospanIndex (Type u))
939+
940+
/-- Given `I : MulticospanIndex (Type u)`, this is a type which identifies
941+
to the sections of the functor `I.multicospan`. -/
942+
@[ext]
943+
structure MulticospanIndex.sections where
944+
/-- The data of an element in `I.left i` for each `i : I.L`. -/
945+
val (i : I.L) : I.left i
946+
property (r : I.R) : I.fst r (val _) = I.snd r (val _)
947+
948+
/-- The bijection `I.sections ≃ I.multicospan.sections` when `I : MulticospanIndex (Type u)`
949+
is a multiequalizer diagram in the category of types. -/
950+
@[simps]
951+
def MulticospanIndex.sectionsEquiv :
952+
I.sections ≃ I.multicospan.sections where
953+
toFun s :=
954+
{ val := fun i ↦ match i with
955+
| .left i => s.val i
956+
| .right j => I.fst j (s.val _)
957+
property := by
958+
rintro _ _ (_|_|r)
959+
· rfl
960+
· rfl
961+
· exact (s.property r).symm }
962+
invFun s :=
963+
{ val := fun i ↦ s.val (.left i)
964+
property := fun r ↦ (s.property (.fst r)).trans (s.property (.snd r)).symm }
965+
left_inv _ := rfl
966+
right_inv s := by
967+
ext (_|r)
968+
· rfl
969+
· exact s.property (.fst r)
970+
971+
namespace Multifork
972+
973+
variable {I}
974+
variable (c : Multifork I)
975+
976+
/-- Given a multiequalizer diagram `I : MulticospanIndex (Type u)` in the category of
977+
types and `c` a multifork for `I`, this is the canonical map `c.pt → I.sections`. -/
978+
@[simps]
979+
def toSections (x : c.pt) : I.sections where
980+
val i := c.ι i x
981+
property r := congr_fun (c.condition r) x
982+
983+
lemma toSections_fac : I.sectionsEquiv.symm ∘ Types.sectionOfCone c = c.toSections := rfl
984+
985+
/-- A multifork `c : Multifork I` in the category of types is limit iff the
986+
map `c.toSections : c.pt → I.sections` is a bijection. -/
987+
lemma isLimit_types_iff : Nonempty (IsLimit c) ↔ Function.Bijective c.toSections := by
988+
rw [Types.isLimit_iff_bijective_sectionOfCone, ← toSections_fac, EquivLike.comp_bijective]
989+
990+
namespace IsLimit
991+
992+
variable {c}
993+
variable (hc : IsLimit c)
994+
995+
/-- The bijection `I.sections ≃ c.pt` when `c : Multifork I` is a limit multifork
996+
in the category of types. -/
997+
noncomputable def sectionsEquiv : I.sections ≃ c.pt :=
998+
(Equiv.ofBijective _ (c.isLimit_types_iff.1 ⟨hc⟩)).symm
999+
1000+
@[simp]
1001+
lemma sectionsEquiv_symm_apply_val (x : c.pt) (i : I.L) :
1002+
((sectionsEquiv hc).symm x).val i = c.ι i x := rfl
1003+
1004+
@[simp]
1005+
lemma sectionsEquiv_apply_val (s : I.sections) (i : I.L) :
1006+
c.ι i (sectionsEquiv hc s) = s.val i := by
1007+
obtain ⟨x, rfl⟩ := (sectionsEquiv hc).symm.surjective s
1008+
simp
1009+
1010+
end IsLimit
1011+
1012+
end Multifork
1013+
1014+
end Multiequalizer
1015+
1016+
end CategoryTheory.Limits

0 commit comments

Comments
 (0)