Skip to content

Commit 1fd7e46

Browse files
committed
simplify explicit coproducts
1 parent 12a3315 commit 1fd7e46

2 files changed

Lines changed: 29 additions & 117 deletions

File tree

Lines changed: 10 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
22
import Mathlib.Topology.Category.LightProfinite.Limits
33

4-
open CategoryTheory Topology
4+
open CategoryTheory Topology Limits
55

66
namespace CompHausLike
77

@@ -11,107 +11,19 @@ section BinaryCoproducts
1111

1212
variable {P : TopCat.{u} → Prop} (X Y : CompHausLike P)
1313

14-
/--
15-
A typeclass describing the property that forming the disjoint union is stable under the
16-
property `P`.
17-
-/
18-
abbrev HasExplicitBinaryCoproduct := HasProp P (X ⊕ Y)
14+
section Coproduct
1915

20-
variable [HasExplicitBinaryCoproduct X Y]
16+
variable [HasProp P (X ⊕ Y)]
2117

22-
/--
23-
The coproduct of two objects in `CompHausLike`, constructed as the disjoint
24-
union with its usual topology.
25-
-/
26-
def coprod : CompHausLike P := CompHausLike.of P (X ⊕ Y)
18+
def coproductCocone : BinaryCofan X Y := BinaryCofan.mk (P := CompHausLike.of P (X ⊕ Y))
19+
(TopCat.ofHom { toFun := Sum.inl }) (TopCat.ofHom { toFun := Sum.inr })
2720

28-
/--
29-
The inclusion of the left factor into the explicit binary coproduct.
30-
-/
31-
def coprod.inl : X ⟶ coprod X Y := ofHom _ { toFun := fun x ↦ Sum.inl x }
32-
33-
/--
34-
The inclusion of the right factor into the explicit binary coproduct.
35-
-/
36-
def coprod.inr : Y ⟶ coprod X Y := ofHom _ { toFun := fun x ↦ Sum.inr x }
37-
38-
variable {X Y}
39-
40-
/--
41-
To construct a morphism from the explicit finite coproduct, it suffices to
42-
specify a morphism from each of its factors.
43-
This is essentially the universal property of the coproduct.
44-
-/
45-
def coprod.desc {B : CompHausLike P} (l : X ⟶ B) (r : Y ⟶ B) : coprod X Y ⟶ B :=
46-
ofHom _ { toFun := Sum.elim l r }
47-
48-
@[reassoc (attr := simp)]
49-
lemma coprod.inl_desc {B : CompHausLike P} (l : X ⟶ B) (r : Y ⟶ B) :
50-
coprod.inl X Y ≫ coprod.desc l r = l := rfl
51-
52-
@[reassoc (attr := simp)]
53-
lemma coprod.inr_desc {B : CompHausLike P} (l : X ⟶ B) (r : Y ⟶ B) :
54-
coprod.inr X Y ≫ coprod.desc l r = r := rfl
55-
56-
@[ext]
57-
lemma coprod.hom_ext {B : CompHausLike P} (f g : coprod X Y ⟶ B)
58-
(hl : coprod.inl X Y ≫ f = coprod.inl X Y ≫ g) (hr : coprod.inr X Y ≫ f = coprod.inr X Y ≫ g) :
59-
f = g := by
21+
def coproductIsColimit : IsColimit (coproductCocone X Y) := by
22+
refine BinaryCofan.isColimitMk (fun s ↦ ofHom _ { toFun := Sum.elim s.inl s.inr })
23+
(by cat_disch) (by cat_disch) fun _ _ h₁ h₂ ↦ ?_
6024
ext ⟨⟩
61-
exacts [ConcreteCategory.congr_hom hl _, ConcreteCategory.congr_hom hr _]
62-
63-
variable (X Y)
64-
65-
/-- The coproduct cocone associated to the explicit finite coproduct. -/
66-
abbrev coprod.binaryCofan : Limits.BinaryCofan X Y :=
67-
Limits.BinaryCofan.mk (coprod.inl X Y) (coprod.inr X Y)
68-
69-
/-- The explicit finite coproduct cocone is a colimit cocone. -/
70-
def coprod.isColimit : Limits.IsColimit (coprod.binaryCofan X Y) := by
71-
refine Limits.BinaryCofan.isColimitMk (fun s ↦ ofHom _ { toFun := Sum.elim s.inl s.inr }) ?_ ?_ ?_
72-
all_goals cat_disch
73-
74-
lemma coprod.inl_injective : Function.Injective (coprod.inl X Y) :=
75-
Sum.inl_injective
76-
77-
lemma coprod.inr_injective : Function.Injective (coprod.inr X Y) :=
78-
Sum.inr_injective
79-
80-
lemma coprod.inl_inr_jointly_surjective (r : coprod X Y) :
81-
(∃ x : X, r = coprod.inl _ _ x) ∨ (∃ y : Y, r = coprod.inr _ _ y) := by
82-
obtain (r | r) := r
83-
exacts [Or.inl ⟨r, rfl⟩, Or.inr ⟨r, rfl⟩]
84-
85-
-- lemma finiteCoproduct.ι_desc_apply {B : CompHausLike P} {π : (a : α) → X a ⟶ B} (a : α) :
86-
-- ∀ x, finiteCoproduct.desc X π (finiteCoproduct.ι X a x) = π a x := by
87-
-- tauto
88-
89-
instance : Limits.HasBinaryCoproduct X Y where
90-
exists_colimit := ⟨coprod.binaryCofan X Y, coprod.isColimit X Y⟩
91-
92-
variable (P) in
93-
/--
94-
A typeclass describing the property that forming all finite disjoint unions is stable under the
95-
property `P`.
96-
-/
97-
class HasExplicitBinaryCoproducts : Prop where
98-
hasProp (X Y : CompHausLike.{u} P) : HasExplicitBinaryCoproduct X Y
99-
100-
attribute [instance] HasExplicitBinaryCoproducts.hasProp
101-
102-
instance [HasExplicitBinaryCoproducts P] : Limits.HasBinaryCoproducts (CompHausLike P) :=
103-
Limits.hasBinaryCoproducts_of_hasColimit_pair _
104-
105-
/-- The inclusion maps into the explicit finite coproduct are open embeddings. -/
106-
lemma coprod.isOpenEmbedding_inl : IsOpenEmbedding (coprod.inl X Y) :=
107-
IsOpenEmbedding.inl
108-
109-
/-- The inclusion maps into the explicit finite coproduct are open embeddings. -/
110-
lemma coprod.isOpenEmbedding_inr : IsOpenEmbedding (coprod.inr X Y) :=
111-
IsOpenEmbedding.inr
25+
exacts [ConcreteCategory.congr_hom h₁ _, ConcreteCategory.congr_hom h₂ _]
11226

