Skip to content

Commit d54a7d0

Browse files
committed
feat(CategoryTheory/Limits): precomposition with final functors and ColimitType (#30779)
We obtain a dual result to #30403 for the interaction between final functors and colimits of functors to types. This is phrased using the universe generic `Functor.ColimitType`. (We also improve the proof of #30403)
1 parent 7c26ba6 commit d54a7d0

File tree

3 files changed

+70
-10
lines changed

3 files changed

+70
-10
lines changed

Mathlib/CategoryTheory/IsConnected.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ theorem constant_of_preserves_morphisms [IsPreconnected J] {α : Type u₂} (F :
145145
map := fun f => eqToHom (by ext; exact h _ _ f) }
146146
j j'
147147

148+
/-- If `J` is connected, then given any function `F` such that the presence of a
149+
morphism `j₁ ⟶ j₂` implies `F j₁ = F j₂`, there exists `a` such that `F j = a`
150+
holds for any `j`. See `constant_of_preserves_morphisms` for a different
151+
formulation of the fact that `F` is constant.
152+
This can be thought of as a local-to-global property.
153+
154+
The converse is shown in `IsConnected.of_constant_of_preserves_morphisms`
155+
-/
156+
theorem constant_of_preserves_morphisms' [IsConnected J] {α : Type u₂} (F : J → α)
157+
(h : ∀ (j₁ j₂ : J) (_ : j₁ ⟶ j₂), F j₁ = F j₂) :
158+
∃ (a : α), ∀ (j : J), F j = a :=
159+
⟨F (Classical.arbitrary _), fun _ ↦ constant_of_preserves_morphisms _ h _ _⟩
160+
148161
/-- `J` is connected if: given any function `F : J → α` which is constant for any
149162
`j₁, j₂` for which there is a morphism `j₁ ⟶ j₂`, then `F` is constant.
150163
This can be thought of as a local-to-global property.

Mathlib/CategoryTheory/Limits/Final/Type.lean

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ As `Functor.sections` identify to limits of functors to types
1616
be deduced from general results about limits and
1717
initial functors, but we provide a more down to earth proof.
1818
19+
We also obtain the dual result that if `F` is final,
20+
then `F.colimitTypePrecomp : (F ⋙ P).ColimitType → P.ColimitType`
21+
is a bijection.
22+
1923
-/
2024

2125
universe w v₁ v₂ u₁ u₂
@@ -44,22 +48,57 @@ lemma bijective_sectionsPrecomp (F : C ⥤ D) (P : D ⥤ Type w) [F.Initial] :
4448
have h₂ := s₂.property X.hom
4549
dsimp at this h₁ h₂
4650
rw [← h₁, this, h₂]
47-
· let X (Y : D) : CostructuredArrow F Y := Classical.arbitrary _
48-
let val (Y : D) : P.obj Y := P.map (X Y).hom (t.val (X Y).left)
49-
have h (Y : D) (Z : CostructuredArrow F Y) :
50-
val Y = P.map Z.hom (t.val Z.left) :=
51-
constant_of_preserves_morphisms (α := P.obj Y)
52-
(fun (Z : CostructuredArrow F Y) ↦ P.map Z.hom (t.val Z.left)) (by
51+
· have h (Y : D) := constant_of_preserves_morphisms'
52+
(fun (Z : CostructuredArrow F Y) ↦ P.map Z.hom (t.val Z.left)) (by
5353
intro Z₁ Z₂ φ
5454
dsimp
5555
rw [← t.property φ.left]
5656
dsimp
57-
rw [← FunctorToTypes.map_comp_apply, CostructuredArrow.w]) _ _
57+
rw [← FunctorToTypes.map_comp_apply, CostructuredArrow.w])
58+
choose val hval using h
5859
refine ⟨⟨val, fun {Y₁ Y₂} f ↦ ?_⟩, ?_⟩
59-
· rw [h Y₁ (X Y₁), h Y₂ ((CostructuredArrow.map f).obj (X Y₁))]
60-
simp
60+
· let X : CostructuredArrow F Y₁ := Classical.arbitrary _
61+
simp [← hval Y₁ X, ← hval Y₂ ((CostructuredArrow.map f).obj X)]
6162
· ext X : 2
62-
simpa using h (F.obj X) (CostructuredArrow.mk (𝟙 _))
63+
simpa using (hval (F.obj X) (CostructuredArrow.mk (𝟙 _))).symm
64+
65+
/-- Given `P : D ⥤ Type w` and `F : C ⥤ D`, this is the obvious map
66+
`(F ⋙ P).ColimitType → P.ColimitType`. -/
67+
def colimitTypePrecomp (F : C ⥤ D) (P : D ⥤ Type w) :
68+
(F ⋙ P).ColimitType → P.ColimitType :=
69+
(F ⋙ P).descColimitType (P.coconeTypes.precomp F)
70+
71+
@[simp]
72+
lemma colimitTypePrecomp_ιColimitType (F : C ⥤ D) {P : D ⥤ Type w}
73+
(i : C) (x : P.obj (F.obj i)) :
74+
colimitTypePrecomp F P ((F ⋙ P).ιColimitType i x) = P.ιColimitType (F.obj i) x :=
75+
rfl
76+
77+
lemma bijective_colimitTypePrecomp (F : C ⥤ D) (P : D ⥤ Type w) [F.Final] :
78+
Function.Bijective (F.colimitTypePrecomp (P := P)) := by
79+
refine ⟨?_, fun x ↦ ?_⟩
80+
· have h (Y : D) := constant_of_preserves_morphisms'
81+
(fun (Z : StructuredArrow Y F) ↦ (F ⋙ P).ιColimitType Z.right ∘ P.map Z.hom) (by
82+
intro Z₁ Z₂ f
83+
ext x
84+
dsimp
85+
rw [← (F ⋙ P).ιColimitType_map f.right, comp_map,
86+
← FunctorToTypes.map_comp_apply, StructuredArrow.w f])
87+
choose φ hφ using h
88+
let c : P.CoconeTypes :=
89+
{ pt := (F ⋙ P).ColimitType
90+
ι Y := φ Y
91+
ι_naturality {Y₁ Y₂} f := by
92+
ext
93+
have X : StructuredArrow Y₂ F := Classical.arbitrary _
94+
rw [← hφ Y₂ X, ← hφ Y₁ ((StructuredArrow.map f).obj X)]
95+
simp }
96+
refine Function.RightInverse.injective (g := (P.descColimitType c)) (fun x ↦ ?_)
97+
obtain ⟨X, x, rfl⟩ := (F ⋙ P).ιColimitType_jointly_surjective x
98+
simp [c, ← hφ (F.obj X) (StructuredArrow.mk (𝟙 _))]
99+
· obtain ⟨X, x, rfl⟩ := P.ιColimitType_jointly_surjective x
100+
let Y : StructuredArrow X F := Classical.arbitrary _
101+
exact ⟨(F ⋙ P).ιColimitType Y.right (P.map Y.hom x), by simp⟩
63102

64103
end Functor
65104

Mathlib/CategoryTheory/Limits/Types/ColimitType.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ def precompose (c : CoconeTypes.{w₁} F) {G : J ⥤ Type w₀'} (app : ∀ j, G
8484
ι_naturality f := by
8585
rw [Function.comp_assoc, naturality, ← Function.comp_assoc, ι_naturality]
8686

87+
/-- Given `F : J ⥤ w₀`, `c : F.CoconeTypes` and `G : J' ⥤ J`, this is
88+
the induced cocone in `(G ⋙ F).CoconeTypes`. -/
89+
@[simps]
90+
def precomp (c : CoconeTypes.{w₁} F) {J' : Type*} [Category J'] (G : J' ⥤ J) :
91+
CoconeTypes.{w₁} (G ⋙ F) where
92+
pt := c.pt
93+
ι _ := c.ι _
94+
8795
end CoconeTypes
8896

8997
/-- Given `F : J ⥤ Type w₀`, this is the relation `Σ j, F.obj j` which

0 commit comments

Comments
 (0)