Skip to content

Commit

Permalink
feat(CategoryTheory/Limits): generalize universes for preserving fini…
Browse files Browse the repository at this point in the history
…te products (#17408)
  • Loading branch information
dagurtomas committed Oct 4, 2024
1 parent d2499a7 commit 584dd88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 12 additions & 5 deletions Mathlib/CategoryTheory/Limits/Preserves/Finite.lean
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ open CategoryTheory
namespace CategoryTheory.Limits

-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w w₂ v₁ v₂ v₃ u₁ u₂ u₃
universe u w w₂ v₁ v₂ v₃ u₁ u₂ u₃

variable {C : Type u₁} [Category.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D]
Expand Down Expand Up @@ -98,6 +98,12 @@ class PreservesFiniteProducts (F : C ⥤ D) where

attribute [instance] PreservesFiniteProducts.preserves

noncomputable instance (priority := 100) (F : C ⥤ D) (J : Type u) [Finite J]
[PreservesFiniteProducts F] : PreservesLimitsOfShape (Discrete J) F := by
apply Nonempty.some
obtain ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
exact ⟨preservesLimitsOfShapeOfEquiv (Discrete.equivalence e.symm) F⟩

instance compPreservesFiniteProducts (F : C ⥤ D) (G : D ⥤ E)
[PreservesFiniteProducts F] [PreservesFiniteProducts G] :
PreservesFiniteProducts (F ⋙ G) where
Expand Down Expand Up @@ -243,14 +249,15 @@ class PreservesFiniteCoproducts (F : C ⥤ D) where
/-- preservation of colimits indexed by `Discrete J` when `[Fintype J]` -/
preserves : ∀ (J : Type) [Fintype J], PreservesColimitsOfShape (Discrete J) F

noncomputable instance (F : C ⥤ D) (J : Type*) [Finite J] [PreservesFiniteCoproducts F] :
PreservesColimitsOfShape (Discrete J) F := by
attribute [instance] PreservesFiniteCoproducts.preserves

noncomputable instance (priority := 100) (F : C ⥤ D) (J : Type u) [Finite J]
[PreservesFiniteCoproducts F] : PreservesColimitsOfShape (Discrete J) F := by
apply Nonempty.some
obtain ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
have : PreservesColimitsOfShape (Discrete (Fin n)) F := PreservesFiniteCoproducts.preserves _
exact ⟨preservesColimitsOfShapeOfEquiv (Discrete.equivalence e.symm) F⟩

noncomputable instance compPreservesFiniteCoproducts (F : C ⥤ D) (G : D ⥤ E)
instance compPreservesFiniteCoproducts (F : C ⥤ D) (G : D ⥤ E)
[PreservesFiniteCoproducts F] [PreservesFiniteCoproducts G] :
PreservesFiniteCoproducts (F ⋙ G) where
preserves _ _ := inferInstance
Expand Down
4 changes: 0 additions & 4 deletions Mathlib/Topology/Category/CompHausLike/SigmaComparison.lean
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ values on the components.
def sigmaComparison : X.obj ⟨(of P ((a : α) × σ a))⟩ ⟶ ((a : α) → X.obj ⟨of P (σ a)⟩) :=
fun x a ↦ X.map ⟨Sigma.mk a, continuous_sigmaMk⟩ x

noncomputable instance : PreservesLimitsOfShape (Discrete α) X :=
letI : Fintype α := Fintype.ofFinite _
preservesFiniteProductsOfPreservesBinaryAndTerminal X α

theorem sigmaComparison_eq_comp_isos : sigmaComparison X σ =
(X.mapIso (opCoproductIsoProduct'
(finiteCoproduct.isColimit.{u, u} (fun a ↦ of P (σ a)))
Expand Down

0 comments on commit 584dd88

Please sign in to comment.