@@ -7,6 +7,7 @@ import Mathlib.CategoryTheory.Limits.EssentiallySmall
77import  Mathlib.CategoryTheory.Limits.Shapes.Opposites.Equalizers
88import  Mathlib.CategoryTheory.Subobject.Lattice
99import  Mathlib.CategoryTheory.ObjectProperty.Small
10+ import  Mathlib.CategoryTheory.Comma.StructuredArrow.Small
1011
1112/-! 
1213# Separating and detecting sets 
@@ -287,31 +288,103 @@ lemma isCodetecting_bot_of_isGroupoid [IsGroupoid C] :
287288
288289end  Empty
289290
291+ lemma  IsSeparating.mk_of_exists_epi 
292+     (hP : ∀ (X : C), ∃ (ι : Type  w) (s : ι → C) (_ : ∀ i, P (s i)) (c : Cofan s) (_ : IsColimit c)
293+       (p : c.pt ⟶ X), Epi p) :
294+     P.IsSeparating := by 
295+   intro X Y f g h
296+   obtain ⟨ι, s, hs, c, hc, p, _⟩ := hP X
297+   rw [← cancel_epi p]
298+   exact Cofan.IsColimit.hom_ext hc _ _
299+     (fun  i ↦ by  simpa using h _ (hs i) (c.inj i ≫ p))
300+ 
301+ lemma  IsCoseparating.mk_of_exists_mono 
302+     (hP : ∀ (X : C), ∃ (ι : Type  w) (s : ι → C) (_ : ∀ i, P (s i)) (c : Fan s) (_ : IsLimit c)
303+       (j : X ⟶ c.pt), Mono j) :
304+     P.IsCoseparating := by 
305+   intro X Y f g h
306+   obtain ⟨ι, s, hs, c, hc, j, _⟩ := hP Y
307+   rw [← cancel_mono j]
308+   exact Fan.IsLimit.hom_ext hc _ _
309+     (fun  i ↦ by  simpa using h _ (hs i) (j ≫ c.proj i))
310+ 
290311variable  (P)
291312
313+ section 
314+ 
315+ /-- Given `P : ObjectProperty C` and `X : C`, this is the map which 
316+ sends `i : CostructuredArrow P.ι X` to `i.left.obj : C`. The coproduct 
317+ of this family is the source of the morphism `P.coproductFrom X`. -/ 
318+ abbrev  coproductFromFamily  (X : C) (i : CostructuredArrow P.ι X) : C := i.left.obj
319+ 
320+ variable  (X : C)
321+ 
322+ variable  [HasCoproduct (P.coproductFromFamily X)]
323+ 
324+ /-- Given `P : ObjectProperty C` and `X : C`, this is the coproduct of 
325+ all the morphisms `Y ⟶ X` such that `P Y` holds. -/ 
326+ noncomputable  abbrev  coproductFrom  : ∐ (P.coproductFromFamily X) ⟶ X :=
327+   Sigma.desc (fun  i ↦ i.hom)
328+ 
329+ variable  {X} in 
330+ /-- The inclusion morphisms to `∐ (P.coproductFromFamily X)`. -/ 
331+ noncomputable  abbrev  ιCoproductFrom  {Y : C} (f : Y ⟶ X) (hY : P Y) :
332+     Y ⟶ ∐ (P.coproductFromFamily X) := by 
333+   exact Sigma.ι (P.coproductFromFamily X) (CostructuredArrow.mk (Y := ⟨Y, hY⟩) (by  exact f))
334+ 
335+ end 
336+ 
337+ variable  {P} in 
338+ lemma  IsSeparating.epi_coproductFrom  (hP : P.IsSeparating)
339+     (X : C) [HasCoproduct (P.coproductFromFamily X)] :
340+     Epi (P.coproductFrom X) where 
341+   left_cancellation u v huv :=
342+     hP _ _ (fun  G hG h ↦ by  simpa using P.ιCoproductFrom h hG ≫= huv)
343+ 
292344theorem  isSeparating_iff_epi 
293-     [∀ A : C, HasCoproduct fun  f : Σ G : Subtype P, G.1  ⟶ A ↦ f.1 .1 ] :
294-     IsSeparating P ↔
295-       ∀ A : C, Epi (Sigma.desc (Sigma.snd (β := fun  (G : Subtype P) ↦ G.1  ⟶ A))) := by 
296-   let  β (A : C) (G : Subtype P) := G.1  ⟶ A
297-   let  b (A : C) (x : Σ G, β A G) := x.1 .1 
298-   refine ⟨fun  h A ↦ ⟨fun  u v huv ↦ h _ _ fun  G hG f ↦ ?_⟩, fun  h X Y f g hh ↦ ?_⟩
299-   · simpa [β, b] using Sigma.ι (b A) ⟨⟨G, hG⟩, f⟩ ≫= huv
300-   · rw [← cancel_epi (Sigma.desc (Sigma.snd (β := β X)))]
301-     ext ⟨⟨_, hG⟩, _⟩
302-     simpa using hh _ hG _
345+     [∀ (X : C), HasCoproduct (P.coproductFromFamily X)] :
346+     IsSeparating P ↔ ∀ X : C, Epi (P.coproductFrom X) :=
347+   ⟨fun  hP X ↦ hP.epi_coproductFrom X,
348+     fun  hP ↦ IsSeparating.mk_of_exists_epi (fun  X ↦ ⟨_, P.coproductFromFamily X,
349+       fun  i ↦ i.left.2 , _, colimit.isColimit _, _, hP X⟩)⟩
350+ 
351+ section 
352+ 
353+ /-- Given `P : ObjectProperty C` and `X : C`, this is the map which 
354+ sends `i : StructuredArrow P.ι X` to `i.right.obj : C`. The product 
355+ of this family is the target of the morphism `P.productTo X`. -/ 
356+ abbrev  productToFamily  (X : C) (i : StructuredArrow X P.ι) : C := i.right.obj
357+ 
358+ variable  (X : C)
359+ 
360+ variable  [HasProduct (P.productToFamily X)]
361+ 
362+ /-- Given `P : ObjectProperty C` and `X : C`, this is the product of 
363+ all the morphisms `X ⟶ Y` such that `P Y` holds. -/ 
364+ noncomputable  abbrev  productTo  : X ⟶ ∏ᶜ (P.productToFamily X) :=
365+   Pi.lift (fun  i ↦ i.hom)
366+ 
367+ variable  {X} in 
368+ /-- The projection morphisms from `∏ᶜ (P.productToFamily X)`. -/ 
369+ noncomputable  abbrev  πProductTo  {Y : C} (f : X ⟶ Y) (hY : P Y) :
370+     ∏ᶜ (P.productToFamily X) ⟶ Y := by 
371+   exact Pi.π (P.productToFamily X) (StructuredArrow.mk (Y := ⟨Y, hY⟩) (by  exact f))
372+ 
373+ end 
374+ 
375+ variable  {P} in 
376+ lemma  IsCoseparating.mono_productTo  (hP : P.IsCoseparating)
377+     (X : C) [HasProduct (P.productToFamily X)] :
378+     Mono (P.productTo X) where 
379+   right_cancellation u v huv :=
380+     hP _ _ (fun  G hG h ↦ by  simpa using huv =≫ P.πProductTo h hG)
303381
304382theorem  isCoseparating_iff_mono 
305-     [∀ A : C, HasProduct fun  f : Σ G : Subtype P, A ⟶ G.1  ↦ f.1 .1 ] :
306-     IsCoseparating P ↔
307-       ∀ A : C, Mono (Pi.lift (Sigma.snd (β := fun  (G : Subtype P) ↦ A ⟶ G.1 ))) := by 
308-   let  β (A : C) (G : Subtype P) := A ⟶ G.1 
309-   let  b (A : C) (x : Σ G, β A G) := x.1 .1 
310-   refine ⟨fun  h A ↦ ⟨fun  u v huv ↦ h _ _ fun  G hG f ↦ ?_⟩, fun  h X Y f g hh ↦ ?_⟩
311-   · simpa [β, b] using huv =≫ Pi.π (b A) ⟨⟨G, hG⟩, f⟩
312-   · rw [← cancel_mono (Pi.lift (Sigma.snd (β := β Y)))]
313-     ext ⟨⟨_, hG⟩, _⟩
314-     simpa using hh _ hG _
383+     [∀ (X : C), HasProduct (P.productToFamily X)] :
384+     IsCoseparating P ↔ ∀ X : C, Mono (P.productTo X) :=
385+   ⟨fun  hP X ↦ hP.mono_productTo X,
386+     fun  hP ↦ IsCoseparating.mk_of_exists_mono (fun  X ↦ ⟨_, P.productToFamily X,
387+       fun  i ↦ i.right.2 , _, limit.isLimit _, _, hP X⟩)⟩
315388
316389end  ObjectProperty
317390
@@ -324,16 +397,17 @@ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C]
324397    [HasLimitsOfSize.{w, w} C] {P : ObjectProperty C} [ObjectProperty.Small.{w} P]
325398    (hP : P.IsCoseparating) : HasInitial C := by 
326399  have  := hasFiniteLimits_of_hasLimitsOfSize C
327-   haveI : HasProductsOfShape (Subtype P) C : = hasProductsOfShape_of_small C (Subtype P)
328-   haveI := fun  A => hasProductsOfShape_of_small.{w} C (Σ G : Subtype P, A ⟶ (G : C) )
400+   haveI := hasProductsOfShape_of_small C (Subtype P)
401+   haveI := fun  A => hasProductsOfShape_of_small.{w} C (StructuredArrow A P.ι )
329402  letI := completeLatticeOfCompleteSemilatticeInf (Subobject (piObj (Subtype.val : Subtype P → C)))
330403  suffices  ∀ A : C, Unique (((⊥ : Subobject (piObj (Subtype.val : Subtype P → C))) : C) ⟶ A) by 
331404    exact hasInitial_of_unique ((⊥ : Subobject (piObj (Subtype.val : Subtype P → C))) : C)
405+   have  := hP.mono_productTo
332406  refine fun  A => ⟨⟨?_⟩, fun  f => ?_⟩
333-   · let  s := Pi.lift  fun  f : Σ G :  Subtype P, A ⟶ (G : C) => Pi.π (Subtype.val : Subtype P → C) f. 1 
334-     let  t :=  Pi.lift (@Sigma.snd (Subtype P)  fun  G => A ⟶ (G : C) )
335-     haveI : Mono t := P.isCoseparating_iff_mono. 1  hP A 
336-     exact Subobject.ofLEMk _  (pullback.fst _ _ : pullback s t  ⟶ _) bot_le ≫ pullback.snd _ _
407+   · let  s : ∏ᶜ ( Subtype.val (p := P)) ⟶ ∏ᶜ P.productToFamily A := 
408+        Pi.lift (fun  f ↦ Pi.π Subtype.val ⟨f.right.obj, f.right.property⟩ )
409+     exact Subobject.ofLEMk _ 
410+        (pullback.fst _ _ : pullback s (P.productTo A)  ⟶ _) bot_le ≫ pullback.snd _ _
337411  · suffices  ∀ (g : Subobject.underlying.obj ⊥ ⟶ A), f = g by 
338412      apply this
339413    intro g
0 commit comments