113-
instance : HasExplicitBinaryCoproducts
114-
(fun X ↦ TotallyDisconnectedSpace X ∧ SecondCountableTopology X) where
115-
hasProp _ _ := { hasProp := ⟨inferInstance, inferInstance⟩ }
27+
end Coproduct
11628

11729
end BinaryCoproducts

LeanCondensed/Projects/Proj.lean

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Jonas van der Schaaf
55
-/
66
import Mathlib.Condensed.Light.InternallyProjective
7+
import Mathlib.Topology.FiberPartition
78
import LeanCondensed.Projects.LightProfiniteInjective
89
import LeanCondensed.Projects.PreservesCoprod
910
import LeanCondensed.Projects.Epi
@@ -180,16 +181,14 @@ lemma refinedCover {S T : LightProfinite} (π : T ⟶ S ⊗ ℕ∪{∞}) [Epi π
180181
have : Function.Surjective π := by rwa [← LightProfinite.epi_iff_surjective]
181182
let p (s : S) (n : ℕ∪{∞}) : T := (this (s, n)).choose
182183
have hp (s : S) (n : ℕ∪{∞}) : π (p s n) = (s, n) := (this (s, n)).choose_spec
183-
refine ⟨⟨fun n ↦ ⟨p y n, ?_⟩, ?_⟩, ?_⟩
184-
· simp [hp]; rfl
185-
· simp [hp]
186-
· simp [y', hp]
184+
exact ⟨⟨fun n ↦ ⟨p y n, by simp [hp]; rfl⟩, by simp [hp]⟩, by simp [y', hp]⟩
187185
· simp [π_tilde, CompHausLike.pullback.condition]
188-
· exact ⟨⟨⟨sectionOfFibreIncl π_tilde σ' hσ', .subtype_mk (.subtype_mk (by fun_prop) _) _⟩⟩, rfl⟩
186+
· exact ⟨TopCat.ofHom ⟨(sectionOfFibreIncl π_tilde σ' hσ'),
187+
(.subtype_mk (.subtype_mk (by fun_prop) _) _)⟩, rfl⟩
189188
· rw [LightProfinite.epi_iff_surjective]
190189
exact smartCoverToFun_surjective _ _ hσ hσ'
191190

192-
private lemma comm_sq {X Y : LightCondMod R} (p : X ⟶ Y) [hp : Epi p] {S : LightProfinite}
191+
lemma comm_sq {X Y : LightCondMod R} (p : X ⟶ Y) [hp : Epi p] {S : LightProfinite}
193192
(f : (free R).obj (S).toCondensed ⟶ Y) :
194193
∃ (T : LightProfinite) (π : T ⟶ S) (g : ((free R).obj T.toCondensed) ⟶ X),
195194
Epi π ∧ (lightProfiniteToLightCondSet ⋙ (free R)).map π ≫ f = g ≫ p := by
@@ -232,22 +231,23 @@ noncomputable def c {X : LightCondMod R} {S T : LightProfinite} (π : T ⟶ (S
232231
refine parallelPairNatTrans (_ ≫ g_tilde) g_tilde ?_ rfl
233232
rw [← cancel_epi ((lightProfiniteToLightCondSet ⋙ (free R)).map <| smartCoverNew π)]
234233
apply (isColimitOfPreserves (lightProfiniteToLightCondSet ⋙ (free R))
235-
(CompHausLike.coprod.isColimit _ _)).hom_ext
234+
(CompHausLike.coproductIsColimit _ _)).hom_ext
236235
rintro ⟨⟨⟩⟩
237236
· simp [← Functor.map_comp_assoc, ← Functor.map_comp]
238237
rfl
239-
· simp only [comp_obj, pair_obj_right, const_obj_obj, mapCocone_pt, BinaryCofan.mk_pt,
240-
mapCocone_ι_app, BinaryCofan.mk_inr, Functor.comp_map, parallelPair_obj_zero,
241-
parallelPair_obj_one, parallelPair_map_left, ← map_comp_assoc, ← Functor.map_comp,
242-
parallelPair_map_right, const_obj_map, Category.comp_id]
243-
have : smartCoverNew π =
244-
CompHausLike.coprod.desc (CompHausLike.pullback.lift _ _ (𝟙 T) (𝟙 T) (by simp))
245-
(CompHausLike.pullback.lift _ _ ((CompHausLike.pullback.fst _ _) ≫ fibre_incl _ _)
246-
((CompHausLike.pullback.snd _ _) ≫ fibre_incl _ _)
247-
(by simp [CompHausLike.pullback.condition])) := rfl
248-
simp only [this, CompHausLike.coprod.inr_desc_assoc, CompHausLike.pullback.lift_fst, comp_obj,
249-
Functor.comp_map, Preadditive.comp_add, Preadditive.comp_sub, ← map_comp_assoc,
250-
← Functor.map_comp, Category.assoc, CompHausLike.pullback.lift_snd, g_tilde]
238+
· simp only [comp_obj, pair_obj_right, const_obj_obj, mapCocone_pt, mapCocone_ι_app,
239+
Functor.comp_map, parallelPair_obj_zero, parallelPair_obj_one, parallelPair_map_left,
240+
← map_comp_assoc, ← Functor.map_comp, parallelPair_map_right, const_obj_map, Category.comp_id]
241+
have : smartCoverNew π = (BinaryCofan.IsColimit.desc' (CompHausLike.coproductIsColimit _ _)
242+
(CompHausLike.pullback.lift _ _ (𝟙 T) (𝟙 T) (by simp))
243+
(CompHausLike.pullback.lift _ _ ((CompHausLike.pullback.fst _ _) ≫ fibre_incl _ _)
244+
((CompHausLike.pullback.snd _ _) ≫ fibre_incl _ _)
245+
(by simp [CompHausLike.pullback.condition]))).val := rfl
246+
simp only [this, pair_obj_left, const_obj_obj, pair_obj_right,
247+
BinaryCofan.IsColimit.desc'_coe, IsColimit.fac_assoc, BinaryCofan.mk_pt, BinaryCofan.mk_inr,
248+
CompHausLike.pullback.lift_fst, comp_obj, Functor.comp_map, Preadditive.comp_add,
249+
Preadditive.comp_sub, ← map_comp_assoc, ← Functor.map_comp, Category.assoc,
250+
CompHausLike.pullback.lift_snd, g_tilde]
251251
simp only [← Functor.comp_map, ← Category.assoc, hr, Category.id_comp, sub_self, zero_add]
252252
simp [CompHausLike.pullback.condition]
253253

0 commit comments

Comments
 (0)