Skip to content

Commit 3ffda22

Browse files
author
mathlib4-bot
committed
Merge remote-tracking branch 'upstream/master' into bump/v4.27.0
2 parents 3c626a6 + f9a3323 commit 3ffda22

File tree

18 files changed

+400
-399
lines changed

18 files changed

+400
-399
lines changed

Archive.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ import Archive.Wiedijk100Theorems.FriendshipGraphs
7474
import Archive.Wiedijk100Theorems.HeronsFormula
7575
import Archive.Wiedijk100Theorems.InverseTriangleSum
7676
import Archive.Wiedijk100Theorems.Konigsberg
77-
import Archive.Wiedijk100Theorems.Partition
7877
import Archive.Wiedijk100Theorems.PerfectNumbers
7978
import Archive.Wiedijk100Theorems.SolutionOfCubicQuartic
8079
import Archive.Wiedijk100Theorems.SumOfPrimeReciprocalsDiverges

Archive/Wiedijk100Theorems/Partition.lean

Lines changed: 0 additions & 384 deletions
This file was deleted.

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,6 +3038,7 @@ public import Mathlib.CategoryTheory.Sites.NonabelianCohomology.H1
30383038
public import Mathlib.CategoryTheory.Sites.Over
30393039
public import Mathlib.CategoryTheory.Sites.Plus
30403040
public import Mathlib.CategoryTheory.Sites.Point.Basic
3041+
public import Mathlib.CategoryTheory.Sites.Point.Category
30413042
public import Mathlib.CategoryTheory.Sites.Precoverage
30423043
public import Mathlib.CategoryTheory.Sites.Preserves
30433044
public import Mathlib.CategoryTheory.Sites.PreservesLocallyBijective

Mathlib/CategoryTheory/Limits/Shapes/Products.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ from a family of morphisms between the factors.
322322
abbrev Pi.map {f g : β → C} [HasProduct f] [HasProduct g] (p : ∀ b, f b ⟶ g b) : ∏ᶜ f ⟶ ∏ᶜ g :=
323323
limMap (Discrete.natTrans fun X => p X.as)
324324

