Module docstring
{"# Categories with finite (co)products
Typeclasses representing categories with (co)products over finite indexing types. "}
{"# Categories with finite (co)products
Typeclasses representing categories with (co)products over finite indexing types. "}
CategoryTheory.Limits.HasFiniteProducts
structure
/-- A category has finite products if there exists a limit for every diagram
with shape `Discrete J`, where we have `[Finite J]`.
We require this condition only for `J = Fin n` in the definition, then deduce a version for any
`J : Type*` as a corollary of this definition.
-/
class HasFiniteProducts : Prop where
/-- `C` has finite products -/
out (n : ℕ) : HasLimitsOfShape (Discrete (Fin n)) C
CategoryTheory.Limits.hasFiniteProducts_of_hasFiniteLimits
instance
[HasFiniteLimits C] : HasFiniteProducts C
/-- If `C` has finite limits then it has finite products. -/
instance (priority := 10) hasFiniteProducts_of_hasFiniteLimits [HasFiniteLimits C] :
HasFiniteProducts C :=
⟨fun _ => inferInstance⟩
CategoryTheory.Limits.hasLimitsOfShape_discrete
instance
[HasFiniteProducts C] (ι : Type w) [Finite ι] : HasLimitsOfShape (Discrete ι) C
instance hasLimitsOfShape_discrete [HasFiniteProducts C] (ι : Type w) [Finite ι] :
HasLimitsOfShape (Discrete ι) C := by
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩
haveI : HasLimitsOfShape (Discrete (Fin n)) C := HasFiniteProducts.out n
exact hasLimitsOfShape_of_equivalence (Discrete.equivalence e.symm)
CategoryTheory.Limits.hasFiniteProducts_of_hasProducts
theorem
[HasProducts.{w} C] : HasFiniteProducts C
/-- If a category has all products then in particular it has finite products.
-/
theorem hasFiniteProducts_of_hasProducts [HasProducts.{w} C] : HasFiniteProducts C :=
⟨fun _ => hasLimitsOfShape_of_equivalence (Discrete.equivalence Equiv.ulift.{w})⟩
CategoryTheory.Limits.HasFiniteCoproducts
structure
/-- A category has finite coproducts if there exists a colimit for every diagram
with shape `Discrete J`, where we have `[Fintype J]`.
We require this condition only for `J = Fin n` in the definition, then deduce a version for any
`J : Type*` as a corollary of this definition.
-/
class HasFiniteCoproducts : Prop where
/-- `C` has all finite coproducts -/
out (n : ℕ) : HasColimitsOfShape (Discrete (Fin n)) C
CategoryTheory.Limits.hasColimitsOfShape_discrete
instance
[HasFiniteCoproducts C] (ι : Type w) [Finite ι] : HasColimitsOfShape (Discrete ι) C
instance hasColimitsOfShape_discrete [HasFiniteCoproducts C] (ι : Type w) [Finite ι] :
HasColimitsOfShape (Discrete ι) C := by
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩
haveI : HasColimitsOfShape (Discrete (Fin n)) C := HasFiniteCoproducts.out n
exact hasColimitsOfShape_of_equivalence (Discrete.equivalence e.symm)
CategoryTheory.Limits.hasFiniteCoproducts_of_hasFiniteColimits
instance
[HasFiniteColimits C] : HasFiniteCoproducts C
/-- If `C` has finite colimits then it has finite coproducts. -/
instance (priority := 10) hasFiniteCoproducts_of_hasFiniteColimits [HasFiniteColimits C] :
HasFiniteCoproducts C :=
⟨fun J => by infer_instance⟩
CategoryTheory.Limits.hasFiniteCoproducts_of_hasCoproducts
theorem
[HasCoproducts.{w} C] : HasFiniteCoproducts C
/-- If a category has all coproducts then in particular it has finite coproducts.
-/
theorem hasFiniteCoproducts_of_hasCoproducts [HasCoproducts.{w} C] : HasFiniteCoproducts C :=
⟨fun _ => hasColimitsOfShape_of_equivalence (Discrete.equivalence Equiv.ulift.{w})⟩