325+
@[reassoc (attr := simp high)]
326+
lemma Pi.map_π {f g : β → C} [HasProduct f] [HasProduct g] (p : ∀ b, f b ⟶ g b) (b : β) :
327+
Pi.map p ≫ Pi.π g b = Pi.π f b ≫ p b := by simp
328+
325329
@[simp]
326330
lemma Pi.map_id {f : α → C} [HasProduct f] : Pi.map (fun a => 𝟙 (f a)) = 𝟙 (∏ᶜ f) := by
327331
ext; simp
@@ -437,6 +441,10 @@ abbrev Sigma.map {f g : β → C} [HasCoproduct f] [HasCoproduct g] (p : ∀ b,
437441
∐ f ⟶ ∐ g :=
438442
colimMap (Discrete.natTrans fun X => p X.as)
439443

444+
@[reassoc (attr := simp high)]
445+
lemma Sigma.ι_map {f g : β → C} [HasCoproduct f] [HasCoproduct g] (p : ∀ b, f b ⟶ g b) (b : β) :
446+
Sigma.ι f b ≫ Sigma.map p = p b ≫ Sigma.ι g b:= by simp
447+
440448
@[simp]
441449
lemma Sigma.map_id {f : α → C} [HasCoproduct f] : Sigma.map (fun a => 𝟙 (f a)) = 𝟙 (∐ f) := by
442450
ext; simp

Mathlib/CategoryTheory/Limits/Types/ColimitType.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,17 @@ lemma of_equiv {c' : CoconeTypes.{w₂} F} (e : c.pt ≃ c'.pt)
224224
obtain ⟨j, x, rfl⟩ := F.ιColimitType_jointly_surjective y
225225
simp_all
226226

227+
lemma iff_bijective {c' : CoconeTypes.{w₂} F}
228+
(f : c.pt → c'.pt) (hf : ∀ j x, c'.ι j x = f (c.ι j x)) :
229+
c'.IsColimit ↔ Function.Bijective f := by
230+
refine ⟨fun hc' ↦ ?_, fun h ↦ hc.of_equiv (Equiv.ofBijective _ h) hf⟩
231+
have h₁ := hc.bijective
232+
rw [← Function.Bijective.of_comp_iff _ hc.bijective]
233+
convert hc'.bijective
234+
ext x
235+
obtain ⟨j, x, rfl⟩ := F.ιColimitType_jointly_surjective x
236+
simp [hf]
237+
227238
end IsColimit
228239

229240
/-- Structure which expresses that `c : F.CoconeTypes`

Mathlib/CategoryTheory/Limits/Types/Coproducts.lean

Lines changed: 154 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,162 @@ Similarly, the binary coproduct of two types `X` and `Y` identifies to
2222

2323
@[expose] public section
2424

25-
universe v u
25+
universe w v u
2626

27-
open CategoryTheory Limits
27+
namespace CategoryTheory
2828

29-
namespace CategoryTheory.Limits.Types
29+
namespace Limits
30+
31+
variable {C : Type u} (F : C → Type v)
32+
33+
/-- Given a functor `F : Discrete C ⥤ Type v`, this is a "cofan" for `F`,
34+
but we allow the point to be in `Type w` for an arbitrary universe `w`. -/
35+
abbrev CofanTypes := Functor.CoconeTypes.{w} (Discrete.functor F)
36+
37+
variable {F}
38+
39+
namespace CofanTypes
40+
41+
/-- The injection map for a cofan of a functor to types. -/
42+
abbrev inj (c : CofanTypes.{w} F) (i : C) : F i → c.pt := c.ι ⟨i⟩
43+
44+
variable (F) in
45+
/-- The cofan given by a sigma type. -/
46+
@[simps]
47+
def sigma : CofanTypes F where
48+
pt := Σ (i : C), F i
49+
ι := fun ⟨i⟩ x ↦ ⟨i, x⟩
50+
ι_naturality := by
51+
rintro ⟨i⟩ ⟨j⟩ f
52+
obtain rfl : i = j := by simpa using Discrete.eq_of_hom f
53+
rfl
54+
55+
@[simp]
56+
lemma sigma_inj (i : C) (x : F i) :
57+
(sigma F).inj i x = ⟨i, x⟩ := rfl
58+
59+
lemma isColimit_mk (c : CofanTypes.{w} F)
60+
(h₁ : ∀ (x : c.pt), ∃ (i : C) (y : F i), c.inj i y = x)
61+
(h₂ : ∀ (i : C), Function.Injective (c.inj i))
62+
(h₃ : ∀ (i j : C) (x : F i) (y : F j), c.inj i x = c.inj j y → i = j) :
63+
Functor.CoconeTypes.IsColimit c where
64+
bijective := by
65+
constructor
66+
· intro x y h
67+
obtain ⟨⟨i⟩, x, rfl⟩ := (Discrete.functor F).ιColimitType_jointly_surjective x
68+
obtain ⟨⟨j⟩, y, rfl⟩ := (Discrete.functor F).ιColimitType_jointly_surjective y
69+
obtain rfl := h₃ _ _ _ _ h
70+
obtain rfl := h₂ _ h
71+
rfl
72+
· intro x
73+
obtain ⟨i, y, rfl⟩ := h₁ x
74+
exact ⟨(Discrete.functor F).ιColimitType ⟨i⟩ y, rfl⟩
75+
76+
variable (F) in
77+
lemma isColimit_sigma : Functor.CoconeTypes.IsColimit (sigma F) :=
78+
isColimit_mk _ (by aesop)
79+
(fun _ _ _ h ↦ by rw [Sigma.ext_iff] at h; simpa using h)
80+
(fun _ _ _ _ h ↦ congr_arg Sigma.fst h)
81+
82+
variable (F) in
83+
/-- Given a cofan of a functor to types, this is a canonical map
84+
from the Sigma type to the point of the cofan. -/
85+
@[simp]
86+
def fromSigma (c : CofanTypes.{w} F) (x : Σ (i : C), F i) : c.pt :=
87+
c.inj x.1 x.2
88+
89+
lemma isColimit_iff_bijective_fromSigma (c : CofanTypes.{w} F) :
90+
c.IsColimit ↔ Function.Bijective c.fromSigma := by
91+
rw [(isColimit_sigma F).iff_bijective]
92+
aesop
93+
94+
section
95+
96+
variable {c : CofanTypes.{w} F} (hc : Functor.CoconeTypes.IsColimit c)
97+
98+
include hc
99+
100+
lemma bijective_fromSigma_of_isColimit :
101+
Function.Bijective c.fromSigma := by
102+
rwa [← isColimit_iff_bijective_fromSigma]
103+
104+
/-- The bijection from the sigma type to the point of a colimit cofan
105+
of a functor to types. -/
106+
noncomputable def equivOfIsColimit :
107+
(Σ (i : C), F i) ≃ c.pt :=
108+
Equiv.ofBijective _ (bijective_fromSigma_of_isColimit hc)
109+
110+
@[simp]
111+
lemma equivOfIsColimit_apply (i : C) (x : F i) :
112+
equivOfIsColimit hc ⟨i, x⟩ = c.inj i x := rfl
113+
114+
@[simp]
115+
lemma equivOfIsColimit_symm_apply (i : C) (x : F i) :
116+
(equivOfIsColimit hc).symm (c.inj i x) = ⟨i, x⟩ :=
117+
(equivOfIsColimit hc).injective (by simp)
118+
119+
lemma inj_jointly_surjective_of_isColimit (x : c.pt) :
120+
∃ (i : C) (y : F i), c.inj i y = x := by
121+
obtain ⟨⟨i⟩, y, rfl⟩ := hc.ι_jointly_surjective x
122+
exact ⟨i, y, rfl⟩
123+
124+
lemma inj_injective_of_isColimit (i : C) :
125+
Function.Injective (c.inj i) := by
126+
intro y₁ y₂ h
127+
simpa using (equivOfIsColimit hc).injective (a₁ := ⟨i, y₁⟩) (a₂ := ⟨i, y₂⟩) h
128+
129+
lemma eq_of_inj_apply_eq_of_isColimit
130+
{i₁ i₂ : C} (y₁ : F i₁) (y₂ : F i₂) (h : c.inj i₁ y₁ = c.inj i₂ y₂) :
131+
i₁ = i₂ :=
132+
congr_arg Sigma.fst ((equivOfIsColimit hc).injective (a₁ := ⟨i₁, y₁⟩) (a₂ := ⟨i₂, y₂⟩) h)
133+
134+
end
135+
136+
end CofanTypes
137+
138+
namespace Cofan
139+
140+
variable {C : Type u} {F : C → Type v} (c : Cofan F)
141+
142+
/-- If `F : C → Type v`, then the data of a "type-theoretic" cofan of `F`
143+
with a point in `Type v` is the same as the data of a cocone (in a categorical sense). -/
144+
@[simps]
145+
def cofanTypes :
146+
CofanTypes.{v} F where
147+
pt := c.pt
148+
ι := fun ⟨j⟩ ↦ c.inj j
149+
ι_naturality := by
150+
rintro ⟨i⟩ ⟨j⟩ f
151+
obtain rfl : i = j := by simpa using Discrete.eq_of_hom f
152+
rfl
153+
154+
lemma isColimit_cofanTypes_iff :
155+
c.cofanTypes.IsColimit ↔ Nonempty (IsColimit c) :=
156+
Functor.CoconeTypes.isColimit_iff _
157+
158+
lemma nonempty_isColimit_iff_bijective_fromSigma :
159+
Nonempty (IsColimit c) ↔ Function.Bijective c.cofanTypes.fromSigma := by
160+
rw [← isColimit_cofanTypes_iff, CofanTypes.isColimit_iff_bijective_fromSigma]
161+
162+
variable {c}
163+
164+
lemma inj_jointly_surjective_of_isColimit (hc : IsColimit c) (x : c.pt) :
165+
∃ (i : C) (y : F i), c.inj i y = x :=
166+
CofanTypes.inj_jointly_surjective_of_isColimit
167+
((isColimit_cofanTypes_iff c).2 ⟨hc⟩) x
168+
169+
lemma inj_injective_of_isColimit (hc : IsColimit c) (i : C) :
170+
Function.Injective (c.inj i) :=
171+
CofanTypes.inj_injective_of_isColimit ((isColimit_cofanTypes_iff c).2 ⟨hc⟩) i
172+
173+
lemma eq_of_inj_apply_eq_of_isColimit (hc : IsColimit c)
174+
{i₁ i₂ : C} (y₁ : F i₁) (y₂ : F i₂) (h : c.inj i₁ y₁ = c.inj i₂ y₂) :
175+
i₁ = i₂ :=
176+
CofanTypes.eq_of_inj_apply_eq_of_isColimit ((isColimit_cofanTypes_iff c).2 ⟨hc⟩) _ _ h
177+
178+
end Cofan
179+
180+
namespace Types
30181

31182
/-- The category of types has `PEmpty` as an initial object. -/
32183
def initialColimitCocone : Limits.ColimitCocone (Functor.empty (Type u)) where

Mathlib/CategoryTheory/Sites/Point/Basic.lean

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ noncomputable def toPresheafFiber (X : C) (x : Φ.fiber.obj X) (P : Cᵒᵖ ⥤
9797
P.obj (op X) ⟶ Φ.presheafFiber.obj P :=
9898
colimit.ι ((CategoryOfElements.π Φ.fiber).op ⋙ P) (op ⟨X, x⟩)
9999

100+
@[ext]
101+
lemma presheafFiber_hom_ext
102+
{P : Cᵒᵖ ⥤ A} {T : A} {f g : Φ.presheafFiber.obj P ⟶ T}
103+
(h : ∀ (X : C) (x : Φ.fiber.obj X), Φ.toPresheafFiber X x P ≫ f =
104+
Φ.toPresheafFiber X x P ≫ g) : f = g :=
105+
colimit.hom_ext (by rintro ⟨⟨X, x⟩⟩; exact h X x)
106+
100107
/-- Given a point `Φ` of a site `(C, J)`, `X : C` and `x : Φ.fiber.obj X`,
101108
this is the map `P.obj (op X) ⟶ Φ.presheafFiber.obj P` for any `P : Cᵒᵖ ⥤ A`
102109
as a natural transformation. -/
@@ -106,20 +113,38 @@ noncomputable def toPresheafFiberNatTrans (X : C) (x : Φ.fiber.obj X) :
106113
app := Φ.toPresheafFiber X x
107114
naturality _ _ f := by simp [presheafFiber, toPresheafFiber]
108115

109-
@[elementwise (attr := simp)]
116+
@[reassoc (attr := simp), elementwise (attr := simp)]
110117
lemma toPresheafFiber_w {X Y : C} (f : X ⟶ Y) (x : Φ.fiber.obj X) (P : Cᵒᵖ ⥤ A) :
111118
P.map f.op ≫ Φ.toPresheafFiber X x P =
112119
Φ.toPresheafFiber Y (Φ.fiber.map f x) P :=
113120
colimit.w ((CategoryOfElements.π Φ.fiber).op ⋙ P)
114121
(CategoryOfElements.homMk ⟨X, x⟩ ⟨Y, Φ.fiber.map f x⟩ f rfl).op
115122

116-
@[reassoc (attr := elementwise)]
123+
@[reassoc (attr := simp), elementwise (attr := simp)]
117124
lemma toPresheafFiber_naturality {P Q : Cᵒᵖ ⥤ A} (g : P ⟶ Q) (X : C) (x : Φ.fiber.obj X) :
118125
Φ.toPresheafFiber X x P ≫ Φ.presheafFiber.map g =
119126
g.app (op X) ≫ Φ.toPresheafFiber X x Q :=
120127
((Φ.toPresheafFiberNatTrans X x).naturality g).symm
121128

122-
attribute [simp] toPresheafFiber_naturality_apply
129+
section
130+
131+
variable {P : Cᵒᵖ ⥤ A} {T : A}
132+
(φ : ∀ (X : C) (_ : Φ.fiber.obj X), P.obj (op X) ⟶ T)
133+
(hφ : ∀ ⦃X Y : C⦄ (f : X ⟶ Y) (x : Φ.fiber.obj X),
134+
P.map f.op ≫ φ X x = φ Y (Φ.fiber.map f x) := by cat_disch)
135+
136+
/-- Constructor for morphisms from the fiber of a presheaf. -/
137+
noncomputable def presheafFiberDesc :
138+
Φ.presheafFiber.obj P ⟶ T :=
139+
colimit.desc _ (Cocone.mk _ { app x := φ x.unop.1 x.unop.2 })
140+
141+
@[reassoc (attr := simp)]
142+
lemma toPresheafFiber_presheafFiberDesc (X : C) (x : Φ.fiber.obj X) :
143+
Φ.toPresheafFiber X x P ≫ Φ.presheafFiberDesc φ hφ = φ X x :=
144+
colimit.ι_desc _ _
145+
146+
end
147+
123148
variable {FC : A → A → Type*} {CC : A → Type w'}
124149
[∀ (X Y : A), FunLike (FC X Y) (CC X) (CC Y)]
125150
[ConcreteCategory.{w'} A FC]
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/-
2+
Copyright (c) 2025 Joël Riou. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Joël Riou
5+
-/
6+
module
7+
8+
public import Mathlib.CategoryTheory.Sites.Point.Basic
9+
10+
/-!
11+
# The category of points of a site
12+
13+
We define the category structure on the points of a site `(C, J)`:
14+
a morphism between `Φ₁ ⟶ Φ₂` between two points consists of a
15+
morphism `Φ₂.fiber ⟶ Φ₁.fiber` (SGA 4 IV 3.2).
16+
17+
## References
18+
* [Alexander Grothendieck and Jean-Louis Verdier, *Exposé IV : Topos*,
19+
SGA 4 IV 3.2][sga-4-tome-1]
20+
21+
-/
22+
23+
@[expose] public section
24+
25+
universe w v v' u u'
26+
27+
namespace CategoryTheory
28+
29+
open Limits Opposite
30+
31+
variable {C : Type u} [Category.{v} C] {J : GrothendieckTopology C}
32+
33+
namespace GrothendieckTopology.Point
34+
35+
/-- A morphism between points of a site consists of a morphism
36+
between the functors `Point.fiber`, in the opposite direction. -/
37+
@[ext]
38+
structure Hom (Φ₁ Φ₂ : Point.{w} J) where
39+
/-- a natural transformation, in the opposite direction -/
40+
hom : Φ₂.fiber ⟶ Φ₁.fiber
41+
42+
instance : Category (Point.{w} J) where
43+
Hom := Hom
44+
id _ := ⟨𝟙 _⟩
45+
comp f g := ⟨g.hom ≫ f.hom⟩
46+
47+
@[ext]
48+
lemma hom_ext {Φ₁ Φ₂ : Point.{w} J} {f g : Φ₁ ⟶ Φ₂} (h : f.hom = g.hom) : f = g :=
49+
Hom.ext h
50+
51+
@[simp]
52+
lemma id_hom (Φ : Point.{w} J) : Hom.hom (𝟙 Φ) = 𝟙 _ := rfl
53+
54+
@[simp, reassoc]
55+
lemma comp_hom {Φ₁ Φ₂ Φ₃ : Point.{w} J} (f : Φ₁ ⟶ Φ₂) (g : Φ₂ ⟶ Φ₃) :
56+
(f ≫ g).hom = g.hom ≫ f.hom := rfl
57+
58+
variable {A : Type u'} [Category.{v'} A]
59+
[HasColimitsOfSize.{w, w} A]
60+
61+
namespace Hom
62+
63+
variable {Φ₁ Φ₂ Φ₃ : Point.{w} J} (f : Φ₁ ⟶ Φ₂) (g : Φ₂ ⟶ Φ₃)
64+
65+
attribute [local simp] FunctorToTypes.naturality in
66+
/-- The natural transformation on fibers of presheaves that is induced
67+
by a morphism of points of a site. -/
68+
@[simps]
69+
noncomputable def presheafFiber :
70+
Φ₂.presheafFiber (A := A) ⟶ Φ₁.presheafFiber where
71+
app P := Φ₂.presheafFiberDesc (fun X x ↦ Φ₁.toPresheafFiber X (f.hom.app X x) P)
72+
73+
@[simp]
74+
lemma presheafFiber_id (Φ : Point.{w} J) :
75+
presheafFiber (𝟙 Φ) (A := A) = 𝟙 _ := by
76+
cat_disch
77+
78+
@[reassoc, simp]
79+
lemma presheafFiber_comp :
80+
(f ≫ g).presheafFiber (A := A) = g.presheafFiber ≫ f.presheafFiber := by
81+
cat_disch
82+
83+
/-- The natural transformation on fibers of sheaves that is induced
84+
by a morphism of points of a site. -/
85+
noncomputable abbrev sheafFiber :
86+
Φ₂.sheafFiber (A := A) ⟶ Φ₁.sheafFiber :=
87+
Functor.whiskerLeft _ f.presheafFiber
88+
89+
@[simp]
90+
lemma sheafFiber_id (Φ : Point.{w} J) :
91+
sheafFiber (𝟙 Φ) (A := A) = 𝟙 _ := by
92+
cat_disch
93+
94+
@[reassoc, simp]
95+
lemma sheafFiber_comp :
96+
(f ≫ g).sheafFiber (A := A) = g.sheafFiber ≫ f.sheafFiber := by
97+
cat_disch
98+
99+
end Hom
100+
101+
end GrothendieckTopology.Point
102+
103+
end CategoryTheory

0 commit comments

Comments
 (